【建议书优化需求】投被保人姓名没有格式校验

This commit is contained in:
lyt
2023-04-27 14:50:37 +08:00
committed by liu.xiaofeng@ebiz-digits.com
parent 71e44fed65
commit cde98f90de
2 changed files with 17 additions and 6 deletions

View File

@@ -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())

View File

@@ -10,7 +10,6 @@
@on-choose="chooseCustomer"
name="被保险人"
:readonly="disabled"
v-validate="'name'"
label="姓名"
@on-click="selectClick('1')"
:parentShowPicker.sync="customerShowPicker"
@@ -320,8 +319,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)
@@ -329,7 +333,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('被保险人性别有误')
}
@@ -364,7 +372,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 &&