feat: 下单校验

This commit is contained in:
2026-03-26 16:01:30 +08:00
parent 1e01028ba8
commit d7d50e1210
2 changed files with 19 additions and 20 deletions

View File

@@ -20,19 +20,20 @@
<!-- 联系方式 -->
<view class="bg-white rounded-12 overflow-hidden">
<view
class="border-box border-bottom font-size-16 font-500 color-000 line-height-24 p-12"
>联系方式</view
>
<view class="border-box border-bottom font-size-16 font-500 color-000 line-height-24 p-12">联系方式</view>
<view class="flex flex-items-center border-box p-12">
<view class="font-size-14 font-500 color-525866 mr-12"> 联系手机 </view>
<view class="font-size-14 font-500 color-525866 mr-12"> 联系人姓名 </view>
<view class="right">
<input
class="border-box px-4 py-2 font-size-15 color-000 line-height-20"
v-model.trim="userFormList[0].contactPhone"
placeholder="请输入联系手机"
maxlength="11"
/>
<input class="border-box px-4 py-2 font-size-15 color-000 line-height-20"
v-model.trim="userFormList[0].visitorName" placeholder="请输入联系人" maxlength="20" />
</view>
</view>
<view class="flex flex-items-center border-box p-12">
<view class="font-size-14 font-500 color-525866 mr-12"> 手机号码 </view>
<view class="right">
<input class="border-box px-4 py-2 font-size-15 color-000 line-height-20"
v-model.trim="userFormList[0].contactPhone" placeholder="请输入联系手机" maxlength="11" />
</view>
</view>
</view>
@@ -50,7 +51,7 @@ const props = defineProps({
},
userFormList: {
type: Array,
default: () => [{ contactPhone: "" }],
default: () => [{ visitorName: "", contactPhone: "" }],
},
reservationDate: {
type: String,

View File

@@ -197,7 +197,7 @@ const validateUserForms = () => {
});
if (invalidUsers.length) {
uni.showToast({ title: "请填写住客姓名", icon: "none" });
uni.showToast({ title: "请填写姓名", icon: "none" });
return false;
}
@@ -211,14 +211,12 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
try {
console.log("处理支付点击事件", userFormList.value);
// 判断是酒店类型
if (goodsData.commodityTypeCode === "0") {
// 校验用户姓名
if (!validateUserForms()) {
uni.hideLoading();
return;
}
// 校验用户姓名
if (!validateUserForms()) {
uni.hideLoading();
return;
}
// 校验手机号
if (!PhoneUtils.validatePhone(userFormList.value[0].contactPhone)) {
uni.hideLoading();