feat(pay): 支付成功后自动跳转到已购产品页面

- 支付成功后显示成功提示
- 延迟1.5秒自动跳转到已购产品页面
- 处理跳转失败时回退到用户首页
- 优化用户支付完成后的使用体验
This commit is contained in:
2026-07-02 22:40:08 +08:00
parent 1d5bb5b9b1
commit 511e4b8ff3
2 changed files with 109 additions and 0 deletions

View File

@@ -229,6 +229,14 @@ const PayPage: React.FC = () => {
setPaid(true)
Taro.showToast({ title: '支付成功', icon: 'success' })
// 8. 延迟自动跳转到已购产品页面
setTimeout(() => {
Taro.navigateTo({ url: '/user/apps/index' }).catch(() => {
// 如果 navigateTo 失败(比如在 tab 页),回退到用户页
Taro.switchTab({ url: '/pages/user/user' })
})
}, 1500)
} catch (err: any) {
console.error('[PayPage] 支付失败:', err)
console.error('[PayPage] err.name:', err?.name, 'err.type:', err?.type)