diff --git a/src/pages-booking/index.vue b/src/pages-booking/index.vue index 77edaf0..896fd20 100644 --- a/src/pages-booking/index.vue +++ b/src/pages-booking/index.vue @@ -206,20 +206,16 @@ const validateUserForms = () => { // 处理支付点击事件 const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { - // 点击后立即展示 loading - uni.showLoading({ title: "正在提交订单..." }); - + try { console.log("处理支付点击事件", userFormList.value); // 校验用户姓名 if (!validateUserForms()) { - uni.hideLoading(); return; } // 校验手机号 if (!PhoneUtils.validatePhone(userFormList.value[0].contactPhone)) { - uni.hideLoading(); uni.showToast({ title: "请输入正确的手机号", icon: "none" }); return; } @@ -257,12 +253,14 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { params.checkOutData = endDate; } + // 点击后立即展示 loading + uni.showLoading({ title: "正在提交订单..." }); const res = await orderPay(params); console.log("确认订单---2:", res); + uni.hideLoading(); // 检查接口返回数据 if (!res || !res.data) { - uni.hideLoading(); uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" }); return; }