diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3dad8e3..9363612 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -487,6 +487,13 @@
android:exported="false"
android:screenOrientation="userLandscape" />
+
+
+
+ /**
+ * 国际进港提取记录-修改费用
+ * 接口路径: /IntImpPickup/modifyCharge
+ */
+ @POST("IntImpPickup/modifyCharge")
+ suspend fun modifyIntImpPickUpCharge(@Body data: RequestBody): BaseResultBean
+
/**
* 国际进港提取出库-分页查询
* 接口路径: /IntImpPickUpDlv/pageQuery
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpChargeEditActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpChargeEditActivity.kt
new file mode 100644
index 0000000..ab236ce
--- /dev/null
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpChargeEditActivity.kt
@@ -0,0 +1,37 @@
+package com.lukouguoji.gjj.activity
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import com.google.gson.Gson
+import com.lukouguoji.gjj.R
+import com.lukouguoji.gjj.databinding.ActivityIntImpPickUpChargeEditBinding
+import com.lukouguoji.gjj.viewModel.IntImpPickUpChargeEditViewModel
+import com.lukouguoji.module_base.base.BaseBindingActivity
+import com.lukouguoji.module_base.bean.IntImpPickUpRecordBean
+import com.lukouguoji.module_base.common.Constant
+
+/**
+ * 国际进港-费用修改
+ */
+class IntImpPickUpChargeEditActivity :
+ BaseBindingActivity() {
+
+ override fun layoutId() = R.layout.activity_int_imp_pick_up_charge_edit
+ override fun viewModelClass() = IntImpPickUpChargeEditViewModel::class.java
+
+ override fun initOnCreate(savedInstanceState: Bundle?) {
+ setBackArrow("国际进港费用修改")
+ binding.viewModel = viewModel
+ viewModel.initOnCreated(intent)
+ }
+
+ companion object {
+ @JvmStatic
+ fun start(context: Context, bean: IntImpPickUpRecordBean) {
+ val starter = Intent(context, IntImpPickUpChargeEditActivity::class.java)
+ .putExtra(Constant.Key.DATA, Gson().toJson(bean))
+ context.startActivity(starter)
+ }
+ }
+}
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpRecordActivity.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpRecordActivity.kt
index 9928356..ace1f83 100644
--- a/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpRecordActivity.kt
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/activity/IntImpPickUpRecordActivity.kt
@@ -13,6 +13,8 @@ import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.observe
+import com.lukouguoji.module_base.interfaces.IOnItemClickListener
+import com.lukouguoji.module_base.ktx.addOnItemClickListener
import com.lukouguoji.module_base.ktx.commonAdapter
import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.model.ConfirmDialogModel
@@ -41,6 +43,20 @@ class IntImpPickUpRecordActivity :
// 绑定分页
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this)
+ // 设置列表项点击回调(侧滑修改按钮)
+ binding.rv.addOnItemClickListener(object : IOnItemClickListener {
+ override fun onItemClick(position: Int, type: Int) {
+ when (type) {
+ 2000 -> {
+ // 侧滑修改操作
+ val list = viewModel.pageModel.rv?.commonAdapter()?.items as? List<*> ?: return
+ val bean = list.getOrNull(position) as? IntImpPickUpRecordBean ?: return
+ IntImpPickUpChargeEditActivity.start(this@IntImpPickUpRecordActivity, bean)
+ }
+ }
+ }
+ })
+
// 监听刷新事件
FlowBus.with(ConstantEvent.EVENT_REFRESH).observe(this) {
viewModel.refresh()
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpPickUpRecordViewHolder.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpPickUpRecordViewHolder.kt
index de2e2e6..cda8b59 100644
--- a/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpPickUpRecordViewHolder.kt
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/holder/IntImpPickUpRecordViewHolder.kt
@@ -25,8 +25,14 @@ class IntImpPickUpRecordViewHolder(view: View) :
}
// 列表项点击进入提取详情
- itemView.setOnClickListener {
+ binding.ll.setOnClickListener {
IntImpPickUpRecordDetailsActivity.start(itemView.context, bean)
}
+
+ // 侧滑菜单 - 修改按钮
+ binding.btnEdit.setOnClickListener {
+ binding.swipeMenu.quickClose()
+ clickListener?.onItemClick(position, 2000) // type=2000表示修改操作
+ }
}
}
diff --git a/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpPickUpChargeEditViewModel.kt b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpPickUpChargeEditViewModel.kt
new file mode 100644
index 0000000..df40a7d
--- /dev/null
+++ b/module_gjj/src/main/java/com/lukouguoji/gjj/viewModel/IntImpPickUpChargeEditViewModel.kt
@@ -0,0 +1,89 @@
+package com.lukouguoji.gjj.viewModel
+
+import android.content.Intent
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.viewModelScope
+import com.google.gson.Gson
+import com.lukouguoji.module_base.base.BaseViewModel
+import com.lukouguoji.module_base.bean.IntImpPickUpRecordBean
+import com.lukouguoji.module_base.common.Constant
+import com.lukouguoji.module_base.common.ConstantEvent
+import com.lukouguoji.module_base.http.net.NetApply
+import com.lukouguoji.module_base.impl.FlowBus
+import com.lukouguoji.module_base.ktx.launchLoadingCollect
+import com.lukouguoji.module_base.ktx.showToast
+import com.lukouguoji.module_base.ktx.toRequestBody
+import kotlinx.coroutines.launch
+
+/**
+ * 国际进港费用修改 ViewModel
+ */
+class IntImpPickUpChargeEditViewModel : BaseViewModel() {
+
+ val dataBean = MutableLiveData(IntImpPickUpRecordBean())
+
+ // 可编辑费用字段(String 用于双向绑定)
+ val tranChargeStr = MutableLiveData("") // 信息费
+ val whsChargeStr = MutableLiveData("") // 仓储费
+ val drawBillChargeStr = MutableLiveData("") // 抽单费
+ val efrChargeStr = MutableLiveData("") // 冷藏费
+ val svlChargeStr = MutableLiveData("") // 铲车费
+ val tallyChargeStr = MutableLiveData("") // 理货费
+
+ fun initOnCreated(intent: Intent) {
+ val jsonData = intent.getStringExtra(Constant.Key.DATA) ?: ""
+ if (jsonData.isNotEmpty()) {
+ try {
+ val bean = Gson().fromJson(jsonData, IntImpPickUpRecordBean::class.java)
+ dataBean.value = bean
+ // 初始化可编辑费用字段
+ tranChargeStr.value = if (bean.tranCharge != 0.0) bean.tranCharge.toString() else ""
+ whsChargeStr.value = if (bean.whsCharge != 0.0) bean.whsCharge.toString() else ""
+ drawBillChargeStr.value = if (bean.drawBillCharge != 0.0) bean.drawBillCharge.toString() else ""
+ efrChargeStr.value = if (bean.efrCharge != 0.0) bean.efrCharge.toString() else ""
+ svlChargeStr.value = if (bean.svlCharge != 0.0) bean.svlCharge.toString() else ""
+ tallyChargeStr.value = if (bean.tallyCharge != 0.0) bean.tallyCharge.toString() else ""
+ } catch (e: Exception) {
+ showToast("数据解析失败")
+ getTopActivity().finish()
+ }
+ } else {
+ showToast("未接收到数据")
+ getTopActivity().finish()
+ }
+ }
+
+ /**
+ * 保存修改
+ */
+ fun submit() {
+ val bean = dataBean.value ?: return
+
+ // 同步可编辑费用字段回 bean
+ bean.tranCharge = tranChargeStr.value?.toDoubleOrNull() ?: 0.0
+ bean.whsCharge = whsChargeStr.value?.toDoubleOrNull() ?: 0.0
+ bean.drawBillCharge = drawBillChargeStr.value?.toDoubleOrNull() ?: 0.0
+ bean.efrCharge = efrChargeStr.value?.toDoubleOrNull() ?: 0.0
+ bean.svlCharge = svlChargeStr.value?.toDoubleOrNull() ?: 0.0
+ bean.tallyCharge = tallyChargeStr.value?.toDoubleOrNull() ?: 0.0
+
+ launchLoadingCollect({
+ NetApply.api.modifyIntImpPickUpCharge(bean.toRequestBody())
+ }) {
+ onSuccess = {
+ showToast("修改成功")
+ viewModelScope.launch {
+ FlowBus.with(ConstantEvent.EVENT_REFRESH).emit("refresh")
+ }
+ getTopActivity().finish()
+ }
+ }
+ }
+
+ /**
+ * 取消
+ */
+ fun cancel() {
+ getTopActivity().finish()
+ }
+}
diff --git a/module_gjj/src/main/res/layout/activity_int_imp_pick_up_charge_edit.xml b/module_gjj/src/main/res/layout/activity_int_imp_pick_up_charge_edit.xml
new file mode 100644
index 0000000..529e82a
--- /dev/null
+++ b/module_gjj/src/main/res/layout/activity_int_imp_pick_up_charge_edit.xml
@@ -0,0 +1,272 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/module_gjj/src/main/res/layout/activity_int_imp_pick_up_record.xml b/module_gjj/src/main/res/layout/activity_int_imp_pick_up_record.xml
index 2ead80c..7c7ff10 100644
--- a/module_gjj/src/main/res/layout/activity_int_imp_pick_up_record.xml
+++ b/module_gjj/src/main/res/layout/activity_int_imp_pick_up_record.xml
@@ -169,7 +169,7 @@
@@ -178,7 +178,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
- android:text='@{"总件数:" + viewModel.totalPc}'
+ android:text='@{"总件数:" + viewModel.totalPc}'
android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp"
android:textStyle="bold" />
@@ -187,7 +187,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
- android:text='@{"总重量:" + viewModel.totalWeight}'
+ android:text='@{"总重量:" + viewModel.totalWeight}'
android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp"
android:textStyle="bold" />
diff --git a/module_gjj/src/main/res/layout/item_int_imp_pick_up_record.xml b/module_gjj/src/main/res/layout/item_int_imp_pick_up_record.xml
index d499e29..fc957c0 100644
--- a/module_gjj/src/main/res/layout/item_int_imp_pick_up_record.xml
+++ b/module_gjj/src/main/res/layout/item_int_imp_pick_up_record.xml
@@ -13,281 +13,312 @@
type="Integer" />
-
-
+
+ android:orientation="vertical">
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ android:background="@drawable/bg_item"
+ android:gravity="center_vertical"
+ android:orientation="horizontal"
+ android:padding="10dp">
-
+
+
+
+
+
+
+
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
-
+
+ android:layout_weight="1.0"
+ android:gravity="center_vertical">
-
+
+
+
+
+
+
+
+ android:layout_weight="0.7"
+ android:gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ android:layout_marginTop="10dp">
-
+
+ android:layout_weight="1.0"
+ android:gravity="center_vertical">
-
+
+
+
+
+
+
+
+ android:layout_weight="0.7"
+ android:gravity="center_vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
+
-
+
-
+
+
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+