支付调试优化
This commit is contained in:
@@ -31,12 +31,10 @@ import com.sw.dualscreen.ext.gone
|
||||
import com.sw.dualscreen.ext.load
|
||||
import com.sw.dualscreen.ext.maskName
|
||||
import com.sw.dualscreen.ext.visible
|
||||
import com.sw.dualscreen.model.request.UserNutritionParam
|
||||
import com.sw.dualscreen.model.response.DinnerType
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.UserEnergy
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import com.sw.dualscreen.utils.Debouncer
|
||||
import com.sw.dualscreen.utils.SPUtil
|
||||
import com.sw.dualscreen.viewmodel.UserViewModel
|
||||
@@ -119,9 +117,16 @@ class MainScreenPresentation(
|
||||
lastWeight = weight * 1000 // 将千克转成克
|
||||
Timber.tag(TAG)
|
||||
.d("updateWeight lastWeight = $weight, currentStep = $currentStep, isGoStep1 = $isGoStep1")
|
||||
// if (lastWeight <= 5) {
|
||||
// activity.isAnalyzing = false
|
||||
// }
|
||||
mealPickupMode = SPUtil.getInstance().get(GlobalKey.KEY_PICKUP_MODE, 0) ?: 0
|
||||
val chargeMode = SPUtil.getInstance().get(GlobalKey.KEY_CHARGE_MODE, 0)
|
||||
if (mealPickupMode == 1 && chargeMode == 0) {
|
||||
//余量计量+计费模式
|
||||
recognitionWeight = lastWeight
|
||||
if (weight > 5) {
|
||||
//余量计量,有重量的情况下不回到重新识别状态
|
||||
return
|
||||
}
|
||||
}
|
||||
if (currentStep == 2 && lastWeight <= 5 && isGoStep1) {
|
||||
//人脸识别过程中,秤上物品拿走
|
||||
isGoStep1 = false
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.sw.dualscreen.ext.toSafeDouble
|
||||
import com.sw.dualscreen.model.response.FoodInfo
|
||||
import com.sw.dualscreen.model.response.UserEnergy
|
||||
import com.sw.dualscreen.model.response.UserNutrition
|
||||
import com.sw.dualscreen.model.response.UserNutritionData
|
||||
import timber.log.Timber
|
||||
import kotlin.math.max
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ class FacePayPresentation(
|
||||
var userId = faceEntity.userName
|
||||
if (userId == null) return@Observer
|
||||
// TODO: 测试支付用户id
|
||||
userId = "1987710988425662466"
|
||||
// userId = "1987710988425662466"
|
||||
faceRecSuccess(userId)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.sw.dualscreen.presentation.pay
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Presentation
|
||||
import android.os.Bundle
|
||||
import android.view.Display
|
||||
@@ -47,9 +48,11 @@ class ScanQrCodePayPresentation(
|
||||
|
||||
//实际支付金额
|
||||
private var realPayPrice = 0.0
|
||||
|
||||
//扣除余额
|
||||
private var expensesBalance = 0.0
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun initView() {
|
||||
when (type) {
|
||||
0 -> {
|
||||
@@ -69,12 +72,14 @@ class ScanQrCodePayPresentation(
|
||||
}
|
||||
|
||||
1 -> {
|
||||
binding.layoutVip.visible()
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo!=null) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.gone()
|
||||
binding.layoutScanQrCode.visible()
|
||||
|
||||
val memberInfo = activity.memberInfo
|
||||
totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
//totalPrice = if (memberInfo != null) activity.foodInfo?.vipPrice else activity.foodInfo?.specPrice
|
||||
balance = (memberInfo?.topUpBalance ?: 0.0) + (memberInfo?.rewardBalance ?: 0.0)
|
||||
realPayPrice = if (balance >= totalPrice) 0.0 else totalPrice - balance
|
||||
expensesBalance = if (balance >= totalPrice) totalPrice else balance
|
||||
@@ -103,13 +108,15 @@ class ScanQrCodePayPresentation(
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.layoutVip.visible()
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo!=null) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.visible()
|
||||
binding.layoutScanQrCode.gone()
|
||||
|
||||
val memberInfo = activity.memberInfo
|
||||
totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
balance = (memberInfo?.topUpBalance ?: 0.0) + (memberInfo?.rewardBalance ?: 0.0)
|
||||
//totalPrice = activity.foodInfo?.vipPrice ?: 0.0
|
||||
balance = if (memberInfo != null) (memberInfo.topUpBalance ?: 0.0)+(memberInfo.rewardBalance ?: 0.0) else 0.0
|
||||
realPayPrice = if (balance >= totalPrice) 0.0 else totalPrice - balance
|
||||
expensesBalance = if (balance >= totalPrice) totalPrice else balance
|
||||
|
||||
@@ -122,8 +129,9 @@ class ScanQrCodePayPresentation(
|
||||
)
|
||||
)
|
||||
|
||||
binding.tvPayInfo.text =
|
||||
"余额扣除 ${expensesBalance.format2String(2)} 元,在线支付 ${totalPrice.format2String(2)} 元"
|
||||
val showBalance = expensesBalance.format2String(2)
|
||||
val showTotal = totalPrice.format2String(2)
|
||||
binding.tvPayInfo.text = "余额扣除 $showBalance 元,在线支付 $showTotal 元"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,10 +142,8 @@ class ScanQrCodePayPresentation(
|
||||
|
||||
val phone = item.phone ?: ""
|
||||
binding.tvUserPhone.text =
|
||||
if (phone.length == 11)
|
||||
phone.replace(phone.substring(3, 7), "****")
|
||||
else
|
||||
phone
|
||||
if (phone.length == 11) phone.replace(phone.substring(3, 7), "****")
|
||||
else phone
|
||||
}
|
||||
|
||||
private fun getAmountList(): List<TextBean> {
|
||||
@@ -157,9 +163,7 @@ class ScanQrCodePayPresentation(
|
||||
TextBean(text = " 元,扣除后可用余额 ", textSize = 30, textColor = "#FF5E7585")
|
||||
val remainingBalance = balance - totalPrice
|
||||
TextBean(
|
||||
text = remainingBalance.format2String(2),
|
||||
textSize = 30,
|
||||
textColor = "#FF0A1428"
|
||||
text = remainingBalance.format2String(2), textSize = 30, textColor = "#FF0A1428"
|
||||
)
|
||||
} else {
|
||||
//余额小于总价格,使用余额+扫码支付
|
||||
|
||||
Reference in New Issue
Block a user