feat: 国际进港提取记录费用修改页面及列表侧滑菜单

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 15:13:45 +08:00
parent 6278d9738d
commit 5ccb971c61
9 changed files with 711 additions and 246 deletions

View File

@@ -487,6 +487,13 @@
android:exported="false" android:exported="false"
android:screenOrientation="userLandscape" /> android:screenOrientation="userLandscape" />
<!-- 国际进港-费用修改 -->
<activity
android:name="com.lukouguoji.gjj.activity.IntImpPickUpChargeEditActivity"
android:configChanges="orientation|keyboardHidden"
android:exported="false"
android:screenOrientation="userLandscape" />
<!-- 国际进港-提取出库 --> <!-- 国际进港-提取出库 -->
<activity <activity
android:name="com.lukouguoji.gjj.activity.IntImpPickUpDLVActivity" android:name="com.lukouguoji.gjj.activity.IntImpPickUpDLVActivity"

View File

@@ -973,6 +973,13 @@ interface Api {
@POST("IntImpPickup/clearPickup") @POST("IntImpPickup/clearPickup")
suspend fun clearIntImpPickUp(@Body data: RequestBody): BaseResultBean<String> suspend fun clearIntImpPickUp(@Body data: RequestBody): BaseResultBean<String>
/**
* 国际进港提取记录-修改费用
* 接口路径: /IntImpPickup/modifyCharge
*/
@POST("IntImpPickup/modifyCharge")
suspend fun modifyIntImpPickUpCharge(@Body data: RequestBody): BaseResultBean<String>
/** /**
* 国际进港提取出库-分页查询 * 国际进港提取出库-分页查询
* 接口路径: /IntImpPickUpDlv/pageQuery * 接口路径: /IntImpPickUpDlv/pageQuery

View File

@@ -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<ActivityIntImpPickUpChargeEditBinding, IntImpPickUpChargeEditViewModel>() {
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)
}
}
}

View File

@@ -13,6 +13,8 @@ import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.common.ConstantEvent import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.impl.FlowBus import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.observe 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.commonAdapter
import com.lukouguoji.module_base.ktx.showToast import com.lukouguoji.module_base.ktx.showToast
import com.lukouguoji.module_base.model.ConfirmDialogModel import com.lukouguoji.module_base.model.ConfirmDialogModel
@@ -41,6 +43,20 @@ class IntImpPickUpRecordActivity :
// 绑定分页 // 绑定分页
viewModel.pageModel.bindSmartRefreshLayout(binding.srl, binding.rv, viewModel, this) 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<String>(ConstantEvent.EVENT_REFRESH).observe(this) { FlowBus.with<String>(ConstantEvent.EVENT_REFRESH).observe(this) {
viewModel.refresh() viewModel.refresh()

View File

@@ -25,8 +25,14 @@ class IntImpPickUpRecordViewHolder(view: View) :
} }
// 列表项点击进入提取详情 // 列表项点击进入提取详情
itemView.setOnClickListener { binding.ll.setOnClickListener {
IntImpPickUpRecordDetailsActivity.start(itemView.context, bean) IntImpPickUpRecordDetailsActivity.start(itemView.context, bean)
} }
// 侧滑菜单 - 修改按钮
binding.btnEdit.setOnClickListener {
binding.swipeMenu.quickClose()
clickListener?.onItemClick(position, 2000) // type=2000表示修改操作
}
} }
} }

View File

@@ -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<String>(ConstantEvent.EVENT_REFRESH).emit("refresh")
}
getTopActivity().finish()
}
}
}
/**
* 取消
*/
fun cancel() {
getTopActivity().finish()
}
}

View File

@@ -0,0 +1,272 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />
<variable
name="viewModel"
type="com.lukouguoji.gjj.viewModel.IntImpPickUpChargeEditViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_f2"
android:orientation="vertical">
<!-- 标题栏 -->
<include layout="@layout/title_tool_bar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_white_radius_8"
android:orientation="vertical"
android:padding="15dp">
<!-- 第1行运单号、代理人、特码只读 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"运 单 号"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.wbNo}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"代 理 人"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.agentCode}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"特 码"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.spCode}' />
</LinearLayout>
<!-- 第2行提货编号、件数、重量只读 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"提货编号"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{viewModel.dataBean.pkId}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"件数"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(viewModel.dataBean.pc)}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"重量"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(viewModel.dataBean.weight)}' />
</LinearLayout>
<!-- 第3行计费重量只读、信息费可编辑、服务费只读 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"计费重量"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(viewModel.dataBean.cashWeight)}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入信息费"}'
title='@{"信息费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.tranChargeStr}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"服务费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(viewModel.dataBean.optCharge)}' />
</LinearLayout>
<!-- 第4行仓储费、抽单费、冷藏费可编辑 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入仓储费"}'
title='@{"仓储费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.whsChargeStr}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入抽单费"}'
title='@{"抽单费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.drawBillChargeStr}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入冷藏费"}'
title='@{"冷藏费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.efrChargeStr}' />
</LinearLayout>
<!-- 第5行铲车费、理货费可编辑、总金额只读 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入铲车费"}'
title='@{"铲车费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.svlChargeStr}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{true}"
hint='@{"请输入理货费"}'
title='@{"理货费"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@={viewModel.tallyChargeStr}' />
<com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayoutNew
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
enable="@{false}"
title='@{"总金额"}'
titleLength="@{5}"
type="@{DataLayoutType.INPUT}"
value='@{String.valueOf(viewModel.dataBean.amount)}' />
</LinearLayout>
</LinearLayout>
<!-- 底部操作按钮 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginTop="24dp"
android:gravity="center"
android:paddingHorizontal="15dp">
<TextView
style="@style/tv_bottom_btn"
android:layout_width="120dp"
android:layout_marginEnd="20dp"
android:onClick="@{()-> viewModel.cancel()}"
android:text="取消" />
<TextView
style="@style/tv_bottom_btn"
android:layout_width="120dp"
android:onClick="@{()-> viewModel.submit()}"
android:text="保存" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</layout>

View File

@@ -169,7 +169,7 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text='@{"合计:" + viewModel.totalCount + "票"}' android:text='@{"合计" + viewModel.totalCount + "票"}'
android:textColor="@color/bottom_tool_tips_text_color" android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -178,7 +178,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:text='@{"总件数:" + viewModel.totalPc}' android:text='@{"总件数" + viewModel.totalPc}'
android:textColor="@color/bottom_tool_tips_text_color" android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -187,7 +187,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:text='@{"总重量:" + viewModel.totalWeight}' android:text='@{"总重量" + viewModel.totalWeight}'
android:textColor="@color/bottom_tool_tips_text_color" android:textColor="@color/bottom_tool_tips_text_color"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />

View File

@@ -13,13 +13,25 @@
type="Integer" /> type="Integer" />
</data> </data>
<!-- 外层容器承载间距 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp"
android:orientation="vertical">
<!-- 侧滑布局 -->
<com.mcxtzhang.swipemenulib.SwipeMenuLayout
android:id="@+id/swipe_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 主列表项容器 --> <!-- 主列表项容器 -->
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/ll" android:id="@+id/ll"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="15dp"
android:layout_marginVertical="5dp"
android:background="@drawable/bg_item" android:background="@drawable/bg_item"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
@@ -290,4 +302,23 @@
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
<!-- 侧滑菜单区域 -->
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<!-- 修改按钮 -->
<TextView
android:id="@+id/btn_edit"
style="@style/tv_item_action"
android:background="@color/colorPrimary"
android:text="修改" />
</androidx.appcompat.widget.LinearLayoutCompat>
</com.mcxtzhang.swipemenulib.SwipeMenuLayout>
</LinearLayout>
</layout> </layout>