feat: 支付判断有问题 修复

This commit is contained in:
2026-03-30 22:10:26 +08:00
parent bf57fe6ca4
commit c9683398de

View File

@@ -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" });
},
});