From e3cca4c51c7fa642ec2a09280f8325a896a7ee49 Mon Sep 17 00:00:00 2001 From: speakeloudest Date: Tue, 6 Jan 2026 19:52:48 -0800 Subject: [PATCH] bugfix --- index.html | 4 +- .../user-center/OrderStatusDialog.vue | 48 +++++++++++-------- src/pages/Home/index.vue | 4 +- src/pages/UserCenter/index.vue | 11 ++++- src/utils/request/index.ts | 2 +- 5 files changed, 41 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 010c8e6..2a28e5f 100644 --- a/index.html +++ b/index.html @@ -12,9 +12,7 @@ - - - + diff --git a/src/components/user-center/OrderStatusDialog.vue b/src/components/user-center/OrderStatusDialog.vue index 0033235..f5518fe 100644 --- a/src/components/user-center/OrderStatusDialog.vue +++ b/src/components/user-center/OrderStatusDialog.vue @@ -54,43 +54,50 @@ const countdown = ref('') let timer: any = null let countdownTimer: any = null let createdAt: Date | null = null - +/* +* static const int kr_statusPending = 1; // 待支付 + static const int kr_statusPaid = 2; // 已支付 + static const int kr_statusClose = 3; // 已关闭 + static const int kr_statusFailed = 4; // 支付失败 + static const int kr_statusFinished = 5; // 已完成 +* +* */ const statusInfo = computed(() => { switch (status.value) { case -1: return { title: '检查失败', - description: '检查支付状态失败,请稍后刷新页面或联系客服', + description: '获取支付状态失败,请稍后刷新页面', } - case 1: + case 1: // kr_statusPending return { title: '待支付', description: `订单正在处理中\n剩余时间: ${countdown.value}`, } - case 2: + case 2: // kr_statusPaid return { title: '支付确认中', description: '订单已支付,系统正在确认,请稍候...', } - case 3: - return { - title: '支付成功', - description: '您的订单已支付完成', - } - case 4: + case 3: // kr_statusClose return { title: '订单已关闭', description: '该订单已超时或被手动关闭', } - case 5: + case 4: // kr_statusFailed return { title: '支付失败', description: '订单支付失败,请检查支付信息并重试', } + case 5: // kr_statusFinished + return { + title: '支付成功', + description: '您的订单已支付完成,感谢您的支持', + } default: return { - title: '待支付', - description: `订单正在处理中\n剩余时间: ${countdown.value}`, + title: '订单处理中', + description: '请稍候...', } } }) @@ -116,15 +123,16 @@ async function checkStatus() { status.value = res.status - // 2. 根据状态处理业务逻辑 - if (status.value === 3) { - // Finished - stopPolling() - emit('refresh') - } else if (status.value === 4 || status.value === 5) { - // Closed or Failed + // --- 核心逻辑修改点 --- + if (status.value === 5) { + // 5: 已完成 (kr_statusFinished) stopPolling() + emit('refresh') // 只有真正完成后才刷新父组件数据 + } else if (status.value === 3 || status.value === 4) { + // 3: 已关闭 (kr_statusClose), 4: 支付失败 (kr_statusFailed) + stopPolling() // 终止态,不再查询 } + // 状态 1 和 2 继续保持定时器轮询 } catch (error) { console.error('❌ 查询失败:', error) status.value = -1 diff --git a/src/pages/Home/index.vue b/src/pages/Home/index.vue index 782f775..6aa5600 100644 --- a/src/pages/Home/index.vue +++ b/src/pages/Home/index.vue @@ -100,8 +100,8 @@
Hi快VPN™ © All rights reserved.
- Terms of Service - Privacy Policy + Terms of Service + Privacy Policy
diff --git a/src/pages/UserCenter/index.vue b/src/pages/UserCenter/index.vue index a87c6a5..64ffc36 100644 --- a/src/pages/UserCenter/index.vue +++ b/src/pages/UserCenter/index.vue @@ -230,7 +230,10 @@ async function init() { .get('/api/v1/public/payment/methods') .then((res: any) => { payments.value = - res.list?.filter((p: any) => p.platform !== 'apple_iap' && p.platform !== 'Stripe') || [] + res.list?.filter( + (p: any) => + p.platform !== 'apple_iap' && p.platform !== 'Stripe' && p.platform !== 'balance', + ) || [] }) .finally(() => { isPaymentsLoading.value = false @@ -241,7 +244,11 @@ onMounted(() => { init() const orderNo = (route.query.order_no as string) || localStorage.getItem('pending_order_no') if (orderNo) { - orderStatusDialogRef.value?.show(orderNo) + request.get('/api/v1/public/order/detail', { order_no: orderNo }).then((data) => { + if (data.status === 1 || data.status === 5 || data.status === 2) { + orderStatusDialogRef.value?.show(orderNo) + } + }) } }) diff --git a/src/utils/request/index.ts b/src/utils/request/index.ts index ca5666d..eafe3c5 100644 --- a/src/utils/request/index.ts +++ b/src/utils/request/index.ts @@ -1,6 +1,6 @@ import Request from './core' export * from './core' -const baseUrl = import.meta.env.VITE_APP_BASE_URL || '/' +const baseUrl = import.meta.env.VITE_APP_BASE_URL const request = new Request({ baseURL: baseUrl,