联合支付功能调试

This commit is contained in:
2026-03-23 18:13:55 +08:00
parent bf8444e5d5
commit c4a6101a7b
13 changed files with 350 additions and 143 deletions
@@ -10,19 +10,21 @@ import androidx.core.view.updateLayoutParams
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder
import com.sw.dualscreen.databinding.LayoutFoodListHeaderBinding
import com.sw.dualscreen.databinding.ListItemFoodOrderBinding
import com.sw.dualscreen.ext.dp
import com.sw.dualscreen.ext.format2String
import com.sw.dualscreen.ext.gone
import com.sw.dualscreen.ext.visible
import com.sw.dualscreen.model.response.FoodItem
class FoodOrderAdapter(var list: MutableList<FoodItem>) :
BaseQuickAdapter<FoodItem, FoodOrderAdapter.VH>(list) {
inner class VH(var binding: LayoutFoodListHeaderBinding) : QuickViewHolder(binding.root)
inner class VH(var binding: ListItemFoodOrderBinding) : QuickViewHolder(binding.root)
override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
val inflater = LayoutInflater.from(context)
val binding = LayoutFoodListHeaderBinding.inflate(inflater, parent, false)
val binding = ListItemFoodOrderBinding.inflate(inflater, parent, false)
return VH(binding)
}
@@ -31,9 +33,20 @@ class FoodOrderAdapter(var list: MutableList<FoodItem>) :
val binding = holder.binding
item?.let {
binding.tvFoodName.text = it.foodName
binding.tvPriceNorm.text = it.foodPrice.format2String(2)
val foodPrice = it.foodPrice.format2String(2)
if (it.orderFrom == 2) {
binding.tvPriceNorm.text = "${it.specName}-${it.specWeight}"
} else {
binding.tvPriceNorm.text = "${foodPrice}/${it.num}"
}
//if (it.specName.isNullOrBlank().not()) {
// binding.tvPriceFlag.text = "[${it.specName}]"
//}
binding.tvWeight.text = "${it.num}"
binding.tvAmount.text = it.price.format2String(2)
binding.tvLabel.run {
if (it.orderFrom == 2) visible() else gone()
}
}
setTextColor(binding.tvFoodName, binding.tvPriceNorm, binding.tvWeight, binding.tvAmount)
binding.root.updateLayoutParams<RecyclerView.LayoutParams> {