Showing
1 changed file
with
28 additions
and
6 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-12-20 14:11:11 | 2 | * @Date: 2023-12-20 14:11:11 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-12-25 07:08:02 | 4 | + * @LastEditTime: 2023-12-27 11:37:35 |
| 5 | * @FilePath: /meihuaApp/src/components/payCard.vue | 5 | * @FilePath: /meihuaApp/src/components/payCard.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -21,12 +21,13 @@ | ... | @@ -21,12 +21,13 @@ |
| 21 | <script setup> | 21 | <script setup> |
| 22 | import Taro from '@tarojs/taro' | 22 | import Taro from '@tarojs/taro' |
| 23 | import { ref, watch, onMounted, onUnmounted } from 'vue' | 23 | import { ref, watch, onMounted, onUnmounted } from 'vue' |
| 24 | +import { getCurrentPageUrl } from "@/utils/weapp"; | ||
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| 26 | * 格式化时间 | 27 | * 格式化时间 |
| 27 | * @param {*} seconds | 28 | * @param {*} seconds |
| 28 | */ | 29 | */ |
| 29 | - function formatTime(seconds) { | 30 | +function formatTime(seconds) { |
| 30 | const hours = Math.floor(seconds / 3600); | 31 | const hours = Math.floor(seconds / 3600); |
| 31 | const minutes = Math.floor((seconds % 3600) / 60); | 32 | const minutes = Math.floor((seconds % 3600) / 60); |
| 32 | const remainingSeconds = seconds % 60; | 33 | const remainingSeconds = seconds % 60; |
| ... | @@ -86,6 +87,10 @@ onMounted(() => { | ... | @@ -86,6 +87,10 @@ onMounted(() => { |
| 86 | // 进入页面后,开始倒计时 | 87 | // 进入页面后,开始倒计时 |
| 87 | timeId = setInterval(() => { | 88 | timeId = setInterval(() => { |
| 88 | remain_time.value ? remain_time.value -= 1 : 0; | 89 | remain_time.value ? remain_time.value -= 1 : 0; |
| 90 | + if (remain_time.value === 0) { // 倒计时结束 | ||
| 91 | + clearInterval(timeId); | ||
| 92 | + emit('close'); | ||
| 93 | + } | ||
| 89 | }, 1000); | 94 | }, 1000); |
| 90 | }) | 95 | }) |
| 91 | 96 | ||
| ... | @@ -94,9 +99,29 @@ onUnmounted(() => { | ... | @@ -94,9 +99,29 @@ onUnmounted(() => { |
| 94 | }) | 99 | }) |
| 95 | 100 | ||
| 96 | const goToPay = () => { | 101 | const goToPay = () => { |
| 102 | + // TODO:支付成功后的操作 | ||
| 103 | + emit('close'); // 关闭支付弹框 | ||
| 104 | + // | ||
| 105 | + Taro.showToast({ | ||
| 106 | + title: '支付成功', | ||
| 107 | + icon: 'success', | ||
| 108 | + duration: 1000 | ||
| 109 | + }); | ||
| 110 | + setTimeout(() => { | ||
| 111 | + let current_page = getCurrentPageUrl(); | ||
| 112 | + if (current_page === 'pages/my/index') { // 我的页面打开 | ||
| 113 | + // 刷新当前页面 | ||
| 114 | + Taro.reLaunch({ | ||
| 115 | + url: '/pages/my/index' | ||
| 116 | + }); | ||
| 117 | + } | ||
| 118 | + if (current_page === 'pages/detail/index') { // 订房确认页打开 | ||
| 119 | + // 跳转订单成功页 | ||
| 97 | Taro.navigateTo({ | 120 | Taro.navigateTo({ |
| 98 | - url: '/pages/payInfo/index?id=123', | 121 | + url: '/pages/payInfo/index', |
| 99 | }); | 122 | }); |
| 123 | + } | ||
| 124 | + }, 1000); | ||
| 100 | // this.$parent.sdk.post('c/app/prepay', { | 125 | // this.$parent.sdk.post('c/app/prepay', { |
| 101 | // id: this.params.id | 126 | // id: this.params.id |
| 102 | // }).then(res => { | 127 | // }).then(res => { |
| ... | @@ -114,9 +139,6 @@ const goToPay = () => { | ... | @@ -114,9 +139,6 @@ const goToPay = () => { |
| 114 | // }).then(pRes => { | 139 | // }).then(pRes => { |
| 115 | // if (pRes.data.ret === 'OK') { | 140 | // if (pRes.data.ret === 'OK') { |
| 116 | // that.Toast('success', '感谢您的捐赠', 3000) | 141 | // that.Toast('success', '感谢您的捐赠', 3000) |
| 117 | - // wx.navigateBack({ | ||
| 118 | - // delta: 1 | ||
| 119 | - // }); | ||
| 120 | // } else { | 142 | // } else { |
| 121 | // that.Toast('fail', pRes.data.err, 3000); | 143 | // that.Toast('fail', pRes.data.err, 3000); |
| 122 | // } | 144 | // } | ... | ... |
-
Please register or login to post a comment