From 2fb0da3cd7d2586faa85e1e691491c93ab1a2deb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=B3=E5=8D=8E=E7=A5=A5?= Date: Fri, 13 Mar 2020 13:12:10 +0800 Subject: [PATCH] =?UTF-8?q?GFRS-729=E3=80=900326=E3=80=91=E5=9B=BD?= =?UTF-8?q?=E5=AF=8C=E4=BA=BA=E5=AF=BF=E5=9B=BD=E5=AF=8C=E6=B0=91=E5=AE=89?= =?UTF-8?q?=E9=87=8D=E5=A4=A7=E7=96=BE=E7=97=85=E4=BF=9D=E9=99=A9=EF=BC=88?= =?UTF-8?q?2020=E7=89=88=EF=BC=89=5F1=20=E4=BF=9D=E8=B4=B9=E8=AF=95?= =?UTF-8?q?=E7=AE=97=E4=BF=AE=E6=94=B9=20--=E6=8F=90=E4=BA=A4=E4=BA=BA?= =?UTF-8?q?=EF=BC=9A=E9=98=B3=E5=8D=8E=E7=A5=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/common/CalculatePremium.vue | 174 +++++++++++++++------ 1 file changed, 127 insertions(+), 47 deletions(-) diff --git a/src/views/ebiz/common/CalculatePremium.vue b/src/views/ebiz/common/CalculatePremium.vue index bee47e640..ca6ad1934 100644 --- a/src/views/ebiz/common/CalculatePremium.vue +++ b/src/views/ebiz/common/CalculatePremium.vue @@ -77,7 +77,7 @@ :show-minus="false" class="ml10 mr10" @focus="focusStep" - @blur="blurStep(dutyItem)" + @blur="blurStep(dutyItem, index)" @change=" dutyStepperChange( item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt, @@ -163,7 +163,7 @@ :show-minus="false" class="ml10 mr10" @focus="focusStep" - @blur="blurStep(dutyItem)" + @blur="blurStep(dutyItem, index)" @change=" dutyStepperChange( item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt, @@ -216,7 +216,7 @@ class="ml10 mr10" :disabled="dutyItem.changeWithMainRisk === true ? 'disabled' : ''" @focus="focusStep" - @blur="blurStep(dutyItem)" + @blur="blurStep(dutyItem, index)" @change=" dutyStepperChange( item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt, @@ -407,25 +407,52 @@ export default { // } // }) // } - //保存险种编号 - this.mainRiskCode = item.mainRiskCode + //保存主险险种编号 + if (item.isMainRisk == 0) { + this.mainRiskCode = item.mainRiskCode + } }) //GFRS_M0016需要展示免赔额和赔付比例,并需要根据是否有社保调整数值 // let mainRiskCode = chooseProducts[0].mainRiskCode + // eslint-disable-next-line no-unused-vars + this.dogetLimitAndGetRate().then(res => { + if (this.chooseProducts[0].influences && this.chooseProducts[0].influences.length > 0) { + this.influences = this.chooseProducts[0].influences + this.chooseProducts[0].influences.forEach(item => { + this.influenceAddRiskCodes.push(item.productCode) + }) + } + this.mainRiskInfluenceAddRisk() + //初始化数据试算 + this.getTrial() + }) + }, + //特殊处理 GFRS_M0016 GFRS_A0004 GFRS_A0005 赔付比例处理 + async dogetLimitAndGetRate() { + const orderNo = localStorage.getItem('orderNo') + let detailPromise = this.isFrom === 'proposal' ? new Promise(r => r(localStorage.getItem('proposalMedical'))) : await getOrderDetail({ orderNo }) this.chooseProducts.map(item => { - if (item.mainRiskCode === 'GFRS_M0016') { - const orderNo = localStorage.getItem('orderNo') - let detailPromise = this.isFrom === 'proposal' ? new Promise(r => r(localStorage.getItem('proposalMedical'))) : getOrderDetail({ orderNo }) - detailPromise.then(res => { - let isMedical = null - if (this.isFrom === 'proposal') { - isMedical = res === '1' - } else { - isMedical = res.orderDTO.insuredDTOs[0].medical === '0' + if (!(item.mainRiskCode === 'GFRS_M0016' || item.productCode === 'GFRS_A0004' || item.productCode === 'GFRS_A0005')) { + //其他产品删掉两个字段 + let calFactorLst = item.calFactorLst + for (let i = calFactorLst.length - 1; i >= 0; i--) { + let item = calFactorLst[i] + if (item.code === 'getLimit' || item.code === 'getRate') { + calFactorLst.splice(i, 1) } - //根据社保写死两个字段 赔付比例和免赔额 - item.calFactorLst.map(i => { - //免赔额 + } + return + } + if (item.mainRiskCode === 'GFRS_M0016' || item.productCode === 'GFRS_A0004') { + let isMedical = null + if (this.isFrom === 'proposal') { + isMedical = detailPromise === '1' + } else { + isMedical = detailPromise.orderDTO.insuredDTOs[0].medical === '0' + } + //根据社保写死两个字段 赔付比例和免赔额 + item.calFactorLst.map(i => { + if (item.mainRiskCode === 'GFRS_M0016') { if (i.code === 'getLimit') { const text = isMedical ? '0元(意外医疗)' : '100元(意外医疗)' const value = isMedical ? '0' : '100' @@ -451,38 +478,46 @@ export default { i.getRate = value i.columns = [{ text, value }] } - }) - this.$forceUpdate() - }) - } else { - //其他产品删掉两个字段 - let calFactorLst = item.calFactorLst - for (let i = calFactorLst.length - 1; i >= 0; i--) { - let item = calFactorLst[i] - if (item.code === 'getLimit' || item.code === 'getRate') { - calFactorLst.splice(i, 1) + } else if (item.productCode === 'GFRS_A0004') { + if (i.code === 'getLimit') { + const text2 = isMedical ? '0元(住院医疗)' : '100元(住院医疗)' + const value2 = isMedical ? '0' : '100' + + //保存数据 + this.medicalInfo = this.medicalInfo || {} + this.medicalInfo.getLimit = text2 + + i.showContent = text2 + i.getLimit = value2 + i.columns = [{ text2, value2 }] + } + //赔付比例 + if (i.code === 'getRate') { + const text = isMedical ? '80%(住院医疗)' : '60%(住院医疗)' + const value = isMedical ? '0.8' : '0.6' + + //保存数据 + this.medicalInfo = this.medicalInfo || {} + this.medicalInfo.getRate = text + + i.showContent = text + i.getRate = value + i.columns = [{ text, value }] + } + } else if (item.productCode === 'GFRS_A0005') { + // 设置默认值? } - } + }) + this.$forceUpdate() } }) - - // this.influenceAddRiskCodes - - if (this.chooseProducts[0].influences && this.chooseProducts[0].influences.length > 0) { - this.influences = this.chooseProducts[0].influences - this.chooseProducts[0].influences.forEach(item => { - this.influenceAddRiskCodes.push(item.productCode) - }) - } - - this.mainRiskInfluenceAddRisk() - //初始化数据试算 - this.getTrial() }, // 责任保额份数变化 dutyStepperChange(value, productIndex, calFactorIndex, dutyItemIndex, isChecked, min, max) { //这个险种使用其他验证方式 - if (this.mainRiskCode === 'GFRS_M0016') return + if (this.chooseProducts[productIndex].productCode === 'GFRS_M0016') return + // 004险种其他验证方式 + if (this.chooseProducts[productIndex].productCode === 'GFRS_A0004') return if (this.chooseProducts[productIndex].productCode === 'GFRS_A0003') { this.getTrial() return @@ -594,15 +629,20 @@ export default { ].rules[dutyItemIndex]['necess'] return false } - this.valiAndSend(dutyItem) + this.valiAndSend(dutyItem, productIndex) }, - valiAndSend(dutyItem) { + valiAndSend(dutyItem, productIndex) { //验证责任 + let validateRiskCode = this.chooseProducts[productIndex].productCode + let showHint = this.chooseProducts[productIndex].hint let inputValue = dutyItem.defaultDutyAmt, duty = dutyItem.duty - if (this.mainRiskCode === 'GFRS_M0016' && !this.valiDuty(inputValue, duty)) { + if (validateRiskCode === 'GFRS_M0016' && !this.valiDuty(inputValue, duty)) { //验证不通过 return + } else if (validateRiskCode === 'GFRS_A0004' && duty == '210100' && !this.valiA0004Duty(inputValue, showHint, dutyItem)) { + //验证不通过 险种为GFRS_A0004 责任编码为320205 + return } else { this.mainRiskInfluenceAddRisk() this.getTrial() @@ -612,13 +652,13 @@ export default { focusStep() { this.nextStepFlag = true }, - blurStep(dutyItem) { + blurStep(dutyItem, productIndex) { this.nextStepFlag = false //失去焦点时做验证 if (dutyItem.necess) { //勾选时才做验证 - this.valiAndSend(dutyItem) + this.valiAndSend(dutyItem, productIndex) } }, //险种GFRS_M0016的责任的验证规则 @@ -638,6 +678,27 @@ export default { } } }, + //险种 GFRS_A0004 险种验证规则 + valiA0004Duty(value, showHint, currentEle) { + // 保额只能为5000 10000 15000 200000 + if (currentEle.duty == '210100') { + if (!(value == '0.5' || value == '1' || value == '1.5' || value == '2')) { + this.$toast(showHint) + this.nextStepFlag = true + return false + } + if (this.mainRiskCode === 'GFRS_M0005') { + if (!(value == '0.5' || value == '1')) { + this.$toast(showHint) + this.nextStepFlag = true + return false + } + } + this.nextStepFlag = false + return true + } + return true + }, /********start 通用规则、特殊规则处理 start******/ //通用规则1:交费方式为一次交情,无交费期限 hiddenPayEndYear(currentEle) { @@ -1183,6 +1244,25 @@ export default { } } + //GFRS_A0004需要验证责任 + for (let m = 0; m < this.chooseProducts.length; m++) { + if (this.chooseProducts[m].productCode == 'GFRS_A0004') { + let showHint = this.chooseProducts[m].hint + let calFactorLst = this.chooseProducts[m].calFactorLst + for (let i = 0; i < calFactorLst.length; i++) { + if (calFactorLst[i].code === 'dutyGroup') { + let duties = calFactorLst[i].rules + for (let j = 0; j < duties.length; j++) { + let item = duties[j] + if (!this.valiA0004Duty(item.defaultDutyAmt, showHint, item)) { + return + } + } + } + } + } + } + //组装险种提交数据 let [mainRiskCode, riskDTOLst] = ['', []] let rollInResult = '' //校验预计转入保费结果