扫码支付完成页面

This commit is contained in:
weiwei committed 2025-03-26 16:33:32 +08:00
1 parent 8015c7bf57
commit 56bf1d15a5
4 files changed
+80 -26

No files matched your search

+7
View File
@@ -287,6 +287,13 @@
"navigationBarTitleText": "支付",
"disableScroll": true
}
},
{
"path": "payComplete",
"style": {
"navigationBarTitleText": "支付完成",
"disableScroll": true
}
}
]
}
+70
View File
@@ -0,0 +1,70 @@
<template>
<view class="w-full h-full">
<view class="w-full h-55% bg-#1677FF border-b-10rpx">
<view class="flex-col-center p-30rpx">
<view class="sub-text-36 font-bold fixed top-30rpx right-60rpx c-white!" @click="goBack">完成</view>
<view class="flex-col-center m-y-50rpx">
<svg
t="1742975132669"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="2952"
data-spm-anchor-id="a313x.search_index.0.i7.beb13a813i4xbT"
width="64"
height="64"
>
<path
d="M512.187255 0.000125a511.313108 511.313108 0 1 0 511.999937 511.313108A511.625303 511.625303 0 0 0 512.187255 0.000125z m277.041917 360.897517l-343.414592 342.91508a29.283899 29.283899 0 0 1-42.208776 0l-168.585345-168.585345A29.783411 29.783411 0 0 1 277.104356 493.268357l147.668275 147.418519 322.247766-321.748253a29.783411 29.783411 0 1 1 42.146336 42.083897z"
fill="#ffffff"
p-id="2953"
data-spm-anchor-id="a313x.search_index.0.i4.beb13a813i4xbT"
class=""
></path>
</svg>
<text class="sub-text-36 c-white! mt-1">支付成功</text>
</view>
<view class="flex-col-center m-b-60rpx">
<text class="main-text-90 color-white!">¥{{ payData.customPrice }}</text>
</view>
<view class="w-full bg-#f7f7f7 rounded-20rpx p-10rpx flex-col justify-center">
<view class="flex-row justify-between m-15rpx">
<text class="sub-text-30">商家</text>
<text class="sub-text-30">{{ payData.name }}</text>
</view>
<hr />
<view class="flex-row justify-between m-15rpx">
<text class="sub-text-30">支付方式</text>
<text class="sub-text-30">扫一扫</text>
</view>
</view>
</view>
</view>
<view class="w-full h-half bg-#e6e6e655">
<view class="p-30rpx fixed bottom-30rpx left-0 right-0 font-bold">
<tm-button :block="true" @click="goBack">完成</tm-button>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { onShow } from "@dcloudio/uni-app"
import { router } from "@@/index"
import { usePayStore } from "@/sheep/stores/pay"
const payData = ref<{ id?: string; name?: string; customPrice?: number }>({})
onShow(() => {
if (!usePayStore().payData.id) return uni.showToast({ title: "支付信息不存在", icon: "none" })
payData.value = usePayStore().payData
})
const goBack = () => {
router.jump("/pages/tabbar/my", {}, 2)
}
</script>
+2 -25
View File
@@ -67,22 +67,6 @@
</view>
</view>
</view>
<tm-modal
v-model:show="show"
:overlayClick="false"
:showCancel="false"
title="支付成功"
confirmText="确定"
position="right"
@confirm="payConfirm"
>
<view class="w-full text-2xl text-[#333] flex justify-center">
共&nbsp;
<text class="text-3xl color-#0779FD">{{ Number(amount).toFixed(2) }}</text>
&nbsp;元
</view>
</tm-modal>
</crud-layout>
</template>
@@ -102,7 +86,6 @@ const keyboardLayout = ref([
])
const scanData = ref<{ id?: string; name?: string }>({})
const disabled = ref(false)
const show = ref(false)
onShow(() => {
scanData.value = usePayStore().payData
@@ -177,18 +160,12 @@ const pay = async () => {
if (res.code != 0) {
throw new Error()
}
show.value = true
uni.hideLoading()
usePayStore().setPayData({ ...scanData.value, customPrice: Number(amount.value).toFixed(2) })
router.jump("/pages/pay/payComplete", {}, 2)
} catch (error: any) {
uni.showToast({ title: "错误", icon: "error" })
uni.hideLoading()
}
}
// 支付确认
const payConfirm = () => {
usePayStore().payData = {}
show.value = false
router.back()
}
</script>
+1 -1
View File
@@ -1,7 +1,7 @@
import { defineStore } from "pinia"
export const usePayStore = defineStore("pay", {
state: (): { payData: { id?: string; name?: string } } => {
state: (): { payData: { id?: string; name?: string; customPrice?: number } } => {
return {
payData: {},
}