Files
ebiz-h5/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue
hz 52766cbfc1 refactor(product): 优化保费计算组件逻辑
- 移除未使用的组件引用 FieldDatePicter 和 SelectRadio
- 删除冗余的 registerMainTask 调用
- 清理调试代码 window.cps 赋值
- 统一使用严格相等运算符 === 替代 ==
- 简化 forEach 循环中的索引参数
- 修复作用域变量 that 的使用,统一为 this
- 注释掉无用的 proposalOrderNo 相关代码
- 优化产品编码判断逻辑,提高可读性
2025-11-28 16:48:06 +08:00

3781 lines
158 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">
<div v-if="refer === 'detail'" class="flex align-items-c">
<span style="border-radius:8px;height: 15px; width: 5px; background-color: red;"></span>
<h4 class="ml5">保费试算</h4>
</div>
<template v-if="personMessageInfo">
<!--被保人信息详情-->
<insured-message-info :applicantInfo="saleInsuredInfo" :msgInfo="saleInsuredPersonInfo" type="insured" @update="$nextTick(getTrial)" />
<!--投保人信息详情-->
<insured-message-info
v-if="Number(saleInsuredPersonInfo.relationToAppnt) !== 1"
:msgInfo="saleInsuredInfo"
type="applicant"
@update="$nextTick(getTrial)"
/>
</template>
<div v-for="(item, index) in chooseProducts" :key="index" class="ph10 bg-white">
<div v-if="refer === 'detail'" class="flex justify-content-s align-items-c border-bottom pv10">
<van-tag v-if="item.isMainRisk === 0" class="mr5 green" plain type="primary">主险</van-tag>
<van-tag v-else class="mr5 green" plain type="primary">附加险</van-tag>
<span class="ml5 center fs13 flex1">{{ item.riskName }}</span>
<van-tag
v-if="Number(item.isMainRisk) === 0 && item.hasAddtionRisk && isEnterAddtionRisk"
class="green mr8"
plain
type="primary"
@click="selectAddtionRisk"
>
</van-tag>
<van-icon v-if="item.documentDTOS && item.documentDTOS.length > 0" class="green mr5" name="search" size="20" @click="seeDocument(index)" />
<van-icon v-if="item.isMainRisk !== 0" class="green" name="delete" size="22" @click="deleteRisk(index, item)" />
</div>
<div v-else class="bg-white border-bottom">
<van-field label="主险名称" placeholder="请选择" readonly>
<template #input>{{ item.riskName }}</template>
</van-field>
</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 v-if="Number(riskFactor.type) === 1 && item.productCode !== 'GFRS_A0011'" class="flex justify-content-s pv10 border-bottom">
<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>
<template v-if="refer === 'detail'">
<van-stepper
v-model.number="item.calFactorLst[riskFactorIndex].displayAmount"
:disable-input="disabledShow"
:integer="false"
:max="riskFactor.maxAmt || riskFactor.maxPrem"
:min="riskFactor.minAmt || riskFactor.minPrem"
:show-minus="false"
:show-plus="false"
class="ml30"
input-width="100"
@change="
stepperChange(
item.calFactorLst[riskFactorIndex].displayAmount,
index,
riskFactorIndex,
riskFactor.minAmt || riskFactor.minPrem,
riskFactor.maxAmt || riskFactor.maxPrem,
riskFactor
)
"
/>
</template>
<template v-else>
<div class="ml30 black">
{{ item.calFactorLst[riskFactorIndex].displayAmount }}
</div>
</template>
</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" :label="riskFactor.name + '(' + riskFactor.suffix + ')'" readonly />
</div>
<!-- //主险的交费期间联动国富人寿附加两全(GFRS_A0011)保险的交费期间 -->
<div
v-if="riskFactor.type == 0 && item.productCode !== 'GFRS_A0011'"
:class="{ hidden: riskFactor.code === 'payEndYear' && item.isHidden }"
class="flex justify-content-s pv10 border-bottom"
>
<van-field
v-model="riskFactor.showContent"
:label="riskFactor.name"
:right-icon="refer === 'detail' ? 'arrow' : ''"
placeholder="请选择"
readonly
@click="toSelect(index, riskFactorIndex, riskFactor.columns)"
/>
</div>
<div
v-else-if="riskFactor.type == 0 && item.productCode === 'GFRS_A0011'"
:class="{ hidden: riskFactor.code === 'payEndYear' && item.isHidden }"
class="flex justify-content-s pv10 border-bottom"
>
<van-field
v-if="riskFactor.code !== 'payEndYear'"
v-model="riskFactor.showContent"
:label="riskFactor.name"
placeholder="请选择"
readonly
right-icon="arrow"
@click="toSelect(index, riskFactorIndex, riskFactor.columns)"
/>
<van-field v-if="riskFactor.code === 'payEndYear'" v-model="riskFactor.showContent" :label="riskFactor.name" readonly />
</div>
<div v-if="riskFactor.type == 4 && !renewalShow(mainRiskCode)" class="border-bottom renewalWrappser fs14">
<span>{{ riskFactor.name }}</span>
<van-radio-group v-model="renewal" class="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 v-if="riskFactor.type == 3" class="border-bottom">
<div class="pv12 border-bd">{{ riskFactor.name }}</div>
<div class="duty">
<div v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex" class="flex justify-content-s border-bd pv10 align-items-c">
<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"
:disabled="
item.productCode === 'GFRS_M0088' ||
item.productCode === 'GFRS_A0012' ||
(item.productCode === 'GFRS_M0077' && !dutyItem.necess) ||
(item.productCode === 'GFRS_M0077' && dutyItem.duty === '311507')
"
:integer="false"
:max="dutyItem.maxDutyAmt"
:min="dutyItem.minDutyAmt"
:show-minus="false"
:show-plus="false"
class="ml10 mr10"
input-width="200"
@blur="blurStep(dutyItem, index, item.productCode)"
@change="
dutyStepperChange(
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
index,
riskFactorIndex,
dutyItemIndex,
dutyItem.necess,
dutyItem.minDutyAmt,
dutyItem.maxDutyAmt
)
"
@focus="focusStep"
/>
<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 v-if="riskFactor.type == 5" class="border-bottom pv10">
<van-field v-model="riskFactor.showContent" :label="riskFactor.name" disabled readonly />
</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 v-if="riskFactor.type == 1" class="flex justify-content-s pv10 border-bottom">
<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>
<template v-if="refer === 'detail'">
<van-stepper
v-model.number="item.productTrialYearDTOS[payEndYearColumnsIndex].displayAmount"
:integer="false"
:max="item.productTrialYearDTOS[payEndYearColumnsIndex].maxAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].maxPrem"
:min="item.productTrialYearDTOS[payEndYearColumnsIndex].minAmt || item.productTrialYearDTOS[payEndYearColumnsIndex].minPrem"
:show-minus="false"
:show-plus="false"
class="ml30"
input-width="100"
@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]
)
"
/>
</template>
<template v-else>
<div class="ml30 black">
{{ item.productTrialYearDTOS[payEndYearColumnsIndex].displayAmount }}
</div>
</template>
</div>
</div>
<div
v-if="riskFactor.type == 0"
:class="{ hidden: riskFactor.code === 'payEndYear' && item.isHidden }"
class="flex justify-content-s pv10 border-bottom"
>
<van-field
v-model="riskFactor.showContent"
:label="riskFactor.name"
:right-icon="refer === 'detail' ? 'arrow' : ''"
placeholder="请选择"
readonly
@click="toSelect(index, riskFactorIndex, riskFactor.columns)"
/>
</div>
<div v-if="riskFactor.type == 3" class="border-bottom">
<div class="pv12 border-bd">{{ riskFactor.name }}</div>
<div class="duty">
<div v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex" class="flex justify-content-s border-bd pv10 align-items-c">
<span class="fs14 w100">{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span>
<div class="flex relative">
<van-stepper
v-model="dutyItem.defaultDutyAmt"
:integer="false"
:max="dutyItem.maxDutyAmt"
:min="dutyItem.minDutyAmt"
:show-minus="false"
:show-plus="false"
class="ml10 mr10"
input-width="200"
@blur="blurStep(dutyItem, index)"
@change="
dutyStepperChange(
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
index,
riskFactorIndex,
dutyItemIndex,
dutyItem.necess,
dutyItem.minDutyAmt,
dutyItem.maxDutyAmt
)
"
@focus="focusStep"
/>
<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 v-if="riskFactor.type == 5" class="border-bottom pv10">
<van-field v-model="riskFactor.showContent" :label="riskFactor.name" readonly />
</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" :label="riskFactor.name" readonly />
<van-field v-if="riskFactor.type == 1" v-model="riskFactor.defaultValue" :label="riskFactor.name + '(' + riskFactor.suffix + ')'" readonly />
</div>
</div>
<div v-if="riskFactor.type == 3">
<div class="pv12 border-bd">{{ riskFactor.name }}</div>
<div class="duty">
<div v-for="(dutyItem, dutyItemIndex) in riskFactor.rules" :key="dutyItemIndex" class="flex justify-content-s border-bd pv10 align-items-c">
<span class="fs14 w100">{{ dutyItem.dutyName }}({{ dutyItem.suffix }})</span>
<div class="flex relative">
<van-stepper
v-model="dutyItem.defaultDutyAmt"
:disabled="dutyItem.changeWithMainRisk === true ? 'disabled' : ''"
:integer="false"
:max="dutyItem.maxDutyAmt"
:min="dutyItem.minDutyAmt"
:show-minus="false"
:show-plus="false"
class="ml10 mr10"
input-width="200"
@blur="blurStep(dutyItem, index)"
@change="
dutyStepperChange(
item.calFactorLst[riskFactorIndex].rules[dutyItemIndex].defaultDutyAmt,
index,
riskFactorIndex,
dutyItemIndex,
dutyItem.necess,
dutyItem.minDutyAmt,
dutyItem.maxDutyAmt
)
"
@focus="focusStep"
/>
<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 v-if="riskFactor.type == 5" class="border-bottom pv10">
<van-field v-model="riskFactor.showContent" :label="riskFactor.name" readonly />
</div>
</div>
</div>
<!-- 只有万能险且只有建议书才展示 -->
<van-field v-if="item.hasPredictTransferPrem === '0'" v-model="item.predictTransferPrem" class="pv10" label="预计转入保费" placeholder="请输入" />
<div v-if="item.isMainRisk == 0 && isRelated === '0' && isFrom != 'proposal'" class="flex justify-content-s pv10 border-bottom">
<van-field
v-model="policyNo"
autosize
clearable
label="关联保单"
maxlength="380"
name="关联保单号"
placeholder="请录入保单号或者投保单号,如果关联多个保单,请用\隔开"
type="textarea"
@blur="getTrial"
/>
</div>
<div
v-if="
item.productCode != 'GFRS_M0100' &&
item.productCode != 'GFRS_M0080' &&
item.productCode != 'GFRS_M0083' &&
item.productCode != 'GFRS_M0098' &&
item.productCode != 'GFRS_M0103' &&
item.productCode != 'GFRS_M0112' &&
item.productCode != 'GFRS_M0085' &&
trialList[index]
"
:class="refer === 'detail' ? 'justify-content-s' : ''"
class="flex pv10 border-bottom prem"
>
<!-- trialType 0-保额算保费1-保费算保额 -->
<!-- isTrial是否需存在特殊配置(规则) 0-是 1-否-->
<span
v-if="(trialList[index] && trialList.length > 0 && trialList[index].trialType == 0) || (trialList.length > 0 && trialList[index].trialType == 2)"
style="font-weight: bold"
>
首期保费(元):
</span>
<span v-else style="font-weight: bold">保额(元):</span>
<span v-if="trialList && trialList[index] && trialList.length > 0" class="fee red ml20">{{ trialList[index].showPrem | moneyFormat }}</span>
</div>
</div>
<!--底部总保费计算-->
<total-premium v-if="personMessageInfo" :btn-option="{ disable: nextStepFlag, name: '立即投保' }" :money="firstTermTotalPremium" @submit="nextStep" />
<van-action-sheet v-model="show" :actions="policyInfo" cancel-text="取消" @select="openDocument" />
<!-- 字段选择 -->
<van-popup v-model="popupShow" position="bottom">
<van-picker :columns="columns" show-toolbar @cancel="onCancel" @confirm="onConfirm" />
</van-popup>
<!-- 附加险添加窗口 -->
<destoryable-popup :show.sync="showAdditionRiskPopup" class="addtion-risk">
<van-picker show-toolbar title="选择附加险" @cancel="handleSubmitAddAdditionRisk({ submit: false })" @confirm="handleSubmitAddAdditionRisk">
<template #columns-top>
<addtion-risk-list ref="additionRiskList" :show-next="false" :trial-test="false" @changeProducts="handleChoosedProductsChange" />
</template>
</van-picker>
</destoryable-popup>
<van-dialog v-model="trialResultsShow" :show-cancel-button="false" title="核保试算结果">
<div class="pl20 pr20 mt10">
<div v-for="(item, index) in verifyResultList" :key="index" class="flex justify-content-s fs12">
<div>
<img :src="require('@/assets/images/sale/ruleType0' + item.ruleType + '.png')" alt="" class="w20 h20 p10 v-middle" />
<span class="v-middle">{{ item.ruleType | ruleTypeFilter }}</span>
</div>
<div>
<!-- <span class="v-middle">{{item.status | approvedFilter}}</span>-->
<img :src="require('@/assets/images/sale/approved' + item.status + '.png')" alt="" class="w20 h20 p10 v-middle" />
</div>
</div>
<div v-for="item in riskAmntList" :key="item" class="flex justify-content-s align-items-c fs12">
<div>
<img :src="require('@/assets/images/sale/coin.png')" alt="" class="w20 h20 p10 v-middle" />
<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 { ActionSheet, Checkbox, Dialog, Field, Icon, Picker, Popup, Radio, RadioGroup, Stepper, Tag } from 'vant'
import { getOrderDetail, information, orderTrial, saveOrUpdateOrderInfo } from '@/api/ebiz/sale/sale'
import { saveOrUpdateTrialRecordInfo, saveProposal } 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 { validateRelationshipToInsured } from '@/views/ebiz/productFlowImprove/components/js/relationshipToInsured'
import TotalPremium from '@/views/ebiz/saleFlowProImprove/components/TotalPremium.vue'
import { deepClone } from '@/assets/js/utils/objectUtils'
import { applicant, insured } from '@/views/ebiz/saleFlowProImprove/js/state'
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: {
TotalPremium,
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,
InsuredMessageInfo: () => import('./CalculatePremiumInsuredMessageInfo.vue'),
DestoryablePopup: () => import('@/components/common/DestroyablePopup.vue')
},
props: {
productDTOS: { type: Array, default: () => [] },
/** 是否展示 用户信息界面 ,用来区分来源界面, 并制定相应的方案内容
* @type {boolean} 默认
* */
personMessageInfo: { type: Boolean, default: true },
refer: { type: String, default: 'detail' }
},
data() {
return {
// 附加险 popup 控制组件
showAdditionRiskPopup: false,
branchTypeVal: '', //个险渠道G 中介渠道Z
isEnterAddtionRisk: true, //附加险list
activeRadio: '1',
// activeType: localStorage.getItem('active_type'), 现在从订单详情接口取值了
activeType: '',
cvalidateFlag: false,
cvalidateStr: '', //活动生效日
chooseProducts: [],
disabledShow: false,
productIndex: '',
calFactorIndex: '',
premiumData: [], //试算
saleInsuredInfo: applicant,
saleInsuredPersonInfo: insured,
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) => {
return { prem: accumulator.prem + (currentValue.prem || 0) }
},
{ prem: 0 }
)
if (typeof res.prem === 'number') return res.prem
else return 0
},
/**
* 检测信息是否通过校验, 后续可以根据各个字段添加规则
* @returns {boolean}
*/
passUserInfoCheck() {
// 如果不需要输入用户信息内容,则不进行校验
if (!this.personMessageInfo) return true
const hasCompleteInfo = [this.saleInsuredPersonInfo, this.saleInsuredInfo].every(info => {
if (!info || typeof info !== 'object') return false
const keys = Object.keys(info)
// 如果是从订单详情进入,则仅需要校验性别和生日
if (this.refer === 'detail') {
return ['sex', 'birthday'].every(item => isNotEmpty(item))
}
return keys.every(key => isNotEmpty(key))
/**
* 检查指定键的值是否为空
* @param {string} key - 要检查的键名
* @returns {boolean} - 如果值为 null、空字符串或 'null' 字符串则返回 true否则返回 false
*/
function isNotEmpty(key) {
const value = info[key]
return value !== null && value !== '' && value !== 'null'
}
})
// // 二者关系校验
const hasValidata = validateRelationshipToInsured(this.saleInsuredPersonInfo, this.saleInsuredInfo) === true
// console.log(hasCompleteInfo, hasValidata, 'hasCompleteInfo && hasValidata')
// 主险选择限制
const mainRiskLimitRes = this.mainRiskLimit()
return hasCompleteInfo && hasValidata && mainRiskLimitRes
}
},
mounted() {
// 当组件挂载之后开始创建订单
this.isFrom = window.localStorage.isFrom
getAgentInfo({}).then(res => {
this.branchType = res.branchType
// 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.initPersonInfo()
this.init()
this.registerMainTask()
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: {
registerMainTask() {
if (!this.nextStepProcesserContainer) return
const taskID = 'caculatePremium'
this.nextStepProcesserContainer.registerMainTask(
taskID,
() => {
return this.getTrial()
},
[],
[]
)
},
/** 初始化用户详情信息 */
initPersonInfo() {
if (this.personMessageInfo) return
// const { getLocItem, setLocItem } = cacheUtils
// const saleInsuredInfo = getLocItem('saleInsuredInfo')
// const saleInsuredPersonInfo = getLocItem('saleInsuredPersonInfo')
// 如果本地存在之前编辑过的数据, 优先采用这个,如果没有数据,就从网络获取
// if (!(saleInsuredInfo && saleInsuredPersonInfo)) {
// if (false){
// this.saleInsuredInfo = JSON.parse(saleInsuredInfo)
// this.saleInsuredPersonInfo = JSON.parse(saleInsuredPersonInfo)
// } else {
const orderNo = this.$route.query.orderNo
getOrderDetail({ orderNo }).then(({ orderDTO }) => {
const { appntDTO, insuredDTOs } = orderDTO
const [insuredPersonInfo] = insuredDTOs
// 如果从产品详情进入, 则不校验一些属性内容, 保留默认值
const defaultKeys = this.$route.query.source === 'productDetail' ? ['isNewPeopleFlag'] : []
const applicantIgnoreKeys = [...defaultKeys]
for (const key in appntDTO) {
if (applicantIgnoreKeys.includes(key)) continue
this.saleInsuredInfo[key] = appntDTO[key]
}
const insuredIgnoreKeys = [...defaultKeys]
for (const key in insuredPersonInfo) {
if (insuredIgnoreKeys.includes(key)) continue
this.saleInsuredPersonInfo[key] = insuredPersonInfo[key]
}
})
// }
},
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 (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 (item.type == 1) {
//按年龄选择
if (productTrialInfoDTO[item.code] != null) {
productTrialInfoDTO[item.code].forEach(factor => {
item = Object.assign(item, factor)
// todo: 流程缩减
// 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() {
const orderNo = this.$route.query['orderNo']
const params = {
...this.$route.query,
edit: 1,
source: 'productDetail',
salePageFlag: 1,
orderNo: orderNo
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/flow-improve/sale/insuranceApplicationFlow?' + processJson(params)
},
routerInfo: {
name: 'flowImproveSaleInsuranceApplicationFlow',
query: params
}
})
/**
* 处理 json 键值对,到 url 中
*/
function processJson(json) {
if (typeof json !== 'object') return
if (window.URLSearchParams) return new URLSearchParams(json).toString()
let url = ''
for (const key in json) {
if (json.hasOwnProperty(key)) {
url += key + '=' + json[key] + '&'
}
}
return url.substring(0, url.length - 1)
}
},
updateFactorByGFRS_M0077(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 => {
// 提前把 necess 置为 false, 防止更新用户信息的时候出现 多选框更新不正常的问题
ii.necess = false
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'
}
}
}
})
}
}
})
}
},
async fetchResultDate() {
// 1048 投保流程优化 现在不存在建议书的内容, 所以在这里写死。 防止后面出现问题
// 当前组件在产品详情和投保流程信息录入中使用
localStorage.setItem('isFrom', 'sale')
const { productCode: productDetailCode, productName } = this.productDTOS[0]
const productDetail = await information({
productCodes: [productDetailCode],
platform: 'app',
type: '1'
})
return {
productDetail,
productName,
productDetailCode
}
},
//初始化数据
async init() {
const { productDetail, productName, productDetailCode } = await this.fetchResultDate()
if (Number(productDetail.result) !== 0) return
// stepper 步骤需要用到主险的code
localStorage.setItem('trialList', JSON.stringify([{ productCode: productDetailCode }]))
// 构建需要的参数
/*global structuredClone*/
let resultData = (window.structuredClone ? structuredClone : deepClone)(productDetail)
const riskProductCode = productDetailCode
// 缓存获取到的数据
this.fetchdProductDetail = resultData = resultData.trialDTOS[0]
this.isTrial = 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)
}
let flagPermission = await riskRules.getProductSellPermissionList(resultData.productCode, this, this.isCrossChannel)
if (flagPermission.flag && localStorage.isFrom !== 'proposal') {
//校验该代理人是否有该产品的售卖权限
return this.$toast(flagPermission.resultMessage)
}
/********end 主险选择限制 end******/
//保存附加险
localStorage.addtionRiskLst = JSON.stringify(resultData.productTrialInfoDTO.addtionRiskLst)
localStorage.isAutoPay = resultData.isAutoPay
localStorage.isRenew = resultData.isRenew
localStorage.isForceRenew = resultData.isForceRenew
// 关联保单号
this.isRelated = 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
/**在不添加 this.refer !== "flow" 之前, 会意外的出现显示两个主险。此只针对当处于流程录入的时候 ,不处理额外信息*/
if (localStorage.chooseProducts && this.refer !== 'flow') {
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 = (window.structuredClone ? structuredClone : deepClone)(productsData)
this.processProducts()
//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 && div1[x].setAttribute('type', 'digit')
}
} catch (e) {
console.warn(e)
}
})
// 当不显示用户信息的时候, 默认开始的时候进行一次试算
setTimeout(() => {
if (!this.personMessageInfo) this.getTrial()
}, 400)
},
//特殊处理 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) {
// 如果是如下的来源,则拒绝弹窗处理
if (['flow'].includes(this.refer)) return
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) {
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 (this.payExceedInsured(currentEle, currentFactor, value.value)) {
this.popupShow = false
return false
}
if (currentEle.code === 'payEndYear' && this.ageInfluencePayEndYear(value.value, currentEle)) {
this.popupShow = false
return false
}
if (currentEle.code === 'insuYear' && 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
}
if (!this.passUserInfoCheck) return
// 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 => {
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 => {
if (item.productCode == 'GFRS_A0011') {
showPrem001 = item.showPrem //获取两全险的保费
}
})
this.chooseProducts.forEach(item => {
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 => {
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
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 => {
//因交费方式为一次性交清时,不会有豁免险,所以这里不判断一次性交清的情况
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 => {
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 => {
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(() => {})
}
},
/**
* 执行保费试算
* @returns {Promise<boolean>} 返回试算结果true表示成功false表示失败
*/
async getTrial() {
try {
// 1. 验证用户信息
if (!this.passUserInfoCheck) {
console.log('信息验证失败')
return false
}
// 2. 如果没有订单号,则提交订单
if (!this.$route.query.orderNo) {
await this.submitOrder()
}
// 3. 检查特殊产品代码
const codes = ['GFRS_M0083', 'GFRS_M0098', 'GFRS_M0103', 'GFRS_M0085']
let productCode = ''
let hasPredictTransferPrem = ''
const thisproductInfo = JSON.parse(window.localStorage.getItem('chooseProducts') || '[]')
thisproductInfo.forEach(item => {
if (codes.includes(item.productCode)) {
productCode = item.productCode
hasPredictTransferPrem = item.hasPredictTransferPrem
}
})
// 4. 处理特殊产品的显示逻辑
if (this.isFrom !== 'proposal' && codes.includes(productCode)) {
const minPrem = this.policyNo ? 0.01 : 5
this.disabledShow = !this.policyNo
this.chooseProducts.forEach(item => {
;(item.calFactorLst || []).forEach(factor => {
if (factor.type == 1) {
factor.minPrem = minPrem
factor.displayAmount = minPrem
}
})
})
}
if (hasPredictTransferPrem == '1') {
this.disabledShow = false
}
// 5. 设置加载状态
this.nextStepFlag = true
this.$toast.loading({
message: '正在试算...',
forbidClick: true
})
// 6. 设置豁免险
this.setRemitRisk()
// 7. 获取试算参数
const params = this.getParams()
// 8. 处理特殊活动产品
if (this.activeType && this.isFrom !== 'proposal') {
for (const product of params.trialInfos) {
product.isKmh = '1'
product.cvaliDate = this.cvalidateStr
}
}
// 9. 验证年龄和保险期间
const age = (this.saleInsuredPersonInfo && this.saleInsuredPersonInfo.insuredAge) || 0
const sex = (this.saleInsuredPersonInfo && this.saleInsuredPersonInfo.sex) || '0' //0男 1女
let trialFlag = true
params.trialInfos.forEach(item => {
if (item.productCode === 'GFRS_A0011') {
if (
(item.insuYear === '60' && item.payEndYear === '30' && age > 30) ||
(item.insuYear === '70' && item.payEndYear === '30' && age > 40) ||
(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') {
// 国富人寿富桂金生养老年金保险
const ageConditions = [
{ pensionAge: '60', payEndYear: '30', maxAge: sex === '0' ? 30 : 30 },
{ pensionAge: '60', payEndYear: '20', maxAge: sex === '0' ? 40 : 40 },
{ pensionAge: '60', payEndYear: '15', maxAge: sex === '0' ? 45 : 45 },
{ pensionAge: '60', payEndYear: '10', maxAge: sex === '0' ? 50 : 50 },
{ pensionAge: '65', payEndYear: '30', maxAge: sex === '0' ? 35 : 35 },
{ pensionAge: '65', payEndYear: '20', maxAge: sex === '0' ? 45 : 45 },
{ pensionAge: '65', payEndYear: '15', maxAge: sex === '0' ? 50 : 50 },
{ pensionAge: '65', payEndYear: '10', maxAge: 55 },
{ pensionAge: '70', payEndYear: '30', maxAge: sex === '0' ? 40 : 40 },
{ pensionAge: '70', payEndYear: '20', maxAge: sex === '0' ? 50 : 50 },
{ pensionAge: '70', payEndYear: '15', maxAge: sex === '0' ? 55 : 55 },
{ pensionAge: '55', payEndYear: '30', maxAge: sex === '1' ? 25 : 999 },
{ pensionAge: '55', payEndYear: '20', maxAge: sex === '1' ? 35 : 999 },
{ pensionAge: '55', payEndYear: '15', maxAge: sex === '1' ? 40 : 999 },
{ pensionAge: '55', payEndYear: '10', maxAge: sex === '1' ? 45 : 999 }
]
const condition = ageConditions.find(cond => cond.pensionAge === item.pensionAge && cond.payEndYear === item.payEndYear)
if (condition && age > condition.maxAge) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
} else if (item.productCode === 'GFRS_M0061') {
// 中介渠道鑫享金生养老年金保险
const ageConditions = [
{ pensionAge: '60', payEndYear: '20', maxAge: sex === '0' ? 40 : 40 },
{ pensionAge: '60', payEndYear: '10', maxAge: sex === '0' ? 50 : 50 },
{ pensionAge: '60', payEndYear: '5', maxAge: 55 },
{ pensionAge: '60', payEndYear: '3', maxAge: 55 },
{ pensionAge: '65', payEndYear: '20', maxAge: sex === '0' ? 45 : 45 },
{ pensionAge: '65', payEndYear: '10', maxAge: 55 },
{ pensionAge: '65', payEndYear: '5', maxAge: 60 },
{ pensionAge: '65', payEndYear: '3', maxAge: 60 },
{ pensionAge: '70', payEndYear: '20', maxAge: 50 },
{ pensionAge: '70', payEndYear: '10', maxAge: 60 },
{ pensionAge: '70', payEndYear: '5', maxAge: 65 },
{ pensionAge: '70', payEndYear: '3', maxAge: 65 },
{ pensionAge: '55', payEndYear: '20', maxAge: sex === '1' ? 35 : 999 },
{ pensionAge: '55', payEndYear: '10', maxAge: sex === '1' ? 45 : 999 },
{ pensionAge: '55', payEndYear: '5', maxAge: sex === '1' ? 50 : 999 },
{ pensionAge: '55', payEndYear: '3', maxAge: sex === '1' ? 50 : 999 }
]
const condition = ageConditions.find(cond => cond.pensionAge === item.pensionAge && cond.payEndYear === item.payEndYear)
if (condition && age > condition.maxAge) {
this.nextStepFlag = true
this.$toast('被保险人年龄不适合该交费期间!')
trialFlag = false
}
} else if (['GFRS_M0101', 'GFRS_M0102'].includes(item.productCode)) {
// 当投保人年龄≥75周岁时需转人工核保
const appntAge = (this.saleInsuredInfo && this.saleInsuredInfo.age) || 0
if (appntAge >= 75) {
this.nextStepFlag = true
this.$toast('投保人年龄≥75周岁需进一步人工审核')
trialFlag = false
}
}
})
if (!trialFlag) {
return false
}
// 10. 执行试算
const resultData = await trial(params)
// 11. 处理试算结果
if (Number(resultData.result) === 0) {
if (resultData.flag === '1') {
this.richChildrenFlag = true
}
this.trialList = resultData.trialList
localStorage.setItem('trialList', JSON.stringify(resultData.trialList))
this.setRemitRisk()
this.nextStepFlag = false
localStorage.setItem('chooseProducts', JSON.stringify(this.chooseProducts))
return true // 试算成功
} else {
this.nextStepFlag = true
this.$toast(resultData.resultMessage || '试算失败')
return false // 试算失败
}
} catch (error) {
console.error('试算过程中发生错误:', error)
this.$toast('试算过程中发生错误')
this.nextStepFlag = true
return false // 发生异常
}
},
//获取试算参数
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 (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.saleInsuredInfo.birthday,
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.saleInsuredPersonInfo.birthday,
this.saleInsuredPersonInfo.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() {
if (!this.passUserInfoCheck) {
this.$toast('请补充完整相应的信息内容')
return
}
this.showAdditionRiskPopup = true
//存储附加险列表
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
// }
// })
},
//保额份数变化
stepperChange(defalutValue, productIndex, calFactorIndex, min, max, riskFactor) {
if (!this.passUserInfoCheck) return
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) {
if (!this.passUserInfoCheck) return this.$toast('校验失败,请检查填写信息是否正确')
//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])
riskItem = { ...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: this.saleInsuredInfo,
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 /*= new Proxy({}, {
set(target, p, newValue, receiver) {
Reflect.set(target, p, newValue, receiver)
this.$CacheUtils.setLocItem('resultData', newValue)
},
get(target, p, receiver) {
const data = Reflect.get(target, p, receiver)
if (!data) {
return this.$CacheUtils.getLocItem('resultData')
} else return data
}
})*/
if (localStorage.isFrom === 'proposal') {
//this.chooseProducts = JSON.parse(localStorage.getItem('chooseProducts')) 从建议书进入, 豁免险保费空值特殊处理
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') {
this.submitOrder({ riskDTO: params, createOrder: false })
} else if (isFrom === 'orderTrial' && localStorage.isFrom === 'sale') {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '核保试算中'
})
resultData = await orderTrial(params)
}
if (resultData && 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
}
} else if (resultData && resultData.result !== '0') {
this.$toast(resultData.resultMessage)
return false
}
// 保存被保人的相关信息
// this.submitOrder([insuredDTOItem])
if (!this.$route.query.source) {
this.jumpTo()
}
},
//建议书试算记录保存更新--编辑功能
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 } = {}) {
const ele = this.$refs.additionRiskList
if (submit) {
const error = ele.nextStep()
if (error) return
}
ele.result = ''
this.showAdditionRiskPopup = false
},
submitOrder({ riskDTO = [], createOrder = true } = {}) {
const params = {
orderType: 'RISK_ORDER_NEW',
orderDTO: Array.isArray(riskDTO)
? {
orderInfoDTO: {
orderNo: this.$route.query.orderNo || '',
productChannel: '0'
},
appntDTO: this.saleInsuredInfo,
// userModel: {
// branchType: this.branchType
// },
insuredDTOs: [
{
...this.saleInsuredPersonInfo,
riskDTOLst: []
}
]
}
: riskDTO.orderDTO
}
saveOrUpdateOrderInfo(params).then(response => {
const { orderNo } = response
localStorage.setItem('orderNo', orderNo)
if (!createOrder) return
this.$router.replace({
name: 'fiProductDetail',
params: { productDetailCode: this.$route.params.productDetailCode },
query: { orderNo }
})
})
},
handleChoosedProductsChange() {
this.chooseProducts = JSON.parse(localStorage.getItem('chooseProducts'))
this.getTrial()
},
processProducts() {
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_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 + '年交') {
this.payEndYearColumnsIndex = index
}
})
}
}
//保存主险险种编号
if (item.isMainRisk == 0) {
this.mainRiskCode = item.mainRiskCode
}
})
if (this.mainRiskCode === 'GFRS_M0077') {
this.chooseProducts.map(item => {
this.updateFactorByGFRS_M0077(item)
})
}
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'
}
})
}
})
}
})
}
},
mainRiskLimit() {
if (!this.fetchdProductDetail) return false
const resultData = this.fetchdProductDetail
const { productCode } = this.productDTOS[0]
if (riskRules.ageLimit(resultData, this, null, productCode)) return false
return true
}
},
watch: {
/**更新首期保费信息*/
firstTermTotalPremium(value) {
this.$emit('updateTotalPremium', value)
},
saleInsuredPersonInfo: {
deep: true,
handler: function(obj) {
const { birthday, relationToAppnt, sex } = obj
this.saleInsuredPersonInfo.insuredAge = utilsAge.getAge(birthday, new Date())
this.processProducts()
// console.log(`saleInsuredPersonInfo value change`, this.saleInsuredPersonInfo)
if (Number(relationToAppnt) === 1) [this.saleInsuredInfo.sex, this.saleInsuredInfo.birthday] = [sex, birthday]
}
},
saleInsuredInfo: {
deep: true,
handler: function(obj) {
const { birthday, sex } = obj
this.saleInsuredInfo.insuredAge = utilsAge.getAge(birthday, new Date())
// console.log(`saleInsuredInfo value change`, this.saleInsuredInfo)
if (this.saleInsuredPersonInfo.relationToAppnt === 1) {
;[this.saleInsuredPersonInfo.sex, this.saleInsuredPersonInfo.birthday] = [sex, birthday]
}
}
}
},
inject: {
nextStepProcesserContainer: {
default: null
}
}
}
</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>