diff --git a/pages/shop/pay.vue b/pages/shop/pay.vue index ae0f6af..53643d8 100644 --- a/pages/shop/pay.vue +++ b/pages/shop/pay.vue @@ -129,6 +129,12 @@ title: '支付失败', icon: 'error' }) + // 延迟跳转到首页 + setTimeout(() => { + uni.reLaunch({ + url: '/pages/main/order', + }) + }, 1500) // 1.5秒后跳转 console.error(res.data.msg) } }) @@ -142,23 +148,33 @@ signType: payMsg.signType, paySign: payMsg.paySign, success: (res) => { - if (res.status === 1) { - uni.showToast({ - title: '支付成功', - icon: 'success' + uni.showToast({ + title: '支付成功', + icon: 'success' + }) + + // 延迟跳转到首页 + setTimeout(() => { + uni.reLaunch({ + url: '/pages/main/order', }) - } + }, 1500) // 1.5秒后跳转 }, fail: (err) => { + console.error('支付失败:', err) uni.showToast({ title: '支付失败', icon: 'error' }) - console.error(err) + // 延迟跳转到首页 + setTimeout(() => { + uni.reLaunch({ + url: '/pages/main/order', + }) + }, 1500) // 1.5秒后跳转 } }) - }, - + } }, destroyed() {