Merge branch 'feature/GFRS-502_【0206】国富人寿富娃娃两全保险(万能型)' into release/【0210】

# Conflicts:
#	src/views/ebiz/common/CalculatePremium.vue
This commit is contained in:
yuweiqi
2020-02-10 17:26:11 +08:00
14 changed files with 506 additions and 153 deletions

View File

@@ -18,15 +18,17 @@
<van-icon name="delete" size="22" @click="deleteRisk(index)" class="green" />
</div>
<!-- 险种条件-->
<div v-if="item.isRemit == 1">
<div v-if="(item.isRemit == 1 && isTrial == '1') || (item.isRemit == 1 && isTrial != '1' && item.isMainRisk == 1)">
<!-- <div v-if="item.isRemit == 1 && isTrial == '1'"> -->
<div v-for="(riskFactor, riskFactorIndex) in item.calFactorLst" :key="riskFactorIndex">
<div class="flex justify-content-s pv10 border-bottom" v-if="riskFactor.type == 1">
<div class="flex align-items-c">
<span v-if="riskFactor.suffix" class="fs14">{{ riskFactor.name + '(' + riskFactor.suffix + ')' }}</span>
<span v-else class="fs14">{{ riskFactor.name }} &nbsp;&nbsp; &nbsp;&nbsp;</span>
<!-- {{riskFactorIndex}} -->
<!-- {{defalutAmt}} -->
<van-stepper
v-model="defalutAmt"
v-model="item.calFactorLst[riskFactorIndex].displayAmount"
:min="riskFactor.minAmt || riskFactor.minPrem"
:max="riskFactor.maxAmt || riskFactor.maxPrem"
:show-plus="false"
@@ -34,7 +36,7 @@
class="ml30"
@change="
stepperChange(
item.calFactorLst[riskFactorIndex].defaultValue,
item.calFactorLst[riskFactorIndex].displayAmount,
index,
riskFactorIndex,
riskFactor.minAmt || riskFactor.minPrem,
@@ -102,6 +104,93 @@
</div>
</div>
</div>
<!-- 为富娃娃两全保险万能型专写 -->
<div v-if="item.isRemit == 1 && isTrial != '1' && item.isMainRisk == 0">
<div v-for="(riskFactor, riskFactorIndex) in item.calFactorLst" :key="riskFactorIndex">
<div class="flex justify-content-s pv10 border-bottom" v-if="riskFactor.type == 1">
<div class="flex align-items-c">
<span v-if="item.productTrialYearDTOS[payEndYearColumnsIndex].suffix" class="fs14">{{
riskFactor.name + '(' + item.productTrialYearDTOS[payEndYearColumnsIndex]['suffix'] + ')'
}}</span>
<span v-else class="fs14">{{ riskFactor.name }} &nbsp;&nbsp; &nbsp;&nbsp;</span>
<van-stepper
v-model="item.productTrialYearDTOS[payEndYearColumnsIndex].displayAmount"
:min="item.productTrialYearDTOS[payEndYearColumnsIndex].minAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].minPrem"
:max="item.productTrialYearDTOS[payEndYearColumnsIndex].maxAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].maxPrem"
:show-plus="false"
:show-minus="false"
class="ml30"
@change="
stepperChange(
item.productTrialYearDTOS[payEndYearColumnsIndex].displayAmount,
index,
riskFactorIndex,
item.productTrialYearDTOS[payEndYearColumnsIndex].minAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].minPrem,
item.productTrialYearDTOS[payEndYearColumnsIndex].maxAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].maxPrem,
item.productTrialYearDTOS[payEndYearColumnsIndex]
)
"
input-width="100"
:integer="false"
/>
</div>
</div>
<div
class="flex justify-content-s pv10 border-bottom"
v-if="riskFactor.type == 0"
:class="{ hidden: riskFactor.code == 'payEndYear' && item.isHidden }"
>
<van-field
v-model="riskFactor.showContent"
readonly
:label="riskFactor.name"
right-icon="arrow"
placeholder="请选择"
@click="toSelect(index, riskFactorIndex, riskFactor.columns)"
/>
</div>
<div class="border-bottom" v-if="riskFactor.type == 3">
<div class="pv12 border-bd">{{ riskFactor.name }}</div>
<div class="duty">
<div class="flex justify-content-s border-bd pv10 align-items-c" v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex">
<span class="fs14 w100">{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span>
<div class="flex">
<van-stepper
v-model="dutyItem.defaultDutyAmt"
:min="dutyItem.minDutyAmt"
:max="dutyItem.maxDutyAmt"
:show-plus="false"
:show-minus="false"
class="ml10 mr10"
@focus="focusStep"
@blur="blurStep"
@change="
dutyStepperChange(
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
index,
riskFactorIndex,
dutyItemIndex,
dutyItem.necess,
dutyItem.minDutyAmt,
dutyItem.maxDutyAmt
)
"
input-width="200"
:integer="false"
/>
<van-checkbox
v-model="dutyItem.necess"
:disabled="dutyItem.defaultValue == '0'"
shape="square"
@change="changeChecked(index, riskFactorIndex, dutyItemIndex)"
></van-checkbox>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 豁免险条件 -->
<div v-if="item.isRemit == 0">
<div v-for="(riskFactor, riskFactorIndex) in item.calFactorLst" :key="riskFactorIndex">
@@ -121,10 +210,10 @@
<div class="flex justify-content-s pv10 border-bottom prem">
<span
style="font-weight:bold"
v-if="(trialList.length > 0 && trialList[index].trialType == 0) || (trialList.length > 0 && trialList[index].trialType == 2)"
>首期保费(</span
v-if="(trialList.length > 0 && trialList[index].trialType == 0) || (trialList.length > 0 && trialList[index].trialType == 2) || isTrial === '0'"
>首期保费</span
>
<span style="font-weight:bold" v-else>保额(</span>
<span style="font-weight:bold" v-else>保额</span>
<span class="fee red" v-if="trialList && trialList.length > 0">{{ trialList[index].prem.toFixed(2) | moneyFormat }}</span>
</div>
</div>
@@ -182,7 +271,11 @@ export default {
mult: '',
isFrom: '',
// 默认钱数
defalutAmt: ''
defalutAmt: '',
//是否需存在特殊配置 0-是 1-否
isTrial: localStorage.isTrial,
//缴费期间对应index索引
payEndYearColumnsIndex: 0
}
},
mounted() {
@@ -220,16 +313,14 @@ export default {
}
if (item.mainRiskCode != 'GFRS_M0008') {
item.calFactorLst.map(i => {
this.defalutAmt = i.displayAmount || 1
console.log(i.displayAmount)
console.log(i.defaultValue)
// this.defalutAmt = i.displayAmount || 1
// console.log('i.displayAmount ==', i.displayAmount)
// console.log('i.defaultValue ==', i.defaultValue)
this.mult = Number(i.displayAmount) / Number(i.defaultValue)
})
}
})
// 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 => {
@@ -238,7 +329,6 @@ export default {
}
this.mainRiskInfluenceAddRisk()
//初始化数据试算
this.getTrial()
},
@@ -258,7 +348,7 @@ export default {
// this.$toast(localStorage.hint)
} else {
// this.mainRiskInfluenceAddRisk()
// currentEle['amt'] = Number(currentEle.defaultValue) * Number(currentEle.moneyUnit)
// currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
// this.getTrial()
if (isChecked) {
;[this.productIndex, this.calFactorIndex] = [productIndex, calFactorIndex]
@@ -278,9 +368,11 @@ export default {
}
}
},
// blur(value) {
// console.log('哈哈哈',value)
// },
//弹框选择
toSelect(index, index1, columns) {
console.log(index, index1, columns)
;[this.popupShow, this.productIndex, this.calFactorIndex] = [true, index, index1]
this.columns = columns
},
@@ -297,6 +389,18 @@ export default {
console.log('value', value)
console.log('currentFactor', currentFactor)
console.log('currentEle', currentEle)
//特殊设置:如果需要填写的保费/保额校验规则跟缴费期间挂钩当改变缴费期间时将输入框的值恢复默认值1
if (currentEle.code == 'payEndYear' && this.isTrial == '0') {
currentEle['columns'].forEach((item, index) => {
if (item.value == value.value) {
this.payEndYearColumnsIndex = index
}
})
this.defalutAmt = 1
}
console.log('payEndYearColumnsIndex == ', this.payEndYearColumnsIndex)
if (currentEle.showContent != value.text) {
//通用规则校验
if (this.payExceedInsured(currentEle, currentFactor, value.value)) {
@@ -605,6 +709,7 @@ export default {
path: '/common/selectedProduct'
}
})
localStorage.trialList = ''
} else {
this.chooseProducts.splice(index, 1)
}
@@ -653,14 +758,17 @@ export default {
}
} else if (factor.type == 1) {
if (factor.code == 'inputPrem') {
trialInfo['prem'] = Number(this.defalutAmt) * Number(factor.moneyUnit)
trialInfo['prem'] =
this.isTrial == '0'
? Number(item.productTrialYearDTOS[this.payEndYearColumnsIndex].displayAmount) *
Number(item.productTrialYearDTOS[this.payEndYearColumnsIndex].moneyUnit)
: Number(factor.displayAmount) * Number(factor.moneyUnit)
} else {
if (item.isRemit == 0) {
trialInfo['amt'] = Number(factor.defaultValue) * Number(factor.moneyUnit)
trialInfo['amt'] = Number(factor.displayAmount) * Number(factor.moneyUnit)
} else {
trialInfo['amt'] = Number(this.defalutAmt) * Number(factor.moneyUnit)
trialInfo['amt'] = Number(factor.displayAmount) * Number(factor.moneyUnit)
}
// trialInfo['amt'] = Number(this.defalutAmt) * Number(factor.moneyUnit)
}
} else if (factor.type == 2) {
trialInfo.jobLevel = this.saleInsuredPersonInfo[factor.code]
@@ -683,6 +791,7 @@ export default {
console.log('trialInfo == ', trialInfo)
//通用规则1交费方式为一次交情无交费期限
if (trialInfo['payIntv'] == '0') {
console.log(11111)
trialInfo['payEndYear'] = '1000'
trialInfo['payEndYearFlag'] = 'Y'
// 福宝宝和万能险传A
@@ -747,69 +856,103 @@ export default {
console.log(defalutValue, productIndex, calFactorIndex, min, max)
console.log(this.saleInsuredPersonInfo.age)
console.log(riskFactor)
console.log(JSON.parse(localStorage.trialList)[0].productCode)
// debugger
let currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex]
let currentEle =
localStorage.isTrial !== '1' && this.chooseProducts[productIndex].isMainRisk == '0'
? this.chooseProducts[productIndex].productTrialYearDTOS[calFactorIndex]
: this.chooseProducts[productIndex].calFactorLst[calFactorIndex]
//改动原因:孝心保产品有对年龄的特殊要求
//添加判断,是否是孝心保产品
if (JSON.parse(localStorage.trialList)[0].productCode == 'GFRS_M0014') {
let productCode = localStorage.trialList == '' ? '' : JSON.parse(localStorage.trialList)[0].productCode
if (productCode == 'GFRS_M0014') {
//被保人年龄如果在50-65区间
if (this.saleInsuredPersonInfo.age >= 50 && this.saleInsuredPersonInfo.age <= 65) {
//使用rules规则里的第二条控制保额份数
if (Number(this.defalutAmt) < Number(riskFactor.rules[1].minPrem) || Number(this.defalutAmt) > Number(riskFactor.rules[1].maxPrem)) {
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
if ((Number(this.defalutAmt) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(this.defalutAmt) * Number(currentEle.moneyUnit)
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//被保人年龄如果在66-75之间
} else if (this.saleInsuredPersonInfo.age >= 66 && this.saleInsuredPersonInfo.age <= 75) {
//使用rules规则里的第一条控制保额份数
if (Number(this.defalutAmt) < Number(riskFactor.rules[0].minPrem) || Number(this.defalutAmt) > Number(riskFactor.rules[0].maxPrem)) {
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
if ((Number(this.defalutAmt) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(this.defalutAmt) * Number(currentEle.moneyUnit)
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
//isTrial为0 ---暂时为富娃娃两全保险(万能型)专配 输入保费校验
} else if (this.isTrial === '0' && this.chooseProducts[productIndex].isMainRisk == '0') {
if (Number(defalutValue) < Number(min)) {
console.log('校验 == ', Number(defalutValue), Number(min), Number(min) * Number(riskFactor.moneyUnit))
this.$toast(`交费期间为${riskFactor.yearWay}年交时,最低保费为${Number(min) * Number(riskFactor.moneyUnit)}`)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(`超过最低保费部分金额需为1000元整数倍`)
this.nextStepFlag = true
} else {
this.nextStepFlag = false
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(riskFactor.moneyUnit)
this.getTrial()
}
}
//其他产品按照原先的逻辑判断
} else if (this.isTrial === '0' && this.chooseProducts[productIndex].isMainRisk == '1') {
if (Number(defalutValue) < Number(min) || Number(defalutValue) > Number(max)) {
this.$toast('投保本险种最低基本保险金额为10000元超过最低基本保险金额为1000元整数倍')
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// defalutValue = currentEle.rules[productIndex].displayAmount
this.$toast('投保本险种最低基本保险金额为10000元超过最低基本保险金额为1000元整数倍')
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
} else {
if (Number(this.defalutAmt) < Number(min) || Number(this.defalutAmt) > Number(max)) {
if (Number(defalutValue) < Number(min) || Number(defalutValue) > Number(max)) {
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
if ((Number(this.defalutAmt) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// defalutValue = currentEle.rules[productIndex].displayAmount
this.$toast(localStorage.hint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(this.defalutAmt) * Number(currentEle.moneyUnit)
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
// let currentEle = this.chooseProducts[this.productIndex].calFactorLst[this.calFactorIndex]
// currentEle.defaultValue = value
// defalutValue = value
console.log('进来几次')
this.mult = Number(this.defalutAmt) / Number(defalutValue)
this.mult = Number(defalutValue) / Number(defalutValue)
},
//下一步
async nextStep() {
@@ -817,65 +960,67 @@ export default {
let [mainRiskCode, riskDTOLst] = ['', []]
let rollInResult = '' //校验预计转入保费结果
this.chooseProducts.forEach((item, index) => {
if (item.isMainRisk == 0) {
mainRiskCode = item.productCode
}
// this.trialInfos.map(trial=>{
// trial.duty.map(dutylist=> {
// dutylist.dutyname
// })
// })
let riskItem = {
isMainRisk: item.isMainRisk,
riskName: item.riskName,
riskType: item.riskType,
riskCode: item.productCode,
mainRiskCode: mainRiskCode,
prem: this.trialList[index] && this.trialList[index].prem,
standPrem: this.trialList[index] && this.trialList[index].standPrem,
predictTransferPrem: item.predictTransferPrem,
thirdInsuraceNo: this.policyNo,
mult: this.mult
}
if (item.hasPredictTransferPrem && item.hasPredictTransferPrem === '0') {
//增加万能险 预计转入保费校验
rollInResult = this.rollInCheck(item.predictTransferPrem)
} else {
rollInResult = true
}
//责任险保存参数构建
if (this.trialList[index].duty) {
riskItem['dutyLst'] = this.trialList[index].duty
//930折中方案责任险分档
riskItem['amt'] = this.trialList[index].amt
}
//保费算保额
console.log('this.trialList', this.trialList[index].trialType)
// debugger
if (this.trialList[index].trialType == '1' || this.trialList[index].trialType == '2') {
// console.log('11111111111111111')
// console.log(this.trialList[index].amt)
riskItem['amt'] = this.trialList[index].amt
}
// console.log(riskItem)
//万能型产品保费赋值给保额
//增加判断是否是从建议书跳转过来了的
if (localStorage.isFrom != 'proposal') {
if (this.trialList[index].productCode == 'GFRS_M0003') {
// console.log('2222222222')
riskItem['amt'] = this.trialList[index].prem
if (localStorage.trialList != '') {
if (item.isMainRisk == 0) {
mainRiskCode = item.productCode
}
// this.trialInfos.map(trial=>{
// trial.duty.map(dutylist=> {
// dutylist.dutyname
// })
// })
let riskItem = {
isMainRisk: item.isMainRisk,
riskName: item.riskName,
riskType: item.riskType,
riskCode: item.productCode,
mainRiskCode: mainRiskCode,
prem: this.trialList[index] && this.trialList[index].prem,
standPrem: this.trialList[index] && this.trialList[index].standPrem,
predictTransferPrem: item.predictTransferPrem,
thirdInsuraceNo: this.policyNo,
mult: this.mult
}
if (item.hasPredictTransferPrem && item.hasPredictTransferPrem === '0') {
//增加万能险 预计转入保费校验
rollInResult = this.rollInCheck(item.predictTransferPrem)
} else {
rollInResult = true
}
//责任险保存参数构建
if (this.trialList[index].duty) {
riskItem['dutyLst'] = this.trialList[index].duty
//930折中方案责任险分档
riskItem['amt'] = this.trialList[index].amt
}
//保费算保额
console.log('this.trialList', this.trialList[index].trialType)
// debugger
if (this.trialList[index].trialType == '1' || this.trialList[index].trialType == '2') {
// console.log('11111111111111111')
// console.log(this.trialList[index].amt)
riskItem['amt'] = this.trialList[index].amt
}
// console.log(riskItem)
//万能型产品保费赋值给保额
//增加判断是否是从建议书跳转过来了的
if (localStorage.isFrom != 'proposal') {
if (this.trialList[index].productCode == 'GFRS_M0003' || this.trialList[index].productCode == 'GFRS_M0015') {
riskItem['amt'] = this.trialList[index].prem
}
}
//豁免险保额处理
if (item.isRemit == '0') {
// console.log('33333333')
this.trialInfos[index].amt = this.trialList[0].prem
}
// console.log(riskItem)
console.log(this.trialInfos[index])
riskItem = Object.assign(riskItem, this.trialInfos[index])
// console.log(riskItem)
riskDTOLst.push(riskItem)
}
//豁免险保额处理
if (item.isRemit == '0') {
// console.log('33333333')
this.trialInfos[index].amt = this.trialList[0].prem
}
// console.log(riskItem)
console.log(this.trialInfos[index])
riskItem = Object.assign(riskItem, this.trialInfos[index])
// console.log(riskItem)
riskDTOLst.push(riskItem)
})
if (!rollInResult) {
return