调试优化

This commit is contained in:
2025-12-11 18:54:57 +08:00
parent 6e318f8c82
commit a0847d21b7
6 changed files with 93 additions and 44 deletions
@@ -230,15 +230,34 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
//val realWeight = (lastWeight * 1000).roundToInt()
val mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
val eatWeight = if (mealPickupMode == 0) {
//即放即取
presentation!!.recognitionWeight
val chargeMode = SPUtil.getInstance().get(GlobalKey.KEY_CHARGE_MODE, 0) ?: 0
var foodWeight = 0.0
var eatWeight = 0.0
if (chargeMode == 0) {
//计费
if (mealPickupMode == 0) {
//即放即取
eatWeight = presentation!!.lastWeight
foodWeight = presentation!!.lastWeight
} else {
//余量计量
eatWeight = presentation!!.recognitionWeight - presentation!!.lastWeight
foodWeight = presentation!!.recognitionWeight
}
} else {
presentation!!.recognitionWeight - lastWeight
//不计费
foodWeight = presentation!!.recognitionWeight
eatWeight = if (mealPickupMode == 0) {
//即放即取
presentation!!.recognitionWeight
} else {
//余量计量
presentation!!.recognitionWeight - presentation!!.lastWeight
}
}
createOrder(
foodInfo = checkedItem!!,
foodWeight = presentation?.lastWeight?.roundToInt() ?: 0,
foodWeight = foodWeight.roundToInt(),
eatWeight = eatWeight.roundToInt()
) {
presentation?.dismiss()