feat: 国际出港理货 sub list

This commit is contained in:
2026-01-04 16:36:07 +08:00
parent 28159ce738
commit 3c35adc0ed
5 changed files with 261 additions and 301 deletions

View File

@@ -0,0 +1,26 @@
package com.lukouguoji.gjc.holder
import android.view.View
import com.lukouguoji.gjc.databinding.ItemIntExpTallySubBinding
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjcHaWb
/**
* 国际出港-出港理货 子订单(分单) ViewHolder
*/
class IntExpTallySubViewHolder(view: View) :
BaseViewHolder<GjcHaWb, ItemIntExpTallySubBinding>(view) {
override fun onBind(item: Any?, position: Int) {
val bean = getItemBean(item) ?: return
binding.bean = bean
binding.position = position + 1 // 序号从 1 开始
binding.executePendingBindings()
// checkbox点击切换选择状态
binding.ivCheckbox.setOnClickListener {
bean.checked.set(!bean.checked.get())
binding.executePendingBindings()
}
}
}

View File

@@ -1,9 +1,12 @@
package com.lukouguoji.gjc.holder
import android.view.View
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ItemIntExpTallyBinding
import com.lukouguoji.module_base.adapter.setCommonAdapter
import com.lukouguoji.module_base.base.BaseViewHolder
import com.lukouguoji.module_base.bean.GjcMaWb
import com.lukouguoji.module_base.ktx.refresh
/**
* 国际出港-出港理货 ViewHolder
@@ -17,10 +20,25 @@ class IntExpTallyViewHolder(view: View) :
binding.position = position
binding.executePendingBindings()
// 图标点击切换选择状态
// 图标点击切换选择状态(保留原有)
binding.ivIcon.setOnClickListener {
bean.checked.set(!bean.checked.get())
binding.executePendingBindings()
}
// ========== 新增:展开按钮点击事件 ==========
binding.ivShow.setOnClickListener {
bean.showMore.set(!bean.showMore.get())
}
// ========== 新增:初始化子列表 RecyclerView ==========
setCommonAdapter(
binding.rvSub,
IntExpTallySubViewHolder::class.java,
R.layout.item_int_exp_tally_sub
)
// 刷新子列表数据
binding.rvSub.refresh(bean.haWbList ?: emptyList())
}
}

View File

@@ -1,304 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:loadImage="http://schemas.android.com/tools">
<data>
<variable
name="bean"
type="com.lukouguoji.module_base.bean.GjcMaWb" />
<variable
name="position"
type="Integer" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_white_radius_8"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp">
<!-- 选中图标 -->
<ImageView
android:id="@+id/iv_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="10dp"
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
android:src="@drawable/img_plane" />
<!-- 数据展示区域 -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<!-- 第一行:运单号、状态、代理、件数、重量 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- 运单号 (weight=1.5) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:orientation="horizontal">
<TextView
completeSpace="@{4}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="运单号:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.wbNo}"
android:textColor="@color/colorPrimary"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<!-- 状态 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="状态:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.declareStatus}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 代理 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="代理:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.agentName}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 件数 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="件数:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf(bean.pc)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 重量 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="重量:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf((int)bean.weight)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<!-- 第二行:特码、始发站、目的站、运单类型、分单数 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<!-- 特码 (weight=1.5) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="特码:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.spCode}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 始发站 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="始发站:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.dep}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 目的站 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="目的站:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.dest}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 运单类型 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{5}"
android:text="运单类型:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{bean.awbName}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
<!-- 分单数 (weight=1) -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
completeSpace="@{4}"
android:text="分单数:"
android:textColor="@color/text_normal"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{String.valueOf(bean.haWbNumber)}"
android:textColor="@color/text_normal"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:loadImage="http://schemas.android.com/tools">
<data>
<import type="android.view.View"/>
<variable name="bean" type="com.lukouguoji.module_base.bean.GjcMaWb"/>
<variable name="position" type="Integer"/>
</data>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="10dp" android:layout_marginTop="10dp" android:background="@drawable/bg_white_radius_8" android:orientation="vertical">
<!-- 主要内容区域 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" android:padding="10dp">
<!-- 选中图标 -->
<ImageView android:id="@+id/iv_icon" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginEnd="10dp" loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}" android:src="@drawable/img_plane"/>
<!-- 数据展示区域 -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical">
<!-- 第一行:运单号、状态、代理、件数、重量 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal">
<!-- 运单号 (weight=1.5) -->
<LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1.0" android:orientation="horizontal">
<TextView completeSpace="@{4}" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="运单号:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.wbNo}" android:textColor="@color/colorPrimary" android:textSize="16sp" android:textStyle="bold"/>
</LinearLayout>
<!-- 状态 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="状态:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.declareStatus}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 代理 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="代理:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.agentName}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 件数 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.2" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{5}" android:text="件数:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{String.valueOf(bean.pc)}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 重量 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="重量:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{String.valueOf((int)bean.weight)}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
<!-- 第二行:特码、始发站、目的站、运单类型、分单数 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="horizontal">
<!-- 特码 (weight=1.5) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.0" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="特码:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.spCode}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 始发站 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="始发站:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.dep}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 目的站 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="目的站:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.dest}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 运单类型 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.2" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{5}" android:text="运单类型:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{bean.awbName}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
<!-- 分单数 (weight=1) -->
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:orientation="horizontal">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" completeSpace="@{4}" android:text="分单数:" android:textColor="@color/text_normal" android:textSize="16sp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@{String.valueOf(bean.haWbNumber)}" android:textColor="@color/text_normal" android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- 展开/折叠按钮 -->
<ImageView android:id="@+id/iv_show" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:padding="5dp" android:src="@mipmap/img_down"/>
<!-- 子订单列表容器 -->
<LinearLayout visible="@{bean.showMore}" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="10dp" android:layout_marginBottom="10dp" android:background="#e3f6e0" android:orientation="vertical" android:visibility="gone">
<!-- 表头 -->
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:paddingHorizontal="10dp" android:orientation="horizontal">
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.5" android:gravity="center" android:text="选项" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1.2" android:gravity="center" android:text="分单号" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:gravity="center" android:text="件数" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.8" android:gravity="center" android:text="重量(KG)" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="申报状态" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" android:text="品名(中)" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.9" android:gravity="center" android:text="申报次数" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.9" android:gravity="center" android:text="申报费率" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.9" android:gravity="center" android:text="删除次数" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
<TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="0.9" android:gravity="center" android:text="删除费率" android:textColor="@color/text_normal" android:textSize="14sp" android:textStyle="bold"/>
</LinearLayout>
<!-- 子列表 RecyclerView -->
<androidx.recyclerview.widget.RecyclerView android:id="@+id/rv_sub" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="10dp" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
</LinearLayout>
</LinearLayout>
</layout>

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:loadImage="http://schemas.android.com/tools">
<data>
<variable
name="bean"
type="com.lukouguoji.module_base.bean.GjcHaWb" />
<variable
name="position"
type="Integer" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingHorizontal="10dp"
android:orientation="horizontal">
<!-- 选项 - 圆形checkbox -->
<ImageView
android:id="@+id/iv_checkbox"
android:layout_width="0dp"
android:layout_height="24dp"
android:layout_weight="0.5"
android:layout_gravity="center_vertical"
loadImage="@{bean.checked.get() ? @drawable/img_plane_s : @drawable/img_plane}"
android:src="@drawable/img_plane" />
<!-- 分单号 (前缀-编号-H编号) -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.2"
android:gravity="center"
android:text="@{bean.hno ?? ``}"
android:textColor="@color/colorPrimary"
android:textSize="14sp"
android:textStyle="bold" />
<!-- 件数 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{String.valueOf(bean.hpc ?? bean.pc)}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 重量 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:gravity="center"
android:text="@{String.valueOf((int)(bean.hweight ?? bean.weight))}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 申报状态 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@{bean.tallyStatus ?? ``}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 品名(中) -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@{bean.goodsCn ?? bean.goods}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 申报次数 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:gravity="center"
android:text="@{bean.tallySCount != null ? String.valueOf((int)bean.tallySCount.doubleValue()) : `0`}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 申报费率 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:gravity="center"
android:text="@{bean.tallySRate != null ? String.valueOf(bean.tallySRate) : `0`}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 删除次数 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:gravity="center"
android:text="@{bean.tallyDCount != null ? String.valueOf((int)bean.tallyDCount.doubleValue()) : `0`}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
<!-- 删除费率 -->
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.9"
android:gravity="center"
android:text="@{bean.tallyDRate != null ? String.valueOf(bean.tallyDRate) : `0`}"
android:textColor="@color/text_normal"
android:textSize="14sp" />
</LinearLayout>
</layout>