fix: 修复保费试算的异常问题

1. 首期总保费异常  NAN 的问题
2. 解决附加险无法计算的问题
This commit is contained in:
hz
2025-10-29 19:08:53 +08:00
parent f1b587ff75
commit c3b0f0311a

View File

@@ -356,19 +356,20 @@
item.productCode != 'GFRS_M0098' &&
item.productCode != 'GFRS_M0103' &&
item.productCode != 'GFRS_M0112' &&
item.productCode != 'GFRS_M0085'
item.productCode != 'GFRS_M0085' &&
trialList[index]
"
>
<!-- trialType 0-保额算保费1-保费算保额 -->
<!-- isTrial是否需存在特殊配置(规则) 0-是 1-否-->
<span
style="font-weight: bold"
v-if="(trialList.length > 0 && trialList[index].trialType == 0) || (trialList.length > 0 && trialList[index].trialType == 2)"
v-if="(trialList[index] && trialList.length > 0 && trialList[index].trialType == 0) || (trialList.length > 0 && trialList[index].trialType == 2)"
>
首期保费(元):
</span>
<span style="font-weight: bold" v-else>保额(元):</span>
<span class="fee red" v-if="trialList && trialList.length > 0">{{ trialList[index].showPrem | moneyFormat }}</span>
<span class="fee red" v-if="trialList && trialList[index] && trialList.length > 0">{{ trialList[index].showPrem | moneyFormat }}</span>
</div>
</div>
@@ -561,13 +562,11 @@ export default {
firstTermTotalPremium() {
const res = this.trialList.reduce(
(accumulator, currentValue) => {
console.log(accumulator.showPrem, currentValue.showPrem)
return accumulator.showPrem + currentValue.showPrem
return { showPrem: accumulator.showPrem + (currentValue.showPrem || 0) }
},
{ showPrem: 0 }
)
if (typeof res === 'number') return res
if (typeof res.showPrem === 'number') return res.showPrem
else return 0
},
/**
@@ -3595,6 +3594,7 @@ export default {
handleChoosedProductsChange() {
this.chooseProducts = JSON.parse(localStorage.getItem('chooseProducts'))
this.selectAddtionRisk()
this.getTrial()
}
},
watch: {