使用人脸接口中的member字段判断是否会员;逻辑优化;
This commit is contained in:
@@ -302,10 +302,11 @@ class PayPresentation(
|
||||
lastFaceTrackId = compareResult.trackId
|
||||
val faceEntity = compareResult.faceEntity
|
||||
val userId = faceEntity.userName
|
||||
val isMember = faceEntity.userType == "1"
|
||||
if (userId == null) return@Observer
|
||||
// TODO: 测试支付用户id
|
||||
// userId = "1987710988425662466"
|
||||
faceRecSuccess(userId)
|
||||
faceRecSuccess(userId, isMember)
|
||||
})
|
||||
|
||||
recognizeViewModel.drawRectInfoText.observe(activity, Observer { info ->
|
||||
@@ -313,6 +314,7 @@ class PayPresentation(
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
private fun initArcView() {
|
||||
//在布局结束后才做初始化操作
|
||||
binding.dualCameraTexturePreviewRgb.getViewTreeObserver().addOnGlobalLayoutListener(this)
|
||||
@@ -586,7 +588,7 @@ class PayPresentation(
|
||||
}
|
||||
|
||||
|
||||
private fun faceRecSuccess(userId: String) {
|
||||
private fun faceRecSuccess(userId: String, isMember: Boolean) {
|
||||
activity.runOnUiThread {
|
||||
activity.showWaitingDialog("加载中,请稍后……")
|
||||
}
|
||||
@@ -596,6 +598,7 @@ class PayPresentation(
|
||||
//ToastUtils.showToast("查询会员信息失败,请稍后重试")
|
||||
return@getMemberInfoById
|
||||
}
|
||||
memberInfo.member = isMember
|
||||
activity.bindOrder(memberInfo.faceUserId ?: "") { bindResult ->
|
||||
if (bindResult.not()) {
|
||||
activity.hideWaitingDialog()
|
||||
@@ -607,9 +610,9 @@ class PayPresentation(
|
||||
// TODO: 测试 memberInfo.member是否返回正常数据---------------
|
||||
activity.showPayInfo(type = 1, isVip = memberInfo.member, memberInfo = memberInfo)
|
||||
activity.hidePayTab()
|
||||
binding.root.postDelayed({
|
||||
dismiss()
|
||||
}, 500)
|
||||
// binding.root.postDelayed({
|
||||
// dismiss()
|
||||
// }, 500)
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
@@ -680,7 +683,7 @@ class PayPresentation(
|
||||
1 -> {
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo != null) visible() else gone()
|
||||
if (memberInfo != null && memberInfo.member) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.gone()
|
||||
binding.layoutScanQrCode.visible()
|
||||
@@ -709,18 +712,22 @@ class PayPresentation(
|
||||
if (balance >= totalPrice) invisible() else visible()
|
||||
}
|
||||
|
||||
binding.tvPayTip.text = SpannedUtils.getAmountText(getAmountList())
|
||||
if (memberInfo !=null && memberInfo!!.member) {
|
||||
binding.tvPayTip.text = SpannedUtils.getAmountText(getAmountList())
|
||||
} else {
|
||||
binding.tvPayTip.text = SpannedUtils.getAmountText(getAmountListNotMember())
|
||||
}
|
||||
}
|
||||
|
||||
2 -> {
|
||||
val memberInfo = activity.memberInfo
|
||||
binding.layoutVip.run {
|
||||
if (memberInfo != null) visible() else gone()
|
||||
if (memberInfo != null && memberInfo.member) visible() else gone()
|
||||
}
|
||||
binding.layoutPaySuccess.visible()
|
||||
binding.layoutScanQrCode.gone()
|
||||
|
||||
balance = if (memberInfo != null) (memberInfo.topUpBalance
|
||||
balance = if (memberInfo != null && memberInfo.member) (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
|
||||
@@ -758,6 +765,22 @@ class PayPresentation(
|
||||
else phone
|
||||
}
|
||||
|
||||
private fun getAmountListNotMember(): List<TextBean> {
|
||||
val list: MutableList<TextBean> = mutableListOf()
|
||||
|
||||
list.add(TextBean(text = "应付金额 ", textSize = 30, textColor = "#FF889AC2"))
|
||||
list.add(
|
||||
TextBean(
|
||||
text = "-${totalPrice.format2String(2)}",
|
||||
textSize = 30,
|
||||
textColor = "#FF0A1428",
|
||||
isBold = true
|
||||
)
|
||||
)
|
||||
list.add(TextBean(text = " 元", textSize = 30, textColor = "#FF889AC2"))
|
||||
return list
|
||||
}
|
||||
|
||||
private fun getAmountList(): List<TextBean> {
|
||||
val list: MutableList<TextBean> = mutableListOf()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user