diff --git a/src/views/ebiz/proposal/Appnt.vue b/src/views/ebiz/proposal/Appnt.vue index 261bd20cd..cd1727c68 100644 --- a/src/views/ebiz/proposal/Appnt.vue +++ b/src/views/ebiz/proposal/Appnt.vue @@ -6,7 +6,6 @@ class="border-bottom" @nameChange="nameChange" @on-choose="chooseCustomer" - v-validate="'name'" name="投保人" label="姓名" @on-click="selectClick('1')" @@ -53,7 +52,7 @@ import FieldDatePicter from '@/components/ebiz/FieldDatePicter' import SelectRadio from '@/components/ebiz/SelectRadio' import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker' import CustomerPicker from '@/components/ebiz/customer/CustomerPicker' -import { CellGroup, Field } from 'vant' +import { CellGroup, Field ,Toast } from 'vant' import { saveProposal } from '@/api/ebiz/proposal/proposal.js' import getAge from '@/assets/js/utils/age.js' import beforeDate from '@/assets/js/utils/getBeforeDate.js' @@ -311,6 +310,10 @@ export default { if(this.appntDTO.name == name){ this.appntDTO.name = '' } + let ageRule = /^[a-zA-Z\.\s\u4e00-\u9fa5]{2,120}$/ + if (this.appntDTO.name && ageRule.test(this.appntDTO.name)) { + return Toast.fail('姓名长度为2-120个字符之内,只能输入汉字或者英文') + } this.appntDTO.age = String(this.appntDTO.age) //投保人年龄校验 let minAge = getAge.getAge(utils.formatDate(new Date(this.maxDate),'yyyy-MM-dd'), new Date()) diff --git a/src/views/ebiz/proposal/InsuredPerson.vue b/src/views/ebiz/proposal/InsuredPerson.vue index 0215630a8..4980bac1f 100644 --- a/src/views/ebiz/proposal/InsuredPerson.vue +++ b/src/views/ebiz/proposal/InsuredPerson.vue @@ -10,7 +10,6 @@ @on-choose="chooseCustomer" name="被保险人" :readonly="disabled" - v-validate="'name'" label="姓名" @on-click="selectClick('1')" :parentShowPicker.sync="customerShowPicker" @@ -321,8 +320,13 @@ export default { }, //点击下一步 nextStep() { + // 建议书投保人/被保人姓名不必填, 填写姓名时展示姓名(落库),不填写姓名时展示性别+年龄,如:男30岁(不落库) + let sex = this.insured.sex == '0'?'男':'女' + let name = sex + this.insured.insuredAge+'岁' + if(this.insured.name == name){ + this.insured.name = '' + } //保存有没有社保,在保费计算用到 - //localStorage.setItem('proposalMedical', this.insured.medical == '0' ? '1' : '0') localStorage.proposalMedical = this.insured.medical == '0' ? '1' : '0' this.insured.insuredAge = String(this.insured.insuredAge) @@ -330,7 +334,11 @@ export default { let localSex = this.insured.sex let relation = this.localInfo.relationToAppnt let resultSex = checkSex(cacheSex, localSex, relation) - let resultRelation = checkRelation(relation, this.insured.insuredAge) + let resultRelation = checkRelation(relation, this.insured.insuredAge) + let ageRule = /^[a-zA-Z\.\s\u4e00-\u9fa5]{2,120}$/ + if (this.insured.name && !ageRule.test(this.insured.name)) { + return Toast.fail('姓名长度为2-120个字符之内,只能输入汉字或者英文') + } if (!resultSex) { return Toast.fail('被保险人性别有误') } @@ -365,7 +373,7 @@ export default { let locaInsured = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) let { name, sex, birthday, occupationCode, medical } = this.insured if ( - locaInsured.name == name && + // locaInsured.name == name && locaInsured.sex == sex && locaInsured.birthday == birthday && locaInsured.occupationCode == occupationCode &&