mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 01:06:45 +08:00
refactor(product): 优化保费计算组件逻辑
- 移除未使用的组件引用 FieldDatePicter 和 SelectRadio - 删除冗余的 registerMainTask 调用 - 清理调试代码 window.cps 赋值 - 统一使用严格相等运算符 === 替代 == - 简化 forEach 循环中的索引参数 - 修复作用域变量 that 的使用,统一为 this - 注释掉无用的 proposalOrderNo 相关代码 - 优化产品编码判断逻辑,提高可读性
This commit is contained in:
@@ -515,8 +515,6 @@ export default {
|
|||||||
[Dialog.name]: Dialog,
|
[Dialog.name]: Dialog,
|
||||||
[Radio.name]: Radio,
|
[Radio.name]: Radio,
|
||||||
[RadioGroup.name]: RadioGroup,
|
[RadioGroup.name]: RadioGroup,
|
||||||
FieldDatePicter: FieldDatePicter,
|
|
||||||
SelectRadio: SelectRadio,
|
|
||||||
InsuredMessageInfo: () => import('./CalculatePremiumInsuredMessageInfo.vue'),
|
InsuredMessageInfo: () => import('./CalculatePremiumInsuredMessageInfo.vue'),
|
||||||
DestoryablePopup: () => import('@/components/common/DestroyablePopup.vue')
|
DestoryablePopup: () => import('@/components/common/DestroyablePopup.vue')
|
||||||
},
|
},
|
||||||
@@ -633,20 +631,6 @@ export default {
|
|||||||
// 当组件挂载之后开始创建订单
|
// 当组件挂载之后开始创建订单
|
||||||
this.isFrom = window.localStorage.isFrom
|
this.isFrom = window.localStorage.isFrom
|
||||||
|
|
||||||
if (this.isFrom === 'proposal') {
|
|
||||||
setTimeout(() => {
|
|
||||||
/* global EWebBridge */
|
|
||||||
EWebBridge.webCallAppInJs('webview_right_button', {
|
|
||||||
btns: [
|
|
||||||
{
|
|
||||||
img: this.$assetsUrl + 'images/del-close.png',
|
|
||||||
route: { flag: '', extra: {} }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
// window.appCallBack = this.appCallBack
|
|
||||||
getAgentInfo({}).then(res => {
|
getAgentInfo({}).then(res => {
|
||||||
this.branchType = res.branchType
|
this.branchType = res.branchType
|
||||||
// branchType N1、1代表个险渠道 和 N5、5 代表中介渠道,N代表内勤
|
// branchType N1、1代表个险渠道 和 N5、5 代表中介渠道,N代表内勤
|
||||||
@@ -664,7 +648,7 @@ export default {
|
|||||||
})
|
})
|
||||||
// this.initPersonInfo()
|
// this.initPersonInfo()
|
||||||
this.init()
|
this.init()
|
||||||
|
this.registerMainTask()
|
||||||
Array.prototype.min = function() {
|
Array.prototype.min = function() {
|
||||||
var min = this[0]
|
var min = this[0]
|
||||||
var len = this.length
|
var len = this.length
|
||||||
@@ -675,7 +659,6 @@ export default {
|
|||||||
}
|
}
|
||||||
return min
|
return min
|
||||||
}
|
}
|
||||||
this.registerMainTask()
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
registerMainTask() {
|
registerMainTask() {
|
||||||
@@ -1026,7 +1009,6 @@ export default {
|
|||||||
|
|
||||||
this.chooseProducts = (window.structuredClone ? structuredClone : deepClone)(productsData)
|
this.chooseProducts = (window.structuredClone ? structuredClone : deepClone)(productsData)
|
||||||
|
|
||||||
window.cps = this.chooseProducts
|
|
||||||
this.processProducts()
|
this.processProducts()
|
||||||
//GFRS_M0016需要展示免赔额和赔付比例,并需要根据是否有社保调整数值
|
//GFRS_M0016需要展示免赔额和赔付比例,并需要根据是否有社保调整数值
|
||||||
// let mainRiskCode = chooseProducts[0].mainRiskCode
|
// let mainRiskCode = chooseProducts[0].mainRiskCode
|
||||||
@@ -1536,14 +1518,14 @@ export default {
|
|||||||
//勾选时才做验证
|
//勾选时才做验证
|
||||||
this.valiAndSend(dutyItem, productIndex)
|
this.valiAndSend(dutyItem, productIndex)
|
||||||
}
|
}
|
||||||
if (productCode == 'GFRS_M0077') {
|
if (productCode === 'GFRS_M0077') {
|
||||||
this.chooseProducts.forEach(item => {
|
this.chooseProducts.forEach(item => {
|
||||||
if (item.mainRiskCode == 'GFRS_M0077') {
|
if (item.mainRiskCode === 'GFRS_M0077') {
|
||||||
item.calFactorLst.map(i => {
|
item.calFactorLst.map(i => {
|
||||||
if (i.code == 'dutyGroup') {
|
if (i.code === 'dutyGroup') {
|
||||||
if (i.rules && i.rules.length != 0) {
|
if (i.rules && i.rules.length != 0) {
|
||||||
i.rules.forEach(ii => {
|
i.rules.forEach(ii => {
|
||||||
if (ii.duty == '311507' && ii.necess) {
|
if (ii.duty === '311507' && ii.necess) {
|
||||||
ii.defaultDutyAmt = dutyItem.defaultDutyAmt
|
ii.defaultDutyAmt = dutyItem.defaultDutyAmt
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1711,16 +1693,16 @@ export default {
|
|||||||
let addtionRiskLst = JSON.parse(localStorage.addtionRiskLst)
|
let addtionRiskLst = JSON.parse(localStorage.addtionRiskLst)
|
||||||
if (addtionRiskLst) {
|
if (addtionRiskLst) {
|
||||||
let list = []
|
let list = []
|
||||||
addtionRiskLst.forEach((item, index) => {
|
addtionRiskLst.forEach(item => {
|
||||||
if (
|
if (
|
||||||
item.productCode != 'GFRS_A0007' &&
|
item.productCode !== 'GFRS_A0007' &&
|
||||||
item.productCode != 'GFRS_A0009' &&
|
item.productCode !== 'GFRS_A0009' &&
|
||||||
item.productCode != 'GFRS_A0010' &&
|
item.productCode !== 'GFRS_A0010' &&
|
||||||
item.productCode != 'GFRS_A0012' &&
|
item.productCode !== 'GFRS_A0012' &&
|
||||||
item.productCode != 'GFRS_A0013' &&
|
item.productCode !== 'GFRS_A0013' &&
|
||||||
item.productCode != 'GFRS_A0014' &&
|
item.productCode !== 'GFRS_A0014' &&
|
||||||
item.productCode != 'GFRS_A0015' &&
|
item.productCode !== 'GFRS_A0015' &&
|
||||||
item.productCode != 'GFRS_A0016'
|
item.productCode !== 'GFRS_A0016'
|
||||||
) {
|
) {
|
||||||
list.push(item)
|
list.push(item)
|
||||||
}
|
}
|
||||||
@@ -1897,12 +1879,12 @@ export default {
|
|||||||
//只有在搭配附加两全时,才能搭配被保险人附加豁免重疾B;
|
//只有在搭配附加两全时,才能搭配被保险人附加豁免重疾B;
|
||||||
//获取两全险的保费
|
//获取两全险的保费
|
||||||
let showPrem001
|
let showPrem001
|
||||||
this.trialList.forEach((item, index) => {
|
this.trialList.forEach(item => {
|
||||||
if (item.productCode == 'GFRS_A0011') {
|
if (item.productCode == 'GFRS_A0011') {
|
||||||
showPrem001 = item.showPrem //获取两全险的保费
|
showPrem001 = item.showPrem //获取两全险的保费
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.chooseProducts.forEach((item, index) => {
|
this.chooseProducts.forEach(item => {
|
||||||
if (
|
if (
|
||||||
item.productCode === 'GFRS_A0010' ||
|
item.productCode === 'GFRS_A0010' ||
|
||||||
item.productCode === 'GFRS_A0009' ||
|
item.productCode === 'GFRS_A0009' ||
|
||||||
@@ -2050,7 +2032,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.chooseProducts[0].productTrialYearDTOS.forEach((item, index) => {
|
this.chooseProducts[0].productTrialYearDTOS.forEach(item => {
|
||||||
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
|
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
|
||||||
if (payEndYearVal == Number(item.yearWay) - 1 + '年交') {
|
if (payEndYearVal == Number(item.yearWay) - 1 + '年交') {
|
||||||
v.amt = item.displayAmount * item.moneyUnit
|
v.amt = item.displayAmount * item.moneyUnit
|
||||||
@@ -2085,7 +2067,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.chooseProducts[0].productTrialYearDTOS.forEach((v, index) => {
|
this.chooseProducts[0].productTrialYearDTOS.forEach(v => {
|
||||||
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
|
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
|
||||||
if (payEndYearVal01 == v.yearWay + '年交') {
|
if (payEndYearVal01 == v.yearWay + '年交') {
|
||||||
item.amt = v.displayAmount * v.moneyUnit
|
item.amt = v.displayAmount * v.moneyUnit
|
||||||
@@ -2106,7 +2088,7 @@ export default {
|
|||||||
//重新再调一次试算,因保额为文本框没有change事件,所以保额变化后少一次调用试算,所以特此手动重新调用一次
|
//重新再调一次试算,因保额为文本框没有change事件,所以保额变化后少一次调用试算,所以特此手动重新调用一次
|
||||||
let trialList = JSON.parse(localStorage.trialList)
|
let trialList = JSON.parse(localStorage.trialList)
|
||||||
let showPrem
|
let showPrem
|
||||||
trialList.forEach((item, index) => {
|
trialList.forEach(item => {
|
||||||
if (item.productCode === 'GFRS_A0011') {
|
if (item.productCode === 'GFRS_A0011') {
|
||||||
showPrem = item.showPrem //获取两全险的保费
|
showPrem = item.showPrem //获取两全险的保费
|
||||||
}
|
}
|
||||||
@@ -2167,7 +2149,7 @@ export default {
|
|||||||
//获取当前产品编码下的整条数据
|
//获取当前产品编码下的整条数据
|
||||||
getProductCodeItem(productCode) {
|
getProductCodeItem(productCode) {
|
||||||
let remitItem = {}
|
let remitItem = {}
|
||||||
this.chooseProducts.forEach((item, index) => {
|
this.chooseProducts.forEach(item => {
|
||||||
if (item.productCode == productCode) {
|
if (item.productCode == productCode) {
|
||||||
remitItem = item
|
remitItem = item
|
||||||
}
|
}
|
||||||
@@ -3310,8 +3292,7 @@ export default {
|
|||||||
if (!this.renewalShow(this.mainRiskCode)) {
|
if (!this.renewalShow(this.mainRiskCode)) {
|
||||||
for (let prop of item.calFactorLst) {
|
for (let prop of item.calFactorLst) {
|
||||||
if (prop.type === '4') {
|
if (prop.type === '4') {
|
||||||
this.保费试算
|
this.trialInfos[index].isRenewal = this.renewal
|
||||||
trialInfos[index].isRenewal = this.renewal
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3428,7 +3409,7 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
} else if (localStorage.isFrom === 'proposal') {
|
} else if (localStorage.isFrom === 'proposal') {
|
||||||
let proposalOrderNo = this.$CacheUtils.getLocItem('proposalNo') || ''
|
// let proposalOrderNo = this.$CacheUtils.getLocItem('proposalNo') || ''
|
||||||
if (resultData.content.id) {
|
if (resultData.content.id) {
|
||||||
this.saleInsuredPersonInfo.insuredId = resultData.content.id
|
this.saleInsuredPersonInfo.insuredId = resultData.content.id
|
||||||
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(this.saleInsuredPersonInfo))
|
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(this.saleInsuredPersonInfo))
|
||||||
@@ -3473,14 +3454,14 @@ export default {
|
|||||||
saveOrUpdateTrialRecordInfo(data).then(res => {
|
saveOrUpdateTrialRecordInfo(data).then(res => {
|
||||||
if (res.result == '0') {
|
if (res.result == '0') {
|
||||||
//被保人产品列表界面 点击编辑按钮进入产品试算界面 点击完成 页面跳转不正确
|
//被保人产品列表界面 点击编辑按钮进入产品试算界面 点击完成 页面跳转不正确
|
||||||
let proposalOrderNo = ''
|
// let proposalOrderNo = ''
|
||||||
if (this.$route.query.proposalOrderNo) {
|
// if (this.$route.query.proposalOrderNo) {
|
||||||
proposalOrderNo = this.$route.query.proposalOrderNo
|
// proposalOrderNo = this.$route.query.proposalOrderNo
|
||||||
} else {
|
// } else {
|
||||||
proposalOrderNo = this.$route.query.orderNo
|
// proposalOrderNo = this.$route.query.orderNo
|
||||||
}
|
// }
|
||||||
let url = `/common/selectedProduct?proposalOrderNo=${proposalOrderNo}`
|
// let url = `/common/selectedProduct?proposalOrderNo=${proposalOrderNo}`
|
||||||
if (localStorage.isFrom == 'orderTrial' && localStorage.isFrom == 'sale') {
|
if (localStorage.isFrom === 'orderTrial' && localStorage.isFrom === 'sale') {
|
||||||
this.$toast.clear()
|
this.$toast.clear()
|
||||||
this.trialResultsShow = true
|
this.trialResultsShow = true
|
||||||
this.verifyResultList = res.content.data.verifyResultList
|
this.verifyResultList = res.content.data.verifyResultList
|
||||||
@@ -3632,7 +3613,7 @@ export default {
|
|||||||
//初始化时取交费期间的值,值再去对应productTrialYearDTOS中的第几条规则
|
//初始化时取交费期间的值,值再去对应productTrialYearDTOS中的第几条规则
|
||||||
item.productTrialYearDTOS.forEach((item, index) => {
|
item.productTrialYearDTOS.forEach((item, index) => {
|
||||||
if (payEndYearVal == item.yearWay + '年交') {
|
if (payEndYearVal == item.yearWay + '年交') {
|
||||||
that.payEndYearColumnsIndex = index
|
this.payEndYearColumnsIndex = index
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user