【建议书优化需求】年龄不能为空后提示7岁未成年人须由其父母投保

This commit is contained in:
lyt
2023-04-28 18:47:09 +08:00
committed by liu.xiaofeng@ebiz-digits.com
parent eaca6f0840
commit 318441289d

View File

@@ -333,7 +333,6 @@ 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 ageRule = /^[a-zA-Z\.\s\u4e00-\u9fa5]{2,120}$/
if (this.insured.name && !ageRule.test(this.insured.name)) {
return Toast.fail('姓名长度为2-120个字符之内只能输入汉字或者英文')
@@ -341,9 +340,6 @@ export default {
if (!resultSex) {
return Toast.fail('被保险人性别有误')
}
if (!resultRelation) {
return Toast.fail('0-7岁未成年人须由其父母投保')
}
this.$validator.validate().then(valid => {
if (true === valid) {
this.fromPath()
@@ -362,6 +358,11 @@ export default {
}
if (fromSelect) {
//被保人年龄校验
let relation = this.localInfo.relationToAppnt
let resultRelation = checkRelation(relation, this.insured.insuredAge)
if (!resultRelation) {
return Toast.fail('0-7岁未成年人须由其父母投保')
}
let minAge = getAge.getAge(utils.formatDate(new Date(this.maxDate),'yyyy-MM-dd'), new Date())
let maxAge = getAge.getAge('1900-01-01', new Date())
if(this.insured.insuredAge < minAge || this.insured.insuredAge > maxAge){