feat: 下单的loading 改造

This commit is contained in:
2026-04-02 21:22:50 +08:00
parent b8b1a3885a
commit 679bea9135

View File

@@ -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;
}