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 @@