hookehuyr

新增支付等待页

1 /* 1 /*
2 * @Date: 2023-06-13 13:26:46 2 * @Date: 2023-06-13 13:26:46
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-16 16:07:48 4 + * @LastEditTime: 2024-01-19 21:59:56
5 * @FilePath: /xysBooking/src/route.js 5 * @FilePath: /xysBooking/src/route.js
6 * @Description: 路由列表 6 * @Description: 路由列表
7 */ 7 */
...@@ -77,6 +77,13 @@ export default [ ...@@ -77,6 +77,13 @@ export default [
77 }, 77 },
78 }, 78 },
79 { 79 {
80 + path: '/waiting',
81 + component: () => import('@/views/waiting.vue'),
82 + meta: {
83 + title: '支付中',
84 + },
85 + },
86 + {
80 path: '/auth', 87 path: '/auth',
81 component: () => import('@/views/auth.vue'), 88 component: () => import('@/views/auth.vue'),
82 meta: { 89 meta: {
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-28 10:17:40 3 * @Date: 2022-05-28 10:17:40
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2024-01-17 15:14:04 5 + * @LastEditTime: 2024-01-20 08:05:56
6 * @FilePath: /xysBooking/src/utils/axios.js 6 * @FilePath: /xysBooking/src/utils/axios.js
7 * @Description: 7 * @Description:
8 */ 8 */
9 import axios from 'axios'; 9 import axios from 'axios';
10 import router from '@/router'; 10 import router from '@/router';
11 -import qs from 'Qs' 11 +// import qs from 'Qs'
12 -import { strExist } from '@/utils/tools' 12 +// import { strExist } from '@/utils/tools'
13 // import { parseQueryString } from '@/utils/tools' 13 // import { parseQueryString } from '@/utils/tools'
14 14
15 axios.defaults.params = { 15 axios.defaults.params = {
......
1 <!-- 1 <!--
2 * @Date: 2024-01-16 13:19:23 2 * @Date: 2024-01-16 13:19:23
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-19 19:25:47 4 + * @LastEditTime: 2024-01-19 21:53:06
5 * @FilePath: /xysBooking/src/views/bookingDetail.vue 5 * @FilePath: /xysBooking/src/views/bookingDetail.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
31 </div> 31 </div>
32 </div> 32 </div>
33 <div style="height: 5rem;"></div> 33 <div style="height: 5rem;"></div>
34 - <div v-if="status === '预约成功'" class="cancel-wrapper"> 34 + <div v-if="billInfo.status === '3'" class="cancel-wrapper">
35 <div @click="cancelBooking" class="cancel-btn ">取消预约</div> 35 <div @click="cancelBooking" class="cancel-btn ">取消预约</div>
36 </div> 36 </div>
37 </div> 37 </div>
......
1 <!-- 1 <!--
2 * @Date: 2024-01-16 11:37:10 2 * @Date: 2024-01-16 11:37:10
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-19 19:04:27 4 + * @LastEditTime: 2024-01-19 21:55:03
5 * @FilePath: /xysBooking/src/views/bookingList.vue 5 * @FilePath: /xysBooking/src/views/bookingList.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -85,7 +85,7 @@ const formatStatus = (status) => { ...@@ -85,7 +85,7 @@ const formatStatus = (status) => {
85 } 85 }
86 case '11': 86 case '11':
87 return { 87 return {
88 - key: 'used', 88 + key: 'cancel',
89 value: '退款中' 89 value: '退款中'
90 } 90 }
91 } 91 }
......
1 +<!--
2 + * @Date: 2024-01-19 21:57:50
3 + * @LastEditors: hookehuyr hookehuyr@gmail.com
4 + * @LastEditTime: 2024-01-20 07:01:38
5 + * @FilePath: /xysBooking/src/views/waiting.vue
6 + * @Description: 文件描述
7 +-->
8 +<template>
9 + <div class="waiting-page">
10 + <div class="waiting-content">
11 + <div>
12 + <van-icon name="clock-o" size="2.5rem" color="#A67939" />
13 + </div>
14 + <div style="margin: 1rem 0;">支付中...</div>
15 + <div>{{ current.seconds }} s</div>
16 + <div style="margin: 1.5rem 0; font-size: 0.85rem; color: #A67939; text-align: center; line-height: 2;">
17 + 温馨提示:支付可能需要10s左右,请耐心等待<br />
18 + </div>
19 + </div>
20 + <div class="go-back-wrapper">
21 + <div @click="goBackBtn" class="button" style="background-color: #A67939;">返回首页</div>
22 + </div>
23 + </div>
24 +</template>
25 +
26 +<script setup>
27 +import { ref } from 'vue'
28 +import { useRoute, useRouter } from 'vue-router'
29 +import { useCountDown } from '@vant/use';
30 +import { Cookies, $, _, axios, storeToRefs, mainStore, Toast, useTitle } from '@/utils/generatePackage.js'
31 +//import { } from '@/utils/generateModules.js'
32 +//import { } from '@/utils/generateIcons.js'
33 +//import { } from '@/composables'
34 +import { showSuccessToast, showFailToast, showToast } from 'vant';
35 +import { useGo } from '@/hooks/useGo'
36 +const $route = useRoute();
37 +const $router = useRouter();
38 +useTitle($route.meta.title);
39 +
40 +const go = useGo();
41 +
42 +const countDown = useCountDown({
43 + time: 10 * 1000,
44 +});
45 +
46 +// 开始倒计时
47 +countDown.start();
48 +
49 +const current = countDown.current;
50 +
51 +onMounted(() => {
52 + const timer = setInterval(() => {
53 + if (!current.value.seconds) {
54 + clearInterval(timer);
55 + }
56 + // TODO:轮询支付回调
57 + if (current.value.seconds === 3) {
58 + console.warn('支付成功');
59 + // 预约成功页面
60 + // go('/success', { pay_id: 'test' });
61 + }
62 + }, 1000);
63 + onUnmounted(() => {
64 + clearInterval(timer);
65 + })
66 +});
67 +
68 +const goBackBtn = () => {
69 + go('/');
70 +}
71 +</script>
72 +
73 +<style lang="less" scoped>
74 +.waiting-page {
75 + .waiting-content {
76 + display: flex;
77 + // justify-content: center;
78 + align-items: center;
79 + flex-direction: column;
80 + margin-top: 10vh;
81 + background-color: #FFF;
82 + margin: 1rem;
83 + border-radius: 8px;
84 + padding: 3rem 0;
85 + height: 40vh;
86 + }
87 + .go-back-wrapper {
88 + position: fixed;
89 + bottom: 0;
90 + height: 5rem;
91 + width: 100vw;
92 + display: flex;
93 + left: 0;
94 + background-color: #FFF;
95 + align-items: center;
96 + justify-content: center;
97 + box-shadow: 0rem -0.33rem 0.25rem 0rem rgba(0,0,0,0.12);
98 + .button {
99 + color: #FFF;
100 + padding: 0.85rem 0;
101 + border-radius: 8px;
102 + font-size: 1.1rem;
103 + text-align: center;
104 + flex-grow: 1;
105 + margin: 1rem;
106 + }
107 + }
108 +}
109 +</style>