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