优化扫码支付结果会员非会员显示
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.sw.dualscreen.activity
|
||||
|
||||
import android.view.KeyEvent
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.viewModels
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -66,6 +65,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
|
||||
var foodOrderId: String = ""
|
||||
var eatNum: Int = 1
|
||||
var isMember: Boolean = false
|
||||
|
||||
val presentation by lazy {
|
||||
PayPresentation(
|
||||
@@ -99,12 +99,14 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
binding.include.ivPageBack.setOnClickListener { finish() }
|
||||
binding.include.tvPageTitle.text = "下单结算"
|
||||
binding.btnPayQrCode.setOnClickListener {
|
||||
isMember = false
|
||||
if (binding.btnPayQrCode.isChecked) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
showScanQrCodePay()
|
||||
}
|
||||
binding.btnPayCash.setOnClickListener {
|
||||
isMember = false
|
||||
if (binding.btnPayCash.isChecked) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
@@ -160,7 +162,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
presentation?.dismiss()
|
||||
presentation.dismiss()
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@@ -175,14 +177,14 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
// display = displays[1],
|
||||
// type = type
|
||||
// ) {
|
||||
// scanQrCodePayPresentation?.dismiss()
|
||||
// scanQrCodePaypresentation.dismiss()
|
||||
// }.also {
|
||||
// it.foodName = foodInfo?.foodName
|
||||
// //确认使用vipPrice 还是 specPrice
|
||||
// val onePrice = if (isVip) foodInfo?.vipPrice else foodInfo?.specPrice
|
||||
// it.totalPrice = (onePrice ?: 0.0) * eatNum
|
||||
// }
|
||||
// scanQrCodePayPresentation?.show()
|
||||
// scanQrCodePaypresentation.show()
|
||||
// }
|
||||
presentation.let {
|
||||
it.pageType = PayPresentation.QR_CODE_PAY
|
||||
@@ -196,8 +198,8 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
}
|
||||
|
||||
fun updateQrCodeImage(qrCodeUrl: String?) {
|
||||
// scanQrCodePayPresentation?.loadQrCodeImage(qrCodeUrl)
|
||||
presentation?.loadQrCodeImage(qrCodeUrl)
|
||||
// scanQrCodePaypresentation.loadQrCodeImage(qrCodeUrl)
|
||||
presentation.loadQrCodeImage(qrCodeUrl)
|
||||
}
|
||||
|
||||
private var debouncer = Debouncer(5000)
|
||||
@@ -300,7 +302,7 @@ class PayActivity : BaseActivity<ActivityPayBinding>() {
|
||||
Timber.d("qrCodePay支付返回数据:state=$payState,backData=$backData")
|
||||
hideWaitingDialog()
|
||||
if (payState) {
|
||||
showPaySuccess(false)
|
||||
showPaySuccess(isMember)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class NumberPayFragment : BaseFragment<FragmentNumberPayBinding>() {
|
||||
// ToastUtils.showToast("会员验证成功")
|
||||
// }
|
||||
// }
|
||||
|
||||
payActivity.isMember = false
|
||||
payActivity.getMemberInfoByPhone(phone, key) { memberInfo ->
|
||||
if (memberInfo == null) {
|
||||
binding.root.postDelayed({
|
||||
@@ -52,6 +52,7 @@ class NumberPayFragment : BaseFragment<FragmentNumberPayBinding>() {
|
||||
}
|
||||
//肯定是会员
|
||||
memberInfo.member = true
|
||||
payActivity.isMember = true
|
||||
//绑定订单使用faceUserId
|
||||
payActivity.bindOrder(memberInfo.faceUserId ?: "") { bindResult ->
|
||||
if (bindResult.not()) {
|
||||
|
||||
@@ -303,6 +303,7 @@ class PayPresentation(
|
||||
val faceEntity = compareResult.faceEntity
|
||||
val userId = faceEntity.userName
|
||||
val isMember = faceEntity.userType == "1"
|
||||
activity.isMember = isMember
|
||||
if (userId == null) return@Observer
|
||||
// TODO: 测试支付用户id
|
||||
// userId = "1987710988425662466"
|
||||
|
||||
Reference in New Issue
Block a user