Merge branch 'hotfix/bug_自助入司人脸识别放开' into dev

# Conflicts:
#	src/router/ebiz/agentEenter.js
#	src/views/ebiz/agentEenter/Paction.vue
This commit is contained in:
yuweiqi
2020-06-28 16:26:35 +08:00
parent d672a1bbce
commit af298fc439
5 changed files with 298 additions and 280 deletions

View File

@@ -988,7 +988,7 @@ export default {
this.userInfo.applyerCertiStartDate = '' this.userInfo.applyerCertiStartDate = ''
this.$refs.certificateValidate.date = '' this.$refs.certificateValidate.date = ''
this.$refs.applyerCertiEndDate.date = '' this.$refs.applyerCertiEndDate.date = ''
return this.$toast('16周岁以下的证件有效期为5年') return this.$toast('证件有效期错误,16周岁以下的证件有效期为5年')
} }
//年龄在16-25周岁之间 //年龄在16-25周岁之间
} else if (age >= 16 && age <= 25) { } else if (age >= 16 && age <= 25) {
@@ -997,7 +997,7 @@ export default {
this.userInfo.applyerCertiStartDate = '' this.userInfo.applyerCertiStartDate = ''
this.$refs.certificateValidate.date = '' this.$refs.certificateValidate.date = ''
this.$refs.applyerCertiEndDate.date = '' this.$refs.applyerCertiEndDate.date = ''
return this.$toast('16周岁~25周岁的证件有效期为10年') return this.$toast('证件有效期错误,16周岁~25周岁的证件有效期为10年')
} }
//年龄在26-45周岁之间 //年龄在26-45周岁之间
} else if (age >= 26 && age <= 45) { } else if (age >= 26 && age <= 45) {
@@ -1006,7 +1006,7 @@ export default {
this.userInfo.applyerCertiStartDate = '' this.userInfo.applyerCertiStartDate = ''
this.$refs.certificateValidate.date = '' this.$refs.certificateValidate.date = ''
this.$refs.applyerCertiEndDate.date = '' this.$refs.applyerCertiEndDate.date = ''
return this.$toast('26周岁~45周岁的证件有效期为20年') return this.$toast('证件有效期错误,26周岁~45周岁的证件有效期为20年')
} }
} else if (age >= 46 && age <= 65) { } else if (age >= 46 && age <= 65) {
if ( if (
@@ -1017,7 +1017,7 @@ export default {
this.userInfo.applyerCertiStartDate = '' this.userInfo.applyerCertiStartDate = ''
this.$refs.certificateValidate.date = '' this.$refs.certificateValidate.date = ''
this.$refs.applyerCertiEndDate.date = '' this.$refs.applyerCertiEndDate.date = ''
return this.$toast('46周岁~65周岁的证件有效期为20年或为长期') return this.$toast('证件有效期错误,46周岁~65周岁的证件有效期为20年或为长期')
} }
} else if (age >= 66) { } else if (age >= 66) {
if (this.effectiveDateType !== true) { if (this.effectiveDateType !== true) {
@@ -1025,7 +1025,7 @@ export default {
this.userInfo.applyerCertiStartDate = '' this.userInfo.applyerCertiStartDate = ''
this.$refs.certificateValidate.date = '' this.$refs.certificateValidate.date = ''
this.$refs.applyerCertiEndDate.date = '' this.$refs.applyerCertiEndDate.date = ''
return this.$toast('年龄大于等于66周岁证件有效期为长期') return this.$toast('证件有效期错误,年龄大于等于66周岁证件有效期为长期')
} }
} }
// 证件号码规则校验 // 证件号码规则校验

View File

@@ -326,21 +326,21 @@ export default {
if (new Date(val).getFullYear() - new Date().getFullYear() > 5) { if (new Date(val).getFullYear() - new Date().getFullYear() > 5) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁以下的证件有效期为5年') return this.$toast('证件有效期错误,16周岁以下的证件有效期为5年')
} }
//年龄在16-25周岁之间 //年龄在16-25周岁之间
} else if (age >= 16 && age <= 25) { } else if (age >= 16 && age <= 25) {
if (new Date(val).getFullYear() - new Date().getFullYear() > 10) { if (new Date(val).getFullYear() - new Date().getFullYear() > 10) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁~25周岁的证件有效期为10年') return this.$toast('证件有效期错误,16周岁~25周岁的证件有效期为10年')
} }
//年龄在26-45周岁之间 //年龄在26-45周岁之间
} else if (age >= 26 && age <= 45) { } else if (age >= 26 && age <= 45) {
if (new Date(val).getFullYear() - new Date().getFullYear() > 20) { if (new Date(val).getFullYear() - new Date().getFullYear() > 20) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('26周岁~45周岁的证件有效期为20年') return this.$toast('证件有效期错误,26周岁~45周岁的证件有效期为20年')
} }
//此外的年龄段不支持 //此外的年龄段不支持
} }
@@ -588,28 +588,28 @@ export default {
let age = utilsAge.getAge(this.userInfo.insuredBirthday, new Date()) let age = utilsAge.getAge(this.userInfo.insuredBirthday, new Date())
//若证件为身份证——进行证件有效期校验 //若证件为身份证——进行证件有效期校验
if (age < 46 && this.effectiveDateType) { if (age < 46 && this.effectiveDateType) {
return this.$toast('年龄小于46周岁证件有效期不能为长期') return this.$toast('证件有效期错误,年龄小于46周岁证件有效期不能为长期')
} }
// 年龄小于16周岁 // 年龄小于16周岁
if (age <= 15) { if (age <= 15) {
if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1975-01-01')) { if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁以下的证件有效期为5年') return this.$toast('证件有效期错误,16周岁以下的证件有效期为5年')
} }
//年龄在16-25周岁之间 //年龄在16-25周岁之间
} else if (age >= 16 && age <= 25) { } else if (age >= 16 && age <= 25) {
if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1980-01-01')) { if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁~25周岁的证件有效期为10年') return this.$toast('证件有效期错误,16周岁~25周岁的证件有效期为10年')
} }
//年龄在26-45周岁之间 //年龄在26-45周岁之间
} else if (age >= 26 && age <= 45) { } else if (age >= 26 && age <= 45) {
if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1990-01-01')) { if (Date.parse(this.userInfo.certiTypeEndDate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('26周岁~45周岁的证件有效期为20年') return this.$toast('证件有效期错误,26周岁~45周岁的证件有效期为20年')
} }
} /*else if (age >= 46 && age <= 65) { } /*else if (age >= 46 && age <= 65) {
if ( if (

View File

@@ -214,7 +214,11 @@ import idNoCheck from '@/assets/js/utils/idNoCheck'
import { idToData } from './js/verification' import { idToData } from './js/verification'
import { selectComp } from './js/methods' import { selectComp } from './js/methods'
// let relationToInsured = [{ id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }, { id: 5, text: '其他' }] // let relationToInsured = [{ id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }, { id: 5, text: '其他' }]
let relationToInsured = [{ id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }] let relationToInsured = [
{ id: 2, text: '配偶' },
{ id: 3, text: '父母' },
{ id: 4, text: '子女' }
]
export default { export default {
name: 'insuredInfo', name: 'insuredInfo',
@@ -310,7 +314,7 @@ export default {
// intercept: '1' //是否拦截原生返回事件 1是 其他否 // intercept: '1' //是否拦截原生返回事件 1是 其他否
// }) // })
window.appCallBack = this.appCallBack window.appCallBack = this.appCallBack
if (localStorage.applicant == '1' || this.saleInsuredPersonInfo.relationToAppnt == '1' || this.saleInsuredPersonInfo.relationToAppnt == '5' ) { if (localStorage.applicant == '1' || this.saleInsuredPersonInfo.relationToAppnt == '1' || this.saleInsuredPersonInfo.relationToAppnt == '5') {
this.Insured = true this.Insured = true
} else { } else {
this.Insured = false this.Insured = false
@@ -408,7 +412,10 @@ export default {
} else if (pickerType == '3') { } else if (pickerType == '3') {
this.columns = DataDictionary.degree this.columns = DataDictionary.degree
} else if (pickerType == '4') { } else if (pickerType == '4') {
this.columns = [{ id: 0, text: '有' }, { id: 1, text: '无' }] this.columns = [
{ id: 0, text: '有' },
{ id: 1, text: '无' }
]
} else if (pickerType == '5') { } else if (pickerType == '5') {
this.columns = DataDictionary.taxIdentity this.columns = DataDictionary.taxIdentity
} else if (pickerType == '6') { } else if (pickerType == '6') {
@@ -659,271 +666,274 @@ export default {
// 页面跳转 // 页面跳转
let valid = await this.$validator.validate() let valid = await this.$validator.validate()
// .then(valid => { // .then(valid => {
if (true === valid) { if (true === valid) {
// 受益人是被保险人的配偶 // 受益人是被保险人的配偶
if (this.userInfo.relationToInsured == '2') { if (this.userInfo.relationToInsured == '2') {
// 受益人与投保人都是被保险人的配偶时 // 受益人与投保人都是被保险人的配偶时
if (this.userInfo.relationToInsured == '2' && relationToAppnt == '2') { if (this.userInfo.relationToInsured == '2' && relationToAppnt == '2') {
if (this.userInfo.name != insuredDetail.name || this.userInfo.sex != insuredDetail.sex || this.userInfo.idNo != insuredDetail.idNo) { if (this.userInfo.name != insuredDetail.name || this.userInfo.sex != insuredDetail.sex || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入') return this.$toast('受益人数据不合法,请重新输入')
}
}
//与被保人关系是配偶
let insuredInfo = this.saleInsuredPersonInfo
//如果投保人不是已婚
if (insuredInfo.marriage != '1') {
return this.$toast('亲,受益人与被保险人关系为配偶,被保险人婚姻状况必须为已婚哦~')
}
//如果被保险人与投保人性别相同
if (insuredInfo.sex == this.userInfo.sex) {
return this.$toast('额,受益人与被保险人关系为配偶,性别不能相同哦~')
}
//如果性别男小于22岁 或者 性别女小于20岁
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
return this.$toast('年龄与婚姻状况不符')
} }
} }
//与被保人关系是配偶
let insuredInfo = this.saleInsuredPersonInfo
//如果投保人不是已婚
if (insuredInfo.marriage != '1') {
return this.$toast('亲,受益人与被保险人关系为配偶,被保险人婚姻状况必须为已婚哦~')
}
//如果被保险人与投保人性别相同
if (insuredInfo.sex == this.userInfo.sex) {
return this.$toast('额,受益人与被保险人关系为配偶,性别不能相同哦~')
}
// 受益人是被保险人的父母,被保险人是投保人的子女时 //如果性别男小于22岁 或者 性别女小于20岁
if (this.userInfo.relationToInsured == '3' && relationToAppnt == '4') { if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
if (this.userInfo.sex == insuredDetail.sex) { return this.$toast('年龄与婚姻状况不符')
if (this.userInfo.name != insuredDetail.name || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
} }
let insuredInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
// 受益人与被保险人关系为父母时,受益人年龄必须大于被保险人年龄
if (this.userInfo.relationToInsured == '3') {
if (age < insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
// 受益人与被保险人关系为子女时,受益人年龄必须小于被保险人年龄
if (this.userInfo.relationToInsured == '4') {
if (age > insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
//年龄在0-15周岁之间
if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
// else if (this.userInfo.idNo.length < 3) {
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// if (this.userInfo.idNo.length != 9) {
// return this.$toast('证件类型为港澳居民通行证的证件号码须为9位')
// } else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.idNo)) {
// return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
// }
// //证件是台湾居民通行证
// } else if (this.userInfo.idType == '6' && this.userInfo.idNo.length != 8) {
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
if (this.userInfo.nativeplace == '1') {
// “身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”
let obj = {
'1': true,
'5': true,
'6': true
}
let idType = this.userInfo.idType
// 通过年龄 判断证件是否符合要求
// 小于2岁
if (age < 2) {
// “出生证”,"户口本"
obj['2'] = true
obj['3'] = true
if (obj[idType] === undefined) {
return this.$toast('亲国籍为中国且未满2周岁儿童证件类型必须“身份证”或“户口本”或“出生证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
} else if (age < 16) {
// 小于16岁
// “户口本”
obj['2'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且大于2周岁小于16周岁的未成年人证件类型必须为“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
} else {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
let beneficiaries = []
if (localStorage.beneficiaryInfo) {
// 从 localStorage 取出数据
beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// 收益份额不超过 100%
let ratio = 0
beneficiaries.forEach(item => {
ratio += parseInt(item.bnfLot)
})
ratio += parseInt(this.userInfo.bnfLot)
console.log(ratio)
if (ratio > 100) {
return this.$toast('受益份额有误,请重新输入~')
}
if (this.userInfo.idNo != '') {
// 受益人不能重复添加 (证件号码为基准)
let isDbAdd = beneficiaries.some(item => {
return item.idNo == this.userInfo.idNo
})
console.log(isDbAdd)
if (isDbAdd) {
return this.$toast('受益人不支持重复添加')
}
}
} else {
if (this.userInfo.bnfLot > 100) {
return this.$toast('受益份额不能超过100~')
}
}
beneficiaries.push(this.userInfo)
// console.log(beneficiaries)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
localStorage.fromAddBeneficiaryInfo = true
if (this.userInfo.asAppntAddress == true) {
localStorage.applicant = '1'
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/sale/beneficiary',
needRefresh: '1'
},
routerInfo: {
path: '/sale/beneficiary'
}
})
} else {
this.$toast(this.$validator.errors.all()[0])
} }
// 受益人是被保险人的父母,被保险人是投保人的子女时
if (this.userInfo.relationToInsured == '3' && relationToAppnt == '4') {
if (this.userInfo.sex == insuredDetail.sex) {
if (this.userInfo.name != insuredDetail.name || this.userInfo.idNo != insuredDetail.idNo) {
return this.$toast('受益人数据不合法,请重新输入')
}
}
}
let insuredInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
// 受益人与被保险人关系为父母时,受益人年龄必须大于被保险人年龄
if (this.userInfo.relationToInsured == '3') {
if (age < insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
// 受益人与被保险人关系为子女时,受益人年龄必须小于被保险人年龄
if (this.userInfo.relationToInsured == '4') {
if (age > insuredInfo.age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认受益人与被保险人关系哦',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
//年龄在小于周岁不含46周岁证件有效期不能为长期
if (age < 46 && this.userInfo.effectiveDateType == true) {
return this.$toast('证件有效期错误年龄小于46周岁证件有效期不能为长期')
}
//年龄在0-15周岁之间
if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期错误未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期错误16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期错误26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
//证件类型是户口本
} else if (this.userInfo.idType == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
// else if (this.userInfo.idNo.length < 3) {
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// if (this.userInfo.idNo.length != 9) {
// return this.$toast('证件类型为港澳居民通行证的证件号码须为9位')
// } else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.idNo)) {
// return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
// }
// //证件是台湾居民通行证
// } else if (this.userInfo.idType == '6' && this.userInfo.idNo.length != 8) {
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
if (this.userInfo.nativeplace == '1') {
// “身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”
let obj = {
'1': true,
'5': true,
'6': true
}
let idType = this.userInfo.idType
// 通过年龄 判断证件是否符合要求
// 小于2岁
if (age < 2) {
// “出生证”,"户口本"
obj['2'] = true
obj['3'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且未满2周岁儿童证件类型必须“身份证”或“户口本”或“出生证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else if (age < 16) {
// 小于16岁
// “户口本”
obj['2'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且大于2周岁小于16周岁的未成年人证件类型必须为“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
} else {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
let beneficiaries = []
if (localStorage.beneficiaryInfo) {
// 从 localStorage 取出数据
beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// 收益份额不超过 100%
let ratio = 0
beneficiaries.forEach(item => {
ratio += parseInt(item.bnfLot)
})
ratio += parseInt(this.userInfo.bnfLot)
console.log(ratio)
if (ratio > 100) {
return this.$toast('受益份额有误,请重新输入~')
}
if (this.userInfo.idNo != '') {
// 受益人不能重复添加 (证件号码为基准)
let isDbAdd = beneficiaries.some(item => {
return item.idNo == this.userInfo.idNo
})
console.log(isDbAdd)
if (isDbAdd) {
return this.$toast('受益人不支持重复添加')
}
}
} else {
if (this.userInfo.bnfLot > 100) {
return this.$toast('受益份额不能超过100~')
}
}
beneficiaries.push(this.userInfo)
// console.log(beneficiaries)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
localStorage.fromAddBeneficiaryInfo = true
if (this.userInfo.asAppntAddress == true) {
localStorage.applicant = '1'
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/sale/beneficiary',
needRefresh: '1'
},
routerInfo: {
path: '/sale/beneficiary'
}
})
} else {
this.$toast(this.$validator.errors.all()[0])
}
// }) // })
}, },
// //区域选择 // //区域选择

View File

@@ -990,6 +990,10 @@ export default {
return this.$toast('您填写的证件号码有误') return this.$toast('您填写的证件号码有误')
} }
//年龄在小于周岁不含46周岁证件有效期不能为长期
if (age < 46 && this.userInfo.effectiveDateType == true) {
return this.$toast('证件有效期错误年龄小于46周岁证件有效期不能为长期')
}
// 年龄在 16-25 周岁之间 // 年龄在 16-25 周岁之间
if (age >= 16 && age <= 25) { if (age >= 16 && age <= 25) {
console.log('年龄在16-25周岁之间') console.log('年龄在16-25周岁之间')
@@ -997,7 +1001,7 @@ export default {
this.userInfo.certiexpiredate = '' this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = '' this.$refs.certiexpiredate.date = ''
this.effectiveDateTypeAble = true this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年') return this.$toast('证件有效期错误16周岁至25周岁公民身份证有效期应小于等于10年')
} }
//年龄在 26-45 周岁之间 //年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) { } else if (age >= 26 && age <= 45) {
@@ -1006,7 +1010,7 @@ export default {
this.userInfo.certiexpiredate = '' this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = '' this.$refs.certiexpiredate.date = ''
this.effectiveDateTypeAble = true this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年') return this.$toast('证件有效期错误26周岁至45周岁公民身份证有效期应小于等于20年')
} }
} }
//证件类型是户口本 //证件类型是户口本

View File

@@ -1275,13 +1275,17 @@ export default {
return this.$toast('您填写的证件号码有误') return this.$toast('您填写的证件号码有误')
} }
console.log(age) console.log(age)
//年龄在小于周岁不含46周岁证件有效期不能为长期
if (age < 46 && this.userInfo.effectiveDateType == true) {
return this.$toast('证件有效期错误年龄小于46周岁证件有效期不能为长期')
}
//年龄在0-15周岁之间 //年龄在0-15周岁之间
if (age <= 15) { if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) { if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = '' this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = '' this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true // this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常未满16周岁的公民身份证有效期应小于等于5年') return this.$toast('证件有效期错误未满16周岁的公民身份证有效期应小于等于5年')
} }
//年龄在 16-25 周岁之间 //年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) { } else if (age >= 16 && age <= 25) {
@@ -1289,7 +1293,7 @@ export default {
this.userInfo.certiexpiredate = '' this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = '' this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true // this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年') return this.$toast('证件有效期错误16周岁至25周岁公民身份证有效期应小于等于10年')
} }
//年龄在 26-45 周岁之间 //年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) { } else if (age >= 26 && age <= 45) {
@@ -1297,7 +1301,7 @@ export default {
this.userInfo.certiexpiredate = '' this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = '' this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true // this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年') return this.$toast('证件有效期错误26周岁至45周岁公民身份证有效期应小于等于20年')
} }
} }
//如果是身份证,且未成年,则与投保人关系必须是子女关系 //如果是身份证,且未成年,则与投保人关系必须是子女关系