diff --git a/src/assets/js/utils/data-dictionary.js b/src/assets/js/utils/data-dictionary.js index 9bbca7aa9..822103fad 100644 --- a/src/assets/js/utils/data-dictionary.js +++ b/src/assets/js/utils/data-dictionary.js @@ -3608,5 +3608,12 @@ export default { code: 'legalHolidays', label: '元' } + ], + // 卡单与短期险重新投保选择职业类别时,两个模块职业类型数据的排序不同,创建这个数据字典,用于在选择职业类别时,作为一个参数传入组件, + // 区分当前是卡单中的选择职业,还是短期险重新投保中的选择职业,根据这个值向接口中传入不同参数,查询不同数据 + queryOccupationalByType: [ + { id: '1', text: '卡单' }, + { id: '2', text: '重新投保' } ] + } diff --git a/src/components/ebiz/occipation/OccupationForLoop.vue b/src/components/ebiz/occipation/OccupationForLoop.vue index 25ddcc8c2..9279290be 100644 --- a/src/components/ebiz/occipation/OccupationForLoop.vue +++ b/src/components/ebiz/occipation/OccupationForLoop.vue @@ -66,6 +66,12 @@ export default { type: String, default: '' }, + // 卡单与短期险重新投保选择职业类别时,两个模块中职业类型数据的排序不同,利用这个字段,在下方进行判断区分 + // 1 -- 卡单,2-- 短期险重新投保 + type: { + type: String, + default: '' + }, life: { type: String, default: '' @@ -130,7 +136,7 @@ export default { this.third = {} getBankList({ - operateType: 'hot_occupation' + operateType: this.type == '1' ? 'hot_occupation_card' : 'hot_occupation' }).then(res => { if (res.result == '0') { this.commonList = res.content diff --git a/src/views/ebiz/cardList/information.vue b/src/views/ebiz/cardList/information.vue index 0d73b6fb6..f79ed6531 100644 --- a/src/views/ebiz/cardList/information.vue +++ b/src/views/ebiz/cardList/information.vue @@ -1,28 +1,28 @@ @@ -551,8 +580,10 @@ import CacheUtils from '@/assets/js/utils/cacheUtils' import { idToData } from './js/verification' import OccupationForLoop from '@/components/ebiz/occipation/OccupationForLoop' import { selectComp, getIdentityInfo } from './js/methods' +import dateUtils from '@/assets/js/utils/date-utils' import Vue from 'vue' import { GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant' + DataDictionary.relationToAppnt = DataDictionary.relationToAppnt.slice(0, 4) Vue.use(Checkbox).use(CheckboxGroup) Vue.use(GoodsAction) @@ -578,8 +609,8 @@ export default { }, data() { return { - isLessEighteen:true, //是否小于18周岁(不含) - averageAnnualIncomeFlag:false, // 20210730 年收入不展示且默认为0 核心对年收入有非空校验 + isLessEighteen: true, //是否小于18周岁(不含) + averageAnnualIncomeFlag: false, // 20210730 年收入不展示且默认为0 核心对年收入有非空校验 idLimit: false, //截止日期是否可编辑 idLimitInsured: false, //截止日期是否可编辑--被保人 certiexpiredateRequired: true, //证件截止日期是否需要校验 @@ -658,8 +689,8 @@ export default { homeAddress: '', //详细地址 mobile: '', //移动电话 email: '', //电子邮箱 - schoolName:'', - className:'' + schoolName: '', + className: '' // effectiveDate: '' //指定生效日期 }, //被保人信息 @@ -678,16 +709,16 @@ export default { healthGrade: '', //健康等级 nativeplace: '', //国家地区 marriageStatus: '', //婚姻状况 - marriage:'', + marriage: '', homeProvince: '', //家庭省 homeCity: '', //家庭市 homeArea: '450101', //家庭区 homeName: '', //联系地址 homeAddress: '', //详细地址 mobile: '', //移动电话 - email: '' ,//电子邮箱 - schoolName:'', - className:'' + email: '',//电子邮箱 + schoolName: '', + className: '' }, selectUser: '', areaList: areaList, @@ -706,16 +737,17 @@ export default { occupationName: '', itemProductDTOS: JSON.parse(CacheUtils.getLocItem('itemProductDTOS')), // // showDialog:false, - showField:false, + showField: false, //GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保 showFirstOr: false, - medical:'0', - firstOr:'0', - chooseKind:'', + medical: '0', + firstOr: '0', + chooseKind: '', withRootUser: { load: false, //防止重复请求 - value: false, + value: false }, + occupationalType: DataDictionary.queryOccupationalByType[0].id } }, created() { @@ -740,12 +772,21 @@ export default { // } // }) // } - if (this.itemProductDTOS.productCode === 'GFRS_M0048'||this.itemProductDTOS.productCode === 'GFRS_M0049'||this.itemProductDTOS.productCode === 'GFRS_M0050') { - this.userInfo.relationToInsured = ""; - this.showField=true; + if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' || this.itemProductDTOS.productCode === 'GFRS_M0050') { + this.userInfo.relationToInsured = '' + this.showField = true + let currentTime = dateUtils.formatDate(new Date(),'yyyy-MM-dd') + let currentDataArr = currentTime.split('-') + if (currentDataArr[1] >= 6 && currentDataArr[1] <= 8) { + this.cvaliDate = currentDataArr[0]+'-09-01' + this.onDateConfirm(this.cvaliDate,'6') + }else{ + this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1),'yyyy-MM-dd') + this.onDateConfirm(this.cvaliDate,'6') + } } //GFRS-2641 少儿安康 - if(this.itemProductDTOS.productCode === 'GFRS_M0052'){ + if (this.itemProductDTOS.productCode === 'GFRS_M0052') { this.userInfo.relationToInsured = '3' //GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保 this.showFirstOr = true @@ -753,10 +794,11 @@ export default { this.isLessEighteen = false } this.userInfo.homeName = getAreaName([{ code: 450000 }, { code: 450100 }, { code: 620201 }]) //家庭地址 + this.userInfo.homeName = getAreaName([{ code: this.userInfo.homeProvince = 450000 }, { code: this.userInfo.homeCity = 450100 }, { code: this.userInfo.homeArea = 620201 }]) //家庭地址 }, mounted() { // 2516--除万福卡,投保人、被保险人年收入,默认为0,允许修改 - if(this.itemProductDTOS.productCode !='GFRS_M0032'){ + if (this.itemProductDTOS.productCode != 'GFRS_M0032') { this.userInfo.averageAnnualIncome = '0' } // 筛选按钮的点击事件 @@ -1000,13 +1042,13 @@ export default { this.columns = DataDictionary.salarySource } else if (pickerType == '9') { //与被保人关系限定为:父母 (不可选,枚举值只有一个) - if(this.itemProductDTOS.productCode === 'GFRS_M0048'||this.itemProductDTOS.productCode === 'GFRS_M0049' || - this.itemProductDTOS.productCode === 'GFRS_M0052'){ - this.columns = DataDictionary.relationToAppnt.slice(2,3); - }else if(this.itemProductDTOS.productCode === 'GFRS_M0050'){ - this.columns = DataDictionary.relationToAppnt.slice(0,1).concat(DataDictionary.relationToAppnt.slice(2,3)); - }else{ - this.columns = DataDictionary.relationToAppnt + if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' || + this.itemProductDTOS.productCode === 'GFRS_M0052') { + this.columns = DataDictionary.relationToAppnt.slice(2, 3) + } else if (this.itemProductDTOS.productCode === 'GFRS_M0050') { + this.columns = DataDictionary.relationToAppnt.slice(0, 1).concat(DataDictionary.relationToAppnt.slice(2, 3)) + } else { + this.columns = DataDictionary.relationToAppnt } } else if (pickerType == '66') { this.columns = DataDictionary.marriage @@ -1026,7 +1068,7 @@ export default { this.columns.push({ id: item.proSchemeCode, text: item.proScheme, - label:item.chooseKind + label: item.chooseKind }) } }) @@ -1034,9 +1076,9 @@ export default { //2516--三个学平险--被保险人身份信息选择仅保留“身份证、户口本”,目前选择户口本仍要填写身份证到期 //时间,如果选择户口本项,默认为长期。 //GFRS-2641--少儿安康,证件类型枚举“身份证、户口本” - if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049'|| this.itemProductDTOS.productCode == 'GFRS_M0050' || this.itemProductDTOS.productCode == 'GFRS_M0052'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050' || this.itemProductDTOS.productCode == 'GFRS_M0052') { this.columns = DataDictionary.insuredIdTypeSpecial - }else{ + } else { this.columns = DataDictionary.insuredIdType } } @@ -1082,7 +1124,7 @@ export default { } else if (this.pickerType == '10') { this.proScheme = value.text this.proSchemeCode = value.id - this.chooseKind=value.label + this.chooseKind = value.label for (let item of this.trialList) { if (item.proSchemeCode === this.proSchemeCode) { this.allPrice = item.prem @@ -1095,7 +1137,7 @@ export default { if (value.id != '1') { //2516--三个学平险--被保险人身份信息选择仅保留“身份证、户口本”,目前选择户口本仍要填写身份证到期 //时间,如果选择户口本项,默认为长期。 - if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049'|| this.itemProductDTOS.productCode == 'GFRS_M0050'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050') { this.insuredInfo.effectiveDateType = true } this.effectiveDateTypeAbleInsured = false @@ -1115,159 +1157,153 @@ export default { onDateConfirm(val, type) { console.log(type) switch (type) { - case '0': - { - //证件起始日期 - //如果录入日期早于出生日期或晚于当前日期 - if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) { - this.userInfo.certificateValidate = '' - this.$refs.certificateValidate.date = '' - return this.$toast('证件起始日期填写错误') - } + case '0': { + //证件起始日期 + //如果录入日期早于出生日期或晚于当前日期 + if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) { + this.userInfo.certificateValidate = '' + this.$refs.certificateValidate.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 == '1') { + // let age = utilsAge.getAge(this.userInfo.birthday, new Date()) + // // 长期按钮是否禁用 + // this.effectiveDateTypeAble = age <= 45 + // } + } break - case '1': - { - console.log('证件截止日期') - //证件截止日期 - //如果已经勾选了长期 - if (this.userInfo.effectiveDateType) { - //清空数据并返回 - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return - } - this.userInfo.effectiveDateType = false - //如果录入日期早于当前日期 - if (Date.parse(val) < Date.parse(new Date())) { - this.userInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('您的证件已过期') - } - //不同证件类型的判断 - // if (this.userInfo.idType) { - // //获取年龄 - // let age = utilsAge.getAge(this.userInfo.birthday, new Date()) - // console.log(age) - // //年龄在16-25周岁之间 - // if (age >= 16 && age <= 25) { - // if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { - // this.userInfo.certiexpiredate = '' - // this.$refs.certiexpiredate.date = '' - // return this.$toast('16周岁~25周岁的证件有效期为10年') - // } - // //年龄在26-45周岁之间 - // } else if (age >= 26 && age <= 45) { - // if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { - // this.userInfo.certiexpiredate = '' - // this.$refs.certiexpiredate.date = '' - // return this.$toast('26周岁~45周岁的证件有效期为20年') - // } - // //此外的年龄段不支持 - // } else { - // this.userInfo.certiexpiredate = '' - // this.$refs.certiexpiredate.date = '' - // return this.$toast('身份证不支持此年龄段') - // } - // } + case '1': { + console.log('证件截止日期') + //证件截止日期 + //如果已经勾选了长期 + if (this.userInfo.effectiveDateType) { + //清空数据并返回 + this.userInfo.certiexpiredate = '' + this.$refs.certiexpiredate.date = '' + return } + this.userInfo.effectiveDateType = false + //如果录入日期早于当前日期 + if (Date.parse(val) < Date.parse(new Date())) { + this.userInfo.certiexpiredate = '' + this.$refs.certiexpiredate.date = '' + return this.$toast('您的证件已过期') + } + //不同证件类型的判断 + // if (this.userInfo.idType) { + // //获取年龄 + // let age = utilsAge.getAge(this.userInfo.birthday, new Date()) + // console.log(age) + // //年龄在16-25周岁之间 + // if (age >= 16 && age <= 25) { + // if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) { + // this.userInfo.certiexpiredate = '' + // this.$refs.certiexpiredate.date = '' + // return this.$toast('16周岁~25周岁的证件有效期为10年') + // } + // //年龄在26-45周岁之间 + // } else if (age >= 26 && age <= 45) { + // if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) { + // this.userInfo.certiexpiredate = '' + // this.$refs.certiexpiredate.date = '' + // return this.$toast('26周岁~45周岁的证件有效期为20年') + // } + // //此外的年龄段不支持 + // } else { + // this.userInfo.certiexpiredate = '' + // this.$refs.certiexpiredate.date = '' + // 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) - // } + 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) + // } + } break - case '5': - { - //被保人出生日期 - //如果录入日期晚于当前日期 - if (Date.parse(val) > Date.parse(new Date())) { - this.userInfo.insuredBirthday = '' - this.$refs.insuredBirthday.date = '' - return this.$toast('出生日期不晚于当日') - } - //GFRS-2641-- 被保险人年龄小于18周岁(不含),前端需隐藏手机号码、电子邮箱; - //GFRS-2641--被保险人大于等于18周岁(含),前端需展示手机号码、电子邮箱,且非必填 - let age = utilsAge.getAge(val, new Date()) - if(this.itemProductDTOS.productCode != 'GFRS_M0052'){ - if(age <= 17){ - this.isLessEighteen = false //是否小于18周岁(不含) - }else{ - this.isLessEighteen = true //是否小于18周岁(不含) - } - } - //GFRS-2641--被保险人年龄小于20周岁(不含),婚姻状况默认为未婚; - if(age < 20){ - this.insuredInfo.marriage = '2' - }else{ - this.insuredInfo.marriage = '' + case '5': { + //被保人出生日期 + //如果录入日期晚于当前日期 + if (Date.parse(val) > Date.parse(new Date())) { + this.userInfo.insuredBirthday = '' + this.$refs.insuredBirthday.date = '' + return this.$toast('出生日期不晚于当日') + } + //GFRS-2641-- 被保险人年龄小于18周岁(不含),前端需隐藏手机号码、电子邮箱; + //GFRS-2641--被保险人大于等于18周岁(含),前端需展示手机号码、电子邮箱,且非必填 + let age = utilsAge.getAge(val, new Date()) + if (this.itemProductDTOS.productCode != 'GFRS_M0052') { + if (age <= 17) { + this.isLessEighteen = false //是否小于18周岁(不含) + } else { + this.isLessEighteen = true //是否小于18周岁(不含) } } + //GFRS-2641--被保险人年龄小于20周岁(不含),婚姻状况默认为未婚; + if (age < 20) { + this.insuredInfo.marriage = '2' + } else { + this.insuredInfo.marriage = '' + } + } break - case '6': - { - //指定生效日期 - //如果录入日期晚于当前日期 - if (Date.parse(val) < Date.parse(new Date())) { - return this.$toast('当前日期早于当日') - } - let currentDataArr = val.split('-') - let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' - let insuYear = JSON.parse(localStorage.insuYear) - let insuYearM, productDate, productDateTime - let insuYearD, hoDate - switch (insuYear.insuYearFlag) { - case 'D': - hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 - break - case 'Y': - hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1) - break - } - productDate = new Date(parseInt(hoDate) * 1000) - insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 - insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() - productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' - this.productDate = currentData + '0时至' + productDateTime + '24时止' + case '6': { + //指定生效日期 + //如果录入日期晚于当前日期 + if (Date.parse(val) < Date.parse(new Date())) { + return this.$toast('当前日期早于当日') } + let currentDataArr = val.split('-') + let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日' + let insuYear = JSON.parse(localStorage.insuYear) + let insuYearM, productDate, productDateTime + let insuYearD, hoDate + switch (insuYear.insuYearFlag) { + case 'D': + hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600 + break + case 'Y': + hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1) + break + } + productDate = new Date(parseInt(hoDate) * 1000) + insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1 + insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate() + productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日' + this.productDate = currentData + '0时至' + productDateTime + '24时止' + } break - case '7': - { - console.log('证件截止日期') - //被保人--证件截止日期 - //如果已经勾选了长期 - if (this.insuredInfo.effectiveDateType) { - //清空数据并返回 - this.insuredInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return - } - this.insuredInfo.effectiveDateType = false - //如果录入日期早于当前日期 - if (Date.parse(val) < Date.parse(new Date())) { - this.insuredInfo.certiexpiredate = '' - this.$refs.certiexpiredate.date = '' - return this.$toast('您的证件已过期') - } + case '7': { + console.log('证件截止日期') + //被保人--证件截止日期 + //如果已经勾选了长期 + if (this.insuredInfo.effectiveDateType) { + //清空数据并返回 + this.insuredInfo.certiexpiredate = '' + this.$refs.certiexpiredate.date = '' + return } + this.insuredInfo.effectiveDateType = false + //如果录入日期早于当前日期 + if (Date.parse(val) < Date.parse(new Date())) { + this.insuredInfo.certiexpiredate = '' + this.$refs.certiexpiredate.date = '' + return this.$toast('您的证件已过期') + } + } break } }, @@ -1317,11 +1353,11 @@ export default { this.userInfo.lifeGrade = data.lifeGrade this.userInfo.healthGrade = data.healthGrade - this.userInfo.averageAnnualIncome = this.itemProductDTOS.productCode== 'GFRS_M0032'?data.averageYearlyIncome:'0' //平均年收入 + this.userInfo.averageAnnualIncome = this.itemProductDTOS.productCode == 'GFRS_M0032' ? data.averageYearlyIncome : '0' //平均年收入 //2516--三个学平险--被保险人国籍默认中国,允许修改 - if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049'|| this.itemProductDTOS.productCode == 'GFRS_M0050'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050') { this.userInfo.nativeplace = '1' - }else{ + } else { this.userInfo.nativeplace = data.country } this.userInfo.marriage = data.marryStatus @@ -1356,23 +1392,23 @@ export default { } this.insuredInfo.homeAddress = data.homeAddress //家庭详细地址 //2516--三个学平险--被保险人职业类别默认学生,允许修改。 - if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049'|| this.itemProductDTOS.productCode == 'GFRS_M0050'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050') { this.insuredInfo.occupationCode = '2099907' this.insuredInfo.occupationName = '一般学生' - }else{ + } else { this.insuredInfo.occupationCode = data.occupationCode this.insuredInfo.occupationName = data.occupationName } this.insuredInfo.lifeGrade = data.lifeGrade this.insuredInfo.healthGrade = data.healthGrade //除万福卡,投保人、被保险人年收入填写项去掉,默认为0,卡产品不满足反洗钱识别线 - this.insuredInfo.averageAnnualIncome = this.itemProductDTOS.productCode== 'GFRS_M0032'?data.averageYearlyIncome:'0' //平均年收入 + this.insuredInfo.averageAnnualIncome = this.itemProductDTOS.productCode == 'GFRS_M0032' ? data.averageYearlyIncome : '0' //平均年收入 //2516--三个学平险--被保险人婚姻默认未婚,允许修改 //2516--三个学平险--被保险人国籍默认中国,允许修改 - if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049'|| this.itemProductDTOS.productCode == 'GFRS_M0050'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050') { this.insuredInfo.marriage = '2' this.insuredInfo.nativeplace = '1' - }else{ + } else { this.insuredInfo.marriage = data.marryStatus this.insuredInfo.nativeplace = data.country } @@ -1627,25 +1663,25 @@ export default { // return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定') // } - let insuredInfoAge = utilsAge.getAge(this.insuredInfo.birthday, new Date()) + let insuredInfoAge = utilsAge.getAge(this.insuredInfo.birthday, new Date()) if (this.itemProductDTOS.productCode === 'GFRS_M0049') { //幼儿园:2岁≤被保险人≤7岁 - if(insuredInfoAge<2||insuredInfoAge>7){ + if (insuredInfoAge < 2 || insuredInfoAge > 7) { return this.$toast('被保险人年龄应为2岁-7岁,请重新选择。') } - }else if (this.itemProductDTOS.productCode === 'GFRS_M0048') { + } else if (this.itemProductDTOS.productCode === 'GFRS_M0048') { //义务教育:5岁≤被保险人≤18岁 - if(insuredInfoAge<5||insuredInfoAge>18){ + if (insuredInfoAge < 5 || insuredInfoAge > 18) { return this.$toast('被保险人年龄应为5岁-18岁,请重新选择。') } - }else if (this.itemProductDTOS.productCode === 'GFRS_M0050') { + } else if (this.itemProductDTOS.productCode === 'GFRS_M0050') { //高中及高等教育:15岁≤被保险人≤40岁 - if(insuredInfoAge<15||insuredInfoAge>40){ + if (insuredInfoAge < 15 || insuredInfoAge > 40) { return this.$toast('被保险人年龄应为15岁-40岁,请重新选择。') } - }else if (this.itemProductDTOS.productCode === 'GFRS_M0052') { + } else if (this.itemProductDTOS.productCode === 'GFRS_M0052') { //GFRS-2641--少儿安康:17岁≤被保险人 - if(insuredInfoAge>17){ + if (insuredInfoAge > 17) { return this.$toast('被保险人年龄应为0岁-17岁,请重新选择。') } } @@ -1662,10 +1698,10 @@ export default { return this.$toast('当前投保人是被保险人的父母,投保人年龄需大于被保险人年龄') } } - if (this.userInfo.relationToInsured != '1') { - //投被保人关系不是本人 - //投保人和被保险人的证件信息(证件号码、证件类型)相同时,关系只能是本人,当“是投保人的”枚举为非本人(配偶、父母、子女、其他),但证件号码和本人相同,点击【下一步】提示“投保人和被保人关系不是本人,证件号码不可一致,请修改。” - if(this.userInfo.idNo == this.insuredInfo.idNo && this.userInfo.idType == this.insuredInfo.idType){ + if (this.userInfo.relationToInsured != '1') { + //投被保人关系不是本人 + //投保人和被保险人的证件信息(证件号码、证件类型)相同时,关系只能是本人,当“是投保人的”枚举为非本人(配偶、父母、子女、其他),但证件号码和本人相同,点击【下一步】提示“投保人和被保人关系不是本人,证件号码不可一致,请修改。” + if (this.userInfo.idNo == this.insuredInfo.idNo && this.userInfo.idType == this.insuredInfo.idType) { return this.$toast('投保人和被保人关系不是本人,证件号码不可一致,请修改。') } } @@ -1776,9 +1812,9 @@ export default { proSchemeCode: this.proSchemeCode, insuYear: insuYearDate.insuYear, insuYearFlag: insuYearDate.insuYearFlag, - firstOr:this.firstOr, - medical:this.medical, - chooseKind:this.chooseKind + firstOr: this.firstOr, + medical: this.medical, + chooseKind: this.chooseKind } if (item.hasPredictTransferPrem && item.hasPredictTransferPrem === '0') { //增加万能险 预计转入保费校验 @@ -1914,22 +1950,22 @@ export default { this.insuredInfo.sex = idToData(val).sex //GFRS-2641-- 被保险人年龄小于18周岁(不含),前端需隐藏手机号码、电子邮箱; //GFRS-2641--被保险人大于等于18周岁(含),前端需展示手机号码、电子邮箱,且非必填 - if(this.insuredInfo.birthday){ - let age = utilsAge.getAge(this.insuredInfo.birthday, new Date()) - if(this.itemProductDTOS.productCode != 'GFRS_M0052'){ - if(age <= 17){ - this.isLessEighteen = false //是否小于18周岁(不含) - }else{ - this.isLessEighteen = true //是否小于18周岁(不含) - } + if (this.insuredInfo.birthday) { + let age = utilsAge.getAge(this.insuredInfo.birthday, new Date()) + if (this.itemProductDTOS.productCode != 'GFRS_M0052') { + if (age <= 17) { + this.isLessEighteen = false //是否小于18周岁(不含) + } else { + this.isLessEighteen = true //是否小于18周岁(不含) } - //GFRS-2641--被保险人年龄小于20周岁(不含),婚姻状况默认为未婚; - if(age < 20){ - this.insuredInfo.marriage = '2' - }else{ - this.insuredInfo.marriage = '' - } - } + } + //GFRS-2641--被保险人年龄小于20周岁(不含),婚姻状况默认为未婚; + if (age < 20) { + this.insuredInfo.marriage = '2' + } else { + this.insuredInfo.marriage = '' + } + } } } }, @@ -1949,52 +1985,55 @@ export default { Object.assign(this.insuredInfo, this.userInfo) } else { this.insuredInfo = { - name: '', // 被保人姓名 - idType: '1', //被保人证件类型 - idNo: '', //被保人证件号码 - sex: '0', //被保人性别 - birthday: '', //被保人出生日期 - occupationCode: '', //职业代码 - occupationName: '', //职业名称 - lifeGrade: '', //寿险等级 - healthGrade: '', //健康等级 - nativeplace: '1', //国家地区 - marriageStatus: '', //婚姻状况 - homeProvince: '', //家庭省 - homeCity: '', //家庭市 - homeArea: '450101', //家庭区 - homeName: '', //联系地址 - homeAddress: '', //详细地址 - mobile: '', //移动电话 - email: '', //电子邮箱 - effectiveDateType:false //是否长期 - } + name: '', // 被保人姓名 + idType: '1', //被保人证件类型 + idNo: '', //被保人证件号码 + sex: '0', //被保人性别 + birthday: '', //被保人出生日期 + occupationCode: '', //职业代码 + occupationName: '', //职业名称 + lifeGrade: '', //寿险等级 + healthGrade: '', //健康等级 + nativeplace: '1', //国家地区 + marriageStatus: '', //婚姻状况 + homeProvince: '', //家庭省 + homeCity: '', //家庭市 + homeArea: '450101', //家庭区 + homeName: '', //联系地址 + homeAddress: '', //详细地址 + mobile: '', //移动电话 + email: '', //电子邮箱 + effectiveDateType: false //是否长期 + } // 2516--三款学平险-- 0048义务教育 0049 幼儿园 0050 高中 // GFRS-2641--被保险人职业:幼儿园版默认学龄前儿童,义务教育、高中/高等教育默认一般学生 // 被保险人婚姻默认未婚,允许修改 // 被保险人手机及邮箱默认投保人,允许修改 - if(this.itemProductDTOS.productCode == 'GFRS_M0048'|| this.itemProductDTOS.productCode == 'GFRS_M0050'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0050') { this.insuredInfo.occupationCode = '2099907' this.insuredInfo.occupationName = '一般学生' this.insuredInfo.marriage = '2' this.insuredInfo.mobile = this.userInfo.mobile this.insuredInfo.email = this.userInfo.email - }else if(this.itemProductDTOS.productCode == 'GFRS_M0049'){ + } else if (this.itemProductDTOS.productCode == 'GFRS_M0049') { + this.insuredInfo.idType = '2' + this.insuredInfo.effectiveDateType = true this.insuredInfo.occupationCode = '2099908' this.insuredInfo.occupationName = '学龄前儿童' } // GFRS-2641--少儿安康,默认户口本,且户口本证件截止日期默认长期 - if(this.itemProductDTOS.productCode == 'GFRS_M0052'){ + if (this.itemProductDTOS.productCode == 'GFRS_M0052') { this.insuredInfo.idType = '2' - this.insuredInfo.certiexpiredate = '' + this.insuredInfo.certiexpiredate = '' this.insuredInfo.effectiveDateType = true + this.insuredInfo.occupationCode = '2099907' this.insuredInfo.occupationName = '一般学生' this.insuredInfo.marriage = '2' } // 2516--除万福卡,投保人、被保险人年收入,默认为0,允许修改 - if(this.itemProductDTOS.productCode !='GFRS_M0032'){ + if (this.itemProductDTOS.productCode != 'GFRS_M0032') { this.insuredInfo.averageAnnualIncome = '0' } if (newV === 2) { @@ -2029,41 +2068,50 @@ export default { deep: true }, async 'withRootUser.value'(n) { - this.insuredInfo.homeName = getAreaName([ - { code: this.userInfo.homeProvince }, - { code: this.userInfo.homeCity }, - { code: this.userInfo.homeArea }, - ]) - this.insuredInfo.homeProvince = this.userInfo.homeProvince - this.insuredInfo.homeCity = this.userInfo.homeCity - this.insuredInfo.homeArea = this.userInfo.homeArea - this.insuredInfo.homeAddress = this.userInfo.homeAddress - }, + if (n) { + this.insuredInfo.homeName = getAreaName([ + { code: this.userInfo.homeProvince }, + { code: this.userInfo.homeCity }, + { code: this.userInfo.homeArea } + ]) + this.insuredInfo.homeProvince = this.userInfo.homeProvince + this.insuredInfo.homeCity = this.userInfo.homeCity + this.insuredInfo.homeArea = this.userInfo.homeArea + this.insuredInfo.homeAddress = this.userInfo.homeAddress + } else { + this.insuredInfo.homeName = this.insuredInfo.homeAddress = '' + } + } } } -