update: 所有手机号失去焦点进行校验
This commit is contained in:
parent
d324dee645
commit
a6416d85d1
|
@ -18,7 +18,6 @@ import plateInput from "@/components/uni-plate-input/uni-plate-input.vue";
|
|||
|
||||
const props = defineProps<{
|
||||
show: boolean;
|
||||
isShipment: boolean;
|
||||
}>();
|
||||
const emit = defineEmits(["handleDialog", "changeCarNo"]);
|
||||
const statePlate = reactive({
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
:customStyle="{}"
|
||||
border="none"
|
||||
@change="(e:any) => {handleInput(e, item)}"
|
||||
@blur="(e:any) => {handleBlur(e, item)}"
|
||||
:disabled="item.type === 'select'"
|
||||
:disabledColor="
|
||||
['卡号', '供应商分类'].indexOf(item.name) > -1
|
||||
|
@ -108,6 +109,14 @@ const handleInput = (e: any, item: any) => {
|
|||
}, 10);
|
||||
}
|
||||
};
|
||||
const handleBlur = (e: any, item: any) => {
|
||||
if (item.key === "phone") {
|
||||
if (!valid.mobile.pattern.test(model1.formData.phone)) {
|
||||
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
const model1 = reactive<any>({
|
||||
formData: {},
|
||||
});
|
||||
|
@ -413,7 +422,7 @@ onLoad((option: any) => {
|
|||
border-radius: 13rpx 13rpx 0rpx 0rpx;
|
||||
padding: 25rpx 50rpx;
|
||||
position: fixed;
|
||||
width: calc(100vw - 100rpx);
|
||||
width: calc(100vw - 100rpx);
|
||||
bottom: 0rpx;
|
||||
z-index: 999;
|
||||
::v-deep button {
|
||||
|
|
|
@ -37,8 +37,9 @@
|
|||
? '#ffffff'
|
||||
: '#f5f7fa'
|
||||
"
|
||||
@blur="(e:any) => {handleInput(e, item)}"
|
||||
@change="(e:any) => {handleInput(e, item)}"
|
||||
@clear="handleClear(item)"
|
||||
@blur="(e:any) => {handleBlur(e, item)}"
|
||||
>
|
||||
<template #suffix>
|
||||
<text v-if="item.key === 'subtractNum'">
|
||||
|
@ -120,7 +121,6 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
CustomerApi,
|
||||
DeviceApi,
|
||||
GoodsApi,
|
||||
PictureApi,
|
||||
|
@ -194,14 +194,18 @@ const handleInput = (e: any, item: any) => {
|
|||
|
||||
if (item.key === "phone") {
|
||||
const temp = e?.replace(valid.valid_number, "");
|
||||
setTimeout(() => {
|
||||
model1.order[item.key] = temp;
|
||||
}, 10);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBlur = (e: any, item: any) => {
|
||||
if (item.key === "phone") {
|
||||
if (!valid.mobile.pattern.test(model1.order.phone)) {
|
||||
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
model1.order[item.key] = temp;
|
||||
}, 10);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
:disabled="item.disabled || item.type === 'select'"
|
||||
:disabledColor="item.name === '出货产品' ? '#ffffff' : '#f5f7fa'"
|
||||
@change="(e:any) => {handleInput(e, item)}"
|
||||
@blur="(e:any) => {handleBlur(e, item)}"
|
||||
@clear="handleClear(item)"
|
||||
>
|
||||
<template #suffix>
|
||||
|
@ -158,6 +159,15 @@ const handleInput = (e: any, item: any) => {
|
|||
}, 10);
|
||||
}
|
||||
};
|
||||
|
||||
const handleBlur = (e: any, item: any) => {
|
||||
if (item.key === "phone") {
|
||||
if (!valid.mobile.pattern.test(model1.order.phone)) {
|
||||
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
const model1 = reactive<any>({
|
||||
order: {
|
||||
id: 0,
|
||||
|
|
Loading…
Reference in New Issue