支付调试优化
This commit is contained in:
@@ -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