diff --git a/src/views/ebiz/commonFlowImprove/AddRiskList.vue b/src/views/ebiz/commonFlowImprove/AddRiskList.vue index 416722230..a4f58e699 100644 --- a/src/views/ebiz/commonFlowImprove/AddRiskList.vue +++ b/src/views/ebiz/commonFlowImprove/AddRiskList.vue @@ -42,6 +42,10 @@ export default { showNext: { type: Boolean, default: true + }, + trialTest: { + type: Boolean, + default: true } }, mounted() { @@ -51,10 +55,7 @@ export default { title: '附加险选择列表' } }) - //获取投保人信息 - if (this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) { - this.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) - } + getAgentInfo({}).then(res => { // branchType N1、1代表个险渠道 和 N5、5 代表中介渠道,N代表内勤 if (res.branchType === 'N1' || res.branchType == '1') { @@ -64,12 +65,20 @@ export default { } }) - //获取主产品code - let chooseProducts = JSON.parse(window.localStorage.getItem('chooseProducts')) - this.mainRiskCode = chooseProducts.find(item => item.isMainRisk === 0).mainRiskCode + this.loadStorageData() this.filterAddRisk() }, methods: { + loadStorageData(){ + //获取投保人信息 + if (this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) { + this.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) + } + + //获取主产品code + let chooseProducts = JSON.parse(window.localStorage.getItem('chooseProducts')) + this.mainRiskCode = chooseProducts.find(item => item.isMainRisk === 0).mainRiskCode + }, //过滤已选附加险 filterAddRisk() { if (localStorage.addtionRiskLst) { @@ -102,7 +111,7 @@ export default { nextStep() { if (!this.result) { this.$toast('请选择产品') - return + return false } //添加附加险 @@ -110,6 +119,8 @@ export default { }, //储存附加险 async addAdditionRisk() { + // 重新加载 storage 里面的信息 + this.loadStorageData() let riskProductCode = this.result.productCode let resultData = await calculatePremium({ productCodes: [riskProductCode], platform: 'app', type: '1' }) if (resultData.result === '0') { @@ -117,30 +128,28 @@ export default { localStorage.isAutoPay = localStorage.isAutoPay === '0' ? '0' : resultData.isAutoPay //自动垫交 localStorage.isRenew = localStorage.isRenew === '0' ? '0' : resultData.isRenew //自动续保 localStorage.isForceRenew = localStorage.isForceRenew === '0' ? '0' : resultData.isForceRenew //自动续保默认是否选中 0-是 1-否 - if (resultData.productTrialInfoDTO.ruleExpression) { + // todo : 取消 rule 校验 + if (resultData.productTrialInfoDTO.ruleExpression && false) { let ruleExpression = localStorage.ruleExpression ? JSON.parse(localStorage.ruleExpression) : {} ruleExpression[resultData.productCode] = resultData.productTrialInfoDTO.ruleExpression localStorage.ruleExpression = JSON.stringify(ruleExpression) let ttThis = this for (let item of ruleExpression[resultData.productCode]) { let config = JSON.parse(item.ruleExpression) - switch (config.eventType) { - case 'loadFormat': - let initFn = new Function(...config.funPar, config.funBody.join('')) - let str = initFn.call(ttThis, resultData) - if (str) { - return this.$toast(str) - } - break - case 'checkMainRisk': - let checkMainRiskFn = new Function(...config.funPar, config.funBody.join('')) - let checkMainRiskStr = checkMainRiskFn.call(ttThis) - if (checkMainRiskStr) { - return this.$toast(checkMainRiskStr) - } - break - default: - break + if (config.eventType === 'loadFormat') { + let initFn = new Function(...config.funPar, config.funBody.join('')) + let str = initFn.call(ttThis, resultData) + if (str) { + return this.$toast(str) + } + } else if (config.eventType === 'checkMainRisk') { + let checkMainRiskFn = new Function(...config.funPar, config.funBody.join('')) + let checkMainRiskStr = checkMainRiskFn.call(ttThis) + if (checkMainRiskStr) { + return this.$toast(checkMainRiskStr) + } + } else { + // } // if(config.eventType == 'loadFormat'){ // let initFn = new Function(...config.funPar, config.funBody.join('')) @@ -213,24 +222,26 @@ export default { } }*/ - //豁免险与其他附加险年龄险种 - if (resultData.productTrialInfoDTO.isRemit == '0' && resultData.productTrialInfoDTO.remitType == '0') { - if (riskRules.ageLimit(resultData, this, 1)) { + if (this.trialTest) { + //豁免险与其他附加险年龄险种 + if (resultData.productTrialInfoDTO.isRemit == '0' && resultData.productTrialInfoDTO.remitType == '0') { + if (riskRules.ageLimit(resultData, this, 1)) { + return + } + } else { + if (riskRules.ageLimit(resultData, this)) { + return + } + } + + if (riskRules.medicalLimit(resultData, this)) { return } - } else { - if (riskRules.ageLimit(resultData, this)) { + + if (riskRules.healthGradeLimit(resultData, this)) { return } } - - if (riskRules.medicalLimit(resultData, this)) { - return - } - - if (riskRules.healthGradeLimit(resultData, this)) { - return - } // if (riskRules.lifeGradeLimit(resultData, this)) { // return // } diff --git a/src/views/ebiz/productFlowImprove/ProductDetail.vue b/src/views/ebiz/productFlowImprove/ProductDetail.vue index 488ead0e5..629293625 100644 --- a/src/views/ebiz/productFlowImprove/ProductDetail.vue +++ b/src/views/ebiz/productFlowImprove/ProductDetail.vue @@ -178,6 +178,13 @@ export default { beforeRouteLeave(to, from, next) { document.body.style.backgroundColor = '' next() + }, + beforeRouteEnter(to, from, next) { + /*当进入的时候清清除 localstorage 的内容*/ + ;['saleInsuredInfo', 'saleInsuredPersonInfo', 'chooseProducts', "hint"].forEach(type => { + localStorage.removeItem(type) + }) + next() } } diff --git a/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue b/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue index 8d64981b5..ec5cd0224 100644 --- a/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue +++ b/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue @@ -8,7 +8,13 @@ 主险 附加险 {{ item.riskName }} - + @@ -382,7 +388,7 @@ @@ -435,6 +441,7 @@ import SelectRadio from '@/components/ebiz/SelectRadio' import riskRules from '@/views/ebiz/commonFlowImprove/risk-rules' import AddtionRiskList from '@/views/ebiz/commonFlowImprove/AddRiskList.vue' import { trial } from '@/api/ebiz/common/common' +import { syncLocalstorageData } from '@/assets/js/syncLocalstorageData' const DUTY_DEFAULT_MUTIPLE = 1000 const DUTY_DEFAULT_MIN = 10000 @@ -503,9 +510,13 @@ export default { calFactorIndex: '', premiumData: [], //试算 saleInsuredInfo: {}, - saleInsuredPersonInfo: { - sex: '0' - }, //投保人信息 + saleInsuredPersonInfo: syncLocalstorageData( + { + sex: '0', + birthday: "" + }, //投保人信息, + { name: 'saleInsuredPersonInfo', encrypt: true} + ), trialList: [], popupShow: false, columns: [], @@ -558,13 +569,17 @@ export default { * @returns {boolean} */ passUserInfoCheck() { - const keys = Object.keys(this.userInfo) - return ( - keys.filter(key => { - const msg = this.userInfo[key] - return msg !== undefined && msg !== null && msg !== '' - }).length === keys.length - ) + const info = this.saleInsuredPersonInfo + const keys = Object.keys(info) + const res = keys.filter(key => { + const msg = info[key] + return msg != null && msg !== '' + }) + // debugger + console.log(res, info) + if (res !== -1) { + return res.length === keys.length + }else return false } }, mounted() { @@ -747,7 +762,6 @@ export default { async init() { let that = this - localStorage.setItem('isTrial', '1') const { productCode: productDetailCode, productName } = this.productDTOS[0] const productDetail = await information({ productCodes: [productDetailCode], @@ -2701,6 +2715,11 @@ export default { //选择附加险 selectAddtionRisk() { + if (!this.passUserInfoCheck) { + this.$toast('请补充完整相应的信息内容') + return + } + //存储附加险列表 let addRiskCodes = [] this.chooseProducts.forEach(item => { @@ -3543,10 +3562,12 @@ export default { } }, handleSubmitAddAdditionRisk({ submit = true } = {}) { + const ele = this.$refs.additionRiskList if (submit) { - const ele = this.$refs.additionRiskList - ele.nextStep() + const error = ele.nextStep() + if (!error) return } + ele.result = '' this.showAdditionRiskPopup = false }, submitOrder(riskDTO = []) {