mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-11 19:06:43 +08:00
校验修改
This commit is contained in:
@@ -2,6 +2,49 @@
|
|||||||
<div>
|
<div>
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<!-- 基本信息 -->
|
<!-- 基本信息 -->
|
||||||
|
<van-field
|
||||||
|
:value="userInfo.idType | idToText('idType')"
|
||||||
|
readonly
|
||||||
|
label="证件类型"
|
||||||
|
name="证件类型"
|
||||||
|
right-icon="arrow"
|
||||||
|
placeholder="请选择"
|
||||||
|
@click="toSelect('2')"
|
||||||
|
/>
|
||||||
|
<van-field
|
||||||
|
v-model="userInfo.customerIdNumber"
|
||||||
|
label="证件号码"
|
||||||
|
name="证件号码"
|
||||||
|
placeholder="请输入"
|
||||||
|
maxlength="18"
|
||||||
|
@blur="getRelatedData(userInfo.customerIdNumber)"
|
||||||
|
></van-field>
|
||||||
|
<FieldDatePicter
|
||||||
|
label="证件起始日期"
|
||||||
|
name="证件起始日期"
|
||||||
|
:value.sync="userInfo.certificateValidate"
|
||||||
|
type="date"
|
||||||
|
:flag="true"
|
||||||
|
ref="certificateValidate"
|
||||||
|
@confirm="onDateConfirm($event, '0')"
|
||||||
|
></FieldDatePicter>
|
||||||
|
<FieldDatePicter
|
||||||
|
label="证件截止日期"
|
||||||
|
name="证件截止日期"
|
||||||
|
:value.sync="userInfo.certiexpiredate"
|
||||||
|
type="date"
|
||||||
|
:flag="true"
|
||||||
|
ref="certiexpiredate"
|
||||||
|
@confirm="onDateConfirm($event, '1')"
|
||||||
|
></FieldDatePicter>
|
||||||
|
<div class="van-hairline--bottom fs14 p10 clearfix">
|
||||||
|
<van-checkbox
|
||||||
|
v-model="userInfo.effectiveDateType"
|
||||||
|
class="fr"
|
||||||
|
:disabled="effectiveDateTypeAble"
|
||||||
|
@change="isEnd"
|
||||||
|
>长期</van-checkbox>
|
||||||
|
</div>
|
||||||
<select-radio
|
<select-radio
|
||||||
:radios="sexRadio"
|
:radios="sexRadio"
|
||||||
label="性别"
|
label="性别"
|
||||||
@@ -31,45 +74,9 @@
|
|||||||
:value.sync="userInfo.birthday"
|
:value.sync="userInfo.birthday"
|
||||||
type="date"
|
type="date"
|
||||||
:flag="true"
|
:flag="true"
|
||||||
@confirm="onDateConfirm($event, '0')"
|
@confirm="onDateConfirm($event, '2')"
|
||||||
ref="birthday"
|
ref="birthday"
|
||||||
></FieldDatePicter>
|
></FieldDatePicter>
|
||||||
<van-field
|
|
||||||
:value="userInfo.idType | idToText('idType')"
|
|
||||||
readonly
|
|
||||||
label="证件类型"
|
|
||||||
name="证件类型"
|
|
||||||
right-icon="arrow"
|
|
||||||
placeholder="请选择"
|
|
||||||
@click="toSelect('2')"
|
|
||||||
/>
|
|
||||||
<van-field v-model="userInfo.customerIdNumber" label="证件号码" name="证件号码" placeholder="请输入"></van-field>
|
|
||||||
<FieldDatePicter
|
|
||||||
label="证件起始日期"
|
|
||||||
name="证件起始日期"
|
|
||||||
:value.sync="userInfo.certificateValidate"
|
|
||||||
type="date"
|
|
||||||
:flag="true"
|
|
||||||
ref="certificateValidate"
|
|
||||||
@confirm="onDateConfirm($event, '1')"
|
|
||||||
></FieldDatePicter>
|
|
||||||
<FieldDatePicter
|
|
||||||
label="证件截止日期"
|
|
||||||
name="证件截止日期"
|
|
||||||
:value.sync="userInfo.certiexpiredate"
|
|
||||||
type="date"
|
|
||||||
:flag="true"
|
|
||||||
ref="certiexpiredate"
|
|
||||||
@confirm="onDateConfirm($event, '2')"
|
|
||||||
></FieldDatePicter>
|
|
||||||
<div class="van-hairline--bottom fs14 p10 clearfix">
|
|
||||||
<van-checkbox
|
|
||||||
v-model="userInfo.effectiveDateType"
|
|
||||||
class="fr"
|
|
||||||
:disabled="effectiveDateTypeAble"
|
|
||||||
@change="isEnd"
|
|
||||||
>长期</van-checkbox>
|
|
||||||
</div>
|
|
||||||
<van-field
|
<van-field
|
||||||
v-model="userInfo.email"
|
v-model="userInfo.email"
|
||||||
label="电子邮箱"
|
label="电子邮箱"
|
||||||
@@ -322,6 +329,7 @@ import areaList from '@/assets/js/utils/area'
|
|||||||
import utilsAge from '@/assets/js/utils/age'
|
import utilsAge from '@/assets/js/utils/age'
|
||||||
import getAreaName from '@/assets/js/utils/get-area-name'
|
import getAreaName from '@/assets/js/utils/get-area-name'
|
||||||
import idNoCheck from '@/assets/js/utils/idNoCheck'
|
import idNoCheck from '@/assets/js/utils/idNoCheck'
|
||||||
|
import { idToData } from '@/views/ebiz/customer/js/verification'
|
||||||
import filter from '@/filters/index'
|
import filter from '@/filters/index'
|
||||||
import { constants } from 'crypto'
|
import { constants } from 'crypto'
|
||||||
import { userInfo } from 'os'
|
import { userInfo } from 'os'
|
||||||
@@ -428,6 +436,8 @@ export default {
|
|||||||
},
|
},
|
||||||
//证件类型校验
|
//证件类型校验
|
||||||
validateIdType() {
|
validateIdType() {
|
||||||
|
// 计算年龄
|
||||||
|
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||||
//证件是身份证
|
//证件是身份证
|
||||||
if (this.userInfo.idType == '1') {
|
if (this.userInfo.idType == '1') {
|
||||||
console.log('证件类型是身份证')
|
console.log('证件类型是身份证')
|
||||||
@@ -437,10 +447,8 @@ export default {
|
|||||||
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.customerSex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.customerSex != 0)) {
|
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.customerSex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.customerSex != 0)) {
|
||||||
return this.$toast('性别录入与身份证不符')
|
return this.$toast('性别录入与身份证不符')
|
||||||
}
|
}
|
||||||
|
|
||||||
//15位身份证第7-12位是生日位, 年月日
|
//15位身份证第7-12位是生日位, 年月日
|
||||||
let birthSign = this.userInfo.customerIdNumber.substr(6, 6)
|
let birthSign = this.userInfo.customerIdNumber.substr(6, 6)
|
||||||
if (this.userInfo.birthday) {
|
|
||||||
if (
|
if (
|
||||||
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
|
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
|
||||||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
|
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
|
||||||
@@ -448,17 +456,14 @@ export default {
|
|||||||
) {
|
) {
|
||||||
return this.$toast('生日录入与身份证不符')
|
return this.$toast('生日录入与身份证不符')
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (this.userInfo.customerIdNumber.length == '18') {
|
} else if (this.userInfo.customerIdNumber.length == '18') {
|
||||||
//18位身份证第17位是性别位, 奇男偶女
|
//18位身份证第17位是性别位, 奇男偶女
|
||||||
let sexSign = this.userInfo.customerIdNumber.substr(16, 1)
|
let sexSign = this.userInfo.customerIdNumber.substr(16, 1)
|
||||||
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.customerSex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.customerSex != 0)) {
|
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.customerSex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.customerSex != 0)) {
|
||||||
return this.$toast('性别录入与身份证不符')
|
return this.$toast('性别录入与身份证不符')
|
||||||
}
|
}
|
||||||
|
|
||||||
//18位身份证第7-14位是生日位, 年月日
|
//18位身份证第7-14位是生日位, 年月日
|
||||||
let birthSign = this.userInfo.customerIdNumber.substr(6, 8)
|
let birthSign = this.userInfo.customerIdNumber.substr(6, 8)
|
||||||
if (this.userInfo.birthday) {
|
|
||||||
if (
|
if (
|
||||||
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
|
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
|
||||||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
|
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
|
||||||
@@ -467,26 +472,58 @@ export default {
|
|||||||
return this.$toast('生日录入与身份证不符')
|
return this.$toast('生日录入与身份证不符')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// 证件号码规则校验
|
||||||
// // 证件号码规则校验
|
|
||||||
if (!idNoCheck.isIdno(this.userInfo.customerIdNumber)) {
|
if (!idNoCheck.isIdno(this.userInfo.customerIdNumber)) {
|
||||||
return this.$toast('您填写的证件号码有误,只能为18位以内数字或字母组合')
|
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 = ''
|
||||||
|
return this.$toast('证件有效期不正常,未满16周岁的公民身份证有效期应小于等于5年')
|
||||||
} else {
|
} else {
|
||||||
//判断婚否
|
this.checkMarr()
|
||||||
if (this.userInfo.birthday && this.userInfo.marriage) {
|
}
|
||||||
this.validateMarr()
|
//年龄在 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 = ''
|
||||||
|
return this.$toast('证件有效期不正常,16周岁至25周岁公民身份证有效期应小于等于10年')
|
||||||
|
} else {
|
||||||
|
this.checkMarr()
|
||||||
|
}
|
||||||
|
//年龄在 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 = ''
|
||||||
|
return this.$toast('证件有效期不正常,26周岁至45周岁公民身份证有效期应小于等于20年')
|
||||||
} else {
|
} else {
|
||||||
this.$parent.updateCustomerInfo()
|
this.$parent.updateCustomerInfo()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
this.$parent.updateCustomerInfo()
|
||||||
}
|
}
|
||||||
//证件是户口本
|
//证件是户口本
|
||||||
} else if (this.userInfo.idType == '2' && this.userInfo.customerIdNumber.length != 18) {
|
} else if (this.userInfo.idType == '2') {
|
||||||
console.log('证件类型是户口本')
|
if (age >= 16) {
|
||||||
|
return this.$toast('客户年龄在16周岁及以上,不能使用户口本作为有效证件')
|
||||||
|
} else if (this.userInfo.customerIdNumber.length != 18) {
|
||||||
return this.$toast('户口本的证件号码长度应等于18位')
|
return this.$toast('户口本的证件号码长度应等于18位')
|
||||||
|
} else {
|
||||||
|
this.checkMarr()
|
||||||
|
}
|
||||||
//证件是出生证明
|
//证件是出生证明
|
||||||
} else if (this.userInfo.idType == '3' && this.userInfo.customerIdNumber.length < 3) {
|
} else if (this.userInfo.idType == '3') {
|
||||||
console.log('证件类型是出生证')
|
if (age >= 3) {
|
||||||
|
return this.$toast('客户年龄在3周岁及以上,不能使用出生证作为有效证件')
|
||||||
|
} else if (this.userInfo.customerIdNumber.length < 3) {
|
||||||
return this.$toast('出生证须大于等于3个字符')
|
return this.$toast('出生证须大于等于3个字符')
|
||||||
|
} else {
|
||||||
|
this.checkMarr()
|
||||||
|
}
|
||||||
//证件是护照
|
//证件是护照
|
||||||
} else if (this.userInfo.idType == '4' && this.userInfo.customerIdNumber.length < 3) {
|
} else if (this.userInfo.idType == '4' && this.userInfo.customerIdNumber.length < 3) {
|
||||||
console.log('证件类型是护照')
|
console.log('证件类型是护照')
|
||||||
@@ -499,23 +536,14 @@ export default {
|
|||||||
} else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.customerIdNumber)) {
|
} else if (!/^(H|M)[0-9]{8}$/.test(this.userInfo.customerIdNumber)) {
|
||||||
return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
|
return this.$toast('证件类型为港澳居民通行证的,证件号码首位字母为"H"/"M",证件号码第2位至第9位为阿拉伯数字')
|
||||||
} else {
|
} else {
|
||||||
//判断婚否
|
this.checkMarr()
|
||||||
if (this.userInfo.birthday && this.userInfo.marriage) {
|
|
||||||
this.validateMarr()
|
|
||||||
} else {
|
|
||||||
this.$parent.updateCustomerInfo()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//证件是台湾居民通行证
|
//证件是台湾居民通行证
|
||||||
} else if (this.userInfo.idType == '6' && this.userInfo.customerIdNumber.length != 8) {
|
} else if (this.userInfo.idType == '6' && this.userInfo.customerIdNumber.length != 8) {
|
||||||
console.log('证件类型是台湾居民通行证')
|
console.log('证件类型是台湾居民通行证')
|
||||||
return this.$toast('证件类型为台湾居民通行证的,证件号码须为8位数字')
|
return this.$toast('证件类型为台湾居民通行证的,证件号码须为8位数字')
|
||||||
} else {
|
} else {
|
||||||
if (this.userInfo.birthday && this.userInfo.marriage) {
|
this.checkMarr()
|
||||||
this.validateMarr()
|
|
||||||
} else {
|
|
||||||
this.$parent.updateCustomerInfo()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//婚否校验
|
//婚否校验
|
||||||
@@ -531,6 +559,13 @@ export default {
|
|||||||
this.$parent.updateCustomerInfo()
|
this.$parent.updateCustomerInfo()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkMarr() {
|
||||||
|
if (this.userInfo.birthday && this.userInfo.marriage) {
|
||||||
|
this.validateMarr()
|
||||||
|
} else {
|
||||||
|
this.$parent.updateCustomerInfo()
|
||||||
|
}
|
||||||
|
},
|
||||||
censusInfo() {
|
censusInfo() {
|
||||||
let area = [{ code: this.userInfo.province }, { code: this.userInfo.city }]
|
let area = [{ code: this.userInfo.province }, { code: this.userInfo.city }]
|
||||||
this.census = getAreaName(area)
|
this.census = getAreaName(area)
|
||||||
@@ -551,19 +586,19 @@ export default {
|
|||||||
if (pickerType == '1') {
|
if (pickerType == '1') {
|
||||||
this.columns = DataDictionary.nativeplace
|
this.columns = DataDictionary.nativeplace
|
||||||
} else if (pickerType == '2') {
|
} else if (pickerType == '2') {
|
||||||
if (this.userInfo.birthday) {
|
|
||||||
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
|
||||||
console.log('年纪', age)
|
|
||||||
if (age >= 3 && age < 16) {
|
|
||||||
this.columns = DataDictionary.birthType
|
|
||||||
} else if (age >= 3 && age >= 16) {
|
|
||||||
this.columns = DataDictionary.insuredIdType
|
|
||||||
} else {
|
|
||||||
this.columns = DataDictionary.idType
|
this.columns = DataDictionary.idType
|
||||||
}
|
// if (this.userInfo.birthday) {
|
||||||
} else {
|
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||||
this.columns = DataDictionary.idType
|
// if (age >= 3 && age < 16) {
|
||||||
}
|
// this.columns = DataDictionary.birthType
|
||||||
|
// } else if (age >= 3 && age >= 16) {
|
||||||
|
// this.columns = DataDictionary.insuredIdType
|
||||||
|
// } else {
|
||||||
|
// this.columns = DataDictionary.idType
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// this.columns = DataDictionary.idType
|
||||||
|
// }
|
||||||
} else if (pickerType == '3') {
|
} else if (pickerType == '3') {
|
||||||
this.columns = DataDictionary.degree
|
this.columns = DataDictionary.degree
|
||||||
// } else if (pickerType == '4') {
|
// } else if (pickerType == '4') {
|
||||||
@@ -588,10 +623,13 @@ export default {
|
|||||||
this.valueKey = value.text
|
this.valueKey = value.text
|
||||||
} else if (this.pickerType == '2') {
|
} else if (this.pickerType == '2') {
|
||||||
;[this.userInfo.idType, this.idType] = [value.id, value.text]
|
;[this.userInfo.idType, this.idType] = [value.id, value.text]
|
||||||
|
this.userInfo.customerIdNumber = this.userInfo.certificateValidate = this.userInfo.certiexpiredate = this.userInfo.birthday = ''
|
||||||
|
this.userInfo.sex = '0'
|
||||||
|
this.effectiveDateTypeAble = false
|
||||||
//身份证,出生证明,护照以外的证件类型可以使用长期
|
//身份证,出生证明,护照以外的证件类型可以使用长期
|
||||||
if (value.id == '1') {
|
if (value.id == '1') {
|
||||||
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||||
this.effectiveDateTypeAble = !(age >= 45)
|
this.effectiveDateTypeAble = age <= 45
|
||||||
} else if (value.id == '2' || value.id == '3') {
|
} else if (value.id == '2' || value.id == '3') {
|
||||||
this.effectiveDateTypeAble = true
|
this.effectiveDateTypeAble = true
|
||||||
} else {
|
} else {
|
||||||
@@ -635,36 +673,9 @@ export default {
|
|||||||
},
|
},
|
||||||
//证件起始截止日期
|
//证件起始截止日期
|
||||||
onDateConfirm(val, type) {
|
onDateConfirm(val, type) {
|
||||||
if (type == '0') {
|
switch (type) {
|
||||||
//出生日期
|
case '0':
|
||||||
if (Date.parse(val) > Date.parse(new Date())) {
|
{
|
||||||
this.userInfo.birthday = ''
|
|
||||||
this.$refs.birthday.date = ''
|
|
||||||
return this.$toast('出生日期不晚于当日')
|
|
||||||
}
|
|
||||||
//长期判断
|
|
||||||
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
|
||||||
if (this.userInfo.idType == '1') {
|
|
||||||
this.effectiveDateTypeAble = !(age >= 45)
|
|
||||||
if (age < 45) {
|
|
||||||
this.userInfo.effectiveDateType = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//年龄大于等于3岁不能使用出生证明
|
|
||||||
if (age >= 3) {
|
|
||||||
if (this.userInfo.idType == '3') {
|
|
||||||
this.userInfo.idType = ''
|
|
||||||
this.$toast('请选择正确的证件类型')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//年龄大于等于16岁不能使用户口本
|
|
||||||
if (age >= 16) {
|
|
||||||
if (this.userInfo.idType == '2') {
|
|
||||||
this.userInfo.idType = ''
|
|
||||||
this.$toast('请选择正确的证件类型')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (type == '1') {
|
|
||||||
//证件起始日期
|
//证件起始日期
|
||||||
//如果录入日期早于出生日期或晚于当前日期
|
//如果录入日期早于出生日期或晚于当前日期
|
||||||
if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) {
|
if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) {
|
||||||
@@ -676,10 +687,10 @@ export default {
|
|||||||
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||||
// 长期按钮是否禁用
|
// 长期按钮是否禁用
|
||||||
this.effectiveDateTypeAble = age <= 45
|
this.effectiveDateTypeAble = age <= 45
|
||||||
// if(age < 45){
|
}
|
||||||
// this.userInfo.effectiveDateType = false
|
break
|
||||||
// }
|
case '1':
|
||||||
} else {
|
{
|
||||||
//证件截止日期
|
//证件截止日期
|
||||||
//如果已经勾选了长期
|
//如果已经勾选了长期
|
||||||
if (this.userInfo.effectiveDateType) {
|
if (this.userInfo.effectiveDateType) {
|
||||||
@@ -695,6 +706,32 @@ export default {
|
|||||||
return this.$toast('您的证件已过期')
|
return this.$toast('您的证件已过期')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break
|
||||||
|
case '2':
|
||||||
|
{
|
||||||
|
//出生日期
|
||||||
|
//如果录入日期晚于当前日期
|
||||||
|
if (Date.parse(val) > Date.parse(new Date())) {
|
||||||
|
this.userInfo.birthday = ''
|
||||||
|
this.$refs.birthday.date = ''
|
||||||
|
return this.$toast('出生日期不晚于当日')
|
||||||
|
}
|
||||||
|
//长期判断
|
||||||
|
if (this.userInfo.idType == '1') {
|
||||||
|
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||||
|
this.effectiveDateTypeAble = age <= 45
|
||||||
|
}
|
||||||
|
//出生证有效期
|
||||||
|
if (this.userInfo.idType == '3') {
|
||||||
|
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(val) > Date.parse('1973-01-01')) {
|
||||||
|
this.userInfo.birthday = ''
|
||||||
|
this.$refs.birthday.date = ''
|
||||||
|
return this.$toast('出生证有效期或出生日期有误')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//长期状态改变时
|
//长期状态改变时
|
||||||
isEnd(val) {
|
isEnd(val) {
|
||||||
@@ -707,6 +744,30 @@ export default {
|
|||||||
this.certiexpiredateRequired = true
|
this.certiexpiredateRequired = true
|
||||||
sessionStorage.setItem('isEnd', '')
|
sessionStorage.setItem('isEnd', '')
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isEndFlag() {
|
||||||
|
let idType = sessionStorage.getItem('idType')
|
||||||
|
let birthday = sessionStorage.getItem('birthday')
|
||||||
|
let age = utilsAge.getAge(birthday, new Date())
|
||||||
|
if (idType == '1') {
|
||||||
|
this.effectiveDateTypeAble = age <= 45
|
||||||
|
} else if (idType == '2' || idType == '3') {
|
||||||
|
this.effectiveDateTypeAble = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getRelatedData(val) {
|
||||||
|
if (this.userInfo.idType != '1') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//如果证件校验不通过,恢复默认值
|
||||||
|
if (idToData(val).text) {
|
||||||
|
;[this.userInfo.customerSex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['0', '', false]
|
||||||
|
return this.$toast(idToData(val).text)
|
||||||
|
}
|
||||||
|
this.userInfo.effectiveDateType = false
|
||||||
|
this.effectiveDateTypeAble = idToData(val).age < 45
|
||||||
|
this.userInfo.birthday = idToData(val).birthday
|
||||||
|
this.userInfo.customerSex = idToData(val).sex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,6 +178,9 @@ export default {
|
|||||||
$this.userInfo.homeProvince = result.homeProvince
|
$this.userInfo.homeProvince = result.homeProvince
|
||||||
$this.userInfo.homeCity = result.homeCity
|
$this.userInfo.homeCity = result.homeCity
|
||||||
$this.userInfo.homeArea = result.homeArea
|
$this.userInfo.homeArea = result.homeArea
|
||||||
|
sessionStorage.setItem('birthday', result.birthday)
|
||||||
|
sessionStorage.setItem('idType', result.customerIdType)
|
||||||
|
this.$refs.formBlock.isEndFlag()
|
||||||
//查询职业名称
|
//查询职业名称
|
||||||
// occupationList.forEach(first => {
|
// occupationList.forEach(first => {
|
||||||
// first.subs.forEach(second => {
|
// first.subs.forEach(second => {
|
||||||
|
|||||||
47
src/views/ebiz/customer/js/verification.js
Normal file
47
src/views/ebiz/customer/js/verification.js
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import changeFifteenToEighteen from '@/assets/js/utils/changeFifteenToEighteen'
|
||||||
|
import idNoCheck from '@/assets/js/utils/idNoCheck'
|
||||||
|
import utilsAge from '@/assets/js/utils/age'
|
||||||
|
|
||||||
|
//身份证带出出生日期,性别,年龄
|
||||||
|
export function idToData(idNo) {
|
||||||
|
// 证件号码规则校验
|
||||||
|
if (idNo && !idNoCheck.isIdno(idNo)) {
|
||||||
|
return {
|
||||||
|
text: '您填写的证件号码有误'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果是15位身份证号先转为18位
|
||||||
|
if (idNo && idNo.length == 15) {
|
||||||
|
idNo = changeFifteenToEighteen(idNo)
|
||||||
|
}
|
||||||
|
let birthday = getBirthById(idNo)
|
||||||
|
let age = utilsAge.getAge(birthday, new Date())
|
||||||
|
let sex = getSexById(idNo)
|
||||||
|
return {
|
||||||
|
birthday,
|
||||||
|
age,
|
||||||
|
sex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBirthById(idNo) {
|
||||||
|
// 获取生日
|
||||||
|
if (idNo) {
|
||||||
|
var year = idNo.substr(6, 4)
|
||||||
|
var month = idNo.substr(10, 2)
|
||||||
|
var day = idNo.substr(12, 2)
|
||||||
|
return year + '-' + month + '-' + day
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSexById(idNo) {
|
||||||
|
// 获取性别
|
||||||
|
if (idNo.charAt(16) >= '0' && idNo.charAt(16) <= '9') {
|
||||||
|
if (parseInt(idNo.charAt(16)) % 2 == 0) {
|
||||||
|
return '1'
|
||||||
|
} else {
|
||||||
|
return '0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user