chore:支付页面调整

This commit is contained in:
weiwei committed 2025-09-03 10:09:04 +08:00
1 parent 15a8c695e0
commit fef4fbca2e
1 file changed
+16 -15
+16 -15
View File
@@ -3,27 +3,27 @@
<view class="h-screen flex flex-col">
<view class="mx-auto text-34 py-2 h-80rpx">{{ scanPayState.mchName }}</view>
<tm-sheet class="flex flex-row">
<tm-sheet :margin="[0, 10]" class="flex flex-row">
<span class="text-2xl text-[#333] mr-1 line-height-normal">¥</span>
<span class="text-3xl font-medium text-[#333]">{{ displayAmount }}</span>
</tm-sheet>
<tm-sheet v-if="walletList.length > 0" class="flex flex-col">
<view class="text-gray-700 font-bold text-sm mb-1">选择支付钱包:</view>
<tm-sheet v-if="walletList.length > 0" :margin="[0, 10]" class="flex flex-col">
<view class="text-gray-700 font-bold text-28 mb-1">选择支付钱包:</view>
<view
v-for="(v, index) in walletList"
:key="index"
class="card relative border-4 border-solid my-1 duration-200 border-#efefef flex justify-between items-center p-3"
:class="{ 'border-4 border-solid border-blue!': curWalletId == v.id }"
@click="curWalletId = v.id"
class="border-6 border-solid border-#efefef my-2 duration-200 flex justify-between items-center p-3 rounded-2"
:class="{ 'border-6 border-solid border-blue!': selectWallet.id == v.id }"
@click="selectWallet = v"
>
<view class="flex items-center">
<image class="w-70 h-70 mr-2" :src="filePath(v.walletTypeIcon)" />
<view class="main-text-32">{{ v.walletTypeName }}</view>
<view class="text-32">{{ v.walletTypeName }}</view>
</view>
<view class="main-text-28 flex items-center">
<view>余额:{{ hooks.useMoney(v.balance) }}</view>
<text>元</text>
<view class="text-28 flex items-center">
<view>余额:</view>
<text class="main-text-28">{{ hooks.useMoney(v.balance) }} 元</text>
</view>
</view>
</tm-sheet>
@@ -56,7 +56,7 @@ const scanPayState = reactive({
action: "",
})
const walletList = ref<any>([]) // 钱包列表
const curWalletId = ref("") // 当前选中的钱包id
const selectWallet = ref<any>({}) // 当前选中的钱包
const orderInfo = ref<any>({}) // 订单信息
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" })
}