fe6170b4 by joe

保单号校验

1 parent 8384bac0
...@@ -4,7 +4,7 @@ import { ...@@ -4,7 +4,7 @@ import {
4 httpPost 4 httpPost
5 } from '@/api/fetch-api.js' 5 } from '@/api/fetch-api.js'
6 6
7 import { contactMethodCheck } from '@utils/utils.js'; 7 import { contactMethodCheck, policyNumberCheck } from '@utils/utils.js';
8 8
9 import Auth from '@components/auth/auth.vue'; 9 import Auth from '@components/auth/auth.vue';
10 import modalComp from '@/components/modal-comp/modal-comp.vue'; 10 import modalComp from '@/components/modal-comp/modal-comp.vue';
...@@ -164,7 +164,7 @@ export default { ...@@ -164,7 +164,7 @@ export default {
164 }, 164 },
165 checkPolicyNumber() { 165 checkPolicyNumber() {
166 this.data.policyNumber = this.data.policyNumber ? this.data.policyNumber.replace(/\s*/g, "") : ""; 166 this.data.policyNumber = this.data.policyNumber ? this.data.policyNumber.replace(/\s*/g, "") : "";
167 if (this.data.policyNumber && this.data.policyNumber.length != 16) { 167 if (this.data.policyNumber && !policyNumberCheck(this.data.policyNumber)) {
168 this.errorTips.policyNumberErr = this.i18n.complaintAcceptance.errorTips.e3; 168 this.errorTips.policyNumberErr = this.i18n.complaintAcceptance.errorTips.e3;
169 return false; 169 return false;
170 } 170 }
......
...@@ -270,3 +270,7 @@ export function contactMethodCheck(type, value) { ...@@ -270,3 +270,7 @@ export function contactMethodCheck(type, value) {
270 } 270 }
271 return true; 271 return true;
272 } 272 }
273
274 export function policyNumberCheck(policyNumber) {
275 return /^P(0001|0002)\d{11}$/.test(policyNumber);
276 }
...\ No newline at end of file ...\ No newline at end of file
......