|
|
@@ -8,11 +8,9 @@ import androidx.recyclerview.widget.GridLayoutManager
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.yingyang.workbenches.R
|
|
|
import com.yingyang.workbenches.adapter.ServicePackageListAdapter
|
|
|
-import com.yingyang.workbenches.adapter.ServicePackageTypeAdapter
|
|
|
import com.yingyang.workbenches.databinding.ActivityServicePackageBinding
|
|
|
import com.yingyang.workbenches.dialog.PurchaseServicesDialog
|
|
|
import com.yingyang.workbenches.entity.PackageInfoBean
|
|
|
-import com.yingyang.workbenches.entity.TrainTypeBean
|
|
|
import com.yingyangfly.baselib.ext.getEndAnimation
|
|
|
import com.yingyangfly.baselib.ext.getScaleAnimation
|
|
|
import com.yingyangfly.baselib.ext.toast
|
|
|
@@ -28,14 +26,6 @@ class ServicePackageActivity :
|
|
|
BaseMVVMActivity<ActivityServicePackageBinding, ServicePackageViewModel>(),
|
|
|
View.OnTouchListener {
|
|
|
|
|
|
- /**
|
|
|
- * 服务套餐类型
|
|
|
- */
|
|
|
- private var servicePackageTypeGridLayoutManager: GridLayoutManager? = null
|
|
|
- private var servicePackageTypeList = mutableListOf<TrainTypeBean>()
|
|
|
- private val servicePackageTypeAdapter by lazy { ServicePackageTypeAdapter() }
|
|
|
- private var packageType = ""
|
|
|
-
|
|
|
/**
|
|
|
* 服务套餐列表
|
|
|
*/
|
|
|
@@ -45,10 +35,6 @@ class ServicePackageActivity :
|
|
|
|
|
|
override fun initViews() {
|
|
|
binding {
|
|
|
- servicePackageTypeGridLayoutManager = GridLayoutManager(this@ServicePackageActivity, 2)
|
|
|
- rvType.layoutManager = servicePackageTypeGridLayoutManager
|
|
|
- rvType.adapter = servicePackageTypeAdapter
|
|
|
-
|
|
|
gridLayoutManager = GridLayoutManager(this@ServicePackageActivity, 3)
|
|
|
rvTrainingPackage.layoutManager = gridLayoutManager
|
|
|
rvTrainingPackage.adapter = servicePackageListAdapter
|
|
|
@@ -71,35 +57,7 @@ class ServicePackageActivity :
|
|
|
}
|
|
|
|
|
|
override fun initData() {
|
|
|
- servicePackageTypeAdapter.onServicePackageTypeClickListener = {
|
|
|
- packageType = it.dictValue
|
|
|
- servicePackageListAdapter.clearData()
|
|
|
- getServicePackageList()
|
|
|
- }
|
|
|
- getSelectByDictType()
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取服务套餐类型列表
|
|
|
- */
|
|
|
- private fun getSelectByDictType() {
|
|
|
- viewModel.getSelectByDictType(fail = {
|
|
|
- it.toast()
|
|
|
- }, success = {
|
|
|
- runOnUiThread {
|
|
|
- servicePackageTypeList.clear()
|
|
|
- if (it.isNullOrEmpty().not()) {
|
|
|
- servicePackageTypeList.addAll(it!!)
|
|
|
- servicePackageTypeGridLayoutManager?.spanCount = it.size
|
|
|
- servicePackageTypeAdapter.setData(servicePackageTypeList)
|
|
|
- packageType = servicePackageTypeList[0].dictValue
|
|
|
- getServicePackageList()
|
|
|
- } else {
|
|
|
- gridLayoutManager?.spanCount = 1
|
|
|
- servicePackageListAdapter.showEmptyView = servicePackageList.isEmpty()
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ getServicePackageList()
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -107,7 +65,7 @@ class ServicePackageActivity :
|
|
|
*/
|
|
|
private fun getServicePackageList() {
|
|
|
servicePackageList.clear()
|
|
|
- viewModel.getServicePackageList(packageType, fail = {
|
|
|
+ viewModel.getServicePackageList("", fail = {
|
|
|
if (TextUtils.isEmpty(it).not()) {
|
|
|
it.toast()
|
|
|
}
|
|
|
@@ -132,6 +90,7 @@ class ServicePackageActivity :
|
|
|
v.startAnimation(getScaleAnimation())
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
MotionEvent.ACTION_UP -> {
|
|
|
v.startAnimation(getEndAnimation())
|
|
|
if (v.id == R.id.layoutHead) {
|
|
|
@@ -142,6 +101,7 @@ class ServicePackageActivity :
|
|
|
JumpUtil.jumpActivity(RouterUrlCommon.orderList, mContext)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
MotionEvent.ACTION_CANCEL -> {
|
|
|
if (v.id == R.id.layoutHead || v.id == R.id.tvOrderList) {
|
|
|
v.startAnimation(getEndAnimation())
|