From 35326d0bb7ae6145a1ca6fc25dda98ded4750f37 Mon Sep 17 00:00:00 2001 From: lyt Date: Thu, 27 Apr 2023 14:50:37 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=BB=BA=E8=AE=AE=E4=B9=A6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=9C=80=E6=B1=82=E3=80=91=E6=8A=95=E8=A2=AB=E4=BF=9D?= =?UTF-8?q?=E4=BA=BA=E5=A7=93=E5=90=8D=E6=B2=A1=E6=9C=89=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/proposal/Appnt.vue | 7 +++++-- src/views/ebiz/proposal/InsuredPerson.vue | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) 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 &&