From 9c324fbff3bdc52c26967373b2997a7c41f5a7f9 Mon Sep 17 00:00:00 2001 From: zhoulinf <2507241354@qq.com> Date: Tue, 23 Jun 2026 16:44:37 +0800 Subject: [PATCH] =?UTF-8?q?CRM=5F26-06-30#story#8858,=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E2=80=9C=E6=88=91=E7=9A=84=E8=BD=A6=E8=BE=86=E2=80=9D=E4=B8=AD?= =?UTF-8?q?=E8=A1=8C=E9=A9=B6=E8=AF=81=E4=B8=BB=E9=A1=B5=E7=85=A7=E7=89=87?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E5=87=BA=E7=9A=84=E2=80=9C=E8=BD=A6=E7=89=8C?= =?UTF-8?q?=E5=8F=B7=E2=80=9D=E5=92=8C=E2=80=9C=E8=BD=A6=E6=9E=B6=E5=8F=B7?= =?UTF-8?q?=E2=80=9D=E7=9A=84=E6=A0=A1=E9=AA=8C=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/index/vehicleAdd.vue | 47 +++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/views/index/vehicleAdd.vue b/src/views/index/vehicleAdd.vue index 1ae58ac1..637ce1b8 100644 --- a/src/views/index/vehicleAdd.vue +++ b/src/views/index/vehicleAdd.vue @@ -875,7 +875,7 @@ export default { this.vehicleLicenseInfo.address = frontInfo?.address; this.vehicleLicenseInfo.useNature = frontInfo?.useCharacter; this.vehicleLicenseInfo.model = frontInfo?.model; - this.vehicleLicenseInfo.vinCode = frontInfo?.vin; + this.vehicleLicenseInfo.vinCode = String(frontInfo?.vin || '').toUpperCase().replace(/O/g, '0'); this.vehicleLicenseInfo.engineNumber = frontInfo?.engineNo; this.vehicleLicenseInfo.registrationDate = frontInfo?.registerDate; this.vehicleLicenseInfo.issueDate = frontInfo?.issueDate; @@ -1232,7 +1232,52 @@ export default { }*/ }, + validatePlateNumber(value) { + if (!value) { + return { valid: false, message: '请输入车牌号' } + } + const provinceList = ['京','津','冀','晋','蒙','辽','吉','黑','沪','苏','浙','皖','闽','赣','鲁','豫','鄂','湘','粤','桂','琼','渝','川','贵','云','藏','陕','甘','青','宁','新'] + const firstChar = value.charAt(0) + if (!provinceList.includes(firstChar)) { + return { valid: false, message: '车牌号首位必须是省级简称(京/沪/津/渝/冀/晋/辽/吉/黑/苏/浙/皖/闽/赣/鲁/豫/鄂/湘/粤/琼/川/贵/云/陕/甘/青/蒙/桂/藏/宁/新)' } + } + if (!/^[\u4e00-\u9fa5][A-Z0-9]+$/.test(value)) { + return { valid: false, message: '车牌号只能包含汉字、字母和数字' } + } + if (![7, 8].includes(value.length)) { + return { valid: false, message: `车牌号必须为 7 位或 8 位(当前 ${value.length} 位)` } + } + return { valid: true, message: '' } + }, + validateVinNo(value) { + const normalizedValue = String(value || '').toUpperCase() + if (!normalizedValue) { + return { valid: false, message: '车架号识别错误,请重新拍照上传。' } + } + if (!/^[A-NP-Z0-9]{17}$/.test(normalizedValue)) { + if (normalizedValue.includes('O')) { + return { valid: false, message: '车架号识别错误,请重新拍照上传。' } + } + if (!/^[A-NP-Z0-9]+$/.test(normalizedValue)) { + return { valid: false, message: '车架号识别错误,请重新拍照上传。' } + } + return { valid: false, message: `车架号识别错误,请重新拍照上传。` } + } + return { valid: true, message: '' } + }, async submitBtn(){ + const plateResult = this.validatePlateNumber(this.carNum) + if (!plateResult.valid) { + Dialog.alert({ message: plateResult.message }) + return + } + const vinCode = String(this.vehicleLicenseInfo.vinCode || '') + const vinResult = this.validateVinNo(vinCode) + if (!vinResult.valid) { + Dialog.alert({ message: vinResult.message }) + return + } + this.vehicleLicenseInfo.vinCode = vinCode if( !this.vehicleLicenseFront ) { this.$toast('行驶证主页照片不能为空') return