Files
ebiz-h5/src/views/ebiz/cardList/information.vue

2949 lines
125 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='insured-info-container pb50'>
<!-- 投保人信息 -->
<van-cell-group class='mt10'>
<p style='border-bottom: 1px solid #ebedf0' class='fs15 fwb pl10 pv12'>投保人信息</p>
<van-field
:value="userInfo.relationToInsured | idToText('relationToAppnt')"
readonly
required
label='与被保人关系'
name='与被保人关系'
right-icon='arrow'
placeholder='请选择'
v-validate="'required'"
@click="toSelect('9')"
/>
<customer-picker
@on-choose='chooseCustomer(arguments)'
v-validate="'required|name'"
name='投保人姓名'
label='投保人姓名'
required
:parentShowPicker.sync='customerShowPicker'
v-model='userInfo.name'
@nameChange='nameChange'
@on-click="selectClick('1', '0')"
></customer-picker>
<van-field
:value="userInfo.idType | idToText('insuredIdType')"
v-validate="'required'"
readonly
required
label='证件类型'
@click="toSelect('2')"
name='证件类型'
right-icon='arrow'
placeholder='请选择'
/>
<!-- <van-field v-model="userInfo.idNo" v-validate="'required|idNo'" maxlength="18" label="证件号码" name="证件号码" placeholder="请输入" clearable> -->
<van-field
v-model='userInfo.idNo'
maxlength='18'
required
label='证件号码'
v-validate="'required'"
name='证件号码'
placeholder='请输入'
clearable
@blur="getRelatedData(userInfo.idNo, '1')"
>
<van-button v-if='userInfo.idType == 1' slot='button' size='small' type='danger' round
@click="selectClick('3', '', '1')">证件扫描
</van-button>
</van-field>
<FieldDatePicter
:v-validate='{ required: certiexpiredateRequired }'
required
label='证件截止日期'
name='证件截止日期'
:minDate='certiexpiredateMin'
:value.sync='userInfo.certiexpiredate'
type='date'
@confirm="onDateConfirm($event, '1')"
ref='certiexpiredate'
:flag='true'
:readonly='idLimit'
></FieldDatePicter>
<div class='border-bt relative fs14 p10 flex justify-content-fe'>
<van-checkbox v-model='userInfo.effectiveDateType' :disabled='effectiveDateTypeAble'
@change='effectiveDataTypeChange'>长期
</van-checkbox>
</div>
<select-radio required :radios='sexRadio' label='性别' name='性别' v-validate="'required'"
:value.sync='userInfo.sex'></select-radio>
<FieldDatePicter
v-validate="'required'"
label='出生日期'
name='出生日期'
required
:value.sync='userInfo.birthday'
type='date'
:flag='true'
@confirm="onDateConfirm($event, '2')"
ref='birthday'
:maxDate='maxDate'
>
</FieldDatePicter>
<van-field
required
v-model='userInfo.mobile'
clearable
label='手机号码'
name='手机号码'
placeholder='请输入'
v-validate="'required|mobile'"
maxlength='11'
/>
<van-field v-model='userInfo.email' label='邮箱' name='邮箱' placeholder='如需电子保单,请填写' v-validate="'email'"
clearable />
<!-- <van-field v-model="userInfo.workcompany" required label="工作单位" name="工作单位" placeholder="请输入" v-validate="'required'" maxlength="50" clearable /> -->
<van-field
v-validate="'required'"
@click="openOccupation('1')"
required
label='职业类别'
placeholder='请输入'
name='职业类别'
:value='userInfo.occupationName'
right-icon='arrow'
/>
<van-field
v-if='averageAnnualIncomeFlag'
v-model='userInfo.averageAnnualIncome'
label='平均年收入(万元)'
name='平均年收入'
required
placeholder='请输入,单位万元'
v-validate="'required|onlyNumber'"
clearable
maxlength='5'
/>
<van-field
v-validate="'required'"
:value="userInfo.nativeplace | idToText('nativeplace')"
readonly
required
label='国籍'
name='国籍'
right-icon='arrow'
placeholder='请选择'
@click="toSelect('1')"
/>
<van-field
:value="userInfo.marriage | idToText('marriage')"
readonly
required
label='婚姻状况'
name='婚姻状况'
v-validate="'required'"
right-icon='arrow'
placeholder='请选择'
@click="toSelect('6')"
/>
<div class="p15 pl8 fs14" style="border-bottom: 1px solid #eee;display: flex;justify-content: space-between;align-items: center;" v-if="manageComCode == '45'">
<van-radio-group v-model="userInfo.isNewPeopleFlag" class="flex">
<label>
<i class="red">*</i>
新市民身份
</label>
<van-radio name="1" class="ml30"></van-radio>
<van-radio name="0" class="ml20"></van-radio>
</van-radio-group>
<van-icon name="question-o" size="20" @click="isNewPeopleFlagTipshow = true"/>
</div>
<van-field
v-if="userInfo.isNewPeopleFlag == 1"
:value="userInfo.npType | idToText('npType')"
readonly
label="新市民类型"
name="新市民类型"
required
right-icon="arrow"
placeholder="请选择"
v-validate="'required'"
@click="toSelect('appntNpType')"
/>
<van-field
v-model='userInfo.homeName'
readonly
label='联系地址'
name='联系地址'
required
right-icon='arrow'
placeholder='请选择'
v-validate="'required'"
@click="areaSelect('1')"
/>
<van-field v-model='userInfo.homeAddress' label name='详细地址' placeholder='请输入详细地址' v-validate="'required'"
clearable maxlength='30' />
<!-- </template> -->
</van-cell-group>
<!-- 被保险人信息 (投保人与被保险人非同一人的情况)-->
<van-cell-group class='mt10' v-if='userInfo.relationToInsured != 1'>
<p style='border-bottom: 1px solid #ebedf0' class='fs15 fwb pl10 pv12'>被保人信息</p>
<customer-picker
@on-choose='chooseCustomer(arguments)'
v-validate="'required|name'"
name='被保险人姓名'
label='被保险人姓名'
required
:parentShowPicker.sync='customerShowPicker2'
v-model='insuredInfo.name'
@nameChange='nameChanges'
@on-click="selectClick('1', '1')"
></customer-picker>
<van-field
:value="insuredInfo.idType | idToText('insuredIdType')"
v-validate="'required'"
readonly
required
@click="toSelect('22')"
label='证件类型'
name='证件类型'
right-icon='arrow'
placeholder='请选择'
/>
<van-field
v-model='insuredInfo.idNo'
maxlength='18'
required
label='证件号码'
v-validate="'required'"
name='证件号码'
placeholder='请输入'
clearable
@blur="getRelatedData(insuredInfo.idNo, '2')"
>
<van-button v-if='insuredInfo.idType == 1' slot='button' size='small' type='danger' round
@click="selectClick('3', '', '2')">证件扫描
</van-button>
</van-field>
<FieldDatePicter
v-if="isInsuredCertiexpiredate"
:v-validate='{ required: certiexpiredateRequiredInsured }'
required
label='证件截止日期'
name='证件截止日期'
:minDate='certiexpiredateMin'
:value.sync='insuredInfo.certiexpiredate'
type='date'
@confirm="onDateConfirm($event, '7')"
ref='certiexpiredate'
:flag='true'
:readonly='idLimitInsured'
></FieldDatePicter>
<div class='border-bt relative fs14 p10 flex justify-content-fe'>
<van-checkbox v-model='insuredInfo.effectiveDateType' :disabled='effectiveDateTypeAbleInsured'
@change='effectiveDataTypeChangeInsured'
>长期
</van-checkbox
>
</div>
<select-radio required :radios='sexRadio' label='性别' name='性别' v-validate="'required'"
:value.sync='insuredInfo.sex'></select-radio>
<FieldDatePicter
label='出生日期'
name='出生日期'
required
:value.sync='insuredInfo.birthday'
type='date'
:flag='true'
@confirm="onDateConfirm($event, '5')"
ref='insuredBirthday'
:maxDate='insuredMaxDate'
></FieldDatePicter>
<van-field
v-if='isLessEighteen'
v-model='insuredInfo.mobile'
clearable
label='手机号码'
name='手机号码'
placeholder='请输入'
v-validate="'mobile'"
maxlength='11'
/>
<van-field v-if='isLessEighteen' v-model='insuredInfo.email' label='邮箱' name='邮箱' placeholder='请输入'
v-validate="'email'" clearable />
<van-field
required
@click="openOccupation('2')"
label='职业类别'
placeholder='请输入'
name='职业类别'
readonly
:value='insuredInfo.occupationName'
right-icon='arrow'
/>
<van-field
v-model='insuredInfo.schoolName'
v-show='showField'
label='学校名称'
name='学校名称'
placeholder='请输入学校名称'
/>
<van-field
v-model='insuredInfo.className'
v-show='showField'
label='班级名称'
name='班级名称'
placeholder='请输入班级名称'
/>
<select-radio v-show='showField' :radios='medicalRadio' label='有无社保' name='有无社保'
:value.sync='medical'></select-radio>
<van-field
v-if='averageAnnualIncomeFlag'
v-model='insuredInfo.averageAnnualIncome'
label='平均年收入(万元)'
name='平均年收入'
required
placeholder='请输入,单位万元'
v-validate="'required|onlyNumber'"
clearable
maxlength='5'
/>
<van-field
:value="insuredInfo.nativeplace | idToText('nativeplace')"
readonly
required
label='国籍'
name='国籍'
right-icon='arrow'
placeholder='请选择'
@click="toSelect('11')"
/>
<van-field
:value="insuredInfo.marriage | idToText('marriage')"
readonly
required
label='婚姻状况'
name='婚姻状况'
right-icon='arrow'
placeholder='请选择'
@click="toSelect('66')"
/>
<div class="p15 pl8 fs14" style="border-bottom: 1px solid #eee;display: flex;justify-content: space-between;align-items: center;" v-if="manageComCode == '45'">
<van-radio-group v-model="insuredInfo.isNewPeopleFlag" class="flex">
<label>
<i class="red">*</i>
新市民身份
</label>
<van-radio name="1" class="ml30"></van-radio>
<van-radio name="0" class="ml20"></van-radio>
</van-radio-group>
<van-icon name="question-o" size="20" @click="isNewPeopleFlagTipshow = true"/>
</div>
<van-field
v-if="insuredInfo.isNewPeopleFlag == 1"
:value="insuredInfo.npType | idToText('npType')"
readonly
label="新市民类型"
name="新市民类型"
required
right-icon="arrow"
placeholder="请选择"
v-validate="'required'"
@click="toSelect('insuredNpType')"
/>
<van-field
v-model='insuredInfo.homeName'
readonly
label='联系地址'
name='联系地址'
required
right-icon='arrow'
placeholder='请选择'
@click="areaSelect('2')"
/>
<van-field v-model='insuredInfo.homeAddress' label name='详细地址'
placeholder='请输入详细地址' clearable maxlength='30' />
<div class='pl10 pt10 pb10 pr10 address fs14 redRadioCheckbox'>
<van-checkbox v-model='withRootUser.value'>同投保人</van-checkbox>
</div>
</van-cell-group>
<!-- 被保险人信息 (投保人与被保险人是同一人的情况)-->
<van-cell-group class='mt10' v-else>
<p style='border-bottom: 1px solid #ebedf0' class='fs15 fwb pl10 pv12'>被保人信息</p>
<customer-picker v-validate="'required|name'" name='被保险人姓名' label='被保险人姓名' required readonly
:value.sync='userInfo.name'></customer-picker>
<van-field
:value="userInfo.idType | idToText('insuredIdType')"
v-validate="'required'"
readonly
required
label='证件类型'
name='证件类型'
right-icon='arrow'
placeholder='请选择'
/>
<van-field
v-model='userInfo.idNo'
maxlength='18'
required
readonly
label='证件号码'
v-validate="'required'"
name='证件号码'
placeholder='请输入'
clearable
/>
<FieldDatePicter
required
label='证件截止日期'
name='证件截止日期'
:value.sync='userInfo.certiexpiredate'
type='date'
ref='certiexpiredate'
:flag='true'
readonly
></FieldDatePicter>
<div class='border-bt relative fs14 p10 flex justify-content-fe'>
<van-checkbox v-model='userInfo.effectiveDateType' disabled='false'>长期</van-checkbox>
</div>
<select-radio required :disabled='true' :radios='sexRadio' label='性别' name='性别' v-validate="'required'"
:value.sync='userInfo.sex'></select-radio>
<FieldDatePicter
v-validate="'required'"
label='出生日期'
name='出生日期'
readonly
required
:value.sync='userInfo.birthday'
type='date'
:flag='true'
ref='insuredBirthday'
:maxDate='maxDate'
></FieldDatePicter>
<van-field
v-if='isLessEighteen'
v-model='userInfo.mobile'
clearable
label='手机号码'
name='手机号码'
placeholder='请输入'
v-validate="'mobile'"
maxlength='11'
readonly
/>
<van-field v-model='userInfo.email' readonly label='邮箱' name='邮箱' placeholder='请输入'
v-validate="'email'" clearable />
<van-field readonly required label='职业类别' name='职业类别' :value='userInfo.occupationName' right-icon='arrow' />
<van-field
v-model='userInfo.schoolName'
v-show='showField'
label='学校名称'
name='学校名称'
placeholder='请输入学校名称'
/>
<van-field
v-model='userInfo.className'
v-show='showField'
label='班级名称'
name='班级名称'
placeholder='请输入班级名称'
/>
<select-radio v-show='showField' :radios='medicalRadio' label='有无社保' name='有无社保'
:value.sync='medical'></select-radio>
<van-field
v-if='averageAnnualIncomeFlag'
v-model='userInfo.averageAnnualIncome'
label='平均年收入(万元)'
name='平均年收入'
required
readonly
placeholder='请输入,单位万元'
v-validate="'required|onlyNumber'"
clearable
maxlength='5'
/>
<van-field
:value="userInfo.nativeplace | idToText('nativeplace')"
readonly
required
label='国籍'
name='国籍'
v-validate="'required'"
right-icon='arrow'
placeholder='请选择'
/>
<van-field
:value="userInfo.marriage | idToText('marriage')"
readonly
required
label='婚姻状况'
name='婚姻状况'
v-validate="'required'"
right-icon='arrow'
placeholder='请选择'
/>
<div class="p15 pl8 fs14" style="border-bottom: 1px solid #eee;display: flex;justify-content: space-between;align-items: center;" v-if="manageComCode == '45'">
<van-radio-group v-model="userInfo.isNewPeopleFlag" class="flex">
<label>
<i class="red">*</i>
新市民身份
</label>
<van-radio name="1" class="ml30"></van-radio>
<van-radio name="0" class="ml20"></van-radio>
</van-radio-group>
<van-icon name="question-o" size="20" @click="isNewPeopleFlagTipshow = true"/>
</div>
<van-field
v-if="userInfo.isNewPeopleFlag == 1"
:value="userInfo.npType | idToText('npType')"
readonly
label="新市民类型"
name="新市民类型"
required
right-icon="arrow"
placeholder="请选择"
v-validate="'required'"
@click="toSelect('appntNpType')"
/>
<van-field
v-model='userInfo.homeName'
readonly
label='联系地址'
name='联系地址'
required
right-icon='arrow'
placeholder='请选择'
v-validate="'required'"
/>
<van-field readonly v-model='userInfo.homeAddress' label name='详细地址' placeholder='请输入详细地址' v-validate="'required'"
clearable maxlength='30' />
</van-cell-group>
<!-- 受益人信息 -->
<van-cell-group class='mt10'>
<p style='border-bottom: 1px solid #ebedf0' class='fs15 fwb pl10 pv12'>受益人信息</p>
<van-field required readonly v-model='bnfTypeVal' clearable label='受益人类型' v-validate="'required'"
style='border-bottom: 1px solid #ebedf0' />
</van-cell-group>
<p style='background: white; border-bottom: 1px solid #ebedf0' class='fs15 fwb pl10 pv12'>产品信息</p>
<!-- 保障方案为1款时进入投保页面时保障方案直接回显至前端页面
保障方案多于1款时进入投保页面保障方案默认为空需要选择保障方案 -->
<van-field v-if="this.itemProductDTOS.productCode === 'GFRS_M0062'||this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064'" v-model='proScheme' readonly label='保障方案' name='生效日期' placeholder='请输入' />
<van-field
v-else
:value='proScheme'
readonly
required
label='保障方案'
name='保障方案'
v-validate="'required'"
right-icon='arrow'
placeholder='请选择'
@click="toSelect('10')"
/>
<van-field v-if="this.itemProductDTOS.productCode === 'GFRS_M0041'||this.itemProductDTOS.productCode === 'GFRS_M0052'||this.itemProductDTOS.productCode === 'GFRS_M0071'||this.itemProductDTOS.productCode === 'GFRS_M0091'" v-model='cvaliDate' readonly label='生效日期' name='生效日期' placeholder='请输入' />
<FieldDatePicter
v-else
label='指定生效日期'
name='指定生效日期'
required
v-validate="'required'"
:minDate='now'
:value.sync='cvaliDate'
type='date'
:flag='true'
@confirm="onDateConfirm($event, '6')"
ref='effectiveDate'
input-align:right
:maxDate='filterMaxDate'
>
</FieldDatePicter>
<div v-if='cvaliDate.length > 0' class='van-cell van-field' style='border-bottom: 1px solid rgb(235, 237, 240)'>
<div class='van-cell__title van-field__label'><span>保险期间</span></div>
<div class='van-cell__value'>
<div class='van-field__body'>
<span class='van-field__control'>{{ productDate }}</span>
</div>
</div>
</div>
<div class='van-cell van-field' v-show='showField || showFirstOr'
style='border-bottom: 1px solid rgb(235, 237, 240)'>
<van-cell>
<van-radio-group v-model='firstOr'>
<van-row>
<van-col span='11'>
<van-radio name='0'>首次投保</van-radio>
</van-col>
<van-col span='13'>
<van-radio name='1'>保险期间届满重新投保</van-radio>
</van-col>
</van-row>
</van-radio-group>
</van-cell>
</div>
<!-- <van-checkbox-group v-model="result" ref="checkboxGroup" style="box-sizing:border-box;" class="pl8 pr20 pt10 pb10 bg-white">
<van-checkbox name="a" shape="square" icon-size="13px"
>本人已仔细阅读并了解
<span class="blue" @click.stop="goDocu($assetsUrl + 'product/GFRS_M0022/M0022Notice.pdf', '短期交通卡投保须知')">《投保须知》</span>
<span class="blue" @click.stop="goDocu($assetsUrl + 'product/GFRS_M0022/M0022Explain.pdf', '短期交通卡投保声明')">《投保声明》</span>
<span class="blue" @click.stop="goDocu($assetsUrl + 'product/GFRS_M0022/M0022.pdf', '国富人寿综合交通意外保险2020')"
>《国富人寿综合交通工具意外伤害保险2020版条款》</span
>
等内容,自愿为被保险人投保本保险。<br />
为未成年子女投保的人身保险,在被保险人成年之前,因被保险人身故给付的保险金总和不得超过国务院保险监督管理机构规定的限额,身故给付的保险金额总和的约定也不得超过前述限额。但航空意外死亡保险金额及重大自然灾害意外死亡保险金额不计算在上述规定限额之中。</van-checkbox
>
</van-checkbox-group> -->
<!-- <div class="tips" v-if="cvaliDate.length > 0">注2020年04月03日0时至2021年04月02日24时止。</div> -->
<div class='tips'
v-if="this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049'||this.itemProductDTOS.productCode === 'GFRS_M0050'
||this.itemProductDTOS.productCode === 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064'">
注:为未成年子女投保的人身保险,在被保险人成年之前,因被保险人身故给付的保险金总和不得超过国务院保险监督管理机构规定的限额,身故给付的保险金额总和的约定也不得超过前述限额。但航空意外死亡保险金额及重大自然灾害意外死亡保险金额不计算在上述规定限额之中。
</div>
<div class='tips'
v-if="this.itemProductDTOS.productCode === 'GFRS_M0091'">
注:为未成年子女投保的人身保险,在被保险人成年之前,因被保险人身故给付的保险金总和不得超过国务院保险监督管理机构规定的限额,身故给付的保险金额总和的约定也不得超过前述限额。
</div>
<van-goods-action style='z-index: 99'>
<van-button type='default' style='width: 50%; font-size: 14px; height: 40px; background: white'
>总保费:<span style='color: red; font-weight: bold; font-size: 18px; font-weight: 400'>{{ allPrice }}</span
>元
</van-button
>
<van-goods-action-button type='danger' text='立即投保' @click='nextStep' v-no-more-click='1000' style='border-radius: 0em; width: 50%; height: 40px' />
</van-goods-action>
<!-- <van-dialog v-model="showDialog" title="温馨提示" message="被保险人年龄与所投保的方案不一致,请核实。" show-cancel-button @confirm="nextStep" confirmButtonText="继续投保" cancelButtonText="核对信息"> -->
<!-- </van-dialog> -->
<!-- 职业类别弹窗 -->
<van-popup v-model='occupationShowPicker' position='bottom'>
<occupation-for-loop @chooseOccupation='chooseOccupation' :name='occupationName' :code='occupationCode'
:type='occupationalType'></occupation-for-loop>
</van-popup>
<!-- 字段选择 -->
<van-popup v-model='popupShow' position='bottom'>
<van-picker show-toolbar :columns='columns' @confirm='onConfirm' :default-index='pickerIndex'
@cancel='popupShow = false' />
</van-popup>
<!-- 地区选择 -->
<!-- <van-popup v-model="areaShow" position="bottom">
<van-area :area-list="areaList" value="110101" @confirm="sureArea($event, '1')" @cancel="areaShow = false" />
</van-popup> -->
<!-- 家庭地址选择 -->
<van-popup v-model='homeShow' position='bottom'>
<van-area :area-list='areaList' :value='areaCode' @confirm="sureArea($event, '2')" @cancel='homeShow = false' />
</van-popup>
<!-- 户籍选择 -->
<van-popup v-model='censusShow' position='bottom'>
<van-area :area-list='areaList' value='110101' :columns-num='2' @confirm="sureArea($event, '3')"
@cancel='censusShow = false' />
</van-popup>
<!--身份证扫描 -->
<van-popup v-model='isScan' position='bottom'>
<IdentityCardScan @getScanInfo='getIdentityInfo'></IdentityCardScan>
</van-popup>
<van-popup v-model='isScan2' position='bottom'>
<IdentityCardScan @getScanInfo='getIdentityInfo'></IdentityCardScan>
</van-popup>
<van-dialog v-model="isNewPeopleFlagTipshow" :showConfirmButton="false">
<div slot="title">
<p style="color: #E9332E;">新市民身份说明</p>
</div>
<div style="padding: 20px 30px 30px;font-size: 14px;">
<div style="line-height: 25px;">新市民是指因本人创业就业、子女上学、投靠子女等原因来到城镇常住,未获得当地户籍或获得当地户籍不满三年的各类群体,包括但不限于进城务工人员、新就业大中专毕业生等。</div>
</div>
<div style="text-align: center;margin-bottom: 30px;">
<van-button round type="danger" size="small" style="padding:0px 35px;font-size: 14px;" @click="isNewPeopleFlagTipshow = false">我知道了</van-button>
</div>
</van-dialog>
</div>
</template>
<script>
import { Field, CellGroup, Checkbox, CheckboxGroup, Popup, Picker, Area, RadioGroup, Radio } from 'vant'
import SelectRadio from '@/components/ebiz/SelectRadio'
import FieldDatePicter from '@/components/ebiz/FieldDatePicter'
import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker'
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
import DataDictionary from '@/assets/js/utils/data-dictionary'
import areaList from '@/assets/js/utils/areaForSale'
import { getProductInfo,saveOrUpdateCard,insureTrial } from '@/api/ebiz/cardList/cardList.js'
import { underWrite, appntIsAgent } from '@/api/ebiz/sale/sale'
import utilsAge from '@/assets/js/utils/age'
import getAreaName from '@/assets/js/utils/getAreaNameForSale'
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import beforeDate from '@/assets/js/utils/getBeforeDate.js'
import afterDate from '@/assets/js/utils/getAfterDate.js'
import CacheUtils from '@/assets/js/utils/cacheUtils'
import { idToData } from './js/verification'
import OccupationForLoop from '@/components/ebiz/occipation/OccupationForLoop'
import { selectComp, getIdentityInfo } from './js/methods'
import dateUtils from '@/assets/js/utils/date-utils'
import Vue from 'vue'
import { GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant'
import riskRules from '../common/risk-rules'
import occupationList from '@/components/ebiz/occipation/data/occupation'
import {idNoCheck8} from "../sale/js/verification";
DataDictionary.relationToAppnt = DataDictionary.relationToAppnt.slice(0, 4)
Vue.use(Checkbox).use(CheckboxGroup)
Vue.use(GoodsAction)
.use(GoodsActionIcon)
.use(GoodsActionButton)
export default {
name: 'insuredInfo',
components: {
[SelectRadio.name]: SelectRadio,
[FieldDatePicter.name]: FieldDatePicter,
[OccupationPicker.name]: OccupationPicker,
[CustomerPicker.name]: CustomerPicker,
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Checkbox.name]: Checkbox,
[Popup.name]: Popup,
[Picker.name]: Picker,
[Area.name]: Area,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[IdentityCardScan.name]: IdentityCardScan,
OccupationForLoop
},
data() {
return {
expireDate:'', //截止时间
isLessEighteen: true, //是否小于18周岁不含
averageAnnualIncomeFlag: false, // 20210730 年收入不展示且默认为0 核心对年收入有非空校验
idLimit: false, //截止日期是否可编辑
idLimitInsured: false, //截止日期是否可编辑--被保人
certiexpiredateRequired: true, //证件截止日期是否需要校验
certiexpiredateRequiredInsured: true, //证件截止日期是否需要校验--被保人
effectiveDateTypeAble: false, //长期按钮是否禁用
effectiveDateTypeAbleInsured: false, //长期按钮是否禁用--被保人
proScheme: '', //保障方案
proSchemeCode: '',
productDate: '', //保险期间
now: afterDate.getAfterDays(1), //指定生效日期最小值
currentMonth: new Date().getMonth() + 1, //当前月份
currentYear: new Date().getFullYear(), //当前年份
certiexpiredateMin: afterDate.getAfterDays(1), //证件截止日期最小值
insuredSex: '',
isScan: false, //是否显示证件扫描组件
isScan2: false, //是否显示证件扫描组件--被保人
allPrice: 0,
result: [],
checked: true,
current: 'userInfo',
sexRadio: [
{
label: '',
value: '0'
},
{
label: '',
value: '1'
}
],
medicalRadio: [
{
label: '',
value: '0'
},
{
label: '',
value: '1'
}
],
maxDate: beforeDate.getBeforeYear(18), //投保人出生日期可选最大值
insuredMaxDate: beforeDate.getBeforeDays(28), //被保人出生日期可选最大值
filterMaxDate: beforeDate.getBeforeYear(-2),
popupShow: false,
areaShow: false, //省级联动
homeShow: false, //家庭地址联动
censusShow: false, //户籍联动
pickerType: undefined,
columns: [],
valueKey: 'text',
homeName: '', //家庭地址
bnfTypeVal: '法定受益人', //受益人类型文字展示
cvaliDate: '', //指定生效日期
//投保人信息
userInfo: {
name: '', //投保人姓名
insuredname: '',
sex: '0', //投保人性别
bnfType: '0', // 受益人类型
bnfSelec: '请选择',
birthday: '', //投保人出生日期
relationToInsured: '1',
idType: '1', //证件类型
idNo: '', //证件号码
certiexpiredate: '', //证件到期时间
effectiveDateType: false, //是否长期
occupationCode: '', //职业代码
occupationName: '', //职业名称
occupationType: '', //职业等级
averageAnnualIncome: '', //平均年收入
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '1', //国家地区
marriageStatus: '', //婚姻状况
homeProvince: '450000', //家庭省
homeCity: '450100', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '', //电子邮箱
schoolName: '',
className: '',
isNewPeopleFlag: '', //新市民身份
npType: '', //新市民类型
// effectiveDate: '' //指定生效日期
},
//被保人信息
insuredInfo: {
name: '', // 被保人姓名
idType: '1', //被保人证件类型
idNo: '', //被保人证件号码
certiexpiredate: '', //证件到期时间
effectiveDateType: false, //是否长期
sex: '0', //被保人性别
birthday: '', //被保人出生日期
occupationCode: '', //职业代码
occupationName: '', //职业名称
occupationType: '', //职业等级
averageAnnualIncome: '', //平均年收入
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '', //国家地区
marriageStatus: '', //婚姻状况
marriage: '',
homeProvince: '450000', //家庭省
homeCity: '450100', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '',//电子邮箱
schoolName: '',
className: '',
isNewPeopleFlag: '', //新市民身份
npType: '', //新市民类型
},
selectUser: '',
areaList: areaList,
currentPopupIndex: '',
customerShowPicker: false,
customerShowPicker2: false,
occupationShowPicker: false,
timeId: null,
chooseProducts: JSON.parse(localStorage.chooseProducts),
trialList: JSON.parse(CacheUtils.getLocItem('trialList')),
pdf: ['', '', ''],
insureType: '',
pickerIndex: 0,
areaCode: '450101',
occupationCode: '',
occupationName: '',
occupationType:'',
itemProductDTOS: JSON.parse(CacheUtils.getLocItem('itemProductDTOS')), //
// showDialog:false,
showField: false,
//GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保
showFirstOr: false,
medical: '0',
firstOr: '0',
chooseKind: '',
withRootUser: {
load: false, //防止重复请求
value: false
},
occupationalType: DataDictionary.queryOccupationalByType[0].id,
isInsuredCertiexpiredate:true, //被保人有效止期是否显示
trialDTOS:[], //产品详情信息
manageComCode: '',
isNewPeopleFlagTipshow: false,
}
},
created() {
this.getProductDetail()
// document.body.style.backgroundColor = '#F5F5F5'
//如果是编辑进来
// if (this.$route.query.edit) {
// getOrderDetail({ orderNo: localStorage.orderNo }).then(res => {
// if (res.result == 0) {
// //投保人信息返显
// this.userInfo = res.orderDTO.appntDTO
// //是否长期
// this.userInfo.effectiveDateType = res.orderDTO.appntDTO.effectiveDateType == 'false' ? false : true
// //有无社保
// this.userInfo.medical = '1'
// //设为联系地址
// this.userInfo.addressStatus = '0'
// //证件类型
// this.userInfo.idType = '1'
// //国家/地区
// this.userInfo.nativeplace = '1'
// this.$utils.intLocalStorage(res)
// }
// })
// }
//保单终止日期 截止时间--开始
let currentTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd')
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(Number(this.trialList[0].timeliness)), 'yyyy-MM-dd')
//保险期间计算逻辑
let val = this.cvaliDate
if (Date.parse(val) < Date.parse(new Date())) {
return this.$toast('当前日期早于当日')
}
// let currentDataArr = val.split('-')
// let currentData = currentDataArr[0] + '' + currentDataArr[1] + '' + currentDataArr[2] + ''
let insuYear = JSON.parse(localStorage.insuYear)
// let productDateTime
let insuYearM, productDate
let insuYearD, hoDate
switch (insuYear.insuYearFlag) {
case 'D':
hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
break
case 'Y':
hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
break
}
productDate = new Date(parseInt(hoDate) * 1000)
insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
// productDateTime = productDate.getFullYear() + '' + insuYearM + '' + insuYearD + ''
// this.productDate = currentData + '0时至' + productDateTime + '24时止'
// this.expireDate = productDate.getFullYear() + '-' + insuYearM + '-' + insuYearD //截止时间
this.expireDate = afterDate.getAfterDateTime(val,2)
//保单终止日期 截止时间--结束
if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' || this.itemProductDTOS.productCode === 'GFRS_M0050') {
//金掌桂学平险产品指定生效日规则调整的申请,学平险+60
this.filterMaxDate = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
this.userInfo.relationToInsured = ''
this.showField = true
let currentTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd')
let currentDataArr = currentTime.split('-')
if (currentDataArr[1] >= 6 && currentDataArr[1] <= 8) {
this.cvaliDate = currentDataArr[0] + '-09-01'
this.onDateConfirm(this.cvaliDate, '6')
} else {
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1), 'yyyy-MM-dd')
this.onDateConfirm(this.cvaliDate, '6')
}
}
//学平险62、63、64
// 1、8月31日24时前投保
// 1若9月1日-投保日期60指定生效日期可选范围【T+1至T+60】
// 2若9月1日-投保日期≤60指定生效日期默认为2022年9月1日指定生效日期支持修改可选范围【T+1至T+60】
// 2、9月1日0时至9月30日24时投保指定生效日期默认为2022年9月1日指定生效日期支持修改可选范围【9月1日至T+60日】
// 3、10月1日起到12月31指定生效日期可选范围【T+1至T+60】。
if (this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
//金掌桂学平险产品指定生效日规则调整的申请,学平险+60
this.filterMaxDate = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
this.userInfo.relationToInsured = ''
this.showField = true
let dateDifferNumber = afterDate.dateDiffer(this.currentYear + '-09-01')
console.log(dateDifferNumber,'dateDifferNumber')
if(this.currentMonth == 9){
this.cvaliDate = this.currentYear + '-09-01'
} else if(1 <= this.currentMonth && this.currentMonth <= 8) {
if(dateDifferNumber <= 60){
this.cvaliDate = this.currentYear + '-09-01'
}else{
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1), 'yyyy-MM-dd')
}
} else if(10 <= this.currentMonth && this.currentMonth <= 12) {
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1), 'yyyy-MM-dd')
}
this.onDateConfirm(this.cvaliDate, '6')
}
//金掌桂无忧卡,少儿安康卡两款卡单产品关闭指定生效日功能,默认自承保之日起第四日零时生效
//GFRS_M0052 国富人寿少儿安康保险产品组合、GFRS_M0041 国富无忧卡-国富人寿综合意外伤害保险计划
if (this.itemProductDTOS.productCode === 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0041' || this.itemProductDTOS.productCode === 'GFRS_M0071'|| this.itemProductDTOS.productCode === 'GFRS_M0091') {
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(Number(this.trialList[0].timeliness)), 'yyyy-MM-dd')
//保险期间计算逻辑
let val = this.cvaliDate
if (Date.parse(val) < Date.parse(new Date())) {
return this.$toast('当前日期早于当日')
}
let currentDataArr = val.split('-')
let currentData = currentDataArr[0] + '' + currentDataArr[1] + '' + currentDataArr[2] + ''
let insuYear = JSON.parse(localStorage.insuYear)
let insuYearM, productDate, productDateTime
let insuYearD, hoDate
switch (insuYear.insuYearFlag) {
case 'D':
hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
break
case 'Y':
hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
break
}
productDate = new Date(parseInt(hoDate) * 1000)
insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
// productDateTime = productDate.getFullYear() + '' + insuYearM + '' + insuYearD + ''
productDateTime = afterDate.getAfterDateTime(val,1)
this.productDate = currentData + '0时至' + productDateTime + '24时止'
}
//GFRS-2641 少儿安康
if (this.itemProductDTOS.productCode === 'GFRS_M0052') {
this.userInfo.relationToInsured = '3'
//GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保
this.showFirstOr = true
//GFRS-2641 被保险人去掉电子邮箱、手机号码字段
this.isLessEighteen = false
}
this.userInfo.homeName = getAreaName([{ code: 450000 }, { code: 450100 }, { code: 450101 }]) //家庭地址
},
async mounted() {
let dataReturn = await riskRules.getAgentInfoFunc(this)
this.manageComCode = dataReturn.manageComCode
// 2516--除万福卡投保人、被保险人年收入默认为0允许修改
if (this.itemProductDTOS.productCode != 'GFRS_M0032') {
this.userInfo.averageAnnualIncome = '0'
}
// 筛选按钮的点击事件
window.appCallBack = this.appCallBack
if (this.itemProductDTOS.productCode === 'GFRS_M0022') {
this.proScheme = '畅行无忧'
this.proSchemeCode = ''
this.allPrice = this.trialList[0].prem
} else if (this.itemProductDTOS.productCode === 'GFRS_M0052'){
this.proScheme = this.trialList[0].proScheme,
this.proSchemeCode = this.trialList[0].proSchemeCode,
this.chooseKind = this.trialList[0].chooseKind
this.allPrice = this.trialList[0].prem
this.now = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
} else if (this.itemProductDTOS.productCode === 'GFRS_M0062' ||this.itemProductDTOS.productCode === 'GFRS_M0063' || this.itemProductDTOS.productCode === 'GFRS_M0064'){
if(this.currentMonth == 9){
this.now = new Date(this.currentYear + "-09-01")
}else{
this.now = afterDate.getAfterDays(1)
}
this.proScheme = this.trialList[0].proScheme
this.proSchemeCode = this.trialList[0].proSchemeCode
this.chooseKind = this.trialList[0].chooseKind
this.allPrice = this.trialList[0].prem
}else {
// this.proScheme = this.trialList[0].proScheme
// this.proSchemeCode = this.trialList[0].proSchemeCode
// this.allPrice = this.trialList[0].prem
// this.now = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
this.now = afterDate.getAfterDays(1)
}
},
methods: {
insureTrial() {
// if(this.insuredInfo.birthday || that.$route.query.relationToAppnt == '1'){
if (this.userInfo.relationToInsured == 1) {
Object.assign(this.insuredInfo, this.userInfo)
}
if(this.insuredInfo.birthday){
// 获取卡单列表
let birthday = this.insuredInfo.birthday
let jobLevel = ''
let collect = (data,code) => {
data.forEach(item => {
if (item.code == code) {
if (this.trialDTOS.productInsuredDTO.healthGrade && this.trialDTOS.productInsuredDTO.healthGrade != '0') {
jobLevel = item.healthGrade
}
if (this.trialDTOS.productInsuredDTO.lifeGrade && this.trialDTOS.productInsuredDTO.lifeGrade != '0') {
jobLevel = item.lifeGrade
}
} else {
if (item.subs && item.subs.length != 0) {
collect(item.subs,code)
}
}
})
}
collect(occupationList,this.insuredInfo.occupationCode)
let data = {
trialInfos: [{ productCode: this.itemProductDTOS.productCode,birthday:birthday,jobLevel:jobLevel}],
}
insureTrial(data)
.then((res) => {
if (res.result == 0) {
//选择保障方案
this.trialList = res.trialList
if (!this.allPrice) {
this.allPrice = res.trialList[0].prem
}
} else {
this.$toast(res.resultMessage)
}
})
.catch((err) => {
console.log('errerr', err)
})
// }else{
// return this.$toast('请先填写被保人信息')
}
},
async getProductDetail() {
let that = this
let data = {
platform: 'app',
productCodes: [that.chooseProducts[0].productCode],
type: '1',
}
await getProductInfo(data)
.then((res) => {
if (res.result == 0) {
this.trialDTOS = res.trialDTOS[0]
} else {
this.$toast(res.resultMessage)
}
})
.catch((err) => {
console.log('errerr', err)
})
},
//长期状态改变时
effectiveDataTypeChange(val) {
//勾选长期状态时,证件截止日期置空
if (val) {
this.userInfo.certiexpiredate = ''
this.certiexpiredateRequired = false
} else {
this.certiexpiredateRequired = true
}
},
//长期状态改变时--被保人
effectiveDataTypeChangeInsured(val) {
if (val) {
this.insuredInfo.certiexpiredate = ''
this.certiexpiredateRequiredInsured = false
} else {
this.certiexpiredateRequiredInsured = true
}
},
/**
* @description:
* @param {*} data
* @return {*}
*/
chooseOccupation(data) {
let { code, name, healthGrade, lifeGrade } = data
//校验主合同被保险人寿险职业等级
//投保同人时,验证投保人职业,投被不同人时验证被保人职业
if(this.itemProductDTOS.productCode != 'GFRS_M0091') {
if(!(this.userInfo.relationToInsured != 1 && this.insureType === '1')){
if (riskRules.lifeGradeLimitCard(this.trialDTOS, this, lifeGrade)) {
return
}
}
}
this.$jump({
flag: 'navigation',
extra: {
title: '填写投被保人信息',
hiddenRight: '1'
}
})
this.occupationShowPicker = false
// insureType '1'为投保人 '2'为被投保人
if (this.insureType === '1') {
this.userInfo.occupationName = name
this.userInfo.occupationCode = code
this.userInfo.occupationType = lifeGrade
this.userInfo.lifeGrade = lifeGrade
this.userInfo.healthGrade = healthGrade
} else if (this.insureType === '2') {
this.insuredInfo.occupationName = name
this.insuredInfo.occupationCode = code
this.insuredInfo.occupationType = lifeGrade
this.insuredInfo.lifeGrade = lifeGrade
this.insuredInfo.healthGrade = healthGrade
}
},
/**
* @description:
* @param {*}
* @return {*}
*/
openOccupation(insureType) {
this.$jump({
flag: 'navigation',
extra: {
title: '职业类别',
hiddenRight: '1'
}
})
this.occupationShowPicker = !this.occupationShowPicker
this.insureType = insureType
if (this.insureType === '1') {
this.occupationName = this.userInfo.occupationName
this.occupationCode = this.userInfo.occupationCode
this.occupationType = this.userInfo.occupationType
} else if (this.insureType === '2') {
this.occupationName = this.insuredInfo.occupationName
this.occupationCode = this.insuredInfo.occupationCode
this.occupationType = this.insuredInfo.occupationType
}
},
areaSelect(insureType) {
;[this.homeShow, this.insureType] = [true, insureType]
if (insureType === '1') {
this.areaCode = this.userInfo.homeArea
} else if (insureType === '2') {
this.areaCode = this.insuredInfo.homeArea
}
},
appntIsAgent(orderNo){
let params = {
orderNo: orderNo
}
appntIsAgent(params).then(res=>{
if(res.result == '0') {
if(res.content.isAgengFlag == '0') {
this.$dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '投保人/法人同时为代理人此代理人费用为0虚拟账号的提示虚拟代理人费用为0请确认提交审核或者退回修改',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF',
cancelButtonText: '退回'
})
.then(() => {
this.underWrite(orderNo)
})
.catch(() => {
return
})
} else {
this.underWrite(orderNo)
}
} else {
this.$toast(res.resultMessage)
}
})
},
underWrite(orderNo) {
let data = {
platform: 'app',
type: '1',
orderDTO: {
orderInfoDTO: {
orderNo: orderNo
}
}
}
underWrite(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
window.localStorage.setItem('underWriteData', JSON.stringify(res))
if (res.uwResult == '33') {
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
} else {
window.localStorage.setItem('uwResult', res.uwResult)
}
if (res.uwResult == '02') {
this.underWriteData = res
window.localStorage.setItem('underWriteData', JSON.stringify(res))
this.$jump({
flag: 'h5',
extra: {
url: location.origin + `/#/cardList/pay`,
forbidSwipeBack: 1
},
routerInfo: {
path: `/cardList/pay`
}
})
} else {
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/cardList/result',
backToFirst: '1'
},
routerInfo: {
path: '/cardList/result'
}
})
}
return true
} else {
this.$toast(res.resultMessage)
return false
}
})
},
goDocu(url, name) {
// let pdfUrl = //encodeURIComponent(url)
localStorage.setItem('cardListPDF', JSON.stringify({ documentUrl: url, title: name }))
console.log('url', url)
this.$jump({
flag: 'h5',
extra: {
title: name,
// url: 'http://47.96.143.111/pdfjs/web/viewer.html?file=' + url //测试代码
url: location.origin + '/#/cardList/ShowPDF'
},
routerInfo: {
path: '/cardList/ShowPDF'
}
})
},
//监听名字变化
nameChange(name) {
// console.log('name',name)
this.userInfo.name = name
},
//监听名字变化
nameChanges(name) {
// console.log('name',name)
this.insuredInfo.name = name
},
/**
* @description:
* @param {*} index
* @param {*} value
* @param {*} insureType '1'为投保人 '2'为被投保人
* @return {*}
*/
selectClick(index, value, insureType) {
if (value !== undefined) {
this.selectUser = value
}
this.insureType = insureType
selectComp(this, index, insureType)
// console.log(index, value)
// localStorage.setItem('value', value)
},
// closeBtn() {
// // 筛选按钮的显示
// this.$jump({
// flag: 'webview_right_button',
// extra: {
// btns: [
// {
// img: this.$assetsUrl + 'images/del-close.png',
// route: { flag: '', extra: {} }
// }
// ]
// }
// })
// },
appCallBack() {
// 筛选按钮的点击事件
this.$jump({
flag: 'navigation',
extra: {
title: '投被保人信息',
hiddenRight: '1'
}
})
if (this.currentPopupIndex == 1) {
if (this.selectUser == '1') {
this.customerShowPicker2 = false
} else {
this.customerShowPicker = false
}
} else if (this.currentPopupIndex == 2) {
this.occupationShowPicker = false
} else if (this.currentPopupIndex == 3) {
this.isScan = false
this.isScan2 = false
}
},
//弹框选择
toSelect(pickerType, valueKey) {
//pickerType 1、国家地区 2、证件类型 3、文化程度 4、有无社保(弃用) 5、税收居民身份 6、婚姻状况 7、在职情况 8、收入来源, 9 关系
;[this.popupShow, this.pickerType] = [true, pickerType]
if (valueKey) this.valueKey = valueKey
if (pickerType == '1') {
this.columns = DataDictionary.nativeplace
this.pickerIndex = this.userInfo.nativeplace - 1 > 0 ? this.userInfo.nativeplace - 1 : 0
} else if (pickerType == '2') {
this.columns = DataDictionary.insuredIdType
console.log(this.columns, '=======================this.columns==================')
} else if (pickerType == '3') {
this.columns = DataDictionary.degree
} else if (pickerType == '4') {
this.columns = [
{ id: 0, text: '有' },
{ id: 1, text: '无' }
]
} else if (pickerType == '5') {
this.columns = DataDictionary.taxIdentity
} else if (pickerType == '6') {
this.columns = DataDictionary.marriage
this.pickerIndex = this.userInfo.marriage - 1 > 0 ? this.userInfo.marriage - 1 : 0
} else if (pickerType == '7') {
this.columns = DataDictionary.workCondition
} else if (pickerType == '8') {
this.columns = DataDictionary.salarySource
} else if (pickerType == '9') {
//与被保人关系限定为:父母 (不可选,枚举值只有一个)
if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' ||
this.itemProductDTOS.productCode === 'GFRS_M0052'|| this.itemProductDTOS.productCode === 'GFRS_M0062') {
this.columns = DataDictionary.relationToAppnt.slice(2, 3)
} else if (this.itemProductDTOS.productCode === 'GFRS_M0050' || this.itemProductDTOS.productCode === 'GFRS_M0064' || this.itemProductDTOS.productCode === 'GFRS_M0063') {
this.columns = DataDictionary.relationToAppnt.slice(0, 1).concat(DataDictionary.relationToAppnt.slice(2, 3))
} else {
this.columns = DataDictionary.relationToAppnt
}
} else if (pickerType == '66') {
this.columns = DataDictionary.marriage
this.pickerIndex = this.insuredInfo.marriage - 1 > 0 ? this.insuredInfo.marriage - 1 : 0
} else if (pickerType == '11') {
this.columns = DataDictionary.nativeplace
this.pickerIndex = this.insuredInfo.nativeplace - 1 > 0 ? this.insuredInfo.nativeplace - 1 : 0
} else if (pickerType == '10') {
this.columns = []
this.trialList.forEach(item => {
if (item.productCode === 'GFRS_M0022') {
this.columns.push({
id: this.proSchemeCode,
text: this.proScheme
})
} else {
this.columns.push({
id: item.proSchemeCode,
text: item.proScheme,
label: item.chooseKind
})
}
})
} else if (pickerType == '22') {
//2516--三个学平险--被保险人身份信息选择仅保留“身份证、户口本”,目前选择户口本仍要填写身份证到期
//时间,如果选择户口本项,默认为长期。
//GFRS-2641--少儿安康,证件类型枚举“身份证、户口本”
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode == 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.columns = DataDictionary.insuredIdTypeSpecial
} else {
this.columns = DataDictionary.idType
}
} else if(pickerType == 'appntNpType') {
this.columns = DataDictionary.npType
} else if(pickerType == 'insuredNpType') {
this.columns = DataDictionary.npType
}
},
//确认选择字段
onConfirm(value) {
console.log(value, 'value')
this.popupShow = false
if (this.pickerType == '1') {
this.userInfo.nativeplace = value.id
} else if (this.pickerType == '2') {
//身份证以外的证件类型可以使用长期
//value.id 1 居民身份证 todo
if (value.id != '1') {
this.effectiveDateTypeAble = false
} else {
if (this.userInfo.birthday) {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = !(age >= 45)
}
}
this.userInfo.idType = value.id
} else if (this.pickerType == '3') {
this.userInfo.degree = value.id
} else if (this.pickerType == '4') {
this.userInfo.socialSecurity = value.id
} else if (this.pickerType == '5') {
this.userInfo.taxResidentId = value.id
} else if (this.pickerType == '6') {
this.userInfo.marriage = value.id
this.userInfo.marriageStatus = value.text
} else if (this.pickerType == '7') {
this.userInfo.jobStatus = value.id
} else if (this.pickerType == '8') {
this.userInfo.salarySource = value.id
} else if (this.pickerType == '9') {
this.userInfo.relationToInsured = value.id
// 学平险卡单,当与被保人关系为父母时,投保人人婚姻状况默认为已婚,支持修改。
if (this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0064' || this.itemProductDTOS.productCode === 'GFRS_M0063') {
if(this.userInfo.relationToInsured == '3'){
this.userInfo.marriage = '1'
this.userInfo.marriageStatus = '已婚'
}
}
} else if (this.pickerType == '66') {
this.insuredInfo.marriage = value.id
this.insuredInfo.marriageStatus = value.text
} else if (this.pickerType == '11') {
this.insuredInfo.nativeplace = value.id
} else if (this.pickerType == '10') {
this.proScheme = value.text
this.proSchemeCode = value.id
this.chooseKind = value.label
for (let item of this.trialList) {
if (item.proSchemeCode === this.proSchemeCode) {
this.allPrice = item.prem
break
}
}
} else if (this.pickerType == '22') {
this.idLimitInsured = false
//选择证件类型后,清空证件号,证件截止日期,出生日期
this.insuredInfo.idNo = this.insuredInfo.certiexpiredate = this.insuredInfo.birthday = ''
//身份证以外的证件类型可以使用长期
//value.id 1 居民身份证 todo
if (value.id != '1') {
//2516--三个学平险--被保险人身份信息选择仅保留“身份证、户口本”,目前选择户口本仍要填写身份证到期
//时间,如果选择户口本项,默认为长期。
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.insuredInfo.effectiveDateType = true
}
this.effectiveDateTypeAbleInsured = false
} else {
//身份证
if (this.insuredInfo.birthday) {
let age = utilsAge.getAge(this.insuredInfo.birthday, new Date())
this.effectiveDateTypeAbleInsured = !(age >= 45)
//身份证年龄小于等于45不可选长期
this.insuredInfo.effectiveDateType = false
}
}
// 去掉--选择户口本时是否长期默认为是不可点击有效止期隐藏证件类型为户口本时被保人年龄小于16周岁时户口本有效止期长期变更为第16周岁日期
if(value.id==2){
this.idLimitInsured = true
//证件类型户口本时,证件截止日期和是否长期不可选择
this.effectiveDateTypeAbleInsured = true //长期按钮是否禁用--被保人
this.insuredInfo.effectiveDateType = false //是否长期
// this.insuredInfo.effectiveDateType = true
// this.insuredInfo.certiexpiredate = '9999-12-31'
// this.effectiveDateTypeAbleInsured = true
// this.isInsuredCertiexpiredate = false
this.isInsuredCertiexpiredate = true
}else{
this.insuredInfo.certiexpiredate = ''
this.insuredInfo.effectiveDateType = false
this.effectiveDateTypeAbleInsured = false
this.isInsuredCertiexpiredate = true
}
this.insuredInfo.idType = value.id
} else if (this.pickerType === 'appntNpType') {
this.userInfo.npType = value.id
} else if (this.pickerType === 'insuredNpType') {
this.insuredInfo.npType = value.id
}
},
//证件起始截止日期
onDateConfirm(val, type) {
console.log(type)
switch (type) {
case '0': {
//证件起始日期
//如果录入日期早于出生日期或晚于当前日期
if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) {
this.userInfo.certificateValidate = ''
this.$refs.certificateValidate.date = ''
return this.$toast('证件起始日期填写错误')
}
// // 计算年龄
// if (this.userInfo.idType == '1') {
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// // 长期按钮是否禁用
// this.effectiveDateTypeAble = age <= 45
// }
}
break
case '1': {
console.log('证件截止日期')
//证件截止日期
//如果已经勾选了长期
if (this.userInfo.effectiveDateType) {
//清空数据并返回
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return
}
this.userInfo.effectiveDateType = false
//如果录入日期早于当前日期
if (Date.parse(val) < Date.parse(new Date())) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return this.$toast('您的证件已过期')
}
//不同证件类型的判断
// if (this.userInfo.idType) {
// //获取年龄
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// console.log(age)
// //年龄在16-25周岁之间
// if (age >= 16 && age <= 25) {
// if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) {
// this.userInfo.certiexpiredate = ''
// this.$refs.certiexpiredate.date = ''
// return this.$toast('16周岁~25周岁的证件有效期为10年')
// }
// //年龄在26-45周岁之间
// } else if (age >= 26 && age <= 45) {
// if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20) {
// this.userInfo.certiexpiredate = ''
// this.$refs.certiexpiredate.date = ''
// return this.$toast('26周岁~45周岁的证件有效期为20年')
// }
// //此外的年龄段不支持
// } else {
// this.userInfo.certiexpiredate = ''
// this.$refs.certiexpiredate.date = ''
// return this.$toast('身份证不支持此年龄段')
// }
// }
}
break
case '2': {
//出生日期
//如果录入日期晚于当前日期
if (Date.parse(val) > Date.parse(new Date())) {
this.userInfo.birthday = ''
this.$refs.birthday.date = ''
return this.$toast('出生日期不晚于当日')
}
// //长判断
// if (this.userInfo.idType == '1') {
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// this.effectiveDateTypeAble = !(age >= 45)
// }
}
break
case '5': {
//被保人出生日期
//如果录入日期晚于当前日期
if (Date.parse(val) > Date.parse(new Date())) {
this.userInfo.insuredBirthday = ''
this.$refs.insuredBirthday.date = ''
return this.$toast('出生日期不晚于当日')
}
//GFRS-2641-- 被保险人年龄小于18周岁不含前端需隐藏手机号码、电子邮箱
//GFRS-2641--被保险人大于等于18周岁前端需展示手机号码、电子邮箱且非必填
let age = utilsAge.getAge(val, new Date())
if (this.itemProductDTOS.productCode != 'GFRS_M0052') {
if (age <= 17) {
this.isLessEighteen = false //是否小于18周岁不含
} else {
this.isLessEighteen = true //是否小于18周岁不含
}
}
//GFRS-2641--被保险人年龄小于20周岁不含婚姻状况默认为未婚
if (age < 20) {
this.insuredInfo.marriage = '2'
} else {
this.insuredInfo.marriage = ''
}
}
break
case '6': {
//指定生效日期
//如果录入日期晚于当前日期
if (Date.parse(val) < Date.parse(new Date())) {
return this.$toast('当前日期早于当日')
}
let currentDataArr = val.split('-')
let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日'
let insuYear = JSON.parse(localStorage.insuYear)
let insuYearM, productDate, productDateTime
let insuYearD, hoDate
switch (insuYear.insuYearFlag) {
case 'D':
hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
break
case 'Y':
hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
break
}
productDate = new Date(parseInt(hoDate) * 1000)
insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
// productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日'
productDateTime = afterDate.getAfterDateTime(val,1)
this.productDate = currentData + '0时至' + productDateTime + '24时止'
}
break
case '7': {
console.log('证件截止日期')
//被保人--证件截止日期
//如果已经勾选了长期
if (this.insuredInfo.effectiveDateType) {
//清空数据并返回
this.insuredInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return
}
this.insuredInfo.effectiveDateType = false
//如果录入日期早于当前日期
if (Date.parse(val) < Date.parse(new Date())) {
this.insuredInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return this.$toast('您的证件已过期')
}
}
break
}
},
//选择客户
chooseCustomer(data) {
data = data[0]
console.log(data)
console.log(typeof this.selectUser)
if (this.selectUser == '1') {
this.customerShowPicker2 = false
} else {
this.customerShowPicker = false
}
this.$jump({
flag: 'navigation',
extra: {
title: '投被保人信息',
hiddenRight: '1'
}
})
if (this.selectUser == '0') {
let { customerName, customerSex } = data
this.userInfo.name = customerName //用户名
this.userInfo.sex = customerSex ? customerSex.toString() : '0' //性别
this.userInfo.birthday = data.birthday //出生日期
this.userInfo.idType = data.customerIdType //证件类型
this.userInfo.idNo = data.customerIdNumber //证件类别
if (data.idEffectEndDate == '9999-12-31') {
this.userInfo.effectiveDateType = true //是否长期
} else {
this.userInfo.certiexpiredate = data.idEffectEndDate //证件截止日期
this.userInfo.effectiveDateType = false //是否长期
}
this.userInfo.email = data.email //邮箱
this.userInfo.mobile = data.customerPhone //移动电话
this.userInfo.homeProvince = data.homeProvince //家庭省
this.userInfo.homeCity = data.homeCity //家庭市
this.userInfo.homeArea = data.homeArea //家庭区
if (data.homeProvince && data.homeCity && data.homeArea) {
this.userInfo.homeName = getAreaName([{ code: data.homeProvince }, { code: data.homeCity }, { code: data.homeArea }]) //家庭地址
}
this.userInfo.homeAddress = data.homeAddress //家庭详细地址
this.userInfo.occupationCode = data.occupationCode
this.userInfo.occupationName = data.occupationName
let thisoccupationType = ''
let thislifeGrade = ''
let thishealthGrade = ''
let collect = (data,code) => {
data.forEach(item => {
if (item.code == code) {
if (this.trialDTOS.productInsuredDTO.healthGrade && this.trialDTOS.productInsuredDTO.healthGrade != '0') {
thisoccupationType = item.healthGrade
}
if (this.trialDTOS.productInsuredDTO.lifeGrade && this.trialDTOS.productInsuredDTO.lifeGrade != '0') {
thisoccupationType = item.lifeGrade
}
thislifeGrade = item.lifeGrade
thishealthGrade = item.healthGrade
} else {
if (item.subs && item.subs.length != 0) {
collect(item.subs,code)
}
}
})
}
collect(occupationList,data.occupationCode)
this.userInfo.occupationType =thisoccupationType
this.userInfo.lifeGrade = thislifeGrade
this.userInfo.healthGrade = thishealthGrade
this.userInfo.averageAnnualIncome = this.itemProductDTOS.productCode == 'GFRS_M0032' ? data.averageYearlyIncome : '0' //平均年收入
//2516--三个学平险--被保险人国籍默认中国,允许修改
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.userInfo.nativeplace = '1'
} else {
this.userInfo.nativeplace = data.country
}
this.userInfo.marriage = data.marryStatus
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 长期按钮是否禁用
this.effectiveDateTypeAble = age <= 45
this.userInfo.isNewPeopleFlag = data.isNewPeopleFlag //新市民身份
this.userInfo.npType = data.npType //新市民类型
this.getRelatedData(this.userInfo.idNo, '1')
} else if (this.selectUser == '1') {
let { customerName, customerSex, isNewPeopleFlag, npType } = data
this.insuredInfo.isNewPeopleFlag = isNewPeopleFlag //新市民身份
this.insuredInfo.npType = npType //新市民类型
this.insuredInfo.name = customerName //用户名
this.insuredInfo.sex = customerSex ? customerSex.toString() : '0' //性别
this.insuredInfo.birthday = data.birthday //出生日期
this.insuredInfo.idType = data.customerIdType //证件类型
this.insuredInfo.idNo = data.customerIdNumber //证件类别
if(this.insuredInfo.idType == '2' && idToData(this.insuredInfo.idNo).age <16){
// 获取出生日期年份16证件类型为户口本时被保人年龄小于16周岁时卡单户口本有效止期长期变更为第16周岁日期
let year = Number(this.insuredInfo.birthday.substr(0,4)) + 16
if(this.insuredInfo.birthday.substr(5,5) == '02-29'){
// 获取某年某月一共多少天
let date = new Date(year, 2, 1)
let dayEnd = new Date(date.getTime() - 864e5).getDate()
this.insuredInfo.certiexpiredate = year +'-02-'+ dayEnd
}else{
this.insuredInfo.certiexpiredate = year +'-'+ this.insuredInfo.birthday.substr(5,5)
}
}
if (data.customerIdType == 2) {
this.insuredInfo.effectiveDateType = true
this.insuredInfo.certiexpiredate = '9999-12-31'
this.effectiveDateTypeAbleInsured = true
this.isInsuredCertiexpiredate = false
}
else{
this.isInsuredCertiexpiredate = true
// 因为学平险产品 少儿卡单 被保人证件类型只有身份证和户口本 所以回显被保人信息时 如果不是身份证和户口本 就隐藏被保人证件类型
if ((this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode == 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064')
&& data.customerIdType != 1) {
this.insuredInfo.idType = ''
this.insuredInfo.certiexpiredate = ''
this.insuredInfo.effectiveDateType = false;
this.effectiveDateTypeAbleInsured = false
}else{
if (data.idEffectEndDate == '9999-12-31') {
this.insuredInfo.certiexpiredate = ''
this.insuredInfo.effectiveDateType = true //是否长期
this.effectiveDateTypeAbleInsured = true
} else {
this.insuredInfo.certiexpiredate = data.idEffectEndDate //证件截止日期
this.insuredInfo.effectiveDateType = false;
this.effectiveDateTypeAbleInsured = false
}
}
}
this.insuredInfo.email = data.email //邮箱
this.insuredInfo.mobile = data.customerPhone //移动电话
this.insuredInfo.homeProvince = data.homeProvince //家庭省
this.insuredInfo.homeCity = data.homeCity //家庭市
this.insuredInfo.homeArea = data.homeArea //家庭区
if (data.homeProvince && data.homeCity && data.homeArea) {
this.insuredInfo.homeName = getAreaName([{ code: data.homeProvince }, { code: data.homeCity }, { code: data.homeArea }]) //家庭地址
}
this.insuredInfo.homeAddress = data.homeAddress //家庭详细地址
//2516--三个学平险--被保险人职业类别默认学生允许修改
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.insuredInfo.occupationCode = '2099907'
this.insuredInfo.occupationName = '一般学生'
this.insuredInfo.occupationType = '1'
} else if (this.itemProductDTOS.productCode === 'GFRS_M0062') {
this.insuredInfo.occupationCode = '2099908'
this.insuredInfo.occupationName = '学龄前儿童'
this.insuredInfo.occupationType = '1'
} else {
this.insuredInfo.occupationCode = data.occupationCode
this.insuredInfo.occupationName = data.occupationName
}
this.insuredInfo.lifeGrade = data.lifeGrade
this.insuredInfo.occupationType = data.lifeGrade
this.insuredInfo.healthGrade = data.healthGrade
//除万福卡投保人被保险人年收入填写项去掉默认为0卡产品不满足反洗钱识别线
this.insuredInfo.averageAnnualIncome = this.itemProductDTOS.productCode == 'GFRS_M0032' ? data.averageYearlyIncome : '0' //平均年收入
//2516--三个学平险--被保险人婚姻默认未婚允许修改
//2516--三个学平险--被保险人国籍默认中国允许修改
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'||this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.insuredInfo.marriage = '2'
this.insuredInfo.nativeplace = '1'
} else {
this.insuredInfo.marriage = data.marryStatus
this.insuredInfo.nativeplace = data.country
}
// 计算年龄
let age = utilsAge.getAge(this.insuredInfo.birthday, new Date())
if (this.itemProductDTOS.productCode != 'GFRS_M0052') {
if (age <= 17) {
this.isLessEighteen = false //是否小于18周岁不含
} else {
this.isLessEighteen = true //是否小于18周岁不含
}
}
// 长期按钮是否禁用
this.effectiveDateTypeAbleInsured = age <= 45
this.getRelatedData(this.insuredInfo.idNo, '2')
}
// console.log(data, val)
},
nextStep() {
if (this.manageComCode == '45' && (this.userInfo.isNewPeopleFlag == '' || this.userInfo.isNewPeopleFlag == null || this.userInfo.isNewPeopleFlag == undefined)) {
return this.$toast('投保人新市民身份不能为空')
}
if(this.manageComCode == '45' && this.userInfo.isNewPeopleFlag != '0' && !this.userInfo.npType) {
return this.$toast('投保人新市民类型不能为空')
}
//表单校验, 成功跳转
if (this.userInfo.relationToInsured == 1) {
Object.assign(this.insuredInfo, this.userInfo)
}
this.$validator.validate().then(valid => {
if (true === valid) {
// localStorage.chooseProductCodesNew = localStorage.chooseProductCodes
//投保人校验
// 计算年龄
if (!this.insuredInfo.name) {
return this.$toast('被保人姓名不能为空')
}
if (!this.insuredInfo.idNo) {
return this.$toast('被保人证件号码不能为空')
}
if (!this.insuredInfo.birthday) {
return this.$toast('被保人出生日期不能为空')
}
// if (!this.insuredInfo.mobile) {
// return this.$toast('被保人手机号不能为空')
// }
// if (!this.insuredInfo.email) {
// return this.$toast('被保人邮箱不能为空')
// }
if (!this.insuredInfo.occupationName) {
return this.$toast('被保人职业不能为空')
}
if (!this.insuredInfo.nativeplace) {
return this.$toast('被保人国籍不能为空')
}
if (!this.insuredInfo.marriage) {
return this.$toast('被保人婚姻状况不能为空')
}
if (!this.insuredInfo.homeName) {
return this.$toast('被保人联系地址不能为空')
}
if (!this.insuredInfo.homeAddress) {
return this.$toast('被保人详细地址不能为空')
}
if (this.userInfo.relationToInsured == 2 && this.userInfo.sex == this.insuredInfo.sex) {
return this.$toast('哦~配偶性别不能相同的哟~')
}
if (this.manageComCode == '45' && (this.insuredInfo.isNewPeopleFlag == '' || this.insuredInfo.isNewPeopleFlag == null || this.insuredInfo.isNewPeopleFlag == undefined)) {
return this.$toast('被保人新市民身份不能为空')
}
if (this.manageComCode == '45' && this.insuredInfo.isNewPeopleFlag != '0' && !this.insuredInfo.npType) {
return this.$toast('被保人新市民类型不能为空')
}
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
console.log('计算年龄', age)
// return
// 如果是未成年人
if (age < 18) {
return this.$toast('亲投保人年龄必须大于等于18周岁哦~')
}
//如果证件类型是身份证
if (this.userInfo.idType == '1') {
console.log('证件类型是身份证')
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
console.log('性别位' + sexSign)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
console.log('生日位' + birthSign)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
if (age < 46 && this.userInfo.effectiveDateType == true) {
return this.$toast('证件有效期错误年龄小于46周岁的公民身份证有效期不能为长期')
}
// 年龄在 16-25 周岁之间
if (age <= 15) {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期错误未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (age >= 16 && age <= 25) {
console.log('年龄在16-25周岁之间')
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (age >= 26 && age <= 45) {
console.log('年龄在26-45周岁之间')
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
this.effectiveDateTypeAble = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
//如果证件类型是户口本
}
else if(this.userInfo.idType == '2'){
if (this.userInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.userInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 6)
if (
this.userInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.userInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.userInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.userInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.userInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.userInfo.idNo.substr(6, 8)
if (
this.userInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.userInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.userInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
if (age >= 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.userInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
}
else if (this.userInfo.idType == '8') {
if (idNoCheck8(this.userInfo,'cardList').text){
return this.$toast(idNoCheck8(this.userInfo,'cardList').text)
}
}
let insuredAge = utilsAge.getAge(this.insuredInfo.birthday, new Date(this.cvaliDate))
console.log('计算年龄', insuredAge)
//如果证件类型是身份证或户口本
if (this.insuredInfo.idType == '1') {
console.log('证件类型是身份证')
//校验性别是否与身份证号码位相符
if (this.insuredInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.insuredInfo.idNo.substr(14, 1)
console.log('性别位' + sexSign)
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.insuredInfo.idNo.substr(6, 6)
console.log('生日位' + birthSign)
if (
this.insuredInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.insuredInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.insuredInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.insuredInfo.idNo.substr(6, 8)
if (
this.insuredInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.insuredInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
if (insuredAge < 46 && this.insuredInfo.effectiveDateType == true) {
return this.$toast('证件有效期错误年龄小于46周岁的公民身份证有效期不能为长期')
}
// 年龄在 16-25 周岁之间
if (insuredAge <= 15) {
if (Date.parse(this.insuredInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1975-01-01')) {
this.insuredInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
// this.effectiveDateTypeAble = true
return this.$toast('证件有效期错误未满16周岁的公民身份证有效期应小于等于5年')
}
//年龄在 16-25 周岁之间
} else if (insuredAge >= 16 && insuredAge <= 25) {
console.log('年龄在16-25周岁之间')
if (Date.parse(this.insuredInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1980-01-01')) {
this.insuredInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
this.certiexpiredateRequiredInsured = true
return this.$toast('证件有效期不正常16周岁至25周岁公民身份证有效期应小于等于10年')
}
//年龄在 26-45 周岁之间
} else if (insuredAge >= 26 && insuredAge <= 45) {
if (Date.parse(this.insuredInfo.certiexpiredate) - Date.parse(new Date()) > Date.parse('1990-01-01')) {
this.insuredInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
this.certiexpiredateRequiredInsured = true
return this.$toast('证件有效期不正常26周岁至45周岁公民身份证有效期应小于等于20年')
}
}
}
else if (this.insuredInfo.idType == '2'){
if (this.insuredInfo.nativeplace != '1') {
return this.$toast('证件类型”为“身份证,国籍必须为中国哦')
}
//校验性别是否与身份证号码位相符
if (this.insuredInfo.idNo.length == '15') {
//15位身份证第15位是性别位, 奇男偶女
let sexSign = this.insuredInfo.idNo.substr(14, 1)
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//15位身份证第7-12位是生日位, 年月日
let birthSign = this.insuredInfo.idNo.substr(6, 6)
if (
this.insuredInfo.birthday.substr(2, 2) != birthSign.substr(0, 2) ||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(2, 2) ||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(4, 2)
) {
return this.$toast('生日录入与身份证不符')
}
} else if (this.insuredInfo.idNo.length == '18') {
//18位身份证第17位是性别位, 奇男偶女
let sexSign = this.insuredInfo.idNo.substr(16, 1)
if ((parseInt(sexSign) % 2 == 0 && this.insuredInfo.sex != 1) || (parseInt(sexSign) % 2 != 0 && this.insuredInfo.sex != 0)) {
return this.$toast('性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = this.insuredInfo.idNo.substr(6, 8)
if (
this.insuredInfo.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
this.insuredInfo.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
this.insuredInfo.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(this.insuredInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
if (insuredAge >= 16) {
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}
// else if (this.insuredInfo.idNo.length != 18) {
// return this.$toast('户口本的证件号码长度应等于18位')
// }
}
else if (this.insuredInfo.idType == '3'){
if (insuredAge >= 2) {
return this.$toast('客户年龄在2周岁及以上不能使用出生证作为有效证件')
}
// 证件号码规则校验
if (!idNoCheck.isCardNoBirth(this.insuredInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
}
else if (this.insuredInfo.idType == '8') {
if (idNoCheck8(this.insuredInfo,'cardList').text){
return this.$toast(idNoCheck8(this.insuredInfo,'cardList').text)
}
}
if (this.itemProductDTOS.productCode === 'GFRS_M0022') {
// return
// 如果是未成年人
if (insuredAge < 7 && this.userInfo.relationToInsured != '3') {
return this.$toast('0-7岁未成年人须由其父母投保请确定')
}
if (insuredAge > 75) {
return this.$toast('被保险人的年龄不可以超过75周岁')
}
if (insuredAge < 0) {
return this.$toast('被保险人的年龄需要大于28天')
}
}
else if (this.itemProductDTOS.productCode === 'GFRS_M0041') {
console.log(this.proSchemeCode)
if (this.proSchemeCode == '00000227') {
if (insuredAge < 18) {
return this.$toast('被保险人的年龄需要大于18岁')
}
}
if (insuredAge < 0) {
return this.$toast('被保险人的年龄需要大于28天')
}
if (insuredAge > 65) {
return this.$toast('被保险人的年龄不可以超过65周岁')
}
}
else if (this.itemProductDTOS.productCode === 'GFRS_M0071') {
console.log(this.proSchemeCode)
if (this.proSchemeCode == '068645010198') {
if (insuredAge < 10) {
return this.$toast('被保险人的年龄需要大于10岁')
}
}
if (insuredAge < 0) {
return this.$toast('被保险人的年龄需要大于28天')
}
if (insuredAge > 65) {
return this.$toast('被保险人的年龄不可以超过65周岁')
}
}
else if (this.itemProductDTOS.productCode === 'GFRS_M0091') {
console.log(this.proSchemeCode)
if (this.proSchemeCode == '06860438-B') {
if (insuredAge < 10) {
return this.$toast('被保险人的年龄需要大于10岁')
}
}
if (insuredAge < 0) {
return this.$toast('被保险人的年龄需要大于28天')
}
if (insuredAge > 65) {
return this.$toast('被保险人的年龄不可以超过65周岁')
}
}
let insuredInfoAge = utilsAge.getAge(this.insuredInfo.birthday, new Date(this.cvaliDate))
if(this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode == 'GFRS_M0052' ||this.itemProductDTOS.productCode === 'GFRS_M0062' || this.itemProductDTOS.productCode === 'GFRS_M0063'
|| this.itemProductDTOS.productCode === 'GFRS_M0064'){
if (insuredInfoAge < this.trialList[0].ageRangeDTO.minAge || insuredInfoAge > this.trialList[0].ageRangeDTO.maxAge) {
return this.$toast('被保险人年龄应为'+this.trialList[0].ageRangeDTO.minAge+'岁-'+this.trialList[0].ageRangeDTO.maxAge+'岁,请重新选择。')
}
}
if (this.userInfo.relationToInsured == '4') {
//投被保人关系是子女
// 被保险人的出生日期大于投保人的出生日期(即被保险人年龄小于投保人年龄)点击【下一步】提示“当前被保险人是投保人的子女,被保险人年龄需小于投保人年龄。
if (age > insuredAge) {
return this.$toast('当前投保人是被保险人的子女,投保人年龄需小于被保险人年龄')
}
} else if (this.userInfo.relationToInsured == '3') {
//投被保人关系是父母
// 被保险人的出生日期小于投保人的出生日期(即被保险人年龄大于投保人年龄)点击【下一步】提示“当前被保险人是投保人的父母,被保险人年龄需大于投保人年龄。
if (age < insuredAge) {
return this.$toast('当前投保人是被保险人的父母,投保人年龄需大于被保险人年龄')
}
}
if (this.userInfo.relationToInsured != '1') {
//投被保人关系不是本人
//投保人和被保险人的证件信息(证件号码、证件类型)相同时,关系只能是本人,当“是投保人的”枚举为非本人(配偶、父母、子女、其他),但证件号码和本人相同,点击【下一步】提示“投保人和被保人关系不是本人,证件号码不可一致,请修改。”
if (this.userInfo.idNo == this.insuredInfo.idNo && this.userInfo.idType == this.insuredInfo.idType) {
return this.$toast('投保人和被保人关系不是本人,证件号码不可一致,请修改。')
}
}
// 是否长期选项 赋值
if (this.userInfo.effectiveDateType){
this.userInfo.certiexpiredate = '9999-12-31'
}
if (this.insuredInfo.effectiveDateType) {
this.insuredInfo.certiexpiredate = '9999-12-31'
}
switch (this.userInfo.homeArea) {
case "500129":
this.userInfo.homeArea = '500229'
break
case '500130':
this.userInfo.homeArea = '500230'
break
case '500131':
this.userInfo.homeArea = '500231'
break
case '500133':
this.userInfo.homeArea = '500233'
break
case '500135':
this.userInfo.homeArea = '500235'
break
case '500136':
this.userInfo.homeArea = '500236'
break
case '500137':
this.userInfo.homeArea = '500237'
break
case '500138':
this.userInfo.homeArea = '500238'
break
case '500140':
this.userInfo.homeArea = '500240'
break
case '500141':
this.userInfo.homeArea = '500241'
break
case '500142':
this.userInfo.homeArea = '500242'
break
case '500143':
this.userInfo.homeArea = '500243'
break
}
switch (this.insuredInfo.homeArea) {
case "500129":
this.insuredInfo.homeArea = '500229'
break
case '500130':
this.insuredInfo.homeArea = '500230'
break
case '500131':
this.insuredInfo.homeArea = '500231'
break
case '500133':
this.insuredInfo.homeArea = '500233'
break
case '500135':
this.insuredInfo.homeArea = '500235'
break
case '500136':
this.insuredInfo.homeArea = '500236'
break
case '500137':
this.insuredInfo.homeArea = '500237'
break
case '500138':
this.insuredInfo.homeArea = '500238'
break
case '500140':
this.insuredInfo.homeArea = '500240'
break
case '500141':
this.insuredInfo.homeArea = '500241'
break
case '500142':
this.insuredInfo.homeArea = '500242'
break
case '500143':
this.insuredInfo.homeArea = '500243'
break
}
console.log(this.insuredInfo,'this.insuredInfo')
if(this.itemProductDTOS.productCode === 'GFRS_M0091'){
if(this.proSchemeCode == '06860438-A') {
if (Number(this.insuredInfo.lifeGrade) > 3) {
this.$toast('寿险职业等级不适合此款险种,请选择其他险种!')
return
}
}
if(this.proSchemeCode == '06860438-B') {
if (Number(this.insuredInfo.lifeGrade) > 4) {
this.$toast('寿险职业等级不适合此款险种,请选择其他险种!')
return
}
}
if(!this.proSchemeCode) {
if (Number(this.insuredInfo.lifeGrade) > 4) {
this.$toast('寿险职业等级不适合此款险种,请选择其他险种!')
return
}
}
}
this.infoUpdate()
// console.log('success')
} else {
this.$toast(this.$validator.errors.all()[0])
}
})
},
// showDialogMethond(){
// let insuredInfoAge = utilsAge.getAge(this.insuredInfo.birthday, new Date())
// if (this.itemProductDTOS.productCode === 'GFRS_M0048') {
// //义务教育 含6岁以下 20岁以上 弹窗
// if(insuredInfoAge<=6||insuredInfoAge>=20){
// this.showDialog=true;
// }else{
// this.nextStep();
// }
// }else if (this.itemProductDTOS.productCode === 'GFRS_M0049') {
// //幼儿园 含7岁以上
// if(insuredInfoAge>=7){
// this.showDialog=true;
// }else{
// this.nextStep();
// }
// }else if (this.itemProductDTOS.productCode === 'GFRS_M0050') {
// //高等教育 含6岁以下
// if(insuredInfoAge<=6){
// this.showDialog=true;
// }else{
// this.nextStep();
// }
// }else{
// this.nextStep();
// }
// },
//信息变更
infoUpdate() {
//local 里面是否存有险种信息
// let chooseProductCodes = localStorage.chooseProductCodes && JSON.parse(localStorage.chooseProductCodes)
// if (chooseProductCodes && chooseProductCodes.length) {
// console.log('haha')
// //获取险种列表
// //取出local中的投保人信息
// let saleInsuredInfo = JSON.parse(localStorage.saleInsuredInfo)
// //如果 性别, 出生日期, 有无社保, 职业 发生变化
// if (this.userInfo.sex != saleInsuredInfo.sex || this.userInfo.birthday != saleInsuredInfo.birthday) {
// console.log('hehe')
// //提示用户
// return this.$dialog
// .confirm({
// className: 'dialog-delete',
// title: '提示',
// message: '当前信息已经发生改变,有可能影响险种费率,是否确认修改并清除险种信息?',
// cancelButtonColor: '#E9332E',
// confirmButtonColor: '#FFFFFF'
// })
// .then(() => {
// // on confirm
// this.save('isShow=1')
// console.log('success')
// })
// .catch(() => {
// // on cancel
// return
// })
// }
// }
this.save()
},
async save() {
// console.log('this.riskDTOLst', this.riskDTOLst)
let params = {
orderDTO: {
orderInfoDTO: {
expireDate:this.expireDate,
bnfFlag: '0',
supportBank: '0'
},
appntDTO: this.userInfo,
insuredDTOs: [this.insuredInfo]
}
}
//组装险种提交数据
let [mainRiskCode, riskDTOLst] = ['', []]
let rollInResult = '' //校验预计转入保费结果
this.chooseProducts.forEach((item, index) => {
console.log('itemssss', item)
if (item.isMainRisk == 0) {
mainRiskCode = item.productCode
}
let insuYearDate = JSON.parse(localStorage.insuYear)
let riskItem = {
cvaliDate: this.cvaliDate,
isMainRisk: item.isMainRisk,
riskName: item.riskName,
riskType: item.riskType,
riskCode: item.productCode,
mainRiskCode: mainRiskCode,
prem: this.allPrice,
standPrem: this.allPrice,
predictTransferPrem: item.predictTransferPrem,
thirdInsuraceNo: this.policyNo,
mult: this.mult,
proScheme: this.proScheme,
proSchemeCode: this.proSchemeCode,
insuYear: insuYearDate.insuYear,
insuYearFlag: insuYearDate.insuYearFlag,
firstOr: this.firstOr,
medical: this.medical,
chooseKind: this.chooseKind
}
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
}
//保费算保额
if (this.trialList[index].trialType == '1') {
riskItem['amt'] = this.trialList[index].amt
}
//万能型产品保费赋值给保额
if (this.trialList[index].productCode == 'GFRS_M0003') {
riskItem['amt'] = this.trialList[index].prem
}
// //豁免险保额处理
// if (item.isRemit == '0') {
// this.trialInfos[index].amt = this.trialList[0].prem
// }
// console.log()
// riskItem = Object.assign(riskItem, this.trialInfos[index])
riskDTOLst.push(riskItem)
})
if (!rollInResult) {
return
}
params.orderDTO.insuredDTOs[0].riskDTOLst = riskDTOLst
if(params.orderDTO.insuredDTOs[0].occupationCode == '2099907') {
params.orderDTO.insuredDTOs[0].occupationType = '1'
}
let resultData = await saveOrUpdateCard(params)
if (resultData.result == 0) {
console.log('resultData.orderNo', resultData.content.object)
//存储被保人信息
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// localStorage.saleInsuredInfo = JSON.stringify({
// birthday: this.userInfo.birthday,
// name: this.userInfo.name,
// sex: this.userInfo.sex,
// idType: this.userInfo.idType,
// age
// })
// this.userInfo.age = age
// localStorage.saleInsuredInfo = JSON.stringify(this.userInfo)
// console.log(this.userInfo)
let orderNo = (localStorage.orderNo = resultData.content.object)
this.appntIsAgent(orderNo)
// this.underWrite(orderNo)
} else {
console.error(resultData.resultMessage)
this.$toast(resultData.resultMessage)
}
},
//区域选择
sureArea(area, type) {
switch (type) {
case '1': //单位地址
this.areaName = getAreaName(area)
;[this.userInfo.companyProvince, this.userInfo.companyCity, this.userInfo.companyArea] = [area[0].code, area[1].code, area[2].code]
this.areaShow = false
break
case '2': //家庭地址
if (this.insureType === '1') {
this.userInfo.homeName = getAreaName(area)
;[this.userInfo.homeProvince, this.userInfo.homeCity, this.userInfo.homeArea] = [area[0].code, area[1].code, area[2].code]
this.homeShow = false
} else if (this.insureType === '2') {
this.insuredInfo.homeName = getAreaName(area)
;[this.insuredInfo.homeProvince, this.insuredInfo.homeCity, this.insuredInfo.homeArea] = [area[0].code, area[1].code, area[2].code]
this.homeShow = false
}
break
case '3': //户籍
this.census = getAreaName(area)
;[this.userInfo.householdProvince, this.userInfo.householdCity] = [area[0].code, area[1].code]
this.censusShow = false
break
}
},
//获取身份证扫描信息
getIdentityInfo(data) {
getIdentityInfo(this, data, this.insureType)
},
// getIdentityInfo(data) {
// console.log(data)
// if (data.name && data.name != '待识别') {
// this.userInfo.certificateValidate = `${data.startDate.substr(0, 4)}-${data.startDate.substr(5, 2)}-${data.startDate.substr(8, 2)}`
// this.userInfo.certiexpiredate = `${data.endDate.substr(0, 4)}-${data.endDate.substr(5, 2)}-${data.endDate.substr(8, 2)}`
// this.userInfo.name = data.name
// this.userInfo.idNo = data.idNo
// this.userInfo.birthday = `${data.birthYear}-${data.birthMonth}-${data.birthDay}`
// this.userInfo.sex = data.gender == '男' ? '0' : '1'
// }
// this.isScan = false
// this.$jump({
// flag: 'navigation',
// extra: {
// title: '投保人信息',
// hiddenRight: '1'
// }
// })
// },
getRelatedData(val, ind) {
//ind 1 投保人 2 被保人
if (ind == '1') {
if (this.userInfo.idType != '1') {
return
}
//如果证件校验不通过,恢复默认值
if (idToData(val).text) {
;[this.userInfo.idNo, this.userInfo.sex, this.userInfo.birthday, this.effectiveDateTypeAble] = ['', '0', '', false]
return this.$toast(idToData(val).text)
}
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
if (idToData(val).age > 45) {
this.effectiveDateTypeAble = false
}
}
if (ind == '2') {
if (this.insuredInfo.idType != '1' && this.insuredInfo.idType != '2') {
return
}
//如果证件校验不通过,恢复默认值(并且非空时)
if (idToData(val).text) {
if (this.insuredInfo.idType == '2'){
;[this.insuredInfo.idNo, this.insuredInfo.sex, this.insuredInfo.birthday, this.effectiveDateTypeAbleInsured] = ['', '0', '', true]
}else{
;[this.insuredInfo.idNo, this.insuredInfo.sex, this.insuredInfo.birthday, this.effectiveDateTypeAbleInsured] = ['', '0', '', false]
}
return this.$toast(idToData(val).text)
}
if (this.insuredInfo.idType == '2' && idToData(this.insuredInfo.idNo).age >= 16) {
this.idLimitInsured = false //截止日期是否可编辑--被保人
return this.$toast('客户年龄在16周岁以上不能使用户口本作为有效证件')
}else if (this.insuredInfo.idType == '2' && idToData(this.insuredInfo.idNo).age < 16) {
this.idLimitInsured = true //截止日期是否可编辑--被保人
}else{
this.idLimitInsured = false
}
this.insuredInfo.birthday = idToData(val).birthday
// 获取出生日期年份16证件类型为户口本时被保人年龄小于16周岁时卡单户口本有效止期长期变更为第16周岁日期
if(this.insuredInfo.idType == '2' && idToData(this.insuredInfo.idNo).age <16){
let year = Number(this.insuredInfo.birthday.substr(0,4)) + 16
if(this.insuredInfo.birthday.substr(5,5) == '02-29'){
// 获取某年某月一共多少天
let date = new Date(year, 2, 1)
let dayEnd = new Date(date.getTime() - 864e5).getDate()
this.insuredInfo.certiexpiredate = year+'-02-'+ dayEnd
}else{
this.insuredInfo.certiexpiredate = year+'-'+ this.insuredInfo.birthday.substr(5,5)
}
}
this.insuredInfo.sex = idToData(val).sex
//GFRS-2641-- 被保险人年龄小于18周岁不含前端需隐藏手机号码电子邮箱
//GFRS-2641--被保险人大于等于18周岁前端需展示手机号码电子邮箱且非必填
if (this.insuredInfo.birthday) {
let age = utilsAge.getAge(this.insuredInfo.birthday, new Date())
if (this.itemProductDTOS.productCode != 'GFRS_M0052') {
if (age <= 17) {
this.isLessEighteen = false //是否小于18周岁不含
} else {
this.isLessEighteen = true //是否小于18周岁不含
}
}
//GFRS-2641--被保险人年龄小于20周岁不含婚姻状况默认为未婚
if (age < 20) {
this.insuredInfo.marriage = '2'
}
}
if (idToData(val).age > 45) {
this.effectiveDateTypeAbleInsured = false
}
}
}
},
// beforeDestroy() {
// //清理计时器
// console.log('123')
// window.clearInterval(this.timeId)
// this.timeId = null
// this.countDown = 60
// this.codeDisabled = false
// },
watch: {
'userInfo.relationToInsured': {
handler(newV) {
// 如果关系为本人,将投保人信息带入到被保人信息上
if (newV === 1) {
Object.assign(this.insuredInfo, this.userInfo)
} else {
this.insuredInfo = {
name: '', // 被保人姓名
idType: '1', //被保人证件类型
idNo: '', //被保人证件号码
sex: '0', //被保人性别
birthday: '', //被保人出生日期
occupationCode: '', //职业代码
occupationName: '', //职业名称
occupationType: '', //职业等级
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '1', //国家地区
marriageStatus: '', //婚姻状况
homeProvince: '', //家庭省
homeCity: '', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '', //电子邮箱
effectiveDateType: false, //是否长期
isNewPeopleFlag: '', //新市民身份
npType: '', //新市民类型
}
// 设置选中‘同投保人’的勾选项
this.withRootUser.value = true
this.insuredInfo.homeName = getAreaName([
{ code: this.userInfo.homeProvince },
{ code: this.userInfo.homeCity },
{ code: this.userInfo.homeArea }
])
this.insuredInfo.homeProvince = this.userInfo.homeProvince
this.insuredInfo.homeCity = this.userInfo.homeCity
this.insuredInfo.homeArea = this.userInfo.homeArea
this.insuredInfo.homeAddress = this.userInfo.homeAddress
// 针对 3款学平险 和 少儿安康产品 被保人证件类型默认为户口本 --2021-08-26
// 2516--三款学平险-- 0048义务教育 0049 幼儿园 0050 高中
// GFRS-2641--被保险人职业:幼儿园版默认学龄前儿童,义务教育、高中/高等教育默认一般学生
// 被保险人婚姻默认未婚,允许修改
// 被保险人手机及邮箱默认投保人,允许修改
if (this.itemProductDTOS.productCode == 'GFRS_M0048' || this.itemProductDTOS.productCode == 'GFRS_M0050'
|| this.itemProductDTOS.productCode === 'GFRS_M0064') {
this.insuredInfo.occupationCode = '2099907'
this.insuredInfo.occupationName = '一般学生'
this.insuredInfo.occupationType = '1'
this.insuredInfo.marriage = '2'
this.insuredInfo.mobile = this.userInfo.mobile
this.insuredInfo.email = this.userInfo.email
this.insuredInfo.idType = '2'
// this.insuredInfo.effectiveDateType = true
// this.insuredInfo.certiexpiredate = '9999-12-31'
// 去掉--选择户口本时是否长期默认为是不可点击有效止期隐藏证件类型为户口本时被保人年龄小于16周岁时户口本有效止期长期变更为第16周岁日期
// this.effectiveDateTypeAbleInsured = true
// this.isInsuredCertiexpiredate = false
this.isInsuredCertiexpiredate = true
} else if (this.itemProductDTOS.productCode == 'GFRS_M0049' || this.itemProductDTOS.productCode === 'GFRS_M0063') {
this.insuredInfo.occupationCode = '2099907'
this.insuredInfo.occupationName = '一般学生'
this.insuredInfo.occupationType = '1'
this.insuredInfo.marriage = '2'
this.insuredInfo.idType = '2'
// this.insuredInfo.effectiveDateType = true
// this.insuredInfo.certiexpiredate = '9999-12-31'
// 去掉--选择户口本时是否长期默认为是不可点击有效止期隐藏证件类型为户口本时被保人年龄小于16周岁时户口本有效止期长期变更为第16周岁日期
// this.effectiveDateTypeAbleInsured = true
// this.isInsuredCertiexpiredate = false
this.isInsuredCertiexpiredate = true
}
else if (this.itemProductDTOS.productCode === 'GFRS_M0062') {
this.insuredInfo.occupationCode = '2099908'
this.insuredInfo.occupationName = '学龄前儿童'
this.insuredInfo.occupationType = '1'
this.insuredInfo.marriage = '2'
this.insuredInfo.idType = '2'
// this.insuredInfo.effectiveDateType = true
// this.insuredInfo.certiexpiredate = '9999-12-31'
// 去掉--选择户口本时是否长期默认为是不可点击有效止期隐藏证件类型为户口本时被保人年龄小于16周岁时户口本有效止期长期变更为第16周岁日期
// this.effectiveDateTypeAbleInsured = true
// this.isInsuredCertiexpiredate = false
this.isInsuredCertiexpiredate = true
}
// GFRS-2641--少儿安康,默认户口本,且户口本证件截止日期默认长期
if (this.itemProductDTOS.productCode == 'GFRS_M0052') {
this.insuredInfo.idType = '2'
// this.insuredInfo.certiexpiredate = '9999-12-31'
// this.insuredInfo.effectiveDateType = true
this.insuredInfo.occupationCode = '2099907'
this.insuredInfo.occupationName = '一般学生'
this.insuredInfo.occupationType = '1'
this.insuredInfo.marriage = '2'
// 去掉--选择户口本时是否长期默认为是不可点击有效止期隐藏证件类型为户口本时被保人年龄小于16周岁时户口本有效止期长期变更为第16周岁日期
this.effectiveDateTypeAbleInsured = true
// this.isInsuredCertiexpiredate = false
this.isInsuredCertiexpiredate = true
}
// 2516--除万福卡投保人、被保险人年收入默认为0允许修改
if (this.itemProductDTOS.productCode != 'GFRS_M0032') {
this.insuredInfo.averageAnnualIncome = '0'
}
if (newV === 2) {
this.userInfo.sex === '0' ? (this.insuredInfo.sex = '1') : (this.insuredInfo.sex = '0')
}
}
},
immediate: true,
deep: true
},
'userInfo.sex': {
handler(newV) {
if (this.userInfo.relationToInsured === 2) {
this.insuredInfo.sex = this.userInfo.sex === '0' ? '1' : '0'
}
},
immediate: true,
deep: true
},
// 'userInfo.mobile': {
// handler(newV) {
// this.insuredInfo.mobile = this.userInfo.mobile
// },
// immediate: true,
// deep: true
// },
// 'userInfo.email': {
// handler(newV) {
// this.insuredInfo.email = this.userInfo.email
// },
// immediate: true,
// deep: true
// },
'userInfo.homeName': {
handler(newV) {
if (this.withRootUser.value) {
this.insuredInfo.homeName = getAreaName([
{ code: this.userInfo.homeProvince },
{ code: this.userInfo.homeCity },
{ code: this.userInfo.homeArea }
])
this.insuredInfo.homeProvince = this.userInfo.homeProvince
this.insuredInfo.homeCity = this.userInfo.homeCity
this.insuredInfo.homeArea = this.userInfo.homeArea
this.insuredInfo.homeAddress = this.userInfo.homeAddress
}
},
immediate: true,
deep: true
},
'userInfo.homeAddress': {
handler(newV) {
if (this.withRootUser.value) {
this.insuredInfo.homeAddress = this.userInfo.homeAddress
}
},
immediate: true,
deep: true
},
//被保人职业变化时,重新调用试算接口
'insuredInfo.occupationName': {
handler(newV) {
if (newV && (this.itemProductDTOS.productCode === 'GFRS_M0071' || this.itemProductDTOS.productCode === 'GFRS_M0091')) {
this.insureTrial()
}
},
immediate: true,
deep: true
},
//投被同人时,投保人职业变化时,重新调用试算接口
'userInfo.occupationName': {
handler(newV) {
if (newV && (this.itemProductDTOS.productCode === 'GFRS_M0071' || this.itemProductDTOS.productCode === 'GFRS_M0091')) {
this.insureTrial()
}
},
immediate: true,
deep: true
},
async 'withRootUser.value'(n) {
if (n) {
this.insuredInfo.homeName = getAreaName([
{ code: this.userInfo.homeProvince },
{ code: this.userInfo.homeCity },
{ code: this.userInfo.homeArea }
])
this.insuredInfo.homeProvince = this.userInfo.homeProvince
this.insuredInfo.homeCity = this.userInfo.homeCity
this.insuredInfo.homeArea = this.userInfo.homeArea
this.insuredInfo.homeAddress = this.userInfo.homeAddress
} else {
this.insuredInfo.homeName = this.insuredInfo.homeAddress = ''
}
}
}
}
</script>
<style lang='scss'>
// *{ touch-action: none; }
.insured-info-container {
/deep/ .van-checkbox {
margin-left: auto;
align-items: normal;
.van-checkbox__icon {
margin-top: 5px;
}
}
/deep/ .van-radio {
margin-left: auto;
}
}
.van-checkbox__label {
font-size: 13px;
}
.tips {
font-size: 14px;
color: #333;
padding: 15px;
}
.address {
display: flex;
flex-direction: row-reverse;
}
</style>