[IMP]【电投】投被保人年龄小于等于16周岁时,工作单位增加默认值“无”

This commit is contained in:
yuweiqi
2020-04-29 10:43:32 +08:00
parent eb5235b2b9
commit 307f05c0c1
2 changed files with 449 additions and 432 deletions

View File

@@ -386,7 +386,7 @@ export default {
[Radio.name]: Radio,
[IdentityCardScan.name]: IdentityCardScan,
[IndexBar.name]: IndexBar,
[Dialog.name] : Dialog
[Dialog.name]: Dialog
},
data() {
return {
@@ -747,10 +747,14 @@ export default {
return this.$toast('出生日期不晚于当日')
}
//长判断
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
if (this.userInfo.idType == '1') {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = !(age > 45)
}
//如果年龄小于等于16岁工作单位默认值为
if (age <= 16) {
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
}
break
}
@@ -836,221 +840,222 @@ export default {
//表单校验, 成功跳转
let valid = await this.$validator.validate()
// .then(valid => {
if (true === valid) {
localStorage.chooseProductCodesNew = localStorage.chooseProductCodes
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 如果是未成年人
// if (age < 18) {
// return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定')
// }
if (true === valid) {
localStorage.chooseProductCodesNew = localStorage.chooseProductCodes
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 如果是未成年人
// if (age < 18) {
// return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定')
// }
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
console.log('证件类型是身份证')
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
console.log('证件类型是身份证')
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
// if (this.userInfo.idNo.length == '15') {
// //15位身份证第15位是性别位, 奇男偶女
// let sexSign = this.userInfo.idNo.substr(14, 1)
// console.log('性别位' + sexSign)
// 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)
// console.log('生日位' + birthSign)
// 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('您填写的证件号码有误')
}
// 年龄在 16-25 周岁之间
if (age >= 16 && age <= 25) {
console.log('年龄在16-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) {
console.log('年龄在26-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.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// console.log('证件类型是护照')
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// console.log('证件类型是港澳居民通行证')
// 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位为阿拉伯数字')
//校验性别是否与身份证号码位相符
// if (this.userInfo.idNo.length == '15') {
// //15位身份证第15位是性别位, 奇男偶女
// let sexSign = this.userInfo.idNo.substr(14, 1)
// console.log('性别位' + sexSign)
// if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
// return this.$toast('性别录入与身份证不符')
// }
// //证件是台湾居民通行证
// } else if (this.userInfo.idType == '6' && this.userInfo.idNo.length != 8) {
// console.log('证件类型是台湾居民通行证')
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 投保人年龄必须大于等于16周岁哦
if(age < 16) {
return this.$toast('亲投保人年龄必须大于等于16周岁哦~')
}
//投保人需大于等于 18 周岁
if (age < 18) {
return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定')
}
//职业类型不能为 '一般学生'
if (this.userInfo.occupationCode == '2099907') {
this.userInfo.occupationName = ''
return this.$toast('学生不可以作为投保人,请更换投保人投保')
}
// 职业 学龄前儿童 2099908 离休人员 8000003家庭主妇 4071203无业人员 8000001
// 亲,您填写的工作单位过于简短哦~
if (
this.userInfo.occupationCode == '2099908' ||
this.userInfo.occupationCode == '8000003' ||
this.userInfo.occupationCode == '4071203' ||
this.userInfo.occupationCode == '8000001'
) {
;
} else if (this.userInfo.workcompany.length < 6 && this.userInfo.workcompany.trim() != '无') {
// await this.asyncToast('亲,您填写的工作单位过于简短哦~')
await this.$dialog.confirm({
title: '提示',
message: '亲,您填写的工作单位过于简短哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
if (this.userInfo.salarySource == '4') {
if (!this.userInfo.otherSalarySource) {
return this.$toast('请输入其它收入来源')
}
}
//如果是已婚
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
if (this.userInfo.marriage != '2') {
return this.$toast('投保人不符合国家婚姻法定年龄')
}
}
// if (this.userInfo.marriage == '1') {
// if (this.userInfo.sex == '0' && age < 22) {
// return this.$toast('年龄与婚姻状况不符')
// } else if (this.userInfo.sex == '1' && age < 20) {
// return this.$toast('年龄与婚姻状况不符')
// //15位身份证第7-12位是生日位, 年月日
// let birthSign = this.userInfo.idNo.substr(6, 6)
// console.log('生日位' + birthSign)
// 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('您填写的证件号码有误')
}
// 年龄在 16-25 周岁之间
if (age >= 16 && age <= 25) {
console.log('年龄在16-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) {
console.log('年龄在26-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.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
} else if (this.userInfo.idType == '4') {
if (this.userInfo.nativeplace == '1') {
// “身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”
let obj = {
'1': true,
'5': true,
'6': true
return this.$toast('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// else if (this.userInfo.idType == '4' && this.userInfo.idNo.length < 3) {
// console.log('证件类型是护照')
// return this.$toast('护照须大于等于3个字符')
// //证件是港澳居民通行证
// } else if (this.userInfo.idType == '5') {
// console.log('证件类型是港澳居民通行证')
// 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) {
// console.log('证件类型是台湾居民通行证')
// return this.$toast('证件类型为台湾居民通行证的证件号码须为8位数字')
// }
// 投保人年龄必须大于等于16周岁哦
if (age < 16) {
return this.$toast('亲投保人年龄必须大于等于16周岁哦~')
}
//投保人需大于等于 18 周岁
if (age < 18) {
return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定')
}
//职业类型不能为 '一般学生'
if (this.userInfo.occupationCode == '2099907') {
this.userInfo.occupationName = ''
return this.$toast('学生不可以作为投保人,请更换投保人投保')
}
// 职业 学龄前儿童 2099908 离休人员 8000003家庭主妇 4071203无业人员 8000001
// 亲,您填写的工作单位过于简短哦~
if (
this.userInfo.occupationCode == '2099908' ||
this.userInfo.occupationCode == '8000003' ||
this.userInfo.occupationCode == '4071203' ||
this.userInfo.occupationCode == '8000001'
) {
} else if (this.userInfo.workcompany.length < 6 && this.userInfo.workcompany.trim() != '无') {
// await this.asyncToast('亲,您填写的工作单位过于简短哦~')
await this.$dialog.confirm({
title: '提示',
message: '亲,您填写的工作单位过于简短哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
if (this.userInfo.salarySource == '4') {
if (!this.userInfo.otherSalarySource) {
return this.$toast('请输入其它收入来源')
}
}
//如果是已婚
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
if (this.userInfo.marriage != '2') {
return this.$toast('投保人不符合国家婚姻法定年龄')
}
}
// if (this.userInfo.marriage == '1') {
// if (this.userInfo.sex == '0' && age < 22) {
// return this.$toast('年龄与婚姻状况不符')
// } else if (this.userInfo.sex == '1' && age < 20) {
// return this.$toast('年龄与婚姻状况不符')
// }
// }
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
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周岁儿童证件类型必须“身份证”或“户口本”或“出生证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
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 if (age < 16) {
// 小于16岁
// “户口本”
obj['2'] = true
if (obj[idType] === undefined) {
return this.$toast(
'亲国籍为中国且大于2周岁小于16周岁的未成年人证件类型必须为“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
this.infoUpdate()
// console.log('success')
} else {
return this.$toast(this.$validator.errors.all()[0])
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
this.infoUpdate()
// console.log('success')
} else {
return this.$toast(this.$validator.errors.all()[0])
}
// })
},
//信息变更
@@ -1064,10 +1069,7 @@ export default {
//取出local中的投保人信息
let saleInsuredInfo = JSON.parse(localStorage.saleInsuredInfo)
//如果 姓名, 性别, 出生日期, 有无社保, 职业 ,婚姻情况,发生变化
if (
this.userInfo.sex != saleInsuredInfo.sex ||
this.userInfo.birthday != saleInsuredInfo.birthday
) {
if (this.userInfo.sex != saleInsuredInfo.sex || this.userInfo.birthday != saleInsuredInfo.birthday) {
console.log('hehe')
//提示用户
if (chooseProductCodes && chooseProductCodes.length)
@@ -1284,6 +1286,11 @@ export default {
this.effectiveDateTypeAble = idToData(val).age <= 45
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
console.log('111 = ', idToData(val).age <= 16)
if (idToData(val).age <= 16) {
//年龄小于等于16岁默认工作单位为无
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
if (idToData(val).age > 45) {
if (source) {
this.userInfo.effectiveDateType = true

View File

@@ -462,7 +462,7 @@ export default {
[Area.name]: Area,
[IdentityCardScan.name]: IdentityCardScan,
[IndexBar.name]: IndexBar,
[Dialog.name] : Dialog
[Dialog.name]: Dialog
},
data() {
return {
@@ -699,7 +699,7 @@ export default {
// console.log(value);
// this.$toast(value)
// setTimeout(resolve, ms);
// })
// })
// },
//监听名字变化
nameChange(name) {
@@ -774,7 +774,10 @@ export default {
} else if (pickerType == '3') {
this.columns = DataDictionary.degree
} else if (pickerType == '4') {
this.columns = [{ id: 0, text: '有' }, { id: 1, text: '无' }]
this.columns = [
{ id: 0, text: '有' },
{ id: 1, text: '无' }
]
} else if (pickerType == '5') {
this.columns = DataDictionary.taxIdentity
} else if (pickerType == '6') {
@@ -1008,7 +1011,10 @@ export default {
// this.userInfo.marriage = ''
}
}
//如果年龄小于等于16岁工作单位默认值为
if (age <= 16) {
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
//出生证有效期
// if (this.userInfo.idType == '3') {
// if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(val) > Date.parse('1973-01-01')) {
@@ -1151,257 +1157,257 @@ export default {
async nextStep() {
let valid = await this.$validator.validate()
// .then(valid => {
if (true === valid) {
// 职业 学龄前儿童 2099908 离休人员 8000003家庭主妇 4071203无业人员 8000001
// 亲,您填写的工作单位过于简短哦~
if (
this.userInfo.occupationCode == '2099908' ||
this.userInfo.occupationCode == '8000003' ||
this.userInfo.occupationCode == '4071203' ||
this.userInfo.occupationCode == '8000001'
) {
;
} else if (this.userInfo.workcompany.length < 6 && this.userInfo.workcompany.trim() != '无') {
if (true === valid) {
// 职业 学龄前儿童 2099908 离休人员 8000003家庭主妇 4071203无业人员 8000001
// 亲,您填写的工作单位过于简短哦~
if (
this.userInfo.occupationCode == '2099908' ||
this.userInfo.occupationCode == '8000003' ||
this.userInfo.occupationCode == '4071203' ||
this.userInfo.occupationCode == '8000001'
) {
} else if (this.userInfo.workcompany.length < 6 && this.userInfo.workcompany.trim() != '无') {
await this.$dialog.confirm({
title: '提示',
message: '亲,您填写的工作单位过于简短哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 被保险人人年龄≤13岁学历不可以为研究生、本科、高中、大专
if (age < 14 && this.userInfo.degree - 0 <= 5) {
return this.$toast('亲,请确认被保险人学历哦~')
}
//投被保险人关系是配偶
if (this.userInfo.relationToAppnt == '2') {
//投保人或者被保险人不是已婚
if (this.appntMarriage != '1' || this.userInfo.marriage != '1') {
return this.$toast('亲,被保险人与投保人关系为配偶,投保人或被保险人婚姻状况必须为已婚哦~')
}
let insuredSex = this.userInfo.sex
let appntSex = JSON.parse(localStorage.saleInsuredInfo).sex
//投被保险人性别相同
if (insuredSex == appntSex) {
return this.$toast('额~配偶关系性别不能相同哦~')
}
} else if (this.userInfo.relationToAppnt == '4') {
//投被保人关系是子女
if (age > JSON.parse(localStorage.saleInsuredInfo).age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,您填写的工作单位过于简短哦~',
message: '亲,请确认被保险人与投保人关系哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 被保险人人年龄≤13岁学历不可以为研究生、本科、高中、大专
if (age < 14 && this.userInfo.degree - 0 <= 5) {
return this.$toast('亲,请确认被保险人学历哦~')
} else if (this.userInfo.relationToAppnt == '3') {
//投被保人关系是父母
if (age < JSON.parse(localStorage.saleInsuredInfo).age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认被保险人与投保人关系哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
}
}
//投被保险人关系是配偶
if (this.userInfo.relationToAppnt == '2') {
//投保人或者被保险人不是已婚
if (this.appntMarriage != '1' || this.userInfo.marriage != '1') {
return this.$toast('亲,被保险人与投保人关系为配偶,投保人或被保险人婚姻状况必须为已婚哦~')
// if (this.userInfo.marriage == '1') {
// if (this.userInfo.sex == '0' && age < 22) {
// return this.$toast('年龄与婚姻状况不符')
// } else if (this.userInfo.sex == '1' && age < 20) {
// return this.$toast('年龄与婚姻状况不符')
// }
// }
//如果证件类型是身份证
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('性别录入与身份证不符')
}
let insuredSex = this.userInfo.sex
let appntSex = JSON.parse(localStorage.saleInsuredInfo).sex
//投被保险人性别相同
if (insuredSex == appntSex) {
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.relationToAppnt == '4') {
//投被保人关系是子
if (age > JSON.parse(localStorage.saleInsuredInfo).age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认被保险人与投保人关系哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
} 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('性别录入与身份证不符')
}
} else if (this.userInfo.relationToAppnt == '3') {
//投被保人关系是父母
if (age < JSON.parse(localStorage.saleInsuredInfo).age) {
await this.$dialog.confirm({
title: '提示',
message: '亲,请确认被保险人与投保人关系哦~',
confirmButtonText: '继续填写',
cancelButtonText: '返回修改'
})
//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 (this.userInfo.marriage == '1') {
// if (this.userInfo.sex == '0' && age < 22) {
// return this.$toast('年龄与婚姻状况不符')
// } else if (this.userInfo.sex == '1' && age < 20) {
// return this.$toast('年龄与婚姻状况不符')
// }
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
console.log(age)
//年龄在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年')
}
}
//如果是身份证,且未成年,则与投保人关系必须是子女关系
// if(age < 18 && this.userInfo.relationToAppnt != '4'){
// return this.$toast('被保险人小于18周岁选择身份证时与投保人关系必须为子女')
// }
//如果证件类型是身份证
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('您填写的证件号码有误')
}
console.log(age)
//年龄在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年')
}
}
//如果是身份证,且未成年,则与投保人关系必须是子女关系
// if(age < 18 && this.userInfo.relationToAppnt != '4'){
// return this.$toast('被保险人小于18周岁选择身份证时与投保人关系必须为子女')
// }
//证件类型是户口本
} 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 == '2') {
if (age > 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// 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位数字')
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
// 年龄 0-7 周岁且不是投保人的子女
if (age < 7 && this.userInfo.relationToAppnt != '4') {
return this.$toast('0-7岁未成年人须由其父母投保请确定')
//证件类型是出生证明
} else if (this.userInfo.idType == '3') {
if (age >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
if (this.userInfo.salarySource == '4') {
if (!this.userInfo.otherSalarySource) {
return this.$toast('请输入其它收入来源')
}
}
//如果是已婚
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
if (this.userInfo.marriage != '2') {
return this.$toast('被保险人不符合国家婚姻法定年龄')
}
}
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
// else if (this.userInfo.idNo.length < 3) {
// return this.$toast('出生证须大于等于3个字符')
// }
//证件类型是护照
} else if (this.userInfo.idType == '4') {
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('“证件类型”为“外国人护照”,“国籍”不能选择为“中国”哦~')
}
}
// 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位数字')
// }
// 年龄 0-7 周岁且不是投保人的子女
if (age < 7 && this.userInfo.relationToAppnt != '4') {
return this.$toast('0-7岁未成年人须由其父母投保请确定')
}
if (this.userInfo.salarySource == '4') {
if (!this.userInfo.otherSalarySource) {
return this.$toast('请输入其它收入来源')
}
}
//如果是已婚
if ((this.userInfo.sex == '0' && age < 22) || (this.userInfo.sex == '1' && age < 20)) {
if (this.userInfo.marriage != '2') {
return this.$toast('被保险人不符合国家婚姻法定年龄')
}
}
// 通过国籍判断 证件是否符合要求
// 如果是国籍选择中国大陆
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周岁小于16周岁的未成年人,证件类型必须“身份证”或“户口本”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”'
)
}
} else {
// 于16岁
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 {
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
// 大于16岁
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
return this.$toast('亲,国籍为中国,证件类型必须为“身份证”或“台湾居民来往大陆通行证”或“港澳居民来往内地通行证”')
}
}
// this.save()
this.infoUpdate()
// console.log('success')
} else {
return this.$toast(this.$validator.errors.all()[0])
// 非大陆人员按外籍人员
let obj = {
'4': true,
'8': true
}
let idType = this.userInfo.idType
if (obj[idType] === undefined) {
return this.$toast('亲,国籍为外籍,证件类型必须为护照或外国人永久居留身份证投保')
}
}
// this.save()
this.infoUpdate()
// console.log('success')
} else {
return this.$toast(this.$validator.errors.all()[0])
}
// })
},
//信息变更
@@ -1653,6 +1659,10 @@ export default {
this.userInfo.marriage = ''
}
}
if (idToData(val).age <= 16) {
//年龄小于等于16岁默认工作单位为无
this.userInfo.workcompany = this.userInfo.workcompany || '无'
}
if (idToData(val).age > 45) {
// this.idLimit = true
// this.isRequired = false