diff --git a/src/pages-booking/index.vue b/src/pages-booking/index.vue index ba98143..09d98d1 100644 --- a/src/pages-booking/index.vue +++ b/src/pages-booking/index.vue @@ -224,13 +224,6 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { return; } - // 校验预约日期 - if (!selectedReservationDate.value) { - uni.hideLoading(); - uni.showToast({ title: "请选择预约日期", icon: "none" }); - return; - } - // 购买的商品id const commodityId = goodsData.commodityId; // 消费者信息 @@ -241,17 +234,20 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { const payWay = "0"; // 支付渠道 0-app 1-小程序 2-h5 const paySource = "1"; - const reservationDate = selectedReservationDate.value; // 预约日期,酒店类型可能不需要,根据实际情况调整 const params = { commodityId, purchaseAmount, payWay, paySource, - consumerInfoEntityList, - reservationDate + consumerInfoEntityList }; + // 预约日期,酒店类型不需要 + if (orderData.value.orderType !== 0) { + params.reservationDate = selectedReservationDate.value; + } + //酒店类型添加入住时间、离店时间 if (goodsData.orderType === 0 && selectedDate.value) { const { startDate, endDate } = selectedDate.value; @@ -267,7 +263,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { // 检查接口返回数据 if (!res || !res.data) { uni.hideLoading(); - uni.showToast({ title: "订单创建失败,请重试", icon: "none" }); + uni.showToast({ title: res.msg || "订单创建失败,请重试", icon: "none" }); return; } @@ -303,7 +299,8 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => { }, }); }, - fail: () => { + fail: (e) => { + console.error("支付失败:", e); uni.showToast({ title: "支付失败,请重试", icon: "none" }); }, });