mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 10:26:44 +08:00
卡单,电投被保人和受益人,客户列表新增编辑时,出生证证件号只能是由数字字母组合,身份证和户口本证件号校验规则一致
This commit is contained in:
@@ -9,6 +9,12 @@ const idNoCheck = {
|
||||
return false
|
||||
},
|
||||
|
||||
isCardNoBirth: function(card) {
|
||||
//出生证证件号由数字字母组合
|
||||
var reg = /(^[a-zA-Z0-9]{5,17}$)/
|
||||
return reg.test(card)
|
||||
},
|
||||
|
||||
isCardNo: function(card) {
|
||||
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
|
||||
var reg = /(^\d{17}(\d|X)$)/
|
||||
|
||||
@@ -407,6 +407,49 @@ export default {
|
||||
}
|
||||
//证件是户口本
|
||||
} else if (this.userInfo.idType == '2') {
|
||||
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('您填写的证件号码有误')
|
||||
}
|
||||
if (age > 16) {
|
||||
return this.$toast('客户年龄在16周岁以上,不能使用户口本作为有效证件')
|
||||
}
|
||||
@@ -421,6 +464,11 @@ export default {
|
||||
if (age >= 2) {
|
||||
return this.$toast('客户年龄在2周岁及以上,不能使用出生证作为有效证件')
|
||||
}
|
||||
// 证件号码规则校验
|
||||
if (!idNoCheck.isCardNoBirth(this.userInfo.idNo)) {
|
||||
console.log('证件号码校验有误')
|
||||
return this.$toast('您填写的证件号码有误')
|
||||
}
|
||||
// else if (this.userInfo.customerIdNumber.length < 3) {
|
||||
// return this.$toast('出生证须大于等于3个字符')
|
||||
// }
|
||||
@@ -662,7 +710,8 @@ export default {
|
||||
}
|
||||
},
|
||||
getRelatedData(val) {
|
||||
if (this.userInfo.idType != '1') {
|
||||
//客户列表新增时,身份证和户口本证件号校验规则一致
|
||||
if (this.userInfo.idType != '1' && this.userInfo.idType != '2' ) {
|
||||
return
|
||||
}
|
||||
//如果证件校验不通过,恢复默认值
|
||||
|
||||
@@ -1743,10 +1743,61 @@ export default {
|
||||
return this.$toast('证件有效期不正常,26周岁至45周岁公民身份证有效期应小于等于20年')
|
||||
}
|
||||
}
|
||||
//如果证件类型是户口本
|
||||
}else if(this.userInfo.idType == '2'){
|
||||
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('您填写的证件号码有误')
|
||||
}
|
||||
if (age >= 16) {
|
||||
return this.$toast('客户年龄在16周岁以上,不能使用户口本作为有效证件')
|
||||
}
|
||||
// else if (this.userInfo.idNo.length != 18) {
|
||||
// return this.$toast('户口本的证件号码长度应等于18位')
|
||||
// }
|
||||
}
|
||||
let insuredAge = utilsAge.getAge(this.insuredInfo.birthday, new Date())
|
||||
console.log('计算年龄', insuredAge)
|
||||
//如果证件类型是身份证
|
||||
//如果证件类型是身份证或户口本
|
||||
if (this.insuredInfo.idType == '1') {
|
||||
console.log('证件类型是身份证')
|
||||
//校验性别是否与身份证号码位相符
|
||||
@@ -1821,6 +1872,65 @@ export default {
|
||||
return this.$toast('证件有效期不正常,26周岁至45周岁公民身份证有效期应小于等于20年')
|
||||
}
|
||||
}
|
||||
}else if (this.insuredInfo.idType == '2'){
|
||||
if (this.insuredInfo.nativeplace != '1') {
|
||||
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
|
||||
}
|
||||
//校验性别是否与身份证号码位相符
|
||||
if (this.insuredInfo.idNo.length == '15') {
|
||||
//15位身份证第15位是性别位, 奇男偶女
|
||||
let sexSign = this.insuredInfo.idNo.substr(14, 1)
|
||||
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
|
||||
return this.$toast('性别录入与身份证不符')
|
||||
}
|
||||
|
||||
//15位身份证第7-12位是生日位, 年月日
|
||||
let birthSign = this.insuredInfo.idNo.substr(6, 6)
|
||||
if (
|
||||
this.insuredInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
|
||||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
|
||||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
|
||||
) {
|
||||
return this.$toast('生日录入与身份证不符')
|
||||
}
|
||||
} else if (this.insuredInfo.idNo.length == '18') {
|
||||
//18位身份证第17位是性别位, 奇男偶女
|
||||
let sexSign = this.insuredInfo.idNo.substr(16, 1)
|
||||
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
|
||||
return this.$toast('性别录入与身份证不符')
|
||||
}
|
||||
|
||||
//18位身份证第7-14位是生日位, 年月日
|
||||
let birthSign = this.insuredInfo.idNo.substr(6, 8)
|
||||
if (
|
||||
this.insuredInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
|
||||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
|
||||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
|
||||
) {
|
||||
return this.$toast('生日录入与身份证不符')
|
||||
}
|
||||
}
|
||||
|
||||
// 证件号码规则校验
|
||||
if (!idNoCheck.isIdno(this.insuredInfo.idNo)) {
|
||||
console.log('证件号码校验有误')
|
||||
return this.$toast('您填写的证件号码有误')
|
||||
}
|
||||
if (age >= 16) {
|
||||
return this.$toast('客户年龄在16周岁以上,不能使用户口本作为有效证件')
|
||||
}
|
||||
// else if (this.insuredInfo.idNo.length != 18) {
|
||||
// return this.$toast('户口本的证件号码长度应等于18位')
|
||||
// }
|
||||
}else if (this.insuredInfo.idType == '3'){
|
||||
if (insuredAge >= 2) {
|
||||
return this.$toast('客户年龄在2周岁及以上,不能使用出生证作为有效证件')
|
||||
}
|
||||
// 证件号码规则校验
|
||||
if (!idNoCheck.isCardNoBirth(this.insuredInfo.idNo)) {
|
||||
console.log('证件号码校验有误')
|
||||
return this.$toast('您填写的证件号码有误')
|
||||
}
|
||||
}
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0022') {
|
||||
// return
|
||||
|
||||
@@ -984,6 +984,11 @@ export default {
|
||||
if (age >= 2) {
|
||||
return this.$toast('客户年龄在2周岁及以上,不能使用出生证作为有效证件')
|
||||
}
|
||||
// 证件号码规则校验
|
||||
if (!idNoCheck.isCardNoBirth(this.userInfo.idNo)) {
|
||||
console.log('证件号码校验有误')
|
||||
return this.$toast('您填写的证件号码有误')
|
||||
}
|
||||
//证件类型是护照
|
||||
} else if (this.userInfo.idType == '4') {
|
||||
if (this.userInfo.nativeplace == '1') {
|
||||
|
||||
@@ -1602,6 +1602,11 @@ export default {
|
||||
if (age >= 2) {
|
||||
return this.$toast('客户年龄在2周岁及以上,不能使用出生证作为有效证件')
|
||||
}
|
||||
// 证件号码规则校验
|
||||
if (!idNoCheck.isCardNoBirth(this.userInfo.idNo)) {
|
||||
console.log('证件号码校验有误')
|
||||
return this.$toast('您填写的证件号码有误')
|
||||
}
|
||||
// else if (this.userInfo.idNo.length < 3) {
|
||||
// return this.$toast('出生证须大于等于3个字符')
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user