diff --git a/src/pages/pay/scanPay.vue b/src/pages/pay/scanPay.vue index 58091c0..e52ed15 100644 --- a/src/pages/pay/scanPay.vue +++ b/src/pages/pay/scanPay.vue @@ -3,27 +3,27 @@ {{ scanPayState.mchName }} - + ¥ {{ displayAmount }} - - 选择支付钱包: + + 选择支付钱包: - {{ v.walletTypeName }} + {{ v.walletTypeName }} - - 余额:{{ hooks.useMoney(v.balance) }} - 元 + + 余额: + {{ hooks.useMoney(v.balance) }} 元 @@ -56,7 +56,7 @@ const scanPayState = reactive({ action: "", }) const walletList = ref([]) // 钱包列表 -const curWalletId = ref("") // 当前选中的钱包id +const selectWallet = ref({}) // 当前选中的钱包 const orderInfo = ref({}) // 订单信息 const amount = ref("") // 键盘输入的金额 @@ -70,7 +70,8 @@ onLoad(async (options: any) => { scanPayState.action = action await getMchDetail(mchId) await getOrderInfo() - amount.value = displayPrice(orderInfo.value.totalPrice || 0 + orderInfo.value.extraPrice || 0, "") + const order = orderInfo.value + amount.value = displayPrice(order.totalPrice || 0 + order.extraPrice || 0, "") return } @@ -105,7 +106,7 @@ const getWalletList = async () => { if (code !== 0) return uni.showToast({ title: "获取钱包列表失败", icon: "none" }) walletList.value = data.records if (walletList.value.length > 0) { - curWalletId.value = walletList.value.find((v: any) => v.walletTypeUniqueCode == "1").id + selectWallet.value = walletList.value.find((v: any) => v.walletTypeUniqueCode == "1") } } @@ -145,14 +146,14 @@ const pay = async () => { if (scanPayState.action === "harQrCodeScanPay") { const { code, msg }: any = await orderApi.doneHardQrCodeScanOrder({ orderId: scanPayState.orderId, - walletId: curWalletId.value, + walletTypeId: selectWallet.value.walletTypeId, }) if (code != 0) return uni.showToast({ title: msg || "支付失败", icon: "error" }) } else { const { code, msg } = await payApi.createQrCodeOrder({ merchantId: scanPayState.mchId, customPrice: storePrice(Number(amount.value)), - walletId: curWalletId.value, + walletId: selectWallet.value.id, }) if (code != 0) return uni.showToast({ title: msg || "支付失败", icon: "error" }) }