fix: 修复保费试算错误信息

1. 修复保费试算一直使用第一次选择的投保人的问题
2. 清除进入的时候 localstorage 的变量,防止后续流程变量出现异常问题
3.  修复获取被保人的信息校验异常的问题
4. 修复获取投保人的问题,当前试算无需获取(待定),明日讨论后修正
This commit is contained in:
hz
2025-10-27 19:34:36 +08:00
parent 2b4dd4355a
commit 7f6eb84f95
3 changed files with 93 additions and 54 deletions

View File

@@ -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
// }

View File

@@ -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()
}
}
</script>

View File

@@ -8,7 +8,13 @@
<van-tag type="primary" v-if="item.isMainRisk === 0" class="mr5 green" plain>主险</van-tag>
<van-tag type="primary" v-else class="mr5 green" plain>附加险</van-tag>
<span class="ml5 center fs13 flex1">{{ item.riskName }}</span>
<van-tag type="primary" v-if="Number(item.isMainRisk) === 0 && item.hasAddtionRisk && isEnterAddtionRisk" plain @click="selectAddtionRisk" class="green mr8">
<van-tag
type="primary"
v-if="Number(item.isMainRisk) === 0 && item.hasAddtionRisk && isEnterAddtionRisk"
plain
@click="selectAddtionRisk"
class="green mr8"
>
</van-tag>
<van-icon name="search" size="20" v-if="item.documentDTOS && item.documentDTOS.length > 0" @click="seeDocument(index)" class="green mr5" />
@@ -382,7 +388,7 @@
<van-popup v-model="showAdditionRiskPopup" round position="bottom" class="addtion-risk">
<van-picker show-toolbar @confirm="handleSubmitAddAdditionRisk" @cancel="handleSubmitAddAdditionRisk({ submit: false })">
<template #columns-top>
<addtion-risk-list ref="additionRiskList" :show-next="false" />
<addtion-risk-list ref="additionRiskList" :show-next="false" :trial-test="false" />
</template>
</van-picker>
</van-popup>
@@ -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 = []) {