Merge branch '【0609】证件有效期hm' into feature/GFRS-1377【待确定】契约、保全、理赔业务操作平台增加证件有效期校验规则

This commit is contained in:
yuweiqi
2020-06-15 09:47:37 +08:00
3 changed files with 56 additions and 18 deletions

View File

@@ -6,7 +6,8 @@ export default {
getAgeByBirth: function(value, today) { getAgeByBirth: function(value, today) {
return this.getAgeByValue(value, today) return this.getAgeByValue(value, today)
}, },
getAgeByValue: function(value, today) { getAgeByValue: function(value = '', today) {
// value: 身份证号码获取的生日, today: 当前的时间
var b = value.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/) var b = value.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/)
if (b == null) { if (b == null) {
return null return null

View File

@@ -61,11 +61,13 @@
v-validate="certiexpiredateRequired ? 'required' : ''" v-validate="certiexpiredateRequired ? 'required' : ''"
required required
label="证件截止日期" label="证件截止日期"
:minDate="new Date(new Date().getTime() + 24 * 60 * 60 * 1000)"
:maxDate="new Date('2060-12-31')"
name="证件截止日期" name="证件截止日期"
:defaultDate="new Date()" :defaultDate="new Date()"
:value.sync="userInfo.certiTypeEndDate" :value.sync="userInfo.certiTypeEndDate"
type="date" type="date"
@confirm="onEndDateConfirm($event, '1')" @confirm="onEndDateConfirm"
ref="certiTypeEndDate" ref="certiTypeEndDate"
:flag="true" :flag="true"
></FieldDatePicter> ></FieldDatePicter>
@@ -241,16 +243,14 @@ export default {
}, },
created() { created() {
this.judge() this.judge()
if(localStorage.businessNo && localStorage.claimsClear){ if (localStorage.businessNo && localStorage.claimsClear) {
this.init() this.init()
localStorage.claimsClear = '' localStorage.claimsClear = ''
}else{ } else {
localStorage.setItem('businessNo', '') localStorage.setItem('businessNo', '')
} }
}, },
mounted() { mounted() {
// localStorage.setItem('businessNo', '')
console.log('mounted ==', localStorage.businessNo)
document.body.style.backgroundColor = '#fff' document.body.style.backgroundColor = '#fff'
// 筛选按钮的点击事件 // 筛选按钮的点击事件
window.appCallBack = this.appCallBack window.appCallBack = this.appCallBack
@@ -263,24 +263,22 @@ export default {
next() next()
}, },
methods: { methods: {
init(){ init() {
if (localStorage.businessNo) { if (localStorage.businessNo) {
this.userInfo.businessNo = localStorage.businessNo this.userInfo.businessNo = localStorage.businessNo
} }
let data = { let data = {
slaveStatus: this.slaveStatus, slaveStatus: this.slaveStatus,
businessNo: this.userInfo.businessNo businessNo: this.userInfo.businessNo
} }
query(data).then(res => { query(data).then(res => {
if (res.result == 0) { if (res.result == 0) {
console.log(res)
this.userInfo = res.content.claimApplyInsuredReqDTO this.userInfo = res.content.claimApplyInsuredReqDTO
this.userInfo.province = this.userInfo.insuredProvince this.userInfo.province = this.userInfo.insuredProvince
this.userInfo.city = this.userInfo.insuredCity this.userInfo.city = this.userInfo.insuredCity
this.userInfo.area = this.userInfo.insuredCounty this.userInfo.area = this.userInfo.insuredCounty
this.areaName = getAreaName([{ code: this.userInfo.province }, { code: this.userInfo.city }, { code: this.userInfo.area }]) this.areaName = getAreaName([{ code: this.userInfo.province }, { code: this.userInfo.city }, { code: this.userInfo.area }])
} }
}) })
}, },
//判断是否由客户报案历史进入,客户信息反显 //判断是否由客户报案历史进入,客户信息反显
@@ -300,23 +298,62 @@ export default {
} }
}, },
//校验证件截止日期 //校验证件截止日期
onEndDateConfirm(val, type) { onEndDateConfirm(val) {
// 判断身份证号码是否为空, 为空提示并返回
if (this.userInfo.certiCode == '') {
this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = ''
return this.$toast('请先填写证件号码')
}
//如果已经勾选了长期 //如果已经勾选了长期
if (this.userInfo.effectiveDateType) { if (this.effectiveDateType) {
//清空数据并返回 //清空数据并返回
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return return
} }
// 如果有效日期早与当前日期
if (Date.parse(val) < Date.parse(new Date())) { if (Date.parse(val) < Date.parse(new Date())) {
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = '' this.$refs.certiTypeEndDate.date = ''
return this.$toast('您的证件已过期') return this.$toast('您的证件已过期')
} }
if (this.userInfo.certiType == '1') {
//获取年龄
let age = utilsAge.getAge(this.userInfo.insuredBirthday, new Date())
// 年龄小于16周岁
if (age <= 15) {
if (new Date(val).getFullYear() - new Date().getFullYear() != 5) {
this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁以下的证件有效期为5年')
}
//年龄在16-25周岁之间
} else if (age >= 16 && age <= 25) {
if (new Date(val).getFullYear() - new Date().getFullYear() != 10) {
this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = ''
return this.$toast('16周岁~25周岁的证件有效期为10年')
}
//年龄在26-45周岁之间
} else if (age >= 26 && age <= 45) {
if (new Date(val).getFullYear() - new Date().getFullYear() != 20) {
this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = ''
return this.$toast('26周岁~45周岁的证件有效期为20年')
}
//此外的年龄段不支持
} else {
this.userInfo.certiTypeEndDate = ''
this.$refs.certiTypeEndDate.date = ''
return this.$toast('身份证不支持此年龄段')
}
}
}, },
//失焦验证身份证 //失焦验证身份证
getRelatedData(val) { getRelatedData(val) {
if (this.userInfo.certiType != '1') { // 判断是否是身份证类型和是否为空
if (this.userInfo.certiType != '1' || !val) {
return return
} }
//如果证件校验不通过,恢复默认值 //如果证件校验不通过,恢复默认值
@@ -326,6 +363,7 @@ export default {
} }
this.effectiveDateType = false this.effectiveDateType = false
this.userInfo.certiIsLong = '0' this.userInfo.certiIsLong = '0'
this.userInfo.insuredBirthday = idToData(val).birthday
this.userInfo.insuredSex = idToData(val).sex this.userInfo.insuredSex = idToData(val).sex
this.effectiveDateTypeAble = idToData(val).age <= 45 this.effectiveDateTypeAble = idToData(val).age <= 45
}, },
@@ -391,7 +429,7 @@ export default {
this.effectiveDateType = false this.effectiveDateType = false
this.userInfo.certiTypeEndDate = '' this.userInfo.certiTypeEndDate = ''
this.userInfo.certiIsLong = this.effectiveDateType ? '1' : '0' this.userInfo.certiIsLong = this.effectiveDateType ? '1' : '0'
let age = utilsAge.getAge(this.userInfo.certiCode, new Date()) let age = utilsAge.getAge(this.userInfo.insuredBirthday, new Date())
this.effectiveDateTypeAble = age <= 45 this.effectiveDateTypeAble = age <= 45
} }
this.userInfo.certiType = value.id this.userInfo.certiType = value.id

View File

@@ -52,7 +52,6 @@ function closeBtn(that) {
* @param {*} type 1 投保人 2 被保险人 * @param {*} type 1 投保人 2 被保险人
*/ */
export function getIdentityInfo(that, data, type) { export function getIdentityInfo(that, data, type) {
console.log(data)
// 正面 // 正面
if (data.name && data.name != '待识别') { if (data.name && data.name != '待识别') {
that.userInfo.name = data.name that.userInfo.name = data.name