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

1772 lines
68 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>
<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" required label="邮箱" name="邮箱" placeholder="请输入" v-validate="'required|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-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')"
/>
<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-field
:value="userInfo.relationToInsured | idToText('relationToAppnt')"
readonly
required
label="与被保人关系"
name="与被保人关系"
right-icon="arrow"
placeholder="请选择"
v-validate="'required'"
@click="toSelect('9')"
/>
</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-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
required
v-model="insuredInfo.mobile"
clearable
label="手机号码"
name="手机号码"
placeholder="请输入"
v-validate="'required|mobile'"
maxlength="11"
/>
<van-field v-model="insuredInfo.email" required label="邮箱" name="邮箱" placeholder="请输入" v-validate="'required|email'" clearable />
<van-field
required
@click="openOccupation('2')"
label="职业类别"
placeholder="请输入"
name="职业类别"
:value="insuredInfo.occupationName"
right-icon="arrow"
/>
<van-field
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')"
/>
<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" />
</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
required
v-model="userInfo.mobile"
clearable
label="手机号码"
name="手机号码"
placeholder="请输入"
v-validate="'required|mobile'"
maxlength="11"
readonly
/>
<van-field v-model="userInfo.email" readonly required label="邮箱" name="邮箱" placeholder="请输入" v-validate="'required|email'" clearable />
<van-field readonly required label="职业类别" name="职业类别" :value="userInfo.occupationName" right-icon="arrow" />
<van-field
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="请选择"
/>
<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>
<van-field
:value="proScheme"
readonly
required
label="保障方案"
name="保障方案"
v-validate="'required'"
right-icon="arrow"
placeholder="请选择"
@click="toSelect('10')"
/>
<FieldDatePicter
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>
<!-- <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> -->
<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-popup v-model="occupationShowPicker" position="bottom">
<occupation-for-loop @chooseOccupation="chooseOccupation" :name="occupationName" :code="occupationCode"></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>
</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 { saveOrUpdateCard } from '@/api/ebiz/cardList/cardList.js'
import { underWrite } 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 Vue from 'vue'
import { GoodsAction, GoodsActionIcon, GoodsActionButton } from 'vant'
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 {
idLimit: false, //截止日期是否可编辑
idLimitInsured: false, //截止日期是否可编辑--被保人
certiexpiredateRequired: true, //证件截止日期是否需要校验
certiexpiredateRequiredInsured: true, //证件截止日期是否需要校验--被保人
effectiveDateTypeAble: false, //长期按钮是否禁用
effectiveDateTypeAbleInsured: false, //长期按钮是否禁用--被保人
proScheme: '', //保障方案
proSchemeCode: '',
productDate: '', //保险期间
now: afterDate.getAfterDays(1), //指定生效日期最小值
certiexpiredateMin: afterDate.getAfterDays(0), //证件截止日期最小值
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: '', //职业名称
averageAnnualIncome: '', //平均年收入
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '1', //国家地区
marriageStatus: '', //婚姻状况
homeProvince: '', //家庭省
homeCity: '', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '' //电子邮箱
// effectiveDate: '' //指定生效日期
},
//被保人信息
insuredInfo: {
name: '', // 被保人姓名
idType: '1', //被保人证件类型
idNo: '', //被保人证件号码
certiexpiredate: '', //证件到期时间
effectiveDateType: false, //是否长期
sex: '0', //被保人性别
birthday: '', //被保人出生日期
occupationCode: '', //职业代码
occupationName: '', //职业名称
averageAnnualIncome: '', //平均年收入
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '', //国家地区
marriageStatus: '', //婚姻状况
homeProvince: '', //家庭省
homeCity: '', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '' //电子邮箱
},
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: '',
itemProductDTOS: JSON.parse(CacheUtils.getLocItem('itemProductDTOS')) //
}
},
created() {
// 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)
// }
// })
// }
},
mounted() {
// 筛选按钮的点击事件
window.appCallBack = this.appCallBack
if (this.itemProductDTOS.productCode === 'GFRS_M0022') {
this.proScheme = '畅行无忧'
this.proSchemeCode = ''
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))
}
},
methods: {
//长期状态改变时
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
this.$jump({
flag: 'navigation',
extra: {
title: '职业类别',
hiddenRight: '1'
}
})
this.occupationShowPicker = false
if (this.insureType === '1') {
this.userInfo.occupationName = name
this.userInfo.occupationCode = code
} else if (this.insureType === '2') {
this.insuredInfo.occupationName = name
this.insuredInfo.occupationCode = code
}
},
/**
* @description:
* @param {*}
* @return {*}
*/
openOccupation(insureType) {
this.occupationShowPicker = !this.occupationShowPicker
this.insureType = insureType
if (this.insureType === '1') {
this.occupationName = this.userInfo.occupationName
this.occupationCode = this.userInfo.occupationCode
} else if (this.insureType === '2') {
this.occupationName = this.insuredInfo.occupationName
this.occupationCode = this.insuredInfo.occupationCode
}
},
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
}
},
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') {
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
})
}
})
} else if (pickerType == '22') {
this.columns = DataDictionary.insuredIdType
}
},
//确认选择字段
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
} 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
for (let item of this.trialList) {
if (item.proSchemeCode === this.proSchemeCode) {
this.allPrice = item.prem
break
}
}
} else if (this.pickerType == '22') {
//身份证以外的证件类型可以使用长期
//value.id 1 居民身份证 todo
if (value.id != '1') {
this.effectiveDateTypeAbleInsured = false
} else {
if (this.userInfo.birthday) {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAbleInsured = !(age >= 45)
}
}
this.insuredInfo.idType = 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('出生日期不晚于当日')
}
}
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 + '日'
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-01-01') {
this.userInfo.effectiveDateType = true //是否长期
} else {
this.userInfo.certiexpiredate = data.idEffectEndDate //证件截止日期
}
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
this.userInfo.lifeGrade = data.lifeGrade
this.userInfo.healthGrade = data.healthGrade
this.userInfo.averageAnnualIncome = data.averageYearlyIncome //平均年收入
this.userInfo.nativeplace = data.country
this.userInfo.marriage = data.marryStatus
// 计算年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
// 长期按钮是否禁用
this.effectiveDateTypeAble = age <= 45
this.getRelatedData(this.userInfo.idNo, '1')
} else if (this.selectUser == '1') {
let { customerName, customerSex } = data
this.insuredInfo.name = customerName //用户名
this.insuredInfo.sex = customerSex ? customerSex.toString() : '0' //性别
this.insuredInfo.birthday = data.birthday //出生日期
// if (data.customerIdType == 1) {
this.insuredInfo.idType = data.customerIdType //证件类型
this.insuredInfo.idNo = data.customerIdNumber //证件类别
// }
if (data.idEffectEndDate == '9999-01-01') {
this.insuredInfo.effectiveDateType = true //是否长期
} else {
this.insuredInfo.certiexpiredate = data.idEffectEndDate //证件截止日期
}
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 //家庭详细地址
this.insuredInfo.occupationCode = data.occupationCode
this.insuredInfo.occupationName = data.occupationName
this.insuredInfo.lifeGrade = data.lifeGrade
this.insuredInfo.healthGrade = data.healthGrade
this.insuredInfo.averageAnnualIncome = data.averageYearlyIncome //平均年收入
this.insuredInfo.nativeplace = data.country
this.insuredInfo.marriage = data.marryStatus
// 计算年龄
let age = utilsAge.getAge(this.insuredInfo.birthday, new Date())
// 长期按钮是否禁用
this.effectiveDateTypeAbleInsured = age <= 45
this.getRelatedData(this.insuredInfo.idNo, '2')
}
// console.log(data, val)
},
nextStep() {
// console.log(this.userInfo.idType)
// console.log(this.userInfo.salarySource)
// console.log(this.userInfo.otherSalarySource)
//表单校验, 成功跳转
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('哦~配偶性别不能相同的哟~')
}
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年')
}
}
}
//如果证件类型是身份证
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 (age < 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年')
}
}
}
let insuredAge = utilsAge.getAge(this.insuredInfo.birthday, new Date())
console.log('计算年龄', insuredAge)
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周岁')
}
}
//投保人需大于等于 18 周岁
// if (age < 18) {
// return this.$toast('投保人必须是具有民事行为能力且有固定职业和收入的自然人,请确定')
// }
this.infoUpdate()
// console.log('success')
} else {
this.$toast(this.$validator.errors.all()[0])
}
})
},
//信息变更
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: {
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
}
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
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.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) {
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 (ind == '2') {
if (this.insuredInfo.idType != '1') {
return
}
//如果证件校验不通过,恢复默认值
if (idToData(val).text) {
;[this.insuredInfo.idNo, this.insuredInfo.sex, this.insuredInfo.birthday, this.effectiveDateTypeAbleInsured] = ['', '0', '', false]
return this.$toast(idToData(val).text)
}
this.insuredInfo.birthday = idToData(val).birthday
this.insuredInfo.sex = idToData(val).sex
}
}
},
// 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: '', //职业名称
lifeGrade: '', //寿险等级
healthGrade: '', //健康等级
nativeplace: '', //国家地区
marriageStatus: '', //婚姻状况
homeProvince: '', //家庭省
homeCity: '', //家庭市
homeArea: '450101', //家庭区
homeName: '', //联系地址
homeAddress: '', //详细地址
mobile: '', //移动电话
email: '' //电子邮箱
}
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
}
}
}
</script>
<style lang="scss">
.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;
}
</style>