保单号校验
Showing
2 changed files
with
6 additions
and
2 deletions
| ... | @@ -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 | } | ... | ... |
| ... | @@ -269,4 +269,8 @@ export function contactMethodCheck(type, value) { | ... | @@ -269,4 +269,8 @@ export function contactMethodCheck(type, value) { |
| 269 | return /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(value); | 269 | return /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(value); |
| 270 | } | 270 | } |
| 271 | return true; | 271 | return true; |
| 272 | } | ||
| 273 | |||
| 274 | export function policyNumberCheck(policyNumber) { | ||
| 275 | return /^P(0001|0002)\d{11}$/.test(policyNumber); | ||
| 272 | } | 276 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment