feat(payment): 添加支付结果页面和外部支付页面

- 新增 payment-result 和 external 页面组件
- 更新 AppHeader 组件,添加支付结果相关路由
- 在 auth store 中添加 checkoutSessionUrl 属性
- 优化支付结果页面布局,增加回到首页按钮
This commit is contained in:
xingyy 2025-02-18 14:10:19 +08:00
parent 2919400d7f
commit bfb50546b8
6 changed files with 31 additions and 4 deletions

View File

@ -31,7 +31,7 @@ const subTitle = computed(() => {
return route.meta.subTitle ? t(route.meta.subTitle) : '' return route.meta.subTitle ? t(route.meta.subTitle) : ''
}) })
const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name)) const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name))
console.log('route.name',route.name)
</script> </script>
<template> <template>

View File

@ -1,3 +1,3 @@
export const useAppFooterRouteNames= ['index', 'profile'] export const useAppFooterRouteNames= ['index', 'profile']
export const useAppHeaderRouteNames= ['index', 'profile','login','collectCode-login','collectCode-mine'] export const useAppHeaderRouteNames= ['index', 'profile','login','collectCode-login','collectCode-mine','payment-result']

15
app/pages/payment/external/index.vue vendored Normal file
View File

@ -0,0 +1,15 @@
<script setup>
</script>
<template>
<div>
<iframe>
</iframe>
</div>
</template>
<style scoped>
</style>

View File

@ -3,7 +3,8 @@ import {liveStore} from "~/stores/live/index.js";
import {createBuyOrder} from "~/api/goods/index.js"; import {createBuyOrder} from "~/api/goods/index.js";
import {goodStore} from "~/stores/goods/index.js"; import {goodStore} from "~/stores/goods/index.js";
import { showLoadingToast ,closeToast} from 'vant'; import { showLoadingToast ,closeToast} from 'vant';
import {authStore} from "~/stores/auth/index.js";
const {checkoutSessionUrl}= authStore()
const payStatus=ref(0) const payStatus=ref(0)
const changePayStatus=()=>{ const changePayStatus=()=>{
payStatus.value=payStatus.value===0?1:0 payStatus.value=payStatus.value===0?1:0

View File

@ -3,6 +3,7 @@ import {orderQuery} from "~/api/goods/index.js";
definePageMeta({ definePageMeta({
i18n: 'payment.text1', i18n: 'payment.text1',
}) })
const router = useRouter()
const {t}=useI18n(); const {t}=useI18n();
const route = useRoute(); const route = useRoute();
const resData=ref({}) const resData=ref({})
@ -18,15 +19,23 @@ const statusLabel={
3:t('payment.text4'), 3:t('payment.text4'),
4:t('payment.text5'), 4:t('payment.text5'),
} }
const goHome=()=>{
router.push('/')
}
</script> </script>
<template> <template>
<div class="w-[100vw] bg-[url('@/static/images/3532@2x.png')] bg-cover pt-43px flex-grow-1 flex flex-col"> <div class="w-[100vw] h-screen-nav bg-[url('@/static/images/3532@2x.png')] bg-cover grow-1 flex flex-col items-center px-30px">
<div class="flex flex-col items-center mt-150px"> <div class="flex flex-col items-center mt-150px">
<img class="w-119px h-120px mb-36px" src="@/static/images/5554@2x1.png" alt=""> <img class="w-119px h-120px mb-36px" src="@/static/images/5554@2x1.png" alt="">
<div class="text-#000 text-16px mb-25px">{{statusLabel[resData.status]}}!</div> <div class="text-#000 text-16px mb-25px">{{statusLabel[resData.status]}}!</div>
<div class="text-#999 text-16px">{{resData.currency}}{{resData.money}}</div> <div class="text-#999 text-16px">{{resData.currency}}{{resData.money}}</div>
</div> </div>
<div class="w-full mt-auto mb-40px">
<van-button type="primary" block @click="goHome">
回到首页
</van-button>
</div>
</div> </div>
</template> </template>

View File

@ -4,7 +4,9 @@ export const authStore = createGlobalState(() => {
const RefreshToken=useLocalStorage('RefreshToken','') const RefreshToken=useLocalStorage('RefreshToken','')
const userInfo=useLocalStorage('userInfo',{}) const userInfo=useLocalStorage('userInfo',{})
const fingerprint=useLocalStorage('fingerprint','') const fingerprint=useLocalStorage('fingerprint','')
const checkoutSessionUrl=useLocalStorage('checkoutSessionUrl','')
return{ return{
checkoutSessionUrl,
userInfo, userInfo,
RefreshToken, RefreshToken,
token, token,