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