Files
ebiz-h5/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue

3726 lines
157 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="calculate-premium-container pt10 redRadioCheckbox">
<FieldDatePicter label="出生日期" required name="出生日期" :value.sync="userInfo.birthday" @confirm="onConfirm" type="date" :flag="true" />
<select-radio required :radios="sexRadio" label="性别" name="性别" :value.sync="userInfo.sex" />
<div v-for="(item, index) in chooseProducts" :key="index" class="ph10 bg-white">
<div class="flex justify-content-s align-items-c border-bottom pv10">
<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="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" />
<van-icon name="delete" size="22" v-if="item.isMainRisk !== 0" @click="deleteRisk(index, item)" class="green" />
</div>
<!-- 险种条件 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">
<!--riskFactor.type 1输入框和步进器 0 下拉选 -->
<div class="flex justify-content-s pv10 border-bottom" v-if="Number(riskFactor.type) === 1 && item.productCode !== 'GFRS_A0011'">
<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.number="item.calFactorLst[riskFactorIndex].displayAmount"
:min="riskFactor.minAmt || riskFactor.minPrem"
:max="riskFactor.maxAmt || riskFactor.maxPrem"
:show-plus="false"
:show-minus="false"
class="ml30"
:disable-input="disabledShow"
@change="
stepperChange(
item.calFactorLst[riskFactorIndex].displayAmount,
index,
riskFactorIndex,
riskFactor.minAmt || riskFactor.minPrem,
riskFactor.maxAmt || riskFactor.maxPrem,
riskFactor
)
"
input-width="100"
:integer="false"
/>
</div>
</div>
<!-- GFRS_A0011-附加两全 属于非豁免险 但附加两全保额=主险年交保费+其他不带豁免责任的长期期交附加险年交保费 此处保额单独展示 -->
<div
v-else-if="item.productCode === 'GFRS_A0011' && riskFactor.type == 1 && riskFactor.code === 'amt'"
class="flex justify-content-s pv10 border-bottom"
>
<van-field v-model="riskFactor.defaultValue" readonly :label="riskFactor.name + '(' + riskFactor.suffix + ')'" />
</div>
<!-- //主险的交费期间联动国富人寿附加两全(GFRS_A0011)保险的交费期间 -->
<div
class="flex justify-content-s pv10 border-bottom"
v-if="riskFactor.type == 0 && item.productCode !== 'GFRS_A0011'"
: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="flex justify-content-s pv10 border-bottom"
v-else-if="riskFactor.type == 0 && item.productCode === 'GFRS_A0011'"
:class="{ hidden: riskFactor.code === 'payEndYear' && item.isHidden }"
>
<van-field
v-if="riskFactor.code !== 'payEndYear'"
v-model="riskFactor.showContent"
readonly
:label="riskFactor.name"
right-icon="arrow"
placeholder="请选择"
@click="toSelect(index, riskFactorIndex, riskFactor.columns)"
/>
<van-field v-if="riskFactor.code === 'payEndYear'" v-model="riskFactor.showContent" readonly :label="riskFactor.name" />
</div>
<div class="border-bottom renewalWrappser fs14" v-if="riskFactor.type == 4 && !renewalShow(mainRiskCode)">
<span>{{ riskFactor.name }}</span>
<van-radio-group class="renewal" v-model="renewal" direction="horizontal">
<van-radio class="radio" name="-1"></van-radio>
<van-radio class="radio" name="-2"></van-radio>
</van-radio-group>
</div>
<!-- 桂企产品GFRS_M0024/GFRS_M0040等不显示责任保费及万元只显示责任名称及勾选框 -->
<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
v-if="
![
'GFRS_M0024',
'GFRS_M0040',
'GFRS_M0044',
'GFRS_M0046',
'GFRS_M0051',
'GFRS_M0054',
'GFRS_M0073',
'GFRS_M0057',
'GFRS_M0086',
'GFRS_M0092',
'GFRS_M0096'
].includes(item.productCode)
"
class="fs14 w100"
>{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span
>
<span v-else class="fs14 w100">{{ dutyItem.dutyName }}</span>
<div class="flex relative">
<van-stepper
v-if="
![
'GFRS_M0024',
'GFRS_M0040',
'GFRS_M0044',
'GFRS_M0046',
'GFRS_M0051',
'GFRS_M0054',
'GFRS_M0073',
'GFRS_M0057',
'GFRS_M0086',
'GFRS_M0092',
'GFRS_M0096'
].includes(item.productCode)
"
v-model="dutyItem.defaultDutyAmt"
:min="dutyItem.minDutyAmt"
:max="dutyItem.maxDutyAmt"
:show-plus="false"
:show-minus="false"
:disabled="
item.productCode === 'GFRS_M0088' ||
item.productCode === 'GFRS_A0012' ||
(item.productCode === 'GFRS_M0077' && !dutyItem.necess) ||
(item.productCode === 'GFRS_M0077' && dutyItem.duty === '311507')
"
class="ml10 mr10"
@focus="focusStep"
@blur="blurStep(dutyItem, index, item.productCode)"
@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, dutyItem)"
></van-checkbox>
</div>
</div>
</div>
</div>
<!-- 类型为5的字段单元格只展示文本 -->
<div class="border-bottom pv10" v-if="riskFactor.type == 5">
<van-field v-model="riskFactor.showContent" disabled readonly :label="riskFactor.name" />
</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.number="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 relative">
<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(dutyItem, index)"
@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, dutyItem)"
></van-checkbox>
</div>
</div>
</div>
</div>
<!-- 类型为5的字段单元格只展示文本 -->
<div class="border-bottom pv10" v-if="riskFactor.type == 5">
<van-field v-model="riskFactor.showContent" readonly :label="riskFactor.name" />
</div>
</div>
</div>
<!-- 豁免险条件GFRS_A0013,GFRS_A0014 -->
<div v-if="item.isRemit == 0">
<div v-for="(riskFactor, riskFactorIndex) in item.calFactorLst" :key="riskFactorIndex" class="border-bottom">
<div class="flex justify-content-s pv10">
<div class="flex">
<van-field v-if="riskFactor.type == 0" v-model="riskFactor.showContent" readonly :label="riskFactor.name" />
<van-field v-if="riskFactor.type == 1" v-model="riskFactor.defaultValue" readonly :label="riskFactor.name + '(' + riskFactor.suffix + ')'" />
</div>
</div>
<div 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 relative">
<van-stepper
v-model="dutyItem.defaultDutyAmt"
:min="dutyItem.minDutyAmt"
:max="dutyItem.maxDutyAmt"
:show-plus="false"
:show-minus="false"
class="ml10 mr10"
:disabled="dutyItem.changeWithMainRisk === true ? 'disabled' : ''"
@focus="focusStep"
@blur="blurStep(dutyItem, index)"
@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.isDisabled || dutyItem.defaultValue == '0'"
shape="square"
@change="changeChecked(index, riskFactorIndex, dutyItemIndex, dutyItem)"
></van-checkbox>
</div>
</div>
</div>
</div>
<!-- 类型为5的字段单元格只展示文本 -->
<div class="border-bottom pv10" v-if="riskFactor.type == 5">
<van-field v-model="riskFactor.showContent" readonly :label="riskFactor.name" />
</div>
</div>
</div>
<!-- 只有万能险且只有建议书才展示 -->
<van-field class="pv10" v-if="item.hasPredictTransferPrem === '0'" v-model="item.predictTransferPrem" label="预计转入保费" placeholder="请输入" />
<div class="flex justify-content-s pv10 border-bottom" v-if="item.isMainRisk == 0 && isRelated && isFrom != 'proposal'">
<van-field
v-model="policyNo"
clearable
label="关联保单"
name="关联保单号"
maxlength="380"
type="textarea"
autosize
@blur="getTrial"
placeholder="请录入保单号或者投保单号,如果关联多个保单,请用\隔开"
/>
</div>
<div
class="flex justify-content-s pv10 border-bottom prem"
v-if="!['GFRS_M0100', 'GFRS_M0080', 'GFRS_M0083', 'GFRS_M0098', 'GFRS_M0103', 'GFRS_M0085'].every(itemCode => item.productCode !== itemCode)"
>
<!-- 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)"
>
首期保费(元):
</span>
<span style="font-weight: bold" v-else>保额(元):</span>
<span class="fee red" v-if="trialList && trialList.length > 0">{{ trialList[index].showPrem | moneyFormat }}</span>
</div>
</div>
<!--底部总保费计算-->
<div class="bottom-btn bg-white flex">
<span> 首期总保费 ¥ {{ firstTermTotalPremium | moneyFormat }} 元 </span>
<van-button type="danger" size="large" @click="nextStep" :disabled="nextStepFlag" v-no-more-click="1000">立即投保</van-button>
</div>
<van-action-sheet v-model="show" cancel-text="取消" :actions="policyInfo" @select="openDocument" />
<!-- 字段选择 -->
<van-popup v-model="popupShow" position="bottom"><van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="onCancel"/></van-popup>
<!-- 附加险添加窗口 -->
<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" />
</template>
</van-picker>
</van-popup>
<van-dialog v-model="trialResultsShow" title="核保试算结果" :show-cancel-button="false">
<div class="pl20 pr20 mt10">
<div class="flex justify-content-s fs12" v-for="(item, index) in verifyResultList" :key="index">
<div>
<img class="w20 h20 p10 v-middle" :src="require('@/assets/images/sale/ruleType0' + item.ruleType + '.png')" alt="" />
<span class="v-middle">{{ item.ruleType | ruleTypeFilter }}</span>
</div>
<div>
<!-- <span class="v-middle">{{item.status | approvedFilter}}</span>-->
<img class="w20 h20 p10 v-middle" :src="require('@/assets/images/sale/approved' + item.status + '.png')" alt="" />
</div>
</div>
<div class="flex justify-content-s align-items-c fs12" v-for="item in riskAmntList">
<div>
<img class="w20 h20 p10 v-middle" :src="require('@/assets/images/sale/coin.png')" alt="" />
<span class="v-middle">{{ item.accuRiskDesc }}</span>
</div>
<div>
<span class="w20 h20 p10 v-middle">{{ item.accuRiskAmnt }}</span>
<!-- <img class="w20 h20 p10 v-middle" :src="require('@/assets/images/sale/approved' + item.status + '.png')" alt="" />-->
</div>
</div>
<div style="padding: 25px 0px 10px 10px; font-size: 10px; color: #999">
<p style="line-height: 20px">
<span style="width: 40px; display: inline-block">说明:</span><br />
1.绿色✔表示 未触发规则、红色×表示 触发规则;<br />
2.已累计本次投保的风险保额;<br />3.展示的风险保额为常见风险类别。
</p>
</div>
</div>
</van-dialog>
</div>
</template>
<script>
import { Tag, Icon, Dialog, ActionSheet, Popup, Picker, Stepper, Field, Checkbox, RadioGroup, Radio } from 'vant'
import { saveOrUpdateOrderInfo, getOrderDetail, orderTrial, information } from '@/api/ebiz/sale/sale'
import { saveProposal, saveOrUpdateTrialRecordInfo } from '@/api/ebiz/proposal/proposal.js'
import { getAgentInfo } from '@/api/ebiz/my/my.js'
import utilsAge from '@/assets/js/utils/age'
import { dutyRules } from './js/dutyRules'
import { M0070Rules as dutdutyGFRS_M0070RulesyRules } from './js/dutyGFRS/M0070Rules'
import { A0004Rules as dutyGFRS_A0004Rules } from './js/dutyGFRS/A0004Rules'
import { A0008Rules as dutyGFRS_A0008Rules } from './js/dutyGFRS/A0008Rules'
import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
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 DataDictionary from '@/assets/js/utils/data-dictionary'
const DUTY_DEFAULT_MUTIPLE = 1000
const DUTY_DEFAULT_MIN = 10000
export default {
name: 'calculatePremium',
filters: {
ruleTypeFilter(val) {
switch (val) {
case '1':
return '体检:'
case '2':
return '财务问卷:'
case '3':
return '契调:'
case '4':
return '财务资料:'
}
},
approvedFilter(val) {
switch (val) {
case '0':
return '达标:'
case '1':
return '未达标'
}
}
},
components: {
AddtionRiskList,
[Tag.name]: Tag,
[Icon.name]: Icon,
[ActionSheet.name]: ActionSheet,
[Popup.name]: Popup,
[Picker.name]: Picker,
[Stepper.name]: Stepper,
[Field.name]: Field,
[Checkbox.name]: Checkbox,
[Dialog.name]: Dialog,
[Radio.name]: Radio,
[RadioGroup.name]: RadioGroup,
FieldDatePicter: FieldDatePicter,
SelectRadio: SelectRadio
},
props: {
productDTOS: {
type: Array,
default: () => []
}
},
data() {
return {
// 附加险 popup 控制组件
showAdditionRiskPopup: false,
userInfo: {
birthday: void 0,
sex: '0',
relationToAppnt: undefined
},
sexRadio: [
{ label: '男', value: '0' },
{ label: '女', value: '1' }
],
branchTypeVal: '', //个险渠道G 中介渠道Z
isEnterAddtionRisk: true, //附加险list
activeRadio: '1',
// activeType: localStorage.getItem('active_type'), 现在从订单详情接口取值了
activeType: '',
cvalidateFlag: false,
cvalidateStr: '', //活动生效日
chooseProducts: [],
disabledShow: false,
productIndex: '',
calFactorIndex: '',
premiumData: [], //试算
saleInsuredInfo: {},
saleInsuredPersonInfo: {}, //投保人信息
trialList: [],
popupShow: false,
columns: [],
pickerType: '',
show: false,
policyInfo: [],
currentIndex: '', //当前操作产品
trialInfos: [],
influenceAddRiskCodes: [],
influences: [],
nextStepFlag: false,
isRelated: localStorage.isRelated === '0', //关联保单号
policyNo: '',
// 份数
mult: '',
isFrom: '',
// 默认钱数
defalutAmt: '',
//是否需存在特殊配置 0-是 1-否
isTrial: localStorage.isTrial,
//缴费期间对应index索引
payEndYearColumnsIndex: 0,
// 后台配置的校验规则
ruleExpression: {},
mainRiskCode: '',
renewal: '-1',
richChildrenFlag: false,
isCrossChannel: '0', //是否交叉渠道 1-是 0-否
trialResultsShow: false, //核保试算结果
riskAmntList: [], //累计寿险风险保额(元)、累计重大疾病风险保额(元)、累计意外伤害风险保额(元)、意外住院津贴日额(元)、一般住院津贴日额(元)、特定疾病住院津贴日额(元)
verifyResultList: [] //核保试算返回数据结构
}
},
computed: {
firstTermTotalPremium() {
const res = this.trialList.reduce(
(accumulator, currentValue) => {
console.log(accumulator.showPrem, currentValue.showPrem)
return accumulator.showPrem + currentValue.showPrem
},
{ showPrem: 0 }
)
if (typeof res === 'number') return res
else return 0
},
/**
* 检测信息是否通过校验, 后续可以根据各个字段添加规则
* @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
)
}
},
mounted() {
this.isFrom = window.localStorage.isFrom
this.$jump({
flag: 'navigation',
extra: {
title: '保费计算'
}
})
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 => {
// branchType N1、1代表个险渠道 和 N5、5 代表中介渠道N代表内勤
if (res.branchType === 'N1' || res.branchType == '1') {
this.branchTypeVal = 'G'
} else if (res.branchType === 'N5' || res.branchType == '5') {
this.branchTypeVal = 'Z'
} else if (res.branchType == '2') {
// 2 团险业务员
this.branchTypeVal = 'T'
} else if (res.branchType == '3') {
// 3 银保业务员
this.branchTypeVal = 'Y'
}
})
this.init()
Array.prototype.min = function() {
var min = this[0]
var len = this.length
for (var i = 1; i < len; i++) {
if (this[i] < min) {
min = this[i]
}
}
return min
}
},
methods: {
appCallBack(data) {
if (data.trigger === 'right_button_click' && localStorage.isFrom === 'proposal') {
return this.$dialog
.confirm({
className: 'dialog-delete',
title: '提示',
message: '退出流程可能会丢失部分数据,是否确认退出?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
this.$jump({
flag: 'h5',
extra: {
title: '建议书列表',
forbidSwipeBack: 1, //当前页面禁止右滑返回
url: location.origin + `/#/proposal/list`
},
routerInfo: {
path: `/proposal/list`,
type: '1'
}
})
})
.catch(() => {})
}
},
renewalShow(productCode) {
let codes = ['GFRS_M0016', 'GFRS_M0005', 'GFRS_M0018', 'GFRS_M0070']
return codes.find(item => {
return productCode === item
})
},
//构建险种因子列表
getFactorList(resultData) {
let productTrialInfoDTO = resultData.productTrialInfoDTO
let calFactorLst = resultData.productTrialInfoDTO.calFactorLst
calFactorLst.forEach(item => {
item['isMainRisk'] = 0
item.columns = []
if (Number(item.type) === 0) {
//1、type=0 select 2、type=1 input+stepper
productTrialInfoDTO[item.code].forEach(factor => {
if (factor.defaultValue == 0) {
item.showContent = factor.showContent
if (factor[item.code + 'Flag'] !== undefined) {
item[item.code] = factor[item.code]
item[item.code + 'Flag'] = factor[item.code + 'Flag']
item.hasFlag = '1'
} else if (item.code === 'pensionAge') {
//养老保险金领取年龄
item[item.code] = factor[item.code]
item['sex'] = factor.sex
} else {
item[item.code] = factor[item.code]
}
}
let itemColumns = { text: factor.showContent, value: factor[item.code], flag: factor[item.code + 'Flag'], sex: factor.sex }
if (factor.medical !== undefined) {
itemColumns.medical = factor.medical
}
item.columns.push(itemColumns)
})
} else if (Number(item.type) === 1) {
//按年龄选择
if (productTrialInfoDTO[item.code] != null) {
// productTrialInfoDTO[item.code].forEach(factor => {
// // item = Object.assign(item, factor)
// if (
// JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredAge >= Number(factor.minAge) &&
// JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredAge <= Number(factor.maxAge)
// ) {
// // if(JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).age >= Number(factor.minAge) && JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).age <= Number(factor.maxAge)){
// item = Object.assign(item, factor)
// }
// })
if (item.code === 'inputPrem') {
item['inputPrem'] = Number(item.minPrem) * Number(item.moneyUnit)
} else {
item['amt'] = Number(item.minAmt) * Number(item.moneyUnit)
}
}
} else if (item.type == 5) {
// 单元格用于展示文案从extra中获取
item['showContent'] = item.extra
}
//规则储存
item['rules'] = productTrialInfoDTO[item.code]
})
// // 用于意外险初始化保额
// calFactorLst.map(item => {
// if (item.code == '"dutyGroup"') {
// item.rules.map(factor => {
// factor[0].defaultDutyAmt = 50
// })
// }
// })
return calFactorLst
},
//页面跳转
jumpTo() {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/common/calculatePremium' + thismyurl
},
routerInfo: {
path: '/common/calculatePremium' + thismyurl
}
})
},
//初始化数据
async init() {
let that = this
//获取投保人信息
// if (this.$CacheUtils.getLocItem('saleInsuredInfo')) {
// this.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
// }
// //获取被保险人信息
// if (this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) {
// this.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
// this.saleInsuredPersonInfo.insuredAge = this.saleInsuredPersonInfo.insuredAge ? this.saleInsuredPersonInfo.insuredAge : this.saleInsuredPersonInfo.age
// if (this.saleInsuredPersonInfo.birthday) {
// this.saleInsuredPersonInfo.insuredAge = utilsAge.getAge(this.saleInsuredPersonInfo.birthday, new Date())
// }
// if (this.isFrom == 'proposal' && !this.saleInsuredPersonInfo.name) {
// // 建议书投保人/被保人姓名不必填, 填写姓名时展示姓名(落库),不填写姓名时展示性别+年龄,如:男30岁(不落库)
// let sex = this.saleInsuredPersonInfo.sex == '0' ? '男' : '女'
// this.saleInsuredPersonInfo.name = sex + this.saleInsuredPersonInfo.insuredAge + '岁'
// }
// }
this.cvalidateFlag = (this.activeType === 'KMH' || this.activeType === 'SQY') && this.isFrom !== 'proposal'
this.cvalidateStr = this.cvalidateFlag ? (this.activeType === 'KMH' ? '2021-01-01' : this.activeType === 'SQY' ? '2021-06-01' : '') : ''
//GFRS-2552【需求】关于金掌桂投保流程增设指定生效日按钮的申请
// const orderNo = this.$route.query.orderNo
// let detailPromise = this.isFrom === 'proposal' ? localStorage.proposalMedical : await getOrderDetail({ orderNo })
// let collect = (data, code) => {
// data.forEach(item => {
// if (item.code == code) {
// this.saleInsuredPersonInfo.healthGrade = item.healthGrade
// this.saleInsuredPersonInfo.lifeGrade = item.lifeGrade
// } else {
// if (item.subs && item.subs.length != 0) {
// collect(item.subs, code)
// }
// }
// })
// }
// if (this.isFrom != 'proposal') {
// collect(occupationList, detailPromise.orderDTO.insuredDTOs[0].occupationCode)
// //活动生效日期
// this.cvalidateStr = detailPromise.orderDTO.orderInfoDTO.cvaliDate
// this.activeType = detailPromise.orderDTO.orderInfoDTO.activeType
// }
this.cvalidateFlag = this.activeType && this.isFrom !== 'proposal'
//构建提交数据、渲染险种
// if (this.$route.query.insuanceIdInfo && this.isFrom == 'proposal' && !localStorage.editproposaladdrisk) {
// // 获取试算记录详情
// let serialNo = ''
// if (this.$route.query.orderNo) {
// serialNo = this.$route.query.orderNo
// }
// if (this.$route.query.proposalOrderNo) {
// serialNo = this.$route.query.proposalOrderNo
// }
// let thismyinsuanceIdInfo = JSON.parse(this.$route.query.insuanceIdInfo)
// let insuanceId = ''
// let riskProductCode = ''
// thismyinsuanceIdInfo.forEach(item => {
// if (item.isMainRisk == 0) {
// insuanceId = item.insuanceId
// riskProductCode = item.riskCode
// }
// })
// await getTrialRecordInfo({
// serialNo: serialNo,
// mainRiskId: insuanceId
// }).then(res => {
// if (res.result == '0') {
// this.chooseProducts = JSON.parse(res.content.trialJsonStr)
// this.trialRecordInfoId = res.content.id
// } else {
// this.$toast(res.resultMessage)
// }
// })
// } else {
// this.chooseProducts = JSON.parse(localStorage.chooseProducts)
// }
const { productCode: productDetailCode, productName } = this.productDTOS[0]
const productDetail = await information({
productCodes: [productDetailCode],
platform: 'app',
type: '1'
})
// stepper 步骤需要用到主险的code
localStorage.setItem('trialList', JSON.stringify([{ productCode: productDetailCode }]))
// 构建需要的参数
/*global structuredClone*/
let resultData = structuredClone(productDetail)
const riskProductCode = productDetailCode
if (resultData.result !== '0') {
this.$toast('error')
return
}
resultData = resultData.trialDTOS[0]
localStorage.isTrial = resultData.productTrialInfoDTO.productTrialYearDTOS != null ? '0' : '1'
localStorage.hint = resultData.hint
if (resultData.productTrialInfoDTO.dutyGroup != null) {
resultData.productTrialInfoDTO.dutyGroup.map(item => {
if (item.dutyName === '意外身故/伤残保险金') {
item.defaultDutyAmt = item.minDutyAmt
}
})
}
if (resultData.productTrialInfoDTO.ruleExpression) {
let ruleExpression = localStorage.ruleExpression ? JSON.parse(localStorage.ruleExpression) : {}
ruleExpression[resultData.productCode] = resultData.productTrialInfoDTO.ruleExpression
localStorage.ruleExpression = JSON.stringify(ruleExpression)
}
/********start 主险选择限制 start******/
// 检验投被人关系 惠企保特殊校验
// if (riskProductCode === 'GFRS_M0040') {
// if (riskRules.relationLimit(resultData, JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt, this)) {
// return
// }
// }
// 检验投被人关系 国富人寿特定疾病药品费用医疗保险特殊校验
// if (riskProductCode === 'GFRS_M0045') {
// if (riskRules.relationCommonLimit(resultData, JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt, this)) {
// return
// }
// }
// if (riskRules.ageLimit(resultData, this, null, riskProductCode)) {
// return
// }
//
// if (riskRules.medicalLimit(resultData, this)) {
// return
// }
//
// if (riskRules.healthGradeLimit(resultData, this)) {
// return
// }
// if (riskRules.lifeGradeLimit(resultData, this)) {
// return
// }
//validateAppntFlag 0-职业寿险等级需校验主合同的投保人1-职业寿险等级无需校验主合同的投保人
// if (Number(resultData.productInsuredDTO.validateAppntFlag) === 0) {
// //校验主合同投保人寿险职业等级
// if (riskRules.lifeGradeLimitForBaby(resultData, this)) {
// return
// }
// } else {
// //校验主合同被保险人寿险职业等级
// if (riskRules.lifeGradeLimit(resultData, this)) {
// return
// }
// }
let flagPermission = await riskRules.getProductSellPermissionList(resultData.productCode, this, this.isCrossChannel)
if (flagPermission.flag && localStorage.isFrom !== 'proposal') {
//校验该代理人是否有该产品的售卖权限
return this.$toast(flagPermission.resultMessage)
}
// 禁用投保工作单位检测
// let flagCompany = await riskRules.checkCompany(
// resultData.productCode,
// JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).workcompany,
// JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).isAsync,
// this
// )
// if (flagCompany && localStorage.isFrom !== 'proposal') {
// //校验该投保人的工作单位是否能够投保该产品
// return this.$toast('该投保人工作单位不能投保该产品')
// }
/********end 主险选择限制 end******/
//保存附加险
localStorage.addtionRiskLst = JSON.stringify(resultData.productTrialInfoDTO.addtionRiskLst)
localStorage.isAutoPay = resultData.isAutoPay
localStorage.isRenew = resultData.isRenew
localStorage.isForceRenew = resultData.isForceRenew
localStorage.isRelated = resultData.isRelated
let calFactorLst = this.getFactorList(resultData)
// return
let productTrialYearDTOS = resultData.productTrialInfoDTO.productTrialYearDTOS != null ? resultData.productTrialInfoDTO.productTrialYearDTOS : null
let hasAddtionRisk = resultData.productTrialInfoDTO.addtionRiskLst != null && resultData.productTrialInfoDTO.addtionRiskLst.length
let currentProductInfo =
localStorage.isTrial === '1'
? {
isCrossChannel: this.isCrossChannel,
calFactorLst,
hasAddtionRisk,
isMainRisk: 0,
hint: resultData.hint,
riskType: resultData.riskType,
riskName: productName,
productCode: riskProductCode,
mainRiskCode: riskProductCode,
documentDTOS: resultData.productTrialInfoDTO.documentDTOS,
influences: resultData.productTrialInfoDTO.influences,
isRemit: resultData.productTrialInfoDTO.isRemit,
hasPredictTransferPrem: resultData.productTrialInfoDTO.hasPredictTransferPrem, //建议书使用 是否展示预计转入保费
predictTransferPrem: null //建议书使用 预计转入保费字段
}
: {
isCrossChannel: this.isCrossChannel,
productTrialYearDTOS,
calFactorLst,
hasAddtionRisk,
isMainRisk: 0,
hint: resultData.hint,
riskType: resultData.riskType,
riskName: productName,
productCode: riskProductCode,
mainRiskCode: riskProductCode,
documentDTOS: resultData.productTrialInfoDTO.documentDTOS,
influences: resultData.productTrialInfoDTO.influences,
isRemit: resultData.productTrialInfoDTO.isRemit,
hasPredictTransferPrem: resultData.productTrialInfoDTO.hasPredictTransferPrem, //建议书使用 是否展示预计转入保费
predictTransferPrem: null //建议书使用 预计转入保费字段
}
//构建险种数组
let productsData
if (localStorage.chooseProducts) {
productsData = JSON.parse(localStorage.chooseProducts)
productsData.push(currentProductInfo)
} else {
productsData = [currentProductInfo]
}
//保存选择险种
productsData = this.$utils.unrepeatObj(productsData, 'productCode') //产品数组去重,跳转试算页面未成功重复添加同一产品的情况
localStorage.chooseProducts = JSON.stringify(productsData)
// this.jumpTo()
this.chooseProducts = structuredClone(productsData)
this.chooseProducts.forEach((item, index) => {
if (item.isCrossChannel === '1') {
this.isCrossChannel = item.isCrossChannel
}
if (item.mainRiskCode === 'GFRS_M0006') {
item.isHidden = true
}
if (item.mainRiskCode !== 'GFRS_M0008') {
item.calFactorLst.map(i => {
// this.defalutAmt = i.displayAmount || 1
if (i.code === 'inputPrem') {
this.mult = Math.ceil(Number(i.displayAmount) / Number(i.defaultValue))
}
})
}
if (item.mainRiskCode === 'GFRS_M0077') {
item.calFactorLst.map(i => {
if (i.code === 'dutyGroup') {
if (i.rules && i.rules.length !== 0) {
i.rules.forEach(ii => {
if (this.saleInsuredPersonInfo.insuredAge < 18) {
if (ii.duty === '311504') {
ii.necess = true
ii.defaultValue = '0'
} else {
ii.defaultValue = '0'
}
} else {
if (this.saleInsuredPersonInfo.sex === '0') {
if (ii.duty === '311505') {
ii.necess = true
ii.defaultValue = '0'
}
if (ii.duty === '311504' || ii.duty === '311506') {
ii.defaultValue = '0'
}
} else {
if (ii.duty === '311506') {
ii.defaultValue = '0'
ii.necess = true
}
if (ii.duty === '311504' || ii.duty === '311505') {
ii.defaultValue = '0'
}
}
}
})
}
}
})
}
if (item.mainRiskCode === 'GFRS_M0046') {
if (Number(this.saleInsuredPersonInfo.relationToAppnt) === 1) {
this.isEnterAddtionRiskListFunc()
}
}
if (
item.mainRiskCode === 'GFRS_M0083' ||
item.mainRiskCode === 'GFRS_M0098' ||
item.mainRiskCode === 'GFRS_M0103' ||
item.mainRiskCode === 'GFRS_M0085'
) {
this.disabledShow = true
}
if (item.hasPredictTransferPrem === '1') {
this.disabledShow = false
}
if (
(item.mainRiskCode === 'GFRS_M0083' ||
item.mainRiskCode === 'GFRS_M0098' ||
item.mainRiskCode === 'GFRS_M0103' ||
item.mainRiskCode === 'GFRS_M0085') &&
this.isFrom === 'proposal'
) {
item.calFactorLst.forEach(i => {
if (i.code === 'inputPrem') {
i.minPrem = 0.01
i.displayAmount = 0.01
i.defaultValue = 0.01
}
})
}
let payEndYearVal
//初始化时交费期间为一次性交清时,在就是中介渠道, 附加险GFRS_A0007GFRS_A0009GFRS_A0010去掉后附加险list就为空--隐藏icon
item.calFactorLst.map(i => {
if (i.code === 'payEndYear') {
if (i.payEndYear === '1000' && i.payEndYearFlag === 'Y') {
this.isEnterAddtionRiskListFunc()
}
//初始化时取交费期间的值
payEndYearVal = i.showContent
}
})
if (index == 0) {
if (item.productTrialYearDTOS) {
//初始化时取交费期间的值值再去对应productTrialYearDTOS中的第几条规则
item.productTrialYearDTOS.forEach((item, index) => {
if (payEndYearVal == item.yearWay + '年交') {
that.payEndYearColumnsIndex = index
}
})
}
}
//保存主险险种编号
if (item.isMainRisk == 0) {
this.mainRiskCode = item.mainRiskCode
}
})
if (this.mainRiskCode === 'GFRS_M0005') {
this.chooseProducts.map(item => {
if (item.productCode === 'GFRS_A0004') {
item.calFactorLst.map(item2 => {
if (item2.code === 'dutyGroup') {
item2.rules.map(item3 => {
if (item3.duty === '320205') {
item3.maxDutyAmt = '1'
}
})
}
})
}
})
}
if (
this.mainRiskCode === 'GFRS_M0031' ||
this.mainRiskCode === 'GFRS_M0005' ||
this.mainRiskCode === 'GFRS_M0042' ||
this.mainRiskCode === 'GFRS_M0043'
) {
this.chooseProducts.map(item => {
if (item.productCode === 'GFRS_A0008') {
item.calFactorLst.map(item2 => {
if (item2.code === 'dutyGroup') {
item2.rules.map(item3 => {
if (item3.duty === '320404') {
item3.maxDutyAmt = '1'
}
})
}
})
}
})
}
//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()
})
// 判断是否 含有 后台配置js验证函数
if (localStorage.ruleExpression) {
let ruleExpression = JSON.parse(localStorage.ruleExpression)
this.ruleExpression = ruleExpression
let productCodes = Object.keys(ruleExpression)
productCodes.forEach(itemKey => {
let rules = ruleExpression[itemKey]
rules.eventList = []
rules.forEach(item => {
let config = ''
config = JSON.parse(item.ruleExpression)
this.$on(config.eventName, new Function(...config.funPar, config.funBody.join('')))
if (config.eventType === 'init') {
let initFn = new Function('that', config.initBody.join(''))
initFn(this)
}
if (config.otherRisk) {
for (let item of config.otherRisk) {
if (!ruleExpression[item] || !ruleExpression[item].eventList) {
ruleExpression[item] = {
eventList: [config.eventName]
}
} else {
ruleExpression[item].eventList.push(config.eventName)
}
}
}
rules.eventList.push(config.eventName)
})
})
}
//键盘小数点无法输入试了一下iOS16以下没这个问题iOS16以上有这个问题 type="number"改成type="digit"就可以输入了,
// this.$nextTick(() => {
// try {
// var div1 = document.getElementsByClassName('van-stepper__input')
// //拿到的是一个数组集合遍历修改每一个input
// for (var x in div1) {
// div1[x].setAttribute('type', 'digit')
// }
// } catch (e) {
// console.error(e)
// }
// })
},
//特殊处理 GFRS_M0016 GFRS_A0004 GFRS_A0005 赔付比例处理
async dogetLimitAndGetRate() {
const orderNo = this.$route.query.orderNo
let detailPromise = this.isFrom === 'proposal' ? localStorage.proposalMedical : await getOrderDetail({ orderNo })
this.chooseProducts.map(item => {
if (
!(
item.mainRiskCode === 'GFRS_M0016' ||
item.mainRiskCode === 'GFRS_M0070' ||
item.productCode === 'GFRS_A0004' ||
item.productCode === 'GFRS_A0008' ||
item.productCode === 'GFRS_A0005' ||
item.productCode === 'GFRS_M0088'
)
) {
//其他产品删掉两个字段
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)
}
}
return
}
if (
item.mainRiskCode === 'GFRS_M0016' ||
item.mainRiskCode === 'GFRS_M0070' ||
item.productCode === 'GFRS_A0004' ||
item.productCode === 'GFRS_A0008' ||
item.productCode === 'GFRS_A0005'
) {
let isMedical = null
if (this.isFrom === 'proposal') {
isMedical = detailPromise == '1'
} else {
isMedical = detailPromise.orderDTO.insuredDTOs[0].medical == '0'
}
// 赔付比例和免赔额
item.calFactorLst.map(i => {
if (i.code === 'getLimit') {
let tempColumns = i.columns.filter(itemC => {
return itemC.medical == Math.abs(isMedical - 1).toString()
})
if (tempColumns.length !== 0) {
i.columns = tempColumns
}
// i.getLimit = i.columns[0].value
// i.showContent = i.columns[0].text
}
//赔付比例
if (i.code === 'getRate') {
let tempColumns = i.columns.filter(itemC => {
return itemC.medical == Math.abs(isMedical - 1).toString()
})
if (tempColumns.length !== 0) {
i.columns = tempColumns
}
// i.getRate = i.columns[0].value
// i.showContent = i.columns[0].text
}
})
this.$forceUpdate()
} else if (item.productCode === 'GFRS_A0005') {
// GFRS_A0005 未处理
}
})
},
// 责任保额份数变化
dutyStepperChange(value, productIndex, calFactorIndex, dutyItemIndex, isChecked, min, max) {
//这个险种使用其他验证方式
if (this.chooseProducts[productIndex].productCode === 'GFRS_M0016') return
if (this.chooseProducts[productIndex].productCode === 'GFRS_M0070') return
// 004险种其他验证方式
if (this.chooseProducts[productIndex].productCode === 'GFRS_A0004') return
// 008险种其他验证方式
if (this.chooseProducts[productIndex].productCode === 'GFRS_A0008') return
if (
this.chooseProducts[productIndex].productCode === 'GFRS_A0003' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0009' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0014' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0013' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0010' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0015' ||
this.chooseProducts[productIndex].productCode === 'GFRS_A0016'
) {
setTimeout(() => {
this.getTrial()
}, 500)
return
}
let currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules[dutyItemIndex]
let showHint = this.chooseProducts[productIndex].hint
if (value < min || value > max) {
this.$toast(showHint)
} else {
if ((Number(value) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
Dialog.alert({
message: showHint
}).then(() => {
currentEle.defaultDutyAmt = currentEle.minDutyAmt
})
// this.$toast(showHint)
} else {
// this.mainRiskInfluenceAddRisk()
// currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
// this.getTrial()
if (isChecked) {
;[this.productIndex, this.calFactorIndex] = [productIndex, calFactorIndex]
let currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules
currentEle.forEach(item => {
item.amt = Number(item.minDutyAmt) * Number(item.moneyUnit)
})
this.mainRiskInfluenceAddRisk()
this.getTrial()
} else {
;[this.productIndex, this.calFactorIndex] = [productIndex, calFactorIndex]
let currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules
currentEle.forEach(item => {
item.amt = Number(item.minDutyAmt) * Number(item.moneyUnit)
})
}
}
}
},
//弹框选择
toSelect(productIndex, factorIndex, columns) {
this.columns = []
;[this.popupShow, this.productIndex, this.calFactorIndex] = [true, productIndex, factorIndex]
let currentProduct = this.chooseProducts[productIndex]
let currentFactor = currentProduct.calFactorLst
let currentEle = currentFactor[this.calFactorIndex]
let sex = this.saleInsuredPersonInfo.sex //0男 1女
//性别男女,养老保险金领取年龄不一致
if (currentEle.code === 'pensionAge') {
columns.forEach(item => {
if (item.sex == sex) {
this.columns.push(item)
}
})
return
}
if (currentProduct.mainRiskCode === 'GFRS_M0111') {
// 国富人寿鑫盈嘉两全保险(分红型) 交费期间payEndYear: 1次交清和3年交 保险期间insuYear: 5年和6年
// 现要求payEndYear选择一次交清insuYear只能选5年payEndYear选择3年交payEndYear只能选6年保险期间
if (currentEle.code == 'insuYear') {
let payEndYearFactor = currentFactor.find(factor => factor.code == 'payEndYear')
if (!payEndYearFactor) {
return
}
let payEndYear = payEndYearFactor.showContent
if (!payEndYear) {
// 保险期间未选择, 提示选择
this.$toast(`请先选择${payEndYearFactor.name}`)
return
}
let payEndYearOption = payEndYearFactor.columns.find(item => item.text == payEndYear)
let payEndYearVal = payEndYearOption.value
console.log('payEndYearVal--->', payEndYearVal, columns)
// 如果有值,则需约定可选择项
if (payEndYearVal) {
columns.forEach(item => {
if ((payEndYearVal == '1000' && item.value == '5') || (payEndYearVal == '3' && item.value == '6')) {
this.columns.push(item)
}
})
}
return
}
}
this.columns = columns
},
//取消picker
onCancel() {
this.columns = []
this.popupShow = false
},
//确认选择字段
async onConfirm(value) {
const res = [this.productIndex, this.calFactorIndex].find(item => item === '')
if (res !== -1) this.toSelect(0, 0, 0)
this.columns = []
this.popupShow = false
// let productCode = this.chooseProducts[this.productIndex].productCode
let currentFactor = this.chooseProducts[this.productIndex].calFactorLst
let currentEle = currentFactor[this.calFactorIndex]
if (currentEle.code === 'insuYear') {
if (value.value == '70') {
this.chooseProducts.forEach(item => {
if (item.mainRiskCode === 'GFRS_M0086') {
item.calFactorLst.forEach(i => {
if (i.code === 'inputAmt') {
i.minPrem = 20
i.displayAmount = 20
i.defaultValue = 20
}
})
}
})
} else if (value.value == '106') {
this.chooseProducts.forEach(item => {
if (item.mainRiskCode === 'GFRS_M0086') {
item.calFactorLst.forEach(i => {
if (i.code === 'inputAmt') {
i.minPrem = 10
i.displayAmount = 10
i.defaultValue = 10
}
})
}
})
}
}
if (this.chooseProducts[this.productIndex].mainRiskCode === 'GFRS_M0111') {
// 国富人寿鑫盈嘉两全保险(分红型) 交费期间payEndYear: 1次交清和3年交 保险期间insuYear: 5年和6年
// 现要求payEndYear选择一次交清insuYear只能选5年payEndYear选择3年交payEndYear只能选6年保险期间
if (currentEle.code === 'payEndYear') {
// 获取当前的值
let payEndYear = value.value
console.log('payEndYear--->', payEndYear)
const insuYearFactor = currentFactor.find(factor => factor.code === 'insuYear')
if (insuYearFactor) {
console.log('insuYearFactor--->', insuYearFactor)
let matchInsureYearValue = payEndYear == '1000' ? '5' : payEndYear == '3' ? '6' : null
let matchedOption = insuYearFactor.columns.find(item => item.value == matchInsureYearValue)
insuYearFactor.showContent = matchedOption ? matchedOption.text : ''
insuYearFactor['insuYear'] = matchedOption ? matchedOption.value : ''
}
}
}
//中介渠道交费期间为一次性交清时附加险GFRS_A0007GFRS_A0009GFRS_A0010去掉后附加险list就为空--隐藏icon
if (currentEle.code === 'payEndYear' && value.value == '1000') {
this.isEnterAddtionRiskListFunc()
//交费期间为一次性交清时清空豁免险GFRS_A0007GFRS_A0009GFRS_A0010并更新localStorage
this.isClearAddtionRiskListFunc()
} else if (this.chooseProducts[this.productIndex].mainRiskCode === 'GFRS_M0046') {
if (this.saleInsuredPersonInfo.relationToAppnt == 1) {
this.isEnterAddtionRiskListFunc()
}
} else {
this.isEnterAddtionRisk = true
}
if (currentEle.showContent !== value.text) {
//通用规则校验
if (await this.payExceedInsured(currentEle, currentFactor, value.value)) {
this.popupShow = false
return false
}
if (currentEle.code === 'payEndYear' && (await this.ageInfluencePayEndYear(value.value, currentEle))) {
this.popupShow = false
return false
}
if (currentEle.code === 'insuYear' && (await this.ageInfluenceInsuYear(value.value, currentEle))) {
this.popupShow = false
return false
}
//特殊设置:如果需要填写的保费/保额校验规则跟缴费期间挂钩当改变缴费期间时将输入框的值恢复默认值1
//国富人寿富贵年年终身寿险和国富人寿鑫享年年终身寿险B款一次性交清, 选择5,10,15,20 年交时, 保费试算有问题,所有调一下执行顺序
if (currentEle.code === 'payEndYear' && this.isTrial == '0') {
currentEle['columns'].forEach((item, index) => {
if (item.value == value.value) {
this.payEndYearColumnsIndex = index
}
})
this.defalutAmt = 1
}
let productCode = this.chooseProducts[this.productIndex].productCode
if (this.ruleExpression[productCode]) {
this.errorMsg = []
let currentFactor = this.chooseProducts[this.productIndex].calFactorLst
let currentEle = currentFactor[this.calFactorIndex]
this.ruleExpression[productCode].eventList.forEach(item => {
this.$emit(item, currentFactor, currentEle.code, value)
})
if (this.errorMsg.length > 0) {
this.$toast(this.errorMsg[0])
this.errorMsg = []
this.popupShow = false
return false
}
}
// 后台配置 的 js函数 验证
// if(hasR){
// if(currentEle.code == 'payEndYear' || currentEle.code == 'insuYear'){
// this.payEndYear(currentEle.code,value.value,this.tmpInsuYear.insuYear + this.tmpInsuYear.insuYearFlag)
// }
// }
currentEle.showContent = value.text
let name = currentEle.code
currentEle[name] = value.value
if (currentEle.hasFlag) {
currentEle[name + 'Flag'] = value.flag
}
// this.hiddenPayEndYear(currentEle)
//特殊规则:设置豁免险
this.getTrial()
}
},
//交费期间为一次性交清时清空豁免险GFRS_A0007GFRS_A0009GFRS_A0010,GFRS_A0012并更新localStorage
isClearAddtionRiskListFunc() {
let chooseProductsNew = []
this.chooseProducts.forEach(item01 => {
const excludedCodes = ['GFRS_A0007', 'GFRS_A0009', 'GFRS_A0010', 'GFRS_A0012', 'GFRS_A0013', 'GFRS_A0014', 'GFRS_A0015', 'GFRS_A0016']
if (!excludedCodes.includes(item01.productCode)) chooseProductsNew.push(item01)
})
if (chooseProductsNew.length !== this.chooseProducts.length) {
this.chooseProducts = chooseProductsNew
}
localStorage.chooseProducts = JSON.stringify(chooseProductsNew)
},
// 交通责任险复选框变化
changeChecked(productIndex, calFactorIndex, dutyItemIndex, dutyItem) {
//检测责任中是否有勾选责任
let isChecked = this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.some(item => {
return item.necess == true
})
if (!isChecked) {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules[dutyItemIndex]['necess'] = !this.chooseProducts[productIndex].calFactorLst[
calFactorIndex
].rules[dutyItemIndex]['necess']
return false
}
//嘉和保多责任组合选中、取消任意一款其他5款也跟着选中、取消
let validateRiskCode = this.chooseProducts[productIndex].productCode
if (validateRiskCode === 'GFRS_M0054') {
if (
dutyItem.duty == '100022' ||
dutyItem.duty == '100023' ||
dutyItem.duty == '100024' ||
dutyItem.duty == '100025' ||
dutyItem.duty == '100026' ||
dutyItem.duty == '100027'
) {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.map(i => {
if (i.duty == '100022' || i.duty == '100023' || i.duty == '100024' || i.duty == '100025' || i.duty == '100026' || i.duty == '100027') {
i.necess = dutyItem.necess
}
})
}
}
if (validateRiskCode === 'GFRS_M0073') {
if (dutyItem.duty == '100035' || dutyItem.duty == '100036') {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.map(i => {
if (i.duty == '100035' || i.duty == '100036') {
i.necess = dutyItem.necess
}
})
}
if (dutyItem.duty == '100037' || dutyItem.duty == '100038' || dutyItem.duty == '100039' || dutyItem.duty == '100040' || dutyItem.duty == '100041') {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.map(i => {
if (i.duty == '100037' || i.duty == '100038' || i.duty == '100039' || i.duty == '100040' || i.duty == '100041') {
i.necess = dutyItem.necess
}
})
}
}
if (validateRiskCode === 'GFRS_M0077') {
if (dutyItem.duty == '311507' && dutyItem.necess) {
this.chooseProducts.forEach(item => {
item.calFactorLst.map(i => {
if (i.code == 'dutyGroup') {
if (i.rules && i.rules.length != 0) {
i.rules.forEach(ii => {
if (ii.duty != '311507' && ii.necess) {
dutyItem.defaultDutyAmt = ii.defaultDutyAmt
}
})
}
}
})
})
}
}
if (validateRiskCode === 'GFRS_M0088') {
if (dutyItem.duty == '411200' || dutyItem.duty == '411206' || dutyItem.duty == '411207') {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.forEach(i => {
if (i.duty == '411200' || i.duty == '411206' || i.duty == '411207') {
i.necess = dutyItem.necess
} else {
if (dutyItem.necess) {
i.necess = !dutyItem.necess
}
}
})
}
if (dutyItem.duty == '411200_GBC' || dutyItem.duty == '411206_GBC' || dutyItem.duty == '411207_GBC') {
this.chooseProducts[productIndex].calFactorLst[calFactorIndex].rules.forEach(i => {
if (i.duty == '411200_GBC' || i.duty == '411206_GBC' || i.duty == '411207_GBC') {
i.necess = dutyItem.necess
} else {
if (dutyItem.necess) {
i.necess = !dutyItem.necess
}
}
})
}
}
this.valiAndSend(dutyItem, productIndex)
},
valiAndSend(dutyItem, productIndex) {
//验证责任
let validateRiskCode = this.chooseProducts[productIndex].productCode
let showHint = this.chooseProducts[productIndex].hint
let inputValue = dutyItem.defaultDutyAmt,
duty = dutyItem.duty
if (validateRiskCode === 'GFRS_M0016' && !this.valiDuty(inputValue, duty)) {
//验证不通过
return
} else if (validateRiskCode === 'GFRS_M0070' && !this.valiDuty(inputValue, duty)) {
//验证不通过
return
} else if (validateRiskCode === 'GFRS_A0004' && !this.valiA0004Duty(inputValue, showHint, dutyItem)) {
//验证不通过 险种为GFRS_A0004 责任编码为320205
return
} else if (validateRiskCode === 'GFRS_A0008' && !this.valiA0008Duty(inputValue, showHint, dutyItem)) {
//验证不通过 险种为GFRS_A0008 责任编码为320404
return
} else {
this.mainRiskInfluenceAddRisk()
this.getTrial()
}
},
// 计步器聚焦
focusStep() {
this.nextStepFlag = true
},
blurStep(dutyItem, productIndex, productCode) {
this.nextStepFlag = false
//失去焦点时做验证
if (dutyItem.necess) {
//勾选时才做验证
this.valiAndSend(dutyItem, productIndex)
}
if (productCode == 'GFRS_M0077') {
this.chooseProducts.forEach(item => {
if (item.mainRiskCode == 'GFRS_M0077') {
item.calFactorLst.map(i => {
if (i.code == 'dutyGroup') {
if (i.rules && i.rules.length != 0) {
i.rules.forEach(ii => {
if (ii.duty == '311507' && ii.necess) {
ii.defaultDutyAmt = dutyItem.defaultDutyAmt
}
})
}
}
})
}
})
}
},
//险种GFRS_M0016\GFRS_M0070的责任的验证规则
valiDuty(value, duty) {
if (this.mainRiskCode === 'GFRS_M0016') {
value *= 10000
const rule = dutyRules[duty]
const mutiple = rule.mutiple || DUTY_DEFAULT_MUTIPLE
const min = rule.min || DUTY_DEFAULT_MIN
if (!value || value < min || value % mutiple !== 0) {
this.$toast(rule.msg)
this.nextStepFlag = true
return false
} else {
this.nextStepFlag = false
return true
}
} else if (this.mainRiskCode === 'GFRS_M0070') {
value *= 10000
const rule = dutdutyGFRS_M0070RulesyRules[duty]
const mutiple = rule.mutiple || DUTY_DEFAULT_MIN
const min = rule.min || DUTY_DEFAULT_MIN
if (!value || value < min || value % mutiple !== 0) {
this.$toast(rule.msg)
this.nextStepFlag = true
return false
} else {
this.nextStepFlag = false
return true
}
}
},
//险种 GFRS_A0004 险种验证规则
valiA0004Duty(value, showHint, currentEle) {
/* if (!(currentEle.necess == true)) {
this.nextStepFlag = false
return true
}*/
// 验证其他 最小50 其他为50 10 倍数
if (currentEle.duty == '320206' || currentEle.duty == '320207') {
let numberValue = Number(value) * 10000
if (numberValue % 10 != 0 || numberValue < 50) {
this.$toast(dutyGFRS_A0004Rules[currentEle.duty].msg)
this.nextStepFlag = true
return false
}
}
// 保额只能为5000 10000 15000 200000
if (currentEle.duty == '320205') {
if (this.mainRiskCode === dutyGFRS_A0004Rules[currentEle.duty]['mainRisk']) {
if (!(value == '0.5' || value == '1')) {
this.$toast(dutyGFRS_A0004Rules[currentEle.duty].msg_2)
this.nextStepFlag = true
return false
} else if (value - 0 > 1) {
this.$toast(dutyGFRS_A0004Rules[currentEle.duty].msg_1)
this.nextStepFlag = true
return false
}
} else {
if (!(value == '0.5' || value == '1' || value == '1.5' || value == '2')) {
this.$toast(dutyGFRS_A0004Rules[currentEle.duty].msg)
this.nextStepFlag = true
return false
}
}
this.nextStepFlag = false
return true
}
this.nextStepFlag = false
return true
},
//险种 GFRS_A0008 险种验证规则
valiA0008Duty(value, showHint, currentEle) {
/* if (!(currentEle.necess == true)) {
this.nextStepFlag = false
return true
}*/
// 验证其他 最小50 其他为50 10 倍数
if (currentEle.duty == '320405' || currentEle.duty == '320406') {
let numberValue = Number(value) * 10000
if (numberValue % 10 != 0 || numberValue < 50) {
this.$toast(dutyGFRS_A0008Rules[currentEle.duty].msg)
this.nextStepFlag = true
return false
}
}
// 保额只能为5000 10000 15000 200000
if (currentEle.duty == '320404') {
if (
this.mainRiskCode === dutyGFRS_A0008Rules[currentEle.duty]['mainRisk'] ||
this.mainRiskCode === dutyGFRS_A0008Rules[currentEle.duty]['otmainRisk'] ||
this.mainRiskCode === dutyGFRS_A0008Rules[currentEle.duty]['mainRisk2'] ||
this.mainRiskCode === dutyGFRS_A0008Rules[currentEle.duty]['otmainRisk2']
) {
if (!(value == '0.5' || value == '1')) {
this.$toast(dutyGFRS_A0008Rules[currentEle.duty].msg_2)
this.nextStepFlag = true
return false
} else if (value - 0 > 1) {
this.$toast(dutyGFRS_A0008Rules[currentEle.duty].msg_1)
this.nextStepFlag = true
return false
}
} else {
if (!(value == '0.5' || value == '1' || value == '1.5' || value == '2')) {
this.$toast(dutyGFRS_A0008Rules[currentEle.duty].msg)
this.nextStepFlag = true
return false
}
}
this.nextStepFlag = false
return true
}
this.nextStepFlag = false
return true
},
/********start 通用规则、特殊规则处理 start******/
//通用规则1交费方式为一次交情无交费期限
// hiddenPayEndYear(currentEle) {
// if (currentEle.code == 'payIntv') {
// if (this.chooseProducts[0].productCode === 'GFRS_M0015' && this.chooseProducts[this.productIndex].productCode === 'GFRS_A0006') {
// return
// }
// this.chooseProducts[this.productIndex]['isHidden'] = currentEle.payIntv == '0' ? true : false
// }
// },
//通用规则2交费期限不能超过保险期间
payExceedInsured(currentEle, currentFactor, currentVale) {
let payEndYearVal, insuYearVal
if (currentEle.code == 'payEndYear') {
payEndYearVal = Number(currentVale)
insuYearVal = this.getPayEndYearOrInsuYear('insuYear', currentFactor)
}
if (currentEle.code == 'insuYear') {
insuYearVal = Number(currentVale)
payEndYearVal = this.getPayEndYearOrInsuYear('payEndYear', currentFactor)
}
//交费期限为一次性交清时val为1000直接跳过此规则
if (payEndYearVal != 1000) {
if (payEndYearVal > insuYearVal) {
this.$toast('交费期间不能超过保险期间')
return true
} else {
return false
}
} else {
return false
}
},
//中介渠道交费期间为一次性交清时附加险GFRS_A0007GFRS_A0009GFRS_A0010,GFRS_A0012去掉后附加险list就为空--隐藏icon
isEnterAddtionRiskListFunc() {
let addtionRiskLst = JSON.parse(localStorage.addtionRiskLst)
if (addtionRiskLst) {
let list = []
addtionRiskLst.forEach((item, index) => {
if (
item.productCode != 'GFRS_A0007' &&
item.productCode != 'GFRS_A0009' &&
item.productCode != 'GFRS_A0010' &&
item.productCode != 'GFRS_A0012' &&
item.productCode != 'GFRS_A0013' &&
item.productCode != 'GFRS_A0014' &&
item.productCode != 'GFRS_A0015' &&
item.productCode != 'GFRS_A0016'
) {
list.push(item)
}
})
if (list.length) {
this.isEnterAddtionRisk = true
} else {
this.isEnterAddtionRisk = false
}
}
},
getPayEndYearOrInsuYear(flag, currentFactor) {
let returnVal
currentFactor.forEach(item => {
if (item.code == flag) {
returnVal = item[flag]
}
})
return Number(returnVal)
},
//特殊规则1、交费期间跟年龄的关系
ageInfluencePayEndYear(value, currentEle) {
let age = Number(this.saleInsuredPersonInfo.insuredAge)
for (let i = 0; i < currentEle.rules.length; i++) {
if (currentEle.rules[i].payEndYear == value && age > currentEle.rules[i].maxAge) {
this.$toast('被保险人年龄不适合该交费期间!')
return true
}
if (
currentEle.rules[i].payEndYear == value &&
currentEle.rules[i].payEndYearFlag == 'A' &&
(age < currentEle.rules[i].minAge || age > currentEle.rules[i].maxAge)
) {
this.$toast('被保险人年龄不适合该交费期间!')
return true
}
}
return false
},
//年龄对保险期间的影响
ageInfluenceInsuYear(value, currentEle) {
let age = Number(this.saleInsuredPersonInfo.insuredAge)
for (let i = 0; i < currentEle.rules.length; i++) {
if (currentEle.rules[i].insuYear == value && age > currentEle.rules[i].maxAge) {
this.$toast('被保险人年龄不适合该保险期间!')
return true
}
}
return false
},
//特殊规则2、主险对附加险的影响,主要是保额之间的影响 mainAddRelation0-小于1-大于2-等于3-小于等于,4-大于等于
mainRiskInfluenceAddRisk() {
if (this.productIndex == 0) {
this.chooseProducts.forEach((item, index) => {
if (this.influenceAddRiskCodes.includes(item.productCode)) {
let influences = this.getInfluencesItem(item.productCode)
let mainAddRelation = influences.amtInfluence[0].mainAddRelation
let amtTimes = influences.amtInfluence[0].amtTimes
let mainRiskAmt = this.getMainRiskAmt()
if (mainAddRelation == 3 && (amtTimes == 1 || amtTimes == 5)) {
this.setInputAddtionRiskMaxAmt(mainRiskAmt * amtTimes, index)
} else if (mainAddRelation == 3 && amtTimes == 0.2) {
this.setAddtionRiskMaxAmt(mainRiskAmt * amtTimes, index)
}
}
})
}
},
setAddtionRiskMaxAmt(mainRiskAmt, index) {
this.chooseProducts[index].calFactorLst.forEach(item => {
if (item.code == 'amt' || item.code == 'planCode') {
let columnsValArr = []
item.columns.forEach(option => {
columnsValArr.push(Number(option.amt))
if (Number(option.amt) > mainRiskAmt * 10000) {
option.disabled = true
} else {
option.disabled = false
}
})
//主险减,附加险变化,取最小
let currentAmt = this.getAmtByPlanCode(item.columns, item.planCode)
if (mainRiskAmt * 10000 < currentAmt) {
let minVal = columnsValArr.min()
item.columns.forEach(option => {
if (option.amt == minVal) {
item.showContent = option.text
item.planCode = option.value
item.amt = option.amt
}
})
}
}
})
},
getAmtByPlanCode(columns, planCode) {
let amt = ''
columns.forEach(item => {
if (item.value == planCode) {
amt = item.amt
}
})
return amt
},
setInputAddtionRiskMaxAmt(mainRiskAmt, index) {
this.chooseProducts[index].calFactorLst.forEach(item => {
if (item.type == 1) {
item.maxAmt = Math.min(mainRiskAmt, item.oldMaxAmt)
//减保额份数
if (item.maxAmt < item.defaultValue) {
item.defaultValue = item.maxAmt
}
}
})
},
getMainRiskAmt() {
let mainRiskAmt
this.chooseProducts[0].calFactorLst.forEach(item => {
if (item.type == 1) {
mainRiskAmt = item.defaultValue
}
})
return mainRiskAmt
},
getInfluencesItem(productCode) {
let currentInfluences
this.chooseProducts[0].influences.forEach(item => {
if (item.productCode == productCode) {
currentInfluences = item
}
})
return currentInfluences
},
trialBeforeRule() {
let that = this
// 针对于国富人寿附加两全保险附加险(GFRS_A0011),缴费期间期间要等于主险的缴费期间
let mainRiskInfo = this.getMainRiskInfo()
this.chooseProducts.forEach(item => {
if (item.productCode === 'GFRS_A0011') {
item.calFactorLst.map(item2 => {
if (item2.code === 'payEndYear') {
item2.hasFlag = '1'
item2.payEndYearFlag = 'Y'
item2.payEndYear = Number(mainRiskInfo.payEndYear.payEndYear)
item2.showContent = item2.payEndYear + '年交'
} else if (item2.code === 'amt') {
// GFRS_A0011-附加两全 属于非豁免险 但附加两全保额=主险年交保费+其他不带豁免责任的长期期交附加险年交保费
let trialList = JSON.parse(localStorage.trialList)
item2.amt = trialList[0].prem
item2.defaultValue = trialList[0].prem
item2.moneyUnit = 1
item2.suffix = '元'
}
})
}
})
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
// window.localStorage.setItem('chooseProducts',JSON.stringify( this.chooseProducts))
if (
this.chooseProducts[0].productCode === 'GFRS_M0035' ||
this.chooseProducts[0].productCode === 'GFRS_M0044' ||
this.chooseProducts[0].productCode === 'GFRS_M0060' ||
this.chooseProducts[0].productCode === 'GFRS_M0040' ||
this.chooseProducts[0].productCode === 'GFRS_M0046'
) {
if (this.trialList.length) {
let showPrem //计算后的保费
//(被保险人)国富人寿附加豁免保险费重大疾病保险(B款GFRS_A0010
//(投保人)国富人寿附加豁免保险费重大疾病保险(B款 GFRS_A0009
//国富人寿附加两全保险条款 GFRS_A0011
//只有在搭配附加两全时才能搭配被保险人附加豁免重疾B;
//获取两全险的保费
let showPrem001
this.trialList.forEach((item, index) => {
if (item.productCode == 'GFRS_A0011') {
showPrem001 = item.showPrem //获取两全险的保费
}
})
this.chooseProducts.forEach((item, index) => {
if (
item.productCode === 'GFRS_A0010' ||
item.productCode === 'GFRS_A0009' ||
item.productCode === 'GFRS_A0013' ||
item.productCode === 'GFRS_A0014' ||
item.productCode === 'GFRS_A0015' ||
item.productCode === 'GFRS_A0016'
) {
//(投保人)国富人寿附加豁免保险费重大疾病保险(B款
// 投被不同人:投保人豁免险单独搭配主险时,投保人豁免险,豁免主险保费,当投保人豁免险加两全(有长险附加险时),豁免主险保费加两全保费
if (
item.productCode === 'GFRS_A0009' ||
item.productCode === 'GFRS_A0013' ||
item.productCode === 'GFRS_A0015' ||
item.productCode === 'GFRS_A0016'
) {
if (this.saleInsuredPersonInfo.relationToAppnt != 1) {
//不同人
if (showPrem001) {
//加两全时
showPrem = Number(showPrem001) + Number(that.trialList[0].showPrem)
} else {
showPrem = Number(that.trialList[0].showPrem)
}
}
item.calFactorLst.map(item2 => {
if (item2.code === 'dutyGroup') {
item2.rules.map(item3 => {
item3.defaultDutyAmt = (showPrem / 10000).toFixed(6)
})
}
})
} else if (item.productCode === 'GFRS_A0010' || item.productCode === 'GFRS_A0014') {
//(被保险人)国富人寿附加豁免保险费重大疾病保险(B款GFRS_A0010
//投被同人,不同人:被保人豁免险搭配两全(有长险附加险时)时,可选责任为必选,豁免两全保费
if (showPrem001) {
showPrem = Number(showPrem001)
} else {
showPrem = Number(that.trialList[0].showPrem)
}
item.calFactorLst.map(item2 => {
if (item2.code === 'dutyGroup') {
item2.rules.map(item3 => {
item3.defaultDutyAmt = (showPrem / 10000).toFixed(6)
item3.defaultValue = '0'
item3.necess = true
})
}
})
}
}
})
}
}
},
//特殊规则3、设置豁免险
setRemitRisk() {
// 世纪无忧重疾(GFRS_M0046)交费至60/70周岁时不可附加两全险(GFRS_A0011)
let mainRiskInfo = this.getMainRiskInfo()
let mainRiskPayIntv = mainRiskInfo.payIntv.payIntv
let mainRiskPayEndYearFlag = mainRiskInfo.payEndYear.payEndYearFlag
if (mainRiskPayEndYearFlag === 'A' && this.chooseProducts[0].mainRiskCode === 'GFRS_M0046') {
//删除附加两全险
for (let i = 0; i < this.chooseProducts.length; i++) {
if (this.chooseProducts[i].productCode === 'GFRS_A0011') {
this.chooseProducts.splice(i, 1)
i--
}
}
}
//1、一次性交清和交费期间单位为A时删除豁免险
// let mainRiskInfo = this.getMainRiskInfo()
// let mainRiskPayIntv = mainRiskInfo.payIntv.payIntv
// let mainRiskPayEndYearFlag = mainRiskInfo.payEndYear.payEndYearFlag
if (mainRiskPayIntv == 0 || mainRiskPayEndYearFlag === 'A') {
//删除已选或互斥险种
for (let i = 0; i < this.chooseProducts.length; i++) {
if (this.chooseProducts[i].isRemit == 0) {
this.chooseProducts.splice(i, 1)
i--
}
}
}
//2、豁免险跟主险联动豁免险缴费期间和保险期间同主险的缴费期间 -1 (附加险D款时提出的需求)
let remitIndex = this.getRemitIndex()
//if (!remitIndex) return
for (let itemRemitIndex of remitIndex) {
console.log('mainRiskInfo---->', mainRiskInfo)
this.chooseProducts[itemRemitIndex].calFactorLst.forEach(item => {
if (item.code === 'payIntv') {
for (let key in mainRiskInfo.payIntv) {
item[key] = mainRiskInfo.payIntv[key]
}
}
if (item.code === 'payEndYear') {
item.hasFlag = '1'
item.payEndYearFlag = 'Y'
item.payEndYear = Number(mainRiskInfo.payEndYear.payEndYear) - 1
item.showContent = item.payEndYear + '年交'
}
if (item.code === 'insuYear') {
item.hasFlag = '1'
item.insuYearFlag = 'Y'
item.insuYear = Number(mainRiskInfo.payEndYear.payEndYear) - 1
item.showContent = item.insuYear + '年'
}
if (item.code == 'amt') {
let trialList = JSON.parse(localStorage.trialList)
item.amt = trialList[0].prem
item.defaultValue = trialList[0].prem
item.moneyUnit = 1
item.suffix = '元'
}
if (
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0003' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0009' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0010' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0013' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0014' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0015' ||
this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0016'
) {
//此附加险的缴费期间=主险缴费期间;保险期间=主险保险期间
if (item.code === 'insuYear') {
item.hasFlag = '1'
item.insuYearFlag = mainRiskInfo.insuYear.insuYearFlag
item.insuYear = Number(mainRiskInfo.insuYear.insuYear)
item.showContent = mainRiskInfo.insuYear.showContent
}
if (item.code === 'dutyGroup') {
item.rules.forEach(v => {
try {
if (mainRiskInfo.inputPrem.displayAmount && mainRiskInfo.inputPrem.moneyUnit) {
v.amt = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
} else {
// 解决这个问题--建议书添加 附加豁免保险费重大疾病保险 不展示险种保费
// inputPrem 这个里面的规则删除导致的
let payEndYearVal
this.chooseProducts.map(item => {
item.calFactorLst.map(i => {
if (i.code === 'payEndYear') {
payEndYearVal = i.showContent
}
})
})
this.chooseProducts[0].productTrialYearDTOS.forEach((item, index) => {
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
if (payEndYearVal == Number(item.yearWay) - 1 + '年交') {
v.amt = item.displayAmount * item.moneyUnit
}
})
}
} catch (e) {
let trialList = JSON.parse(localStorage.trialList)
v.amt = trialList[0].prem
// v.amt = mainRiskInfo.inputAmt.displayAmount * mainRiskInfo.inputAmt.moneyUnit
}
v.defaultDutyAmt = (Number(v.amt) / v.moneyUnit).toFixed(6)
// v.moneyUnit = 10000
// v.suffix = '万元'
})
}
}
//之所以catch是因为有些参数值不存在导致报错豁免险除国富人寿附加投保人豁免保险费定期寿险B款保险条款 GFRS_A0007试算拼参数时amt保额都重置为null
if (this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0001' || this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0007') {
try {
if (mainRiskInfo.inputPrem.displayAmount && mainRiskInfo.inputPrem.moneyUnit) {
item.amt = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
item.defaultValue = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
} else {
// 解决这个问题--建议书添加 附加豁免保险费重大疾病保险 不展示险种保费
// inputPrem 这个里面的规则删除导致的
let payEndYearVal01
this.chooseProducts.map(item01 => {
item01.calFactorLst.map(i => {
if (i.code === 'payEndYear') {
payEndYearVal01 = i.showContent
}
})
})
this.chooseProducts[0].productTrialYearDTOS.forEach((v, index) => {
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
if (payEndYearVal01 == v.yearWay + '年交') {
item.amt = v.displayAmount * v.moneyUnit
item.defaultValue = v.displayAmount * v.moneyUnit
}
})
}
} catch (e) {
let trialList = JSON.parse(localStorage.trialList)
item.defaultValue = trialList[0].prem
item.amt = trialList[0].prem
}
item.defaultDutyAmt = (Number(item.amt) / item.moneyUnit).toFixed(6)
// 国富人寿附加投保人豁免保险费定期寿险B款保险条款 GFRS_A0007
// 保额----豁免主险+附加两全的保费
// 国富人寿附加两全保险条款 GFRS_A0011
//重新再调一次试算因保额为文本框没有change事件所以保额变化后少一次调用试算所以特此手动重新调用一次
let trialList = JSON.parse(localStorage.trialList)
let showPrem
trialList.forEach((item, index) => {
if (item.productCode === 'GFRS_A0011') {
showPrem = item.showPrem //获取两全险的保费
}
})
if (this.chooseProducts[itemRemitIndex].productCode === 'GFRS_A0007' && showPrem) {
item.amt = trialList[0].prem + showPrem
item.defaultValue = trialList[0].prem + showPrem
}
}
})
}
let product = this.chooseProducts.find(item => {
return item.productCode === 'GFRS_A0006'
})
if (product && this.richChildrenFlag) {
product.calFactorLst[0].showContent = '月交'
product.calFactorLst[2].showContent = '月交'
product.calFactorLst[0].columns[0].text = '月交'
product.calFactorLst[2].columns[0].text = '月交'
let remitProduct = this.trialList.find(item => {
return item.productCode === 'GFRS_A0006'
})
if (remitProduct) {
remitProduct.showPrem = '从万能账户中扣除'
remitProduct.prem = 0
remitProduct.payIntv = 1
}
}
// if(this.chooseProducts[0].productCode == 'GFRS_M0053' || this.chooseProducts[0].productCode == 'GFRS_M0061'){
// if (this.trialList.length) {
// this.chooseProducts.forEach((item, index) => {
// // 国富人寿富桂金生养老年金保险53中介渠道鑫享金生养老年金保险61投保被保险第二个责任默认不勾选不可选
// if (item.productCode == 'GFRS_A0010' || item.productCode == 'GFRS_A0009'|| item.productCode == 'GFRS_A0013' || item.productCode == 'GFRS_A0014') {
// item.calFactorLst.map((item2) => {
// if (item2.code == 'dutyGroup') {
// item2.rules.map((item3) => {
// item3.defaultValue = '0'
// })
// }
// })
// }
// })
// }
// }
this.trialBeforeRule()
},
//获取当前产品编码下的索引值
getProductCodeIndex(productCode) {
let remitIndex = ''
this.chooseProducts.forEach((item, index) => {
if (item.productCode == productCode) {
remitIndex = index
}
})
return remitIndex
},
//获取当前产品编码下的整条数据
getProductCodeItem(productCode) {
let remitItem = {}
this.chooseProducts.forEach((item, index) => {
if (item.productCode == productCode) {
remitItem = item
}
})
return remitItem
},
getRemitIndex() {
let remitIndex = []
this.chooseProducts.forEach((item, index) => {
if (item.isRemit === '0') {
remitIndex.push(index)
}
})
return remitIndex
},
getMainRiskInfo() {
let mainRiskInfo = {}
this.chooseProducts[0].calFactorLst.forEach(item => {
mainRiskInfo[item.code] = item
})
return mainRiskInfo
},
/********end 通用规则、特殊规则处理 end******/
//查看文档列表
seeDocument(index) {
this.show = true
this.policyInfo = this.chooseProducts[index].documentDTOS
},
//打开文档
openDocument(item) {
let pdfUrl = encodeURIComponent(item.url)
this.$jump({
flag: 'h5',
extra: {
title: item.name,
// url: 'http://47.96.143.111/pdfjs/web/viewer.html?file=' + item.url //测试代码
url: location.origin + '/pdfjs/web/viewer.html?file=' + pdfUrl
}
})
// localStorage.documentInfo = JSON.stringify({ documentUrl: item.url, documentType: item.type })
// this.$jump({
// flag: 'h5',
// extra: {
// url: location.origin + '/#/product/productDocument'
// },
// routerInfo: {
// path: `/product/productDocument`
// }
// })
},
//删除所选产品
deleteRisk(index, data) {
if (this.chooseProducts[index].isMainRisk == 0 && this.$route.query.insuanceIdInfo) {
this.$toast('编辑状态不可删除主险')
} else {
Dialog.confirm({
title: '提示',
message: '确认删除该险种?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF',
className: 'dialog-delete'
})
.then(() => {
let currentGFRS_A0011
if (this.chooseProducts[index].isMainRisk == 0) {
this.chooseProducts = []
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
let thismyurl = ''
if (this.$route.query.orderNo) {
thismyurl = '/?orderNo=' + this.$route.query.orderNo
} else if (this.$route.query.proposalOrderNo) {
thismyurl = '?proposalOrderNo=' + this.$route.query.proposalOrderNo
}
this.$jump({
flag: 'goBack',
extra: {
refresh: '1',
index: '-2'
},
routerInfo: {
type: 2,
index: -2,
path: '/common/selectedProduct' + thismyurl
}
})
localStorage.trialList = ''
} else {
currentGFRS_A0011 = this.chooseProducts[index].productCode == 'GFRS_A0011' //当前删除的是否是两全
this.chooseProducts.splice(index, 1)
}
if (
this.chooseProducts[0].mainRiskCode === 'GFRS_M0051' ||
this.chooseProducts[0].mainRiskCode === 'GFRS_M0044' ||
this.chooseProducts[0].mainRiskCode === 'GFRS_M0060' ||
this.chooseProducts[0].mainRiskCode === 'GFRS_M0035' ||
this.chooseProducts[0].mainRiskCode === 'GFRS_M0038' ||
this.chooseProducts[0].mainRiskCode === 'GFRS_M0040'
) {
if (
currentGFRS_A0011 &&
(JSON.stringify(this.chooseProducts).includes('GFRS_A0010') || JSON.stringify(this.chooseProducts).includes('GFRS_A0014'))
) {
this.chooseProducts.forEach((item, index01) => {
if (item.productCode === 'GFRS_A0010' || item.productCode === 'GFRS_A0014') {
this.chooseProducts.splice(index01, 1)
}
})
// Dialog.alert({
// title: '提示',
// message: '当前未投保其他长险附加险,将删除该险种重新选择附加险!'
// }).then(() => {
// })
}
// let risks = this.chooseProducts
// let longRisks = []
// //拿到长险附加险数组
// for (let i = 1; i < risks.length; i++) {
// for (let j = 0; j < risks[i].calFactorLst.length; j++) {
// if (risks[i].calFactorLst[j].code === 'insuYear') {
// if (
// ((risks[i].calFactorLst[j].insuYearFlag == 'Y' && risks[i].calFactorLst[j].insuYear > 1) || risks[i].calFactorLst[j].insuYearFlag == 'A') &&
// risks[i].productCode != 'GFRS_A0010'
// ) {
// longRisks.push(risks[i].productCode)
// }
// }
// }
// }
// if (
// (this.chooseProducts.length == 2 && this.chooseProducts[1].productCode == 'GFRS_A0010') ||
// (this.chooseProducts.length == 3 &&
// JSON.stringify(this.chooseProducts).includes('GFRS_A0010') &&
// JSON.stringify(this.chooseProducts).includes('GFRS_A0009')) ||
// (longRisks.length <= 0 && this.chooseProducts.length > 1)
// ) {
// Dialog.alert({
// title: '提示',
// message: '当前未投保其他长险附加险,将删除该险种重新选择附加险!'
// }).then(() => {
// this.chooseProducts.splice(1, 1)
// localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
// this.getTrial()
// })
// // this.$toast('当前未投保其他长险附加险,请删除该险种重新选择附加险!')
// // this.nextStepFlag = true
// }
}
if (localStorage.oldAddRiskCodes && JSON.parse(localStorage.oldAddRiskCodes)) {
let thismyoldAddRiskCodes = JSON.parse(localStorage.oldAddRiskCodes)
thismyoldAddRiskCodes.forEach((item, index0) => {
if (item == data.productCode) {
thismyoldAddRiskCodes.splice(index0, 1)
}
})
localStorage.oldAddRiskCodes = JSON.stringify(thismyoldAddRiskCodes)
}
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
this.getTrial()
})
.catch(() => {})
}
},
//试算
async getTrial() {
let that = this
let productCode = ''
let hasPredictTransferPrem = ''
let thisproductInfo = JSON.parse(window.localStorage.getItem('chooseProducts'))
if (thisproductInfo && thisproductInfo.length != 0) {
thisproductInfo.forEach(item => {
if (
item.productCode === 'GFRS_M0083' ||
item.productCode === 'GFRS_M0098' ||
item.productCode === 'GFRS_M0103' ||
item.productCode === 'GFRS_M0085'
) {
productCode = item.productCode
hasPredictTransferPrem = item.hasPredictTransferPrem
}
})
}
if (this.isFrom !== 'proposal') {
if (productCode === 'GFRS_M0083' || productCode === 'GFRS_M0098' || productCode === 'GFRS_M0103' || productCode === 'GFRS_M0085') {
if (!that.policyNo) {
this.disabledShow = true
that.chooseProducts.forEach(item => {
item.calFactorLst.forEach(ii => {
if (ii.type == 1) {
ii.minPrem = 5
ii.displayAmount = 5
}
})
})
} else {
this.disabledShow = false
that.chooseProducts.forEach(item => {
item.calFactorLst.forEach(ii => {
if (ii.type == 1) {
ii.minPrem = 0.01
ii.displayAmount = 0.01
}
})
})
}
}
}
if (hasPredictTransferPrem == '1') {
this.disabledShow = false
}
this.nextStepFlag = true
this.$toast.clear()
this.$toast.loading({
message: '正在试算...',
forbidClick: true
})
this.setRemitRisk()
let params = this.getParams()
// 开门红产品试算增加标识,活动产品试算增加标识
if (this.activeType && this.isFrom !== 'proposal') {
for (let product of params.trialInfos) {
product.isKmh = '1'
//GFRS-2552【需求】关于金掌桂投保流程增设指定生效日按钮的申请
product.cvaliDate = that.cvalidateStr
}
}
//国富人寿富桂金生养老年金保险
let age = this.saleInsuredPersonInfo.insuredAge
let sex = this.saleInsuredPersonInfo.sex //0男 1女
let trialFlag = true
params.trialInfos.forEach(item => {
if (item.productCode === 'GFRS_A0011') {
if (item.insuYear === '60' && item.payEndYear === '30' && age > 30) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间或保险期间!')
trialFlag = false
} else if (item.insuYear === '70' && item.payEndYear === '30' && age > 40) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间或保险期间!')
trialFlag = false
} else if (
(item.insuYear === '80' && item.payEndYear === '15' && age > 55) ||
(item.insuYear === '80' && item.payEndYear === '19' && age > 50) ||
(item.insuYear === '80' && item.payEndYear === '20' && age > 50) ||
(item.insuYear === '80' && item.payEndYear === '30' && age > 40)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间或保险期间!')
trialFlag = false
}
} else if (item.productCode == 'GFRS_M0053') {
//国富人寿富桂金生养老年金保险
if (sex == '0') {
if (
(item.pensionAge === '60' && item.payEndYear === '30' && age > 30) ||
(item.pensionAge === '60' && item.payEndYear === '20' && age > 40) ||
(item.pensionAge === '60' && item.payEndYear === '15' && age > 45) ||
(item.pensionAge === '60' && item.payEndYear === '10' && age > 50)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '65' && item.payEndYear == '30' && age > 35) ||
(item.pensionAge == '65' && item.payEndYear == '20' && age > 45) ||
(item.pensionAge == '65' && item.payEndYear == '15' && age > 50) ||
(item.pensionAge == '65' && item.payEndYear == '10' && age > 55)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '70' && item.payEndYear == '30' && age > 40) ||
(item.pensionAge == '70' && item.payEndYear == '20' && age > 50) ||
(item.pensionAge == '70' && item.payEndYear == '15' && age > 55)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
} else {
//女
if (
(item.pensionAge == '55' && item.payEndYear == '30' && age > 25) ||
(item.pensionAge == '55' && item.payEndYear == '20' && age > 35) ||
(item.pensionAge == '55' && item.payEndYear == '15' && age > 40) ||
(item.pensionAge == '55' && item.payEndYear == '10' && age > 45)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '60' && item.payEndYear == '30' && age > 30) ||
(item.pensionAge == '60' && item.payEndYear == '20' && age > 40) ||
(item.pensionAge == '60' && item.payEndYear == '15' && age > 45) ||
(item.pensionAge == '60' && item.payEndYear == '10' && age > 50)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '65' && item.payEndYear == '30' && age > 35) ||
(item.pensionAge == '65' && item.payEndYear == '20' && age > 45) ||
(item.pensionAge == '65' && item.payEndYear == '15' && age > 50) ||
(item.pensionAge == '65' && item.payEndYear == '10' && age > 55)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
}
} else if (item.productCode == 'GFRS_M0061') {
//中介渠道鑫享金生养老年金保险
if (sex == '0') {
//男
if (
(item.pensionAge == '60' && item.payEndYear == '20' && age > 40) ||
(item.pensionAge == '60' && item.payEndYear == '10' && age > 50) ||
(item.pensionAge == '60' && item.payEndYear == '5' && age > 55) ||
(item.pensionAge == '60' && item.payEndYear == '3' && age > 55)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '65' && item.payEndYear == '20' && age > 45) ||
(item.pensionAge == '65' && item.payEndYear == '10' && age > 55) ||
(item.pensionAge == '65' && item.payEndYear == '5' && age > 60) ||
(item.pensionAge == '65' && item.payEndYear == '3' && age > 60)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '70' && item.payEndYear == '20' && age > 50) ||
(item.pensionAge == '70' && item.payEndYear == '10' && age > 60) ||
(item.pensionAge == '70' && item.payEndYear == '5' && age > 65) ||
(item.pensionAge == '70' && item.payEndYear == '3' && age > 65)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
} else {
//女
if (
(item.pensionAge == '55' && item.payEndYear == '20' && age > 35) ||
(item.pensionAge == '55' && item.payEndYear == '10' && age > 45) ||
(item.pensionAge == '55' && item.payEndYear == '5' && age > 50) ||
(item.pensionAge == '55' && item.payEndYear == '3' && age > 50)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '60' && item.payEndYear == '20' && age > 40) ||
(item.pensionAge == '60' && item.payEndYear == '10' && age > 50) ||
(item.pensionAge == '60' && item.payEndYear == '5' && age > 55) ||
(item.pensionAge == '60' && item.payEndYear == '3' && age > 55)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '65' && item.payEndYear == '20' && age > 45) ||
(item.pensionAge == '65' && item.payEndYear == '10' && age > 55) ||
(item.pensionAge == '65' && item.payEndYear == '5' && age > 60) ||
(item.pensionAge == '65' && item.payEndYear == '3' && age > 60)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
} else if (
(item.pensionAge == '70' && item.payEndYear == '20' && age > 50) ||
(item.pensionAge == '70' && item.payEndYear == '10' && age > 60) ||
(item.pensionAge == '70' && item.payEndYear == '5' && age > 65) ||
(item.pensionAge == '70' && item.payEndYear == '3' && age > 65)
) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
}
} else if (item.productCode == 'GFRS_M0101' || item.productCode == 'GFRS_M0102') {
// 当投保人年龄≥75周岁时需转人工核保。核心提示语投保人年龄≥75周岁。前端提示语为投保人年龄≥75周岁需进一步人工审核
let appntAge = this.saleInsuredInfo.age
if (appntAge >= 75) {
this.nextStepFlag = true
this.$toast('投保人年龄≥75周岁需进一步人工审核')
}
}
})
if (!trialFlag) {
return
}
let resultData = await trial(params)
//试算成功,信息返显
if (resultData.result == 0) {
if (resultData.flag === '1') {
this.richChildrenFlag = true
}
this.trialList = resultData.trialList
localStorage.trialList = JSON.stringify(resultData.trialList)
//设置豁免险保额
this.setRemitRisk()
this.nextStepFlag = false
} else {
this.nextStepFlag = true
this.$toast(resultData.resultMessage)
}
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
},
//获取试算参数
getParams() {
let params = {
trialInfos: []
}
this.chooseProducts.forEach(item => {
let trialInfo = {}
// 【需求】鑫管家、金管家追加限额调整thirdInsuraceNoStr关联保单号的值在试算接口添加
if (this.policyNo) {
trialInfo['thirdInsuraceNoStr'] = this.policyNo
}
item.calFactorLst.forEach(factor => {
if (factor.type === '0') {
if (factor.hasFlag == '1') {
trialInfo[factor.code] = factor[factor.code]
trialInfo[factor.code + 'Flag'] = factor[factor.code + 'Flag']
// trialInfo[factor.payEndYear] = factor[factor.payEndYear]
} else {
trialInfo[factor.code] = factor[factor.code]
}
} else if (Number(factor.type) === 1) {
if (factor.code === 'inputPrem') {
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) {
if (item.productCode === 'GFRS_A0007') {
if (factor.code === 'amt') {
trialInfo['amt'] = factor.amt
}
} else {
trialInfo['amt'] = null
}
} else {
if (item.productCode === 'GFRS_A0011') {
// 设置附加两全保额为空 后台试算
// GFRS_A0011-附加两全 属于非豁免险 但附加两全保额=主险年交保费+其他不带豁免责任的长期期交附加险年交保费
trialInfo['amt'] = null
} else {
trialInfo['amt'] = Number(factor.displayAmount) * Number(factor.moneyUnit)
}
}
}
} else if (factor.type == 2) {
trialInfo.jobLevel = this.saleInsuredPersonInfo[factor.code]
} else if (factor.type == 3) {
let result = []
factor.rules.forEach(dutyItem => {
if (dutyItem.necess) {
// trialInfo['amt'] = this.trialList[index].amt
result.push({
amt: (Number(dutyItem.defaultDutyAmt) * Number(dutyItem.moneyUnit)).toFixed(2),
dutyCode: dutyItem.duty,
dutyName: dutyItem.dutyName
})
}
})
trialInfo.duty = result
}
})
//针对八桂D产品 计算被保人重疾B附加险保额 ==其他长险附加险的保额
/*if ( this.chooseProducts[0].mainRiskCode == 'GFRS_M0051'||this.chooseProducts[0].mainRiskCode == 'GFRS_M0044'){
if(item.productCode == 'GFRS_A0010'){
let risks = JSON.parse(localStorage.chooseProducts);
let longRisks=[];
//拿到长险附加险数组
for (let i = 1; i < risks.length; i++) {
for(let j = 0; j < risks[i].calFactorLst.length; j++){
if (risks[i].calFactorLst[j].code === 'insuYear') {
if ((risks[i].calFactorLst[j].insuYearFlag == 'Y' && risks[i].calFactorLst[j].insuYear > 1) || risks[i].calFactorLst[j].insuYearFlag == 'A') {
longRisks.push(risks[i].productCode);
}
}
}
}
let toTrial = 0
let trials = JSON.parse(localStorage.trialList)
trials.forEach(tr=>{
if(tr.isMainRisk=='1'&&tr.productCode!='GFRS_A0010'&&longRisks.includes(tr.productCode)){
toTrial+=Number(tr.prem);
}
})
trialInfo.duty.forEach(d=>{
d.amt=toTrial;
})
}
}*/
//通用规则1交费方式为一次交情无交费期限
if (trialInfo['payIntv'] == '0') {
trialInfo['payEndYear'] = '1000'
trialInfo['payEndYearFlag'] = 'Y'
// 福宝宝和万能险传A
if (
item.mainRiskCode != 'GFRS_M0006' &&
item.mainRiskCode != 'GFRS_M0017' &&
item.mainRiskCode != 'GFRS_M0003' &&
item.mainRiskCode != 'GFRS_M0013'
) {
trialInfo['insuYearFlag'] = 'Y'
}
//
if (item.mainRiskCode == 'GFRS_M0036') {
trialInfo['insuYearFlag'] = 'A'
}
}
//责任险参数构建
// if (trialInfo.duty) {
// trialInfo.duty = [{ dutyCode: trialInfo.duty }]
// }
//获取投被保生日、性别
let birthday, sex, occupationCode, occupationName, age
if (item.isRemit == '0' && item.remitType == '0') {
;[birthday, sex, occupationCode, occupationName, age] = [
this.userInfo.birthday,
// this.saleInsuredInfo.birthday,
this.userInfo.sex,
// this.saleInsuredInfo.sex,
this.saleInsuredInfo.occupationCode,
this.saleInsuredInfo.occupationName,
this.saleInsuredInfo.age ? this.saleInsuredInfo.age : this.saleInsuredInfo.insuredAge
]
} else {
;[birthday, sex, occupationCode, occupationName, age] = [
this.userInfo.birthday,
// this.saleInsuredPersonInfo.birthday,
// this.saleInsuredPersonInfo.sex,
this.userInfo.sex,
this.saleInsuredPersonInfo.occupationCode,
this.saleInsuredPersonInfo.occupationName,
this.saleInsuredPersonInfo.insuredAge
]
}
const saleInsuredPersonInfo = this.saleInsuredPersonInfo
// const saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
trialInfo = Object.assign(trialInfo, {
birthday,
sex,
occupationCode,
occupationName,
age,
platformType: 'app',
productCode: item.productCode,
medical: saleInsuredPersonInfo ? saleInsuredPersonInfo.medical : '',
isCrossChannel: this.isCrossChannel,
orderNo: this.$route.query.orderNo
})
params.trialInfos.push(trialInfo)
})
this.trialInfos = params.trialInfos
return params
},
//选择附加险
selectAddtionRisk() {
//存储附加险列表
let addRiskCodes = []
this.chooseProducts.forEach(item => {
if (item.isMainRisk == 1) {
addRiskCodes.push(item.productCode)
}
})
if (localStorage.oldAddRiskCodes && JSON.parse(localStorage.oldAddRiskCodes)) {
addRiskCodes = addRiskCodes.concat(JSON.parse(localStorage.oldAddRiskCodes))
}
//930折中方案豁免险挂订单
addRiskCodes = addRiskCodes.filter(riskCode => {
return riskCode !== 'DCRS_A0001'
})
localStorage.addRiskCodes = JSON.stringify(addRiskCodes)
let thismyurl = ''
if (this.$route.query.orderNo) {
thismyurl = '/?orderNo=' + this.$route.query.orderNo
} else if (this.$route.query.proposalOrderNo) {
thismyurl = '?proposalOrderNo=' + this.$route.query.proposalOrderNo
}
localStorage.editproposaladdrisk = true
// this.$jump({
// flag: 'h5',
// extra: {
// url: location.origin + '/#/common/addRiskList' + thismyurl
// },
// routerInfo: {
// path: '/common/addRiskList' + thismyurl
// }
// })
this.showAdditionRiskPopup = true
},
//保额份数变化
stepperChange(defalutValue, productIndex, calFactorIndex, min, max, riskFactor) {
let currentEle = ''
let params = this.getParams()
if (localStorage.isTrial !== '1' && this.chooseProducts[productIndex].isMainRisk === 0) {
// params[productIndex].payEndYear == '1000' 交费期间为一次性交清
this.chooseProducts[productIndex].productTrialYearDTOS.forEach(item => {
if (params.trialInfos[productIndex].payEndYear == '1000') {
if (item.yearWay === '一次性交清') {
currentEle = item
}
} else {
if (item.yearWay == params.trialInfos[productIndex].payEndYear) {
currentEle = item
}
}
})
} else {
currentEle = this.chooseProducts[productIndex].calFactorLst[calFactorIndex]
}
//改动原因:孝心保产品有对年龄的特殊要求
//添加判断,是否是孝心保产品
let showHint = this.chooseProducts[productIndex].hint
const trialList = localStorage.getItem('trialList')
let productCode = !trialList ? '' : JSON.parse(localStorage.trialList)[0].productCode
if (productCode === 'GFRS_M0014') {
//被保险人年龄如果在50-65区间
if (this.saleInsuredPersonInfo.insuredAge >= 50 && this.saleInsuredPersonInfo.insuredAge <= 65) {
//使用rules规则里的第二条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(showHint)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(showHint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//被保险人年龄如果在66-75之间
} else if (this.saleInsuredPersonInfo.insuredAge >= 66 && this.saleInsuredPersonInfo.insuredAge <= 75) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(showHint)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(showHint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
//isTrial为0 ---暂时为富娃娃两全保险(万能型)专配 输入保费校验
} else if (
productCode === 'GFRS_M0035' ||
productCode === 'GFRS_M0044' ||
productCode === 'GFRS_M0056' ||
productCode === 'GFRS_M0057' ||
productCode === 'GFRS_M0060'
) {
//被保险人年龄如果在50-65区间
if (this.saleInsuredPersonInfo.insuredAge >= 56 && this.saleInsuredPersonInfo.insuredAge <= 60) {
//使用rules规则里的第二条控制保额份数
// 年龄在56周岁及以上被保险人投保本险种时最低基本保险金额为10000元。超过最低基本保险金额为10000元整数倍。
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(
'56周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(
'56周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//年龄在0-55周岁被保险人投保本险种时最低基本保险金额为50000元超过最低基本保险金额为10000元整数倍。
} else if (this.saleInsuredPersonInfo.insuredAge >= 0 && this.saleInsuredPersonInfo.insuredAge <= 55) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(
'0周岁-55周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(
'0周岁-55周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
//isTrial为0 ---暂时为富娃娃两全保险(万能型)专配 输入保费校验
} else if (productCode === 'GFRS_M0040') {
// 惠企保保额限制
//被保险人年龄如果在41-60区间
if (this.saleInsuredPersonInfo.insuredAge >= 41) {
//使用rules规则里的第二条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast('年龄在41周岁至60周岁被保险人投保本险种时最低基本保险金额为50000元。超过最低基本保险金额为10000元整数倍。')
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast('年龄在41周岁至60周岁被保险人投保本险种时最低基本保险金额为50000元。超过最低基本保险金额为10000元整数倍。')
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
} else if (this.saleInsuredPersonInfo.insuredAge >= 0 && this.saleInsuredPersonInfo.insuredAge <= 40) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast('年龄在0-40周岁被保险人投保本险种时最低基本保险金额为100000元超过最低基本保险金额为10000元整数倍。')
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast('年龄在0-40周岁被保险人投保本险种时最低基本保险金额为100000元超过最低基本保险金额为10000元整数倍。')
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
//isTrial为0 ---暂时为富娃娃两全保险(万能型)专配 输入保费校验
} else if (productCode === 'GFRS_M0046') {
//被保险人年龄如果在50-65区间
if (this.branchTypeVal === 'Z') {
//中介渠道规则
if (this.saleInsuredPersonInfo.insuredAge >= 51 && this.saleInsuredPersonInfo.insuredAge <= 60) {
//使用rules规则里的第二条控制保额份数
// 年龄在51周岁及以上被保险人投保本险种时最低基本保险金额为10000元。超过最低基本保险金额为10000元整数倍。
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(
'51周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(
'51周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//年龄在0-50周岁被保险人投保本险种时最低基本保险金额为50000元超过最低基本保险金额为10000元整数倍。
} else if (this.saleInsuredPersonInfo.insuredAge >= 0 && this.saleInsuredPersonInfo.insuredAge <= 50) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(
'0周岁-50周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
this.$toast(
'0周岁-50周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
} else if (this.branchTypeVal === 'G' || this.branchTypeVal === 'T' || this.branchTypeVal === 'Y') {
//世纪无忧中介渠道规则(银销个,健销个投保规则同个险规则)
//被保险人年龄如果在50-65区间
if (this.saleInsuredPersonInfo.insuredAge >= 56 && this.saleInsuredPersonInfo.insuredAge <= 60) {
//使用rules规则里的第二条控制保额份数
// 年龄在51周岁及以上被保险人投保本险种时最低基本保险金额为10000元。超过最低基本保险金额为10000元整数倍。
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(
'56周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(
'56周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//年龄在0-50周岁被保险人投保本险种时最低基本保险金额为50000元超过最低基本保险金额为10000元整数倍。
} else if (this.saleInsuredPersonInfo.insuredAge >= 0 && this.saleInsuredPersonInfo.insuredAge <= 55) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(
'0周岁-55周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
this.$toast(
'0周岁-55周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
}
// 国富人寿富桂金生养老年金保险GFRS_M0053中介渠道鑫享金生养老年金保险GFRS_M0061
} else if (productCode === 'GFRS_M0053' || productCode === 'GFRS_M0061') {
if (Number(defalutValue) < Number(min)) {
if (riskFactor.yearWay === '一次性交清') {
this.$toast(`交费期间为${riskFactor.yearWay}时,最低保费为${Number(min) * Number(riskFactor.moneyUnit)}元`)
} else {
this.$toast(`交费期间为${riskFactor.yearWay}年交时,最低保费为${Number(min) * Number(riskFactor.moneyUnit)}元`)
}
this.nextStepFlag = true
} else {
this.nextStepFlag = false
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(riskFactor.moneyUnit)
this.getTrial()
}
} else if (productCode === 'GFRS_M0076') {
if (this.saleInsuredPersonInfo.insuredAge >= 51 && this.saleInsuredPersonInfo.insuredAge <= 60) {
//使用rules规则里的第二条控制保额份数
// 年龄在51周岁及以上被保险人投保本险种时最低基本保险金额为10000元。超过最低基本保险金额为10000元整数倍。
if (Number(defalutValue) < Number(riskFactor.rules[1].minPrem) || Number(defalutValue) > Number(riskFactor.rules[1].maxPrem)) {
this.$toast(
'51周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元,最高投保金额为' +
Number(riskFactor.rules[1].maxPrem) * 10000 +
'元。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) !== 0) {
// this.defalutAmt = currentEle.rules[productIndex].displayAmount
this.$toast(
'51周岁-60周岁最低基本保险金额为' +
Number(riskFactor.rules[1].minPrem) * 10000 +
'元,最高投保金额为' +
Number(riskFactor.rules[1].maxPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[1].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
//年龄在0-50周岁被保险人投保本险种时最低基本保险金额为50000元超过最低基本保险金额为10000元整数倍。
} else if (this.saleInsuredPersonInfo.insuredAge >= 0 && this.saleInsuredPersonInfo.insuredAge <= 50) {
//使用rules规则里的第一条控制保额份数
if (Number(defalutValue) < Number(riskFactor.rules[0].minPrem) || Number(defalutValue) > Number(riskFactor.rules[0].maxPrem)) {
this.$toast(
'出生满 28 天至 50周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元,最高投保金额为' +
Number(riskFactor.rules[0].maxPrem) * 10000 +
'元。'
)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
this.$toast(
'出生满 28 天至 50周岁最低基本保险金额为' +
Number(riskFactor.rules[0].minPrem) * 10000 +
'元,最高投保金额为' +
Number(riskFactor.rules[0].maxPrem) * 10000 +
'元。超过最低基本保险金额为' +
Number(riskFactor.rules[0].limit) * 10000 +
'元整数倍。'
)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
} else if (productCode == 'GFRS_M0083' || productCode == 'GFRS_M0098' || productCode == 'GFRS_M0103' || productCode == 'GFRS_M0085') {
if (this.isFrom != 'proposal') {
if (!this.policyNo && defalutValue < 5) {
this.$toast('单独投保保费为大于等于50000元')
currentEle['minPrem'] = 5
} else if (this.policyNo && defalutValue < 0.01) {
this.$toast('与其他主险关联投保时保费要求保费大于等于100元')
currentEle['minPrem'] = 0.01
}
} else {
if (defalutValue < 0.01) {
currentEle['minPrem'] = 0.01
this.$toast('保费最小100元')
}
}
} else if (productCode == 'GFRS_M0087') {
if (this.saleInsuredPersonInfo.insuredAge >= 18 && this.saleInsuredPersonInfo.insuredAge <= 40) {
currentEle['maxAmt'] = 70
} else if (this.saleInsuredPersonInfo.insuredAge >= 41 && this.saleInsuredPersonInfo.insuredAge <= 45) {
currentEle['maxAmt'] = 50
} else if (this.saleInsuredPersonInfo.insuredAge >= 46 && this.saleInsuredPersonInfo.insuredAge <= 50) {
currentEle['maxAmt'] = 40
} else if (this.saleInsuredPersonInfo.insuredAge >= 51 && this.saleInsuredPersonInfo.insuredAge <= 60) {
currentEle['maxAmt'] = 30
}
this.getTrial()
} else if (this.isTrial === '0' && this.chooseProducts[productIndex].isMainRisk == '0') {
if (Number(defalutValue) < Number(min)) {
if (riskFactor.yearWay == '一次性交清') {
this.$toast(`交费期间为${riskFactor.yearWay}时,最低保费为${Number(min) * Number(riskFactor.moneyUnit)}元`)
} else {
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(defalutValue) < Number(min) || Number(defalutValue) > Number(max)) {
this.$toast(showHint)
this.nextStepFlag = true
} else {
if ((Number(defalutValue) * 10000) % (Number(currentEle.limit) * 10000) != 0) {
// defalutValue = currentEle.rules[productIndex].displayAmount
this.$toast(showHint)
this.nextStepFlag = true
} else {
this.mainRiskInfluenceAddRisk()
currentEle['amt'] = Number(defalutValue) * Number(currentEle.moneyUnit)
this.getTrial()
}
}
}
this.mult = Math.ceil(Number(defalutValue) / Number(riskFactor.defaultValue))
},
//下一步
async nextStep(isFrom) {
//GFRS_M0016需要验证责任
if (['GFRS_M0016', 'GFRS_M0070'].includes(this.mainRiskCode)) {
let calFactorLst = this.chooseProducts[0].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.valiDuty(item.defaultDutyAmt, item.duty)) {
return
}
}
}
}
}
//GFRS_A0004需要验证责任
for (let m = 0; m < this.chooseProducts.length; m++) {
if (['GFRS_A0004', 'GFRS_A0008'].includes(this.chooseProducts[m].productCode)) {
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
}
}
}
}
}
}
// 验证格式
if (this.isRelated && this.isFrom !== 'proposal' && this.policyNo) {
let vl = /^[0-9\\]+$/.test(this.policyNo)
if (!vl) {
return this.$toast('关联保单的格式不正确')
}
}
this.$CacheUtils.setLocItem('associatedPolicyNo', this.policyNo || null)
//组装险种提交数据
let [mainRiskCode, riskDTOLst] = ['', []]
let rollInResult = '' //校验预计转入保费结果
this.chooseProducts.forEach((item, index) => {
if (localStorage.trialList != '') {
if (item.isMainRisk == 0) {
mainRiskCode = item.productCode
}
let insuanceId = ''
if (this.$route.query.insuanceIdInfo) {
let thismyinsuanceIdInfo = JSON.parse(this.$route.query.insuanceIdInfo)
thismyinsuanceIdInfo.forEach(item01 => {
if (item01.riskCode == item.productCode) {
insuanceId = item01.insuanceId
}
})
}
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 (this.$route.query.insuanceIdInfo) {
riskItem.insuanceId = insuanceId
}
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
} else {
//国富人寿桂企保重大疾病保险产品专写,有可选责任的产品需要配置一下
if (
[
'GFRS_M0024',
'GFRS_M0040',
'GFRS_M0044',
'GFRS_M0046',
'GFRS_M0051',
'GFRS_M0054',
'GFRS_M0073',
'GFRS_M0077',
'GFRS_M0057',
'GFRS_M0086',
'GFRS_M0092',
'GFRS_M0096'
].includes(this.trialList[index].productCode)
) {
riskItem['dutyLst'] = this.trialInfos[index].duty
}
}
//保费算保额
if (String(this.trialList[index].trialType) === '1' || String(this.trialList[index].trialType) === '2') {
riskItem['amt'] = this.trialList[index].amt
}
//万能型产品保费赋值给保额
//增加判断是否是从建议书跳转过来了的
if (localStorage.isFrom !== 'proposal') {
if (['GFRS_M0003', 'GFRS_M0015', 'GFRS_M0017'].includes(this.trialList[index].productCode)) {
riskItem['amt'] = this.trialList[index].prem
}
}
//豁免险保额处理
if (String(item.isRemit) === '0') {
this.trialInfos[index].amt = this.trialList[0].prem
}
if (item.productCode === 'GFRS_A0001') {
this.trialInfos[index].amt = this.trialList[0].standPrem
}
if (item.productCode === 'GFRS_A0003' || item.productCode === 'GFRS_A0007') {
// bug--鑫享年年+附加豁免投保人定寿B+附加豁免投保人重疾B投保单号8186270000016187
// ①豁免重疾B的保额应该等于主险的保费该单的豁免重疾B的保额等于主险的保额不正确。
this.trialInfos[index].amt = this.trialList[index].amt
}
// GFRS_A0009,GFRS_A0010 这两款时,责任保额不相加
if (['GFRS_A0009', 'GFRS_A0010', 'GFRS_A0013', 'GFRS_A0014', 'GFRS_M0077', 'GFRS_A0015', 'GFRS_A0016'].includes(item.productCode)) {
this.trialInfos[index].amt = this.trialList[index].duty[0].amt
}
// GFRS_A0011-附加两全 属于非豁免险 但附加两全保额=主险年交保费+其他不带豁免责任的长期期交附加险年交保费
if (item.productCode === 'GFRS_A0011') {
this.trialInfos[index].amt = this.trialList[0].prem
}
if (!this.renewalShow(this.mainRiskCode)) {
for (let prop of item.calFactorLst) {
if (prop.type === '4') {
this.trialInfos[index].isRenewal = this.renewal
}
}
}
riskItem = Object.assign(riskItem, this.trialInfos[index])
riskDTOLst.push(riskItem)
}
})
if (!rollInResult) {
return
}
//国富人寿桂企保重大疾病保险产品专写
this.trialInfos.map((v, i) => {
if (['GFRS_M0024', 'GFRS_M0040', 'GFRS_M0044', 'GFRS_M0046', 'GFRS_M0051', 'GFRS_M0057', 'GFRS_M0073', 'GFRS_M0077'].includes(v.productCode)) {
delete riskDTOLst[i].duty
}
})
//建议书需要添加全部投保人信息电投只需要投保人ID
let insuredDTOItem = Object.assign(this.saleInsuredPersonInfo, { riskDTOLst: riskDTOLst })
if (!insuredDTOItem.insuredAge) {
insuredDTOItem.insuredAge = insuredDTOItem.birthday ? utilsAge.getAge(insuredDTOItem.birthday, new Date()) : insuredDTOItem.age
}
let orderNo = localStorage.isFrom === 'proposal' ? this.$route.query.proposalOrderNo : this.$route.query.orderNo
let params = {
orderType: 'RISK_ORDER',
orderDTO: {
orderInfoDTO: {
orderNo: orderNo,
productChannel: this.isCrossChannel
},
// appntDTO: {},
insuredDTOs: [insuredDTOItem]
}
}
// 富娃娃&一年定寿交费方式,交费区间固定为月交
if (this.richChildrenFlag) {
let product = params.orderDTO.insuredDTOs[0].riskDTOLst.find(item => {
return item.productCode === 'GFRS_M0015'
})
if (product) {
let trialProduct = params.orderDTO.insuredDTOs[0].riskDTOLst.find(item => {
return item.productCode === 'GFRS_A0006'
})
if (trialProduct) {
trialProduct.prem = 0
trialProduct.payIntv = 1
trialProduct.insuYearFlag = 'M'
trialProduct.payEndYear = 1
}
}
}
let resultData
if (localStorage.isFrom === 'proposal') {
// 从建议书进入, 豁免险保费空值特殊处理
let prdCodes = ['GFRS_A0001', 'GFRS_A0007']
params.orderDTO.insuredDTOs[0].riskDTOLst.forEach(item => {
if (prdCodes.includes(item.productCode)) {
this.trialList.forEach(element => {
if (item.productCode == element.productCode) {
item.amt = element.amt
}
})
}
})
resultData = await saveProposal(params)
} else if (isFrom !== 'orderTrial' && localStorage.isFrom === 'sale') {
resultData = await saveOrUpdateOrderInfo(params)
// todo 处理下一步的逻辑,需要携带数据到下一页中
} else if (isFrom === 'orderTrial' && localStorage.isFrom === 'sale') {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '核保试算中'
})
resultData = await orderTrial(params)
}
if (Number(resultData.result) === 0) {
window.localStorage.removeItem('editproposaladdrisk')
//电投
if (isFrom !== 'orderTrial' && localStorage.isFrom === 'sale') {
if (Number(resultData.deleteFlag) === 0) {
localStorage.salePageFlag = '3'
}
let thismyurl = ''
if (this.$route.query.orderNo) {
thismyurl = '/?orderNo=' + this.$route.query.orderNo
} else if (this.$route.query.proposalOrderNo) {
thismyurl = '?proposalOrderNo=' + this.$route.query.proposalOrderNo
}
this.$jump({
flag: 'goBack',
extra: {
refresh: '1',
index: '-2'
},
routerInfo: {
type: 2,
index: -2,
path: '/common/selectedProduct' + thismyurl
}
})
} else if (localStorage.isFrom === 'proposal') {
let proposalOrderNo = this.$CacheUtils.getLocItem('proposalNo') || ''
if (resultData.content.id) {
this.saleInsuredPersonInfo.insuredId = resultData.content.id
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(this.saleInsuredPersonInfo))
}
//试算记录保存更新--编辑
this.saveOrUpdateTrialRecordInfoFunc(resultData.content.riskDTO)
} else if (isFrom === 'orderTrial' && localStorage.isFrom === 'sale') {
this.$toast.clear()
this.trialResultsShow = true
this.verifyResultList = resultData.content.data.verifyResultList
this.riskAmntList = resultData.content.data.riskAmntList
}
}
},
//建议书试算记录保存更新--编辑功能
saveOrUpdateTrialRecordInfoFunc(riskDTO) {
let insuanceId
riskDTO.forEach(item => {
if (item.isMainRisk == '0') {
insuanceId = item.insuanceId
}
})
let data = {
serialNo: this.$route.query.proposalOrderNo,
mainRiskId: insuanceId + '',
trialJsonStr: localStorage.chooseProducts
}
if (this.trialRecordInfoId) {
data.id = this.trialRecordInfoId
}
saveOrUpdateTrialRecordInfo(data).then(res => {
if (res.result == '0') {
//被保人产品列表界面 点击编辑按钮进入产品试算界面 点击完成 页面跳转不正确
let proposalOrderNo = ''
if (this.$route.query.proposalOrderNo) {
proposalOrderNo = this.$route.query.proposalOrderNo
} else {
proposalOrderNo = this.$route.query.orderNo
}
let url = `/common/selectedProduct?proposalOrderNo=${proposalOrderNo}`
if (localStorage.isFrom == 'orderTrial' && localStorage.isFrom == 'sale') {
this.$toast.clear()
this.trialResultsShow = true
this.verifyResultList = res.content.data.verifyResultList
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#' + url
},
routerInfo: {
path: url
}
})
// this.$jump({
// flag: 'goBack',
// extra: {
// refresh: '1',
// index: '-2'
// },
// routerInfo: {
// type: 2,
// index: -2,
// path: url
// }
// })
} else {
this.$toast(res.resMessage)
}
})
},
rollInCheck(value) {
let regExp = /^[1-9]+[0-9]*$/
let result = regExp.test(value)
if (result) {
return true
} else {
this.$toast.fail('请输入正确的预计转入保费')
return false
}
},
handleSubmitAddAdditionRisk({ submit = true } = {}) {
if (submit) {
const ele = this.$refs.additionRiskList
ele.nextStep()
}
this.showAdditionRiskPopup = false
}
},
watch: {
userInfo: {
deep: true,
handler: function(obj) {
/**
* birthday: void 0,
* sex: '0',
* relationToAppnt: undefined
*/
const { birthday } = obj
this.saleInsuredPersonInfo.insuredAge = utilsAge.getAge(birthday, new Date())
}
}
}
}
</script>
<style lang="scss" scoped>
/deep/ .van-dialog .van-dialog__header {
font-size: 16px;
font-weight: 700;
}
/deep/ .van-button--danger {
border-radius: 0;
}
/deep/ .van-button--plain {
border: none !important;
border-top: 1px solid #e9332e !important;
}
.renewalWrappser {
display: flex;
justify-content: space-between;
align-items: center;
}
/deep/ .van-radio {
margin: 0 0.5em;
}
.renewal {
display: flex;
justify-content: flex-end;
padding: 1em;
}
/deep/ .van-radio__label {
line-height: normal;
}
.calculate-premium-container {
.border-bottom {
border-bottom: 1px solid #dadada;
}
.van-cell {
padding: 0px;
}
.prem:last-child {
border: none;
}
/deep/.van-action-sheet__name {
font-size: 12px;
}
.checkbox-click {
position: absolute;
right: 0;
top: 0;
width: 7.46667vw;
height: 7.46667vw;
}
.van-dialog__content {
border: 1px solid red;
}
}
.addtion-risk /deep/ .van-picker__columns {
display: none !important;
}
</style>