// insuredInfo.vue; insuredPersonInfo.vue; addBeneficiaryInfo.vue 方法抽取 import DataDictionary from '@/assets/js/utils/data-dictionary' import utilsAge from '@/assets/js/utils/age' import dateUtils from '@/assets/js/utils/date-utils' import { saveOrUpdateOrderInfo, getAuthCode, getOrderDetail } from '@/api/ebiz/sale/sale' import getAreaName from '@/assets/js/utils/get-area-name' // import idNoCheck from '@/assets/js/utils/idNoCheck' import { idToData } from './verification' import CacheUtils from '@/assets/js/utils/cacheUtils' let relationToInsured = [ { id: 2, text: '配偶' }, { id: 3, text: '父母' }, { id: 4, text: '子女' }, { id: 5, text: '其他' } ] //点击弹出组件 export function selectComp(that, index, type = '') { console.log(index) that.currentPopupIndex = index let title = '' if (index == 1) { ;[that.customerShowPicker, title] = [true, '客户列表'] } else if (index == 2) { ;[that.occupationShowPicker, title] = [true, '职业类别'] } else if (index == 3) { if (type == '1') { //投保人 CacheUtils.setLocItem('scanFromInsured','true') } else if (type == '2') { //被保险人 CacheUtils.setLocItem('scanFromInsured','false') } ;[that.isScan, title] = [true, '身份证扫描'] } else if (index == 4) { CacheUtils.setLocItem('scanFromInsured','0') ;[that.bankisScan, title] = [true, '银行卡扫描'] } setTimeout(() => { that.$jump({ flag: 'navigation', extra: { title, hiddenLeft: '1' } }) closeBtn(that) }, 400) } // 关闭按钮的显示 function closeBtn(that) { that.$jump({ flag: 'webview_right_button', extra: { btns: [ { img: that.$assetsUrl + 'images/del-close.png', route: { flag: '', extra: {} } } ] } }) } // appCallBack回调 /** * * @param {*} that 上下文 * @param {String} type 1 投保人; 2 被保险人; 3 受益人 */ export function appCallBack(that, type) { return function() { let title switch (type) { case '1': title = '投保人信息' break case '2': title = '被保险人信息' break case '3': title = '指定受益人信息' break } console.log(that.currentPopupIndex) // 筛选按钮的点击事件 that.$jump({ flag: 'navigation', extra: { title, hiddenRight: '1' } }) if (that.currentPopupIndex == 1) { that.customerShowPicker = false } else if (that.currentPopupIndex == 2) { that.occupationShowPicker = false } else if (that.currentPopupIndex == 3) { that.isScan = false } else if (that.currentPopupIndex == 4) { that.bankisScan = false } } } //职业类别选择 export function chooseOccupation(that, type) { // return function() { let title switch (type) { case '1': title = '投保人信息' break case '2': title = '被保险人信息' break case '3': title = '指定受益人信息' break } that.$jump({ flag: 'navigation', extra: { title, hiddenRight: '1' } }) that.occupationShowPicker = false } //弹框选择 /** * * @param {*} that 上下文 * @param {*} pickerType 弹框类型 * @param {*} valueKey 弹框编号 * @param {*} type 1 投保人; 2 被保险人; 3 受益人 */ export function toSelect(that, pickerType, valueKey, type) { //pickerType 1、民族 2、证件类型 3、文化程度 4、有无社保(弃用) 5、税收居民身份 6、婚姻状况 7、在职情况 ;[that.popupShow, that.pickerType] = [true, pickerType] if (valueKey) that.valueKey = valueKey if (pickerType == '1') { that.columns = DataDictionary.nationType } else if (pickerType == '2') { that.columns = type == '1' ? DataDictionary.rsIdType : DataDictionary.idType } else if (pickerType == '3') { that.columns = DataDictionary.rshealthCondition } else if (pickerType == '4') { that.columns = DataDictionary.rsmarriage } else if (pickerType == '5') { that.columns = DataDictionary.rspoliticsStatus } else if (pickerType == '6') { // console.log(that.colums) that.columns = DataDictionary.rsdegree } else if (pickerType == '7') { switch (type) { case '1': that.columns = DataDictionary.workCondition break case '2': that.columns = DataDictionary.relationToAppnt break case '3': that.columns = relationToInsured break } } else if (pickerType == '8') { that.columns = DataDictionary.workCondition } else if (pickerType == '10') { that.columns = DataDictionary.rsnativePlace } else if (pickerType == '11') { that.columns = DataDictionary.oldOccupation } else if (pickerType == '12') { that.columns = DataDictionary.rsnativeplace } else if (pickerType == '13') { that.columns = DataDictionary.applGrade } else if (pickerType == '14') { that.columns = DataDictionary.rsnativePlace } else if (pickerType == '15') { that.columns = DataDictionary.rshealthCondition } } //确认选择字段 /** * * @param {*} that 上下文 * @param {*} value 值 * @param {*} type 1 投保人 2 被保险人 3 受益人 */ export function onConfirm(that, value, type) { that.popupShow = false if (that.pickerType == '1') { that.userInfo.ethnic = value.id } else if (that.pickerType == '2') { //清空证件号码, 证件起始日期, 证件截止日期, 生日, 性别 that.userInfo.idNo = that.userInfo.certificateValidate = that.userInfo.certiexpiredate = that.userInfo.birthday = '' that.userInfo.sex = '0' if (type != '1') { that.idLimit = false that.effectiveDateTypeAble = false } //身份证以外的证件类型可以使用长期 if (value.id == '1') { let age = utilsAge.getAge(that.userInfo.birthday, new Date()) that.effectiveDateTypeAble = age <= 45 } else if (value.id == 2 || value.id == 3) { that.effectiveDateTypeAble = true } else { that.effectiveDateTypeAble = false } type == '3' ? ([that.userInfo.idType, that.idType] = [value.id, value.text]) : (that.userInfo.idType = value.id) } else if (that.pickerType == '3') { that.userInfo.sameTrade = value.id } else if (that.pickerType == '4') { that.userInfo.marriage = value.id } else if (that.pickerType == '5') { that.userInfo.political = value.id } else if (that.pickerType == '6') { that.userInfo.degree = value.id } else if (that.pickerType == '7') { switch (type) { case '1': that.userInfo.jobStatus = value.id break case '2': { //如果关系是本人 if (value.id == 1) { //获取订单详情 getOrderDetail({ orderNo: CacheUtils.getLocItem('orderNo') }).then(res => { if (res.result == 0) { that.isAppnt = true //获取投保人信息 let insuredInfo = res.orderDTO.appntDTO //清空验证码 insuredInfo.authCode = '' for (let key in that.userInfo) { that.userInfo[key] = insuredInfo[key] } that.userInfo.birthday = insuredInfo.birthday //户籍 that.sureArea( [ { code: insuredInfo.householdProvince }, { code: insuredInfo.householdCity } ], '3' ) //单位地址 that.sureArea( [ { code: insuredInfo.companyProvince }, { code: insuredInfo.companyCity }, { code: insuredInfo.companyArea } ], '1' ) //家庭地址 that.sureArea( [ { code: insuredInfo.homeProvince }, { code: insuredInfo.homeCity }, { code: insuredInfo.homeArea } ], '2' ) //是否长期 if (insuredInfo.effectiveDateType == 'false') { that.userInfo.effectiveDateType = false } else { that.userInfo.effectiveDateType = true that.userInfo.certiexpiredate = '' that.$refs.certiexpiredate.date = '' } //数据不是从用户列表拉取 that.fromCustomer = false that.userInfo.relationToAppnt = value.id //长期判断 if (that.userInfo.idType == '1') { // 计算年龄 let age = utilsAge.getAge(that.userInfo.birthday, new Date()) // 长期按钮是否禁用 that.effectiveDateTypeAble = age <= 45 } } else { that.$toast(res.resultMessage) } }) } else { that.isAppnt = false //数据是否从用户列表拉取 if (that.fromCustomer) { return (that.userInfo.relationToAppnt = value.id) } //如果关系不是本人(选了本人之后修改), 清空 userInfo 信息 for (var key in that.userInfo) { if (!['rsnationType', 'sex', 'idType', 'effectiveDateType', 'medical'].includes(key)) { that.userInfo[key] = '' } } that.userInfo.effectiveDateType = false that.effectiveDateTypeAble = false that.areaName = that.homeName = that.census = '' that.userInfo.relationToAppnt = value.id } } break case '3': { //如果受益人是被保险人本人 if (value.id == 1) { //获取投保人数据 getOrderDetail({ orderNo: CacheUtils.getLocItem('orderNo') }).then(res => { if (res.result == 0) { that.isInsured = true //获取被保险人信息 let insuredInfo = res.orderDTO.insuredDTOs[0] for (let key in that.userInfo) { that.userInfo[key] = insuredInfo[key] } setTimeout(() => { that.userInfo.city = insuredInfo.homeCity //家庭市 that.userInfo.area = insuredInfo.homeArea //家庭区 that.userInfo.province = insuredInfo.homeProvince //家庭省 that.areaName = getAreaName([ { code: insuredInfo.homeProvince }, { code: insuredInfo.homeCity }, { code: insuredInfo.homeArea } ]) //家庭地址 that.userInfo.village = insuredInfo.homeAddress //家庭详细地址 }, 0) //受益人类型 that.userInfo.bnfType = '0' //是否长期 that.userInfo.effectiveDateType = insuredInfo.effectiveDateType == 'false' ? false : true //受益顺序 that.userInfo.bnfOrder = '1' //长期判断 if (that.userInfo.idType == '1') { // 计算年龄 let age = utilsAge.getAge(that.userInfo.birthday, new Date()) // 长期按钮是否禁用 that.effectiveDateTypeAble = age <= 45 } } else { that.$toast(res.resultMessage) } ;[that.userInfo.relationToInsured, that.relationToAppnt] = [value.id, value.text] }) } else { that.isInsured = false for (var key in that.userInfo) { if (!['rsnationType', 'sex', 'idType', 'bnfOrder', 'bnfType'].includes(key)) { that.userInfo[key] = '' } } that.areaName = '' ;[that.userInfo.relationToInsured, that.relationToAppnt] = [value.id, value.text] } } break } } else if (that.pickerType == '8') { that.userInfo.jobStatus = value.id } else if (that.pickerType == '10') { that.userInfo.rgtAddress = value.id } else if (that.pickerType == '11') { that.userInfo.oldOccupation = value.id } else if (that.pickerType == '12') { that.userInfo.nationality = value.id } else if (that.pickerType == '13') { that.userInfo.applGrade = value.id } else if (that.pickerType == '14') { that.userInfo.nativePlace = value.id } else if (that.pickerType == '15') { that.userInfo.foreigners = value.id } } //日期确认 /** * * @param {*} that 上下文 * @param {*} val 日期值 * @param {*} type 0 证件起始日期; 1 证件截止日期; 2 出生日期 */ export function onDateConfirm(that, val, type) { console.log(type) switch (type) { case '0': { //证件起始日期 //如果录入日期早于出生日期或晚于当前日期 if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(that.userInfo.birthday)) { that.userInfo.certificateValidate = '' that.$refs.certificateValidate.date = '' return that.$toast('证件起始日期填写错误') } // 计算年龄 let age = utilsAge.getAge(that.userInfo.birthday, new Date()) // 长期按钮是否禁用 that.effectiveDateTypeAble = age <= 45 } break case '1': { console.log('证件截止日期') //证件截止日期 //如果已经勾选了长期 if (that.userInfo.effectiveDateType) { //清空数据并返回 that.userInfo.certiexpiredate = '' that.$refs.certiexpiredate.date = '' return } //如果录入日期早于当前日期 if (Date.parse(val) < Date.parse(new Date())) { that.userInfo.certiexpiredate = '' that.$refs.certiexpiredate.date = '' return that.$toast('您的证件已过期') } //不同证件类型的判断 // if (that.userInfo.idType) { // //获取年龄 // let age = utilsAge.getAge(that.userInfo.birthday, new Date()) // console.log(age) // //年龄在16-25周岁之间 // if (age >= 16 && age <= 25) { // if (new Date(val).getFullYear() - new Date(that.userInfo.certificateValidate).getFullYear() != 10) { // that.userInfo.certiexpiredate = '' // that.$refs.certiexpiredate.date = '' // return that.$toast('16周岁~25周岁的证件有效期为10年') // } // //年龄在26-45周岁之间 // } else if (age >= 26 && age <= 45) { // if (new Date(val).getFullYear() - new Date(that.userInfo.certificateValidate).getFullYear() != 20) { // that.userInfo.certiexpiredate = '' // that.$refs.certiexpiredate.date = '' // return that.$toast('26周岁~45周岁的证件有效期为20年') // } // //此外的年龄段不支持 // } else { // that.userInfo.certiexpiredate = '' // that.$refs.certiexpiredate.date = '' // return that.$toast('身份证不支持此年龄段') // } // } } break case '2': { //出生日期 //如果录入日期晚于当前日期 if (Date.parse(val) > Date.parse(new Date())) { that.userInfo.birthday = '' that.$refs.birthday.date = '' return that.$toast('出生日期不晚于当日') } //长期判断 if (that.userInfo.idType == '1') { let age = utilsAge.getAge(that.userInfo.birthday, new Date()) that.effectiveDateTypeAble = age <= 45 } //出生证有效期 if (that.userInfo.idType == '3' && that.userInfo.idNo.length != 15 && that.userInfo.idNo.length != 18) { let exipreDate = Date.parse(val) + Date.parse('1972-12-31') that.userInfo.certificateValidate = val that.userInfo.certiexpiredate = that.timeStampFormat(exipreDate) that.idLimit = true } // 由日期算周岁 let age = dateUtils.jsGetAge(val) that.userInfo.age = age } break } } //拉取客户列表信息 /** * * @param {*} that 上下文 * @param {*} data 客户列表数据 * @param {*} type 1 投保人; 2 被保险人; 3 受益人 */ export function chooseCustomer(that, data, type) { let title switch (type) { case '1': title = '投保人信息' break case '2': title = '被保险人信息' break case '3': title = '指定受益人信息' break } that.customerShowPicker = false that.$jump({ flag: 'navigation', extra: { title, hiddenRight: '1' } }) that.userInfo.name = data.customerName //用户名 that.userInfo.sex = String(data.customerSex) //性别 that.userInfo.rsnationType = data.country //国家地区 that.userInfo.birthday = data.birthday //出生日期 that.userInfo.idType = data.customerIdType //证件类型 that.userInfo.idNo = data.customerIdNumber //证件类别 that.userInfo.certificateValidate = data.idEffectStartDate //证件起始日期 that.userInfo.certiexpiredate = data.idEffectEndDate //证件截止日期 that.userInfo.effectiveDateType = data.idEffectEndDate == '9999-01-01' //是否长期 that.userInfo.occupationCode = data.occupationCode //职业类别编码 that.userInfo.occupationName = data.occupationName //职业类别名称 that.userInfo.lifeGrade = data.lifeGrade //寿险等级 that.userInfo.healthGrade = data.healthGrade //健康等级 that.userInfo.mobile = data.customerPhone //移动电话 that.userInfo.email = data.email //电子邮箱 if (data.companyProvince.length) { that.areaName = getAreaName([ { code: data.companyProvince }, { code: data.companyCity }, { code: data.companyArea } ]) //单位地址 } if (type != '3') { that.userInfo.stature = data.height //身高 that.userInfo.avoirdupois = data.weight //体重 that.userInfo.rshealthCondition = data.educationLevel //教育水平 that.userInfo.medical = data.socialSecurity //有无社保 that.userInfo.taxResidentId = data.residentStatus //税收居民身份 that.userInfo.averageAnnualIncome = data.averageYearlyIncome //平均年收入 that.userInfo.workcompany = data.workUnits //工作单位 that.userInfo.jobStatus = data.jobStatus //工作情况 that.userInfo.marriage = data.marryStatus //婚姻状况 that.userInfo.familyAnnualIncome = data.familyAnnualIncome //家庭年收入 that.userInfo.liabilitiesMoney = data.liabilitiesMoney //负债金额 that.userInfo.companyProvince = data.companyProvince //单位省 that.userInfo.companyCity = data.companyCity //单位市 that.userInfo.companyArea = data.companyArea //单位区 that.userInfo.companyAddress = data.companyAddress //单位详细地址 that.userInfo.companyZip = data.companyZip //单位邮编 that.userInfo.companyPhone = data.companyPhone //单位电话 that.userInfo.homeProvince = data.homeProvince //家庭省 that.userInfo.homeCity = data.homeCity //家庭市 that.userInfo.homeArea = data.homeArea //家庭区 that.userInfo.homeAddress = data.homeAddress //家庭详细地址 that.userInfo.homeZip = data.homeZip //家庭邮编 that.userInfo.homePhone = data.homePhone //家庭电话 that.userInfo.householdProvince = data.province //户籍省 that.userInfo.householdCity = data.city //户籍市 if (data.province.length) { that.census = getAreaName([ { code: data.province }, { code: data.city } ]) //户籍 } if (data.homeProvince.length) { that.homeName = getAreaName([ { code: data.homeProvince }, { code: data.homeCity }, { code: data.homeArea } ]) //家庭地址 } } else { that.userInfo.province = data.homeProvince //家庭省 that.userInfo.city = data.homeCity //家庭市 that.userInfo.area = data.homeArea //家庭区 that.userInfo.village = data.homeAddress //家庭详细地址 } // 计算年龄 let age = utilsAge.getAge(that.userInfo.birthday, new Date()) // 长期按钮是否禁用 that.effectiveDateTypeAble = age <= 45 //数据是否从客户列表拉取 that.fromCustomer = true } //下一步 /** * * @param {*} that 上下文 * @param {*} type 1 投保人; 2 被保险人; 3 受益人 */ export function nextStep(that, type) { //表单校验, 成功跳转 that.$jump({ flag: 'h5', extra: { url: location.origin + `/#/agentEenter/basicEdu` }, routerInfo: { path: `/agentEenter/basicEdu` } }) // that.$validator.validate().then(valid => { // if (true === valid) { // // 计算年龄 // that.$jump({ // flag: 'goBack', // extra: { // refresh: '1' // // url: location.origin + '/#/sale/beneficiary' // }, // routerInfo: { // path: '/sale/beneficiary' // } // }) // } else { // console.log(that.$validator.errors) // that.$toast(that.$validator.errors.all()[0]) // } // }) } //信息变更 export function infoUpdate(that, type) { //local 里面是否存有险种信息 let chooseProductCodes = CacheUtils.getLocItem('chooseProductCodes') && JSON.parse(CacheUtils.getLocItem('chooseProductCodes')) if (chooseProductCodes && chooseProductCodes.length) { let flag switch (type) { case '1': { //取出local中的投被保险人信息 let saleInsuredInfo = JSON.parse(CacheUtils.getLocItem('saleInsuredInfo')) //如果 性别, 出生日期, 有无社保, 职业 发生变化 if (that.userInfo.sex != saleInsuredInfo.sex || that.userInfo.birthday != saleInsuredInfo.birthday) { flag = true } } break case '2': { //取出local中的被保险人信息 let saleInsuredPersonInfo = JSON.parse(CacheUtils.getLocItem('saleInsuredPersonInfo')) //如果 性别, 出生日期, 有无社保, 职业 发生变化 if ( that.userInfo.sex != saleInsuredPersonInfo.sex || that.userInfo.birthday != saleInsuredPersonInfo.birthday || that.userInfo.medical != saleInsuredPersonInfo.medical || that.userInfo.occupationCode != saleInsuredPersonInfo.occupationCode ) { flag = true } } break } if (flag) { //提示用户 return that.$dialog .confirm({ className: 'dialog-delete', title: '提示', message: '当前信息已经发生改变,有可能影响险种费率,是否确认修改并清除险种信息?', cancelButtonColor: '#4FC6B3', confirmButtonColor: '#FFFFFF' }) .then(() => { CacheUtils.setLocItem('from','anotherChanged') type == '1' ? that.save('isShow=1') : that.save() }) .catch(() => { return }) } } that.save() } //保存 /** * * @param {*} that 上下文 * @param {*} type 1 投保人 2 被保险人 */ export function save(that, type, str) { let params = { // 投被保险人入参不同 orderType: type == '1' ? 'APPNT_ORDER' : 'INSURED_ORDER', orderDTO: { orderInfoDTO: { orderNo: CacheUtils.getLocItem('orderNo') }, smsCodeDTO: { smsId: that.sessionId, code: that.userInfo.authCode }, appntDTO: {} } } if (type == '2' && that.userInfo.mediaDTOS == '') { delete that.userInfo.mediaDTOS } // 投被保险人入参不同 type == '1' ? (params.orderDTO.appntDTO = that.userInfo) : (params.orderDTO.insuredDTOs = [that.userInfo]) saveOrUpdateOrderInfo(params).then(res => { if (res.result == 0) { type == '1' ? (CacheUtils.setLocItem('orderNo', res.orderNo)) : (CacheUtils.setLocItem('isFrom', 'sale')) //清理计时器 window.clearInterval(that.timeId) that.timeId = null that.countDown = 60 that.codeDisabled = false // let url // 投被保险人跳转路径不同 if (type == '1') { that.$jump({ flag: 'h5', extra: { url: location.origin + `/#/sale/insuredPerson?${str}` }, routerInfo: { path: `/sale/insuredPerson?${str}` } }) } else { that.$jump({ flag: 'h5', extra: { url: location.origin + '/#/common/selectedProduct' }, routerInfo: { path: '/common/selectedProduct' } }) } // url = type == '1' ? `/#/sale/insuredPerson?${str}` : '/#/common/selectedProduct' // that.$jump({ // flag: 'h5', // extra: { // url: location.origin + url // }, // routerInfo: { // path: url // } // }) } else { that.$toast(res.resultMessage) } }) } //区域选择 /** * * @param {*} that 上下文 * @param {*} area 省市区编码 * @param {*} type 1 单位地址 2 家庭地址 3 户籍 * @param {*} flag 是否受益人 */ export function sureArea(that, area, type, flag = false) { switch (type) { case '1': //单位地址 that.areaName = getAreaName(area) if (flag) { ;[that.userInfo.province, that.userInfo.city, that.userInfo.area] = [area[0].code, area[1].code, area[2].code] ;[that.userInfo.bankProvince, that.userInfo.bankCity] = [area[0].code, area[1].code] } else { ;[that.userInfo.companyProvince, that.userInfo.companyCity, that.userInfo.companyArea] = [area[0].code, area[1].code, area[2].code] } that.areaShow = false break case '2': //家庭地址 that.homeName = getAreaName(area) ;[that.userInfo.homeProvince, that.userInfo.homeCity, that.userInfo.homeArea] = [area[0].code, area[1].code, area[2].code] that.homeShow = false break case '3': //户籍 that.census = getAreaName(area) ;[that.userInfo.householdProvince, that.userInfo.householdCity] = [area[0].code, area[1].code] that.censusShow = false break } } // 获取身份证扫描信息 /** * * @param {*} that 上下文 * @param {*} data 扫描数据 * @param {*} type 1 投保人 2 被保险人 */ export function getIdentityInfo(that, data, type) { if (data.name && data.name != '待识别') { that.userInfo.certificateValidate = `${data.startDate.substr(0, 4)}-${data.startDate.substr(4, 2)}-${data.startDate.substr(6, 2)}` that.userInfo.certiexpiredate = `${data.endDate.substr(0, 4)}-${data.endDate.substr(4, 2)}-${data.endDate.substr(6, 2)}` that.userInfo.name = data.name that.userInfo.idNo = data.idNo that.userInfo.birthday = `${data.birthYear}-${data.birthMonth}-${data.birthDay}` that.userInfo.sex = data.gender == '男' ? '0' : '1' that.effectiveDateTypeAble = idToData(data.idNo).age <= 45 } that.isScan = false that.bankisScan = false let title = type == '1' ? '投保人信息' : '被保险人信息' that.$jump({ flag: 'navigation', extra: { title, hiddenRight: '1' } }) } //证件号码返显相关信息 export function getRelatedData(that, val) { //如果证件类型不为"身份证", "出生证明", "户口本", 返回 if (!['1', '2', '3', 1, 2, 3].includes(that.userInfo.idType)) { return } //如果证件类型是出生证明,并且证件号码不是身份证号, 返回 if (that.userInfo.idType == '3' && that.userInfo.idNo.length != 15 && that.userInfo.idNo.length != 18) { console.log('证件类型是出生证明,并且证件号码不是身份证号, 返回') return } //如果证件校验不通过,恢复默认值 if (idToData(val).text) { ;[that.userInfo.idNo, that.userInfo.sex, that.userInfo.birthday, that.effectiveDateTypeAble] = ['', '0', '', false] return that.$toast(idToData(val).text) } that.userInfo.effectiveDateType = false that.effectiveDateTypeAble = idToData(val).age <= 45 that.userInfo.birthday = idToData(val).birthday that.userInfo.sex = idToData(val).sex //如果选择户口本 if (that.userInfo.idType == '2') { let exipreDate = Date.parse(that.userInfo.birthday) + Date.parse('1985-12-31') that.userInfo.certificateValidate = that.userInfo.birthday that.userInfo.certiexpiredate = that.timeStampFormat(exipreDate) that.idLimit = true //如果选择出生证明 } else if (that.userInfo.idType == '3') { let exipreDate = Date.parse(that.userInfo.birthday) + Date.parse('1972-12-31') that.userInfo.certificateValidate = that.userInfo.birthday that.userInfo.certiexpiredate = that.timeStampFormat(exipreDate) that.idLimit = true } else { that.idLimit = false } } // 获取验证码 /** * * @param {*} that 上下文 * @param {*} type 1 投保人 2 被保险人 */ export function getCode(that, type) { if (that.userInfo.mobile == '') { return that.$toast('请填写移动电话') } that.codeDisabled = true //倒计时 that.timeId = setInterval(() => { that.countDown-- if (that.countDown <= 0) { window.clearInterval(that.timeId) that.codeDisabled = false that.countDown = 60 } }, 1000) let data = { operateType: type == '1' ? 'appntInfoEntry' : 'insureInfoEntry', type: 'H5', operateCode: that.userInfo.mobile, system: 'agentApp', operateCodeType: '0' } //获取验证码 getAuthCode(data).then(res => { console.log(res) if (res.result == 0) { that.sessionId = res.sessionId } else { that.$toast(res.resultMessage) } }) } // 长期状态改变 export function effectiveDataTypeChange(that, val) { //勾选长期状态时,证件截止日期置空 if (val) { that.userInfo.certiexpiredate = '' that.certiexpiredateRequired = false } else { that.certiexpiredateRequired = true } } /** * @param {*} that 上下文 * @param {*} signList 所有协议list * @param {*} code 未签署协议类型 0-申请人 1-担保人 * @param {*} appntSign 当前签署页 签署状态信息 */ //筛选申请人、担保人所需阅读签署文档list export function filtSignList(that, signList) { let agentSignList = [], //申请人所需签署协议list guaranteeSignList = [] //担保人所需签署协议list //documentType:签名类型 0代理人 1 担保人 orderLis:显示顺序 signList.sort(function(a, b) { return a.orderLis - b.orderLis }) signList.forEach(item => { addKey(item) if (item.documentType == '0') { agentSignList.push(item) } else if (item.documentType == '1') { guaranteeSignList.push(item) } }) return { agentSignList, guaranteeSignList } //增加路径跳转path用 function addKey(item) { //13保险代理申请人健康声明 10承诺书 16广西保险销售从业人员信息公开承诺书 //15销售从业人员拒绝非法集资、非法放贷、金融诈骗承诺书 12担保书 11代理人基本福利保障知晓函 14个险销售人员代理合同 switch (item.type) { case '7': // item.key = 1 item.path = 'healthNotice' break case '10': // item.key = 2 item.path = 'LetterOfCommitment' break case '16': // item.key = 3 item.path = 'MessageLetterOfCommitment' break case '15': // item.key = 4 item.path = 'IllegalLetterOfCommitment' break case '12': // item.key = 5 item.path = 'Guarantee' break case '11': // item.key = 6 item.path = 'LetterOfKnow' break case '14': // item.key = 7 item.path = 'paction' break } } } //筛选未签名协议并获取到当前协议签署完成后下一页跳转路径 export function getAgreementNextPagePath(signList, code, appntSign) { //signState 0-未签名 1-已签名 let unAgentSignList = [], unGuaranteeSignList = [], nextPagePath = '' signList.forEach(item => { if (item.signState == '0' && item.documentType == '0') { unAgentSignList.push(item) } else if (item.signState == '0' && item.documentType == '1') { unGuaranteeSignList.push(item) } }) console.log('unAgentSignList==', unAgentSignList) // console.log('unGuaranteeSignList==', unGuaranteeSignList) if (code == '0') { go(unAgentSignList) } else if (code == '1') { go(unGuaranteeSignList) } return nextPagePath function go(list) { //此方法内剔除当前页面是否签署 if (code == '1') { if (appntSign.signStateD == '0') { nextPagePath = list.length > 1 ? list[1].path : 'signContract' } else { nextPagePath = list.length > 0 ? list[0].path : 'signContract' } } else { if (appntSign.signState == '0') { nextPagePath = list.length > 1 ? list[1].path : 'signContract' } else { nextPagePath = list.length > 0 ? list[0].path : 'signContract' } } } }