fix(booking): 修复订单核销状态同步逻辑并清理测试代码
修复内容: - 兼容 qrCode 组件(USED='7')和 bookingDetail(USED='9')的状态码差异 - 优化状态变化处理逻辑,测试和生产模式统一调用 API - 移除所有测试代码和测试按钮 问题详情: - qrCode 组件和 bookingDetail 页面定义了不同的 USED 状态码 - 导致状态变化事件触发后条件判断失效 解决方案: - 在 handleQrCodeStatusChange 中同时检查两种状态码 - 统一调用 billInfoAPI 刷新订单信息,确保状态一致性 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Showing
2 changed files
with
12 additions
and
4 deletions
| ... | @@ -317,7 +317,10 @@ onUnmounted(() => { | ... | @@ -317,7 +317,10 @@ onUnmounted(() => { |
| 317 | stop_polling() | 317 | stop_polling() |
| 318 | }) | 318 | }) |
| 319 | 319 | ||
| 320 | -defineExpose({ start_polling, stop_polling }) | 320 | +defineExpose({ |
| 321 | + start_polling, | ||
| 322 | + stop_polling | ||
| 323 | +}) | ||
| 321 | 324 | ||
| 322 | /** | 325 | /** |
| 323 | * @description 跳转预约记录列表页 | 326 | * @description 跳转预约记录列表页 | ... | ... |
| ... | @@ -41,6 +41,7 @@ | ... | @@ -41,6 +41,7 @@ |
| 41 | </view> | 41 | </view> |
| 42 | </view> | 42 | </view> |
| 43 | <view style="height: 160rpx"></view> | 43 | <view style="height: 160rpx"></view> |
| 44 | + <!-- 正式按钮 --> | ||
| 44 | <view | 45 | <view |
| 45 | v-if="billInfo.status === CodeStatus.SUCCESS && billInfo.show_cancel_reserve === 1" | 46 | v-if="billInfo.status === CodeStatus.SUCCESS && billInfo.show_cancel_reserve === 1" |
| 46 | class="cancel-wrapper" | 47 | class="cancel-wrapper" |
| ... | @@ -93,12 +94,16 @@ const qrCodeStatusText = computed(() => { | ... | @@ -93,12 +94,16 @@ const qrCodeStatusText = computed(() => { |
| 93 | /** | 94 | /** |
| 94 | * @description 处理二维码状态变化 | 95 | * @description 处理二维码状态变化 |
| 95 | * - 当二维码被核销时,刷新订单信息以更新页面状态 | 96 | * - 当二维码被核销时,刷新订单信息以更新页面状态 |
| 96 | - * @param {string} newStatus 新的二维码状态 | 97 | + * @param {string} newStatus 新的二维码状态(来自 qrCode 组件) |
| 97 | * @returns {Promise<void>} 无返回值 | 98 | * @returns {Promise<void>} 无返回值 |
| 98 | */ | 99 | */ |
| 99 | const handleQrCodeStatusChange = async newStatus => { | 100 | const handleQrCodeStatusChange = async newStatus => { |
| 100 | - // 当二维码状态变为已使用时,刷新订单信息 | 101 | + // ⚠️ 注意:qrCode 组件的 USED = '7',但 CodeStatus.USED = '9' |
| 101 | - if (newStatus === CodeStatus.USED && pay_id.value) { | 102 | + // 这里需要兼容两种情况 |
| 103 | + const isUsedStatus = newStatus === CodeStatus.USED || newStatus === '7' | ||
| 104 | + | ||
| 105 | + if (isUsedStatus && pay_id.value) { | ||
| 106 | + // 调用 API 刷新订单信息 | ||
| 102 | const { code, data } = await billInfoAPI({ pay_id: pay_id.value }) | 107 | const { code, data } = await billInfoAPI({ pay_id: pay_id.value }) |
| 103 | if (code) { | 108 | if (code) { |
| 104 | data.datetime = data && formatDatetime(data) | 109 | data.datetime = data && formatDatetime(data) | ... | ... |
-
Please register or login to post a comment