hookehuyr

fix: 处理免费订单直接跳转成功页而非支付页

1 <!-- 1 <!--
2 * @Date: 2024-01-15 16:25:51 2 * @Date: 2024-01-15 16:25:51
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-01-22 11:21:08 4 + * @LastEditTime: 2026-01-22 12:18:08
5 * @FilePath: /git/xysBooking/src/views/submit.vue 5 * @FilePath: /git/xysBooking/src/views/submit.vue
6 * @Description: 预约人员信息 6 * @Description: 预约人员信息
7 --> 7 -->
...@@ -128,7 +128,16 @@ const submitBtn = async () => { ...@@ -128,7 +128,16 @@ const submitBtn = async () => {
128 // TAG: 提交订单跳转到支付页面 128 // TAG: 提交订单跳转到支付页面
129 const { code, data } = await addReserveAPI({ reserve_date: date, begin_time: time.split('-')[0], end_time: time.split('-')[1], person_id_list: JSON.stringify(checked_visitors.value), period_type }); 129 const { code, data } = await addReserveAPI({ reserve_date: date, begin_time: time.split('-')[0], end_time: time.split('-')[1], person_id_list: JSON.stringify(checked_visitors.value), period_type });
130 if (code) { 130 if (code) {
131 - const pay_url = `/srv/?f=reserve&a=icbc_pay&pay_id=${data.pay_id}`; 131 + const pay_id = data?.pay_id
132 + const need_pay = data?.need_pay
133 +
134 + const is_free_order = Number(total.value) <= 0 || Number(need_pay) === 0 || need_pay === false
135 + if (is_free_order) {
136 + go('/success', { pay_id })
137 + return
138 + }
139 +
140 + const pay_url = `/srv/?f=reserve&a=icbc_pay&pay_id=${pay_id}`;
132 location.href = pay_url; // 跳转支付页面 141 location.href = pay_url; // 跳转支付页面
133 } 142 }
134 } 143 }
......