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<{
|
const props = defineProps<{
|
||||||
show: boolean;
|
show: boolean;
|
||||||
isShipment: boolean;
|
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits(["handleDialog", "changeCarNo"]);
|
const emit = defineEmits(["handleDialog", "changeCarNo"]);
|
||||||
const statePlate = reactive({
|
const statePlate = reactive({
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
:customStyle="{}"
|
:customStyle="{}"
|
||||||
border="none"
|
border="none"
|
||||||
@change="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
|
@blur="(e:any) => {handleBlur(e, item)}"
|
||||||
:disabled="item.type === 'select'"
|
:disabled="item.type === 'select'"
|
||||||
:disabledColor="
|
:disabledColor="
|
||||||
['卡号', '供应商分类'].indexOf(item.name) > -1
|
['卡号', '供应商分类'].indexOf(item.name) > -1
|
||||||
|
@ -108,6 +109,14 @@ const handleInput = (e: any, item: any) => {
|
||||||
}, 10);
|
}, 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>({
|
const model1 = reactive<any>({
|
||||||
formData: {},
|
formData: {},
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,8 +37,9 @@
|
||||||
? '#ffffff'
|
? '#ffffff'
|
||||||
: '#f5f7fa'
|
: '#f5f7fa'
|
||||||
"
|
"
|
||||||
@blur="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
@clear="handleClear(item)"
|
@clear="handleClear(item)"
|
||||||
|
@blur="(e:any) => {handleBlur(e, item)}"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<text v-if="item.key === 'subtractNum'">
|
<text v-if="item.key === 'subtractNum'">
|
||||||
|
@ -120,7 +121,6 @@
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {
|
import {
|
||||||
CustomerApi,
|
|
||||||
DeviceApi,
|
DeviceApi,
|
||||||
GoodsApi,
|
GoodsApi,
|
||||||
PictureApi,
|
PictureApi,
|
||||||
|
@ -194,14 +194,18 @@ const handleInput = (e: any, item: any) => {
|
||||||
|
|
||||||
if (item.key === "phone") {
|
if (item.key === "phone") {
|
||||||
const temp = e?.replace(valid.valid_number, "");
|
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)) {
|
if (!valid.mobile.pattern.test(model1.order.phone)) {
|
||||||
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
uni.showToast({ icon: "none", title: "请输入正确的手机号" });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
model1.order[item.key] = temp;
|
|
||||||
}, 10);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
:disabled="item.disabled || item.type === 'select'"
|
:disabled="item.disabled || item.type === 'select'"
|
||||||
:disabledColor="item.name === '出货产品' ? '#ffffff' : '#f5f7fa'"
|
:disabledColor="item.name === '出货产品' ? '#ffffff' : '#f5f7fa'"
|
||||||
@change="(e:any) => {handleInput(e, item)}"
|
@change="(e:any) => {handleInput(e, item)}"
|
||||||
|
@blur="(e:any) => {handleBlur(e, item)}"
|
||||||
@clear="handleClear(item)"
|
@clear="handleClear(item)"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
|
@ -158,6 +159,15 @@ const handleInput = (e: any, item: any) => {
|
||||||
}, 10);
|
}, 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>({
|
const model1 = reactive<any>({
|
||||||
order: {
|
order: {
|
||||||
id: 0,
|
id: 0,
|
||||||
|
|
Loading…
Reference in New Issue