Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
meihua-island-book
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-12-27 11:39:22 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c3692bd45963efcacc1f6bb23c53623335b4ce72
c3692bd4
1 parent
bdc74f4c
支付组件逻辑优化调整
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
src/components/payCard.vue
src/components/payCard.vue
View file @
c3692bd
<!--
* @Date: 2023-12-20 14:11:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-2
5 07:08:02
* @LastEditTime: 2023-12-2
7 11:37:35
* @FilePath: /meihuaApp/src/components/payCard.vue
* @Description: 文件描述
-->
...
...
@@ -21,12 +21,13 @@
<script setup>
import Taro from '@tarojs/taro'
import { ref, watch, onMounted, onUnmounted } from 'vue'
import { getCurrentPageUrl } from "@/utils/weapp";
/**
* 格式化时间
* @param {*} seconds
*/
function formatTime(seconds) {
function formatTime(seconds) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainingSeconds = seconds % 60;
...
...
@@ -86,6 +87,10 @@ onMounted(() => {
// 进入页面后,开始倒计时
timeId = setInterval(() => {
remain_time.value ? remain_time.value -= 1 : 0;
if (remain_time.value === 0) { // 倒计时结束
clearInterval(timeId);
emit('close');
}
}, 1000);
})
...
...
@@ -94,9 +99,29 @@ onUnmounted(() => {
})
const goToPay = () => {
Taro.navigateTo({
url: '/pages/payInfo/index?id=123',
// TODO:支付成功后的操作
emit('close'); // 关闭支付弹框
//
Taro.showToast({
title: '支付成功',
icon: 'success',
duration: 1000
});
setTimeout(() => {
let current_page = getCurrentPageUrl();
if (current_page === 'pages/my/index') { // 我的页面打开
// 刷新当前页面
Taro.reLaunch({
url: '/pages/my/index'
});
}
if (current_page === 'pages/detail/index') { // 订房确认页打开
// 跳转订单成功页
Taro.navigateTo({
url: '/pages/payInfo/index',
});
}
}, 1000);
// this.$parent.sdk.post('c/app/prepay', {
// id: this.params.id
// }).then(res => {
...
...
@@ -114,9 +139,6 @@ const goToPay = () => {
// }).then(pRes => {
// if (pRes.data.ret === 'OK') {
// that.Toast('success', '感谢您的捐赠', 3000)
// wx.navigateBack({
// delta: 1
// });
// } else {
// that.Toast('fail', pRes.data.err, 3000);
// }
...
...
Please
register
or
login
to post a comment