编写受益人新增可编辑字段,配投保人信息字段

This commit is contained in:
pangxingyue
2021-03-09 18:10:45 +08:00
parent 0dc981c23b
commit f1d6c3a61c
4 changed files with 491 additions and 135 deletions

View File

@@ -49,7 +49,7 @@ export default {
handleChoose(value) {
if (this.disabled) {
return
}
}
this.$emit('update:value', value)
this.$emit('radioChange', value)
}

View File

@@ -12,7 +12,7 @@
<select-radio required :radios="sexRadio" label="性别" name="性别" v-validate="'required'" :value.sync="userInfo.sex"></select-radio>
<InfoCell label="国籍">{{userInfo.nativeplace | idToText('nativeplace')}}</InfoCell>
<van-field :value="userInfo.marriageStatus" readonly required label="婚姻状况" name="婚姻状况" v-validate="'required'"
right-icon="arrow" placeholder="请选择" @click="toSelect('10')" />
right-icon="arrow" placeholder="请选择" @click="toSelect('10','','appntDTO')" />
<InfoCell label="职业类别">{{userInfo.occupationCode}}</InfoCell>
<InfoCell label="移动电话">{{userInfo.mobile}}</InfoCell>
<InfoCell label="电子邮箱">{{userInfo.email}}</InfoCell>
@@ -29,77 +29,80 @@
<template #boxTitle>
<span class="title">被保险人信息</span>
</template>
<InfoCell label="姓名"></InfoCell>
<InfoCell label="证件类型"></InfoCell>
<InfoCell label="证件号码"></InfoCell>
<InfoCell label="出生日期"></InfoCell>
<InfoCell label="性别">
<van-button class="mr10" size="small" type="danger" round></van-button>
<van-button plain size="small" type="danger" round></van-button>
</InfoCell>
<InfoCell label="国籍"></InfoCell>
<InfoCell label="婚姻状况">
<input class="input" type="text" value="" placeholder="请输入" />
</InfoCell>
<InfoCell label="职业类别"></InfoCell>
<InfoCell label="有无社保">
<van-button class="mr10" size="small" type="danger" round></van-button>
<van-button plain size="small" type="danger" round></van-button>
</InfoCell>
<InfoCell label="税收居民身份"></InfoCell>
<InfoCell label="联系地址"></InfoCell>
<InfoCell label="姓名">{{insuredPersonInfo.name}}</InfoCell>
<InfoCell label="证件类型">{{userInfo.idType | idToText('idType')}}</InfoCell>
<InfoCell label="证件号码">{{insuredPersonInfo.idNo}}</InfoCell>
<InfoCell label="出生日期">{{insuredPersonInfo.birthday}}</InfoCell>
<select-radio required :radios="sexRadio" label="性别" name="性别" v-validate="'required'" :value.sync="insuredPersonInfo.sex"></select-radio>
<InfoCell label="国籍">{{insuredPersonInfo.nativeplace | idToText('nativeplace')}}</InfoCell>
<van-field :value="insuredPersonInfo.marriageStatus" readonly required label="婚姻状况" name="婚姻状况" v-validate="'required'"
right-icon="arrow" placeholder="请选择" @click="toSelect('10','','insuredDTOs')" />
<InfoCell label="职业类别">{{insuredPersonInfo.occupationCode}}</InfoCell>
<select-radio :radios="medicalRadio" label="有无社保" name="有无社保" v-validate="'required'" required :value.sync="insuredPersonInfo.medical"
:disabled="true"></select-radio>
<InfoCell label="税收居民身份">{{insuredPersonInfo.name}}</InfoCell>
<InfoCell label="联系地址">{{insuredHomeName}}</InfoCell>
<InfoCell label="详细地址">{{userInfo.homeAddress}}</InfoCell>
</DropdownBox>
<DropdownBox>
<template #boxTitle>
<span class="title">受益人信息</span>
</template>
<InfoCell label="受益类型"></InfoCell>
<InfoCell label="是被保险人的"></InfoCell>
<InfoCell label="姓名"></InfoCell>
<InfoCell label="证件类型"></InfoCell>
<InfoCell label="证件截止日期"></InfoCell>
<InfoCell label="性别">
<van-button class="mr10" size="small" type="danger" round></van-button>
<van-button plain size="small" type="danger" round></van-button>
</InfoCell>
<InfoCell label="国籍">
<input class="input" type="text" value="" placeholder="请输入" />
</InfoCell>
<InfoCell label="婚姻状况">
<input class="input" type="text" value="" placeholder="请输入" />
</InfoCell>
<InfoCell label="移动电话">
<input class="input" type="text" value="" placeholder="请输入" />
</InfoCell>
<InfoCell label="联系地址"></InfoCell>
<InfoCell label="职业类别"></InfoCell>
<InfoCell label="受益顺序"></InfoCell>
<InfoCell label="受益比例"></InfoCell>
<div v-if="bnftype === '0'">
<InfoCell label="受益类型">法定受益人</InfoCell>
</div>
<div v-else>
<div v-for="(item, index) in bnfPersonInfo" :key="index">
<InfoCell label="受益类型">指定受益人</InfoCell>
<InfoCell label="是被保险人的">{{ item.relationToInsured | idToText('relationToAppnt') }}</InfoCell>
<InfoCell label="姓名">{{ item.name }}</InfoCell>
<InfoCell label="证件类型">{{item.idType | idToText('insuredIdType')}}</InfoCell>
<InfoCell label="证件截止日期">{{item.certiexpiredate}}</InfoCell>
<!-- <InfoCell label="性别">
<van-button class="mr10" size="small" type="danger" round></van-button>
<van-button plain size="small" type="danger" round></van-button>
</InfoCell> -->
<select-radio required :disabled="true" :radios="sexRadio" label="性别" name="性别" v-validate="'required'"
:value.sync="item.sex"></select-radio>
<van-field :value="item.nativeplace | idToText('nativeplace')" label="国籍" name="国籍" required v-validate="'required'"
right-icon="arrow" placeholder="请选择" @click="toSelect('1','','bnfDTOs',index)" />
<van-field :value="item.marriageStatus" readonly required label="婚姻状况" name="婚姻状况" v-validate="'required'"
right-icon="arrow" placeholder="请选择" @click="toSelect('10','','bnfDTOs',index)" />
<van-field v-model="item.mobile" clearable label="移动电话" name="移动电话" required placeholder="请输入" v-validate="'required|mobileLength11|mobileStartWith1|mobile'"
maxlength="11" />
<van-field v-model="bnfHomeName[index]" readonly label="联系地址" name="联系地址" required right-icon="arrow"
placeholder="请选择" v-validate="'required|contactAdderss'" @click="areaChoose('2','bnfDTOs',index)" />
<van-field v-model="item.homeAddress" label="" name="详细地址" placeholder="具体到街道、门牌号、楼号、单元号、室号" v-validate="'required|homeAddressNum|homeAddressCh'"
clearable maxlength="30" :readonly="false" style="font-size: 3.5vw;" />
<occupation-picker :value.sync="item.occupationCode" :chooseName.sync="item.occupationName" :lifeGrade.sync="item.lifeGrade"
:healthGrade.sync="item.healthGrade" clearable label="职业类别" name="职业类别" required v-validate="'required'"
placeholder="请选择" :parentShowPicker.sync="occupationShowPicker" @on-click="selectClick('2')" @on-choose="chooseOccupation" />
<InfoCell label="受益顺序"></InfoCell>
<InfoCell label="受益比例">{{ item.bnfLot }}%</InfoCell>
</div>
</div>
</DropdownBox>
<DropdownBox>
<template #boxTitle>
<span class="title">账户信息</span>
</template>
<InfoCell label="性别">
<van-button class="mr10" size="small" type="danger" round></van-button>
<van-button plain size="small" type="danger" round></van-button>
</InfoCell>
<InfoCell label="账户名称"></InfoCell>
<InfoCell label="开户银行"></InfoCell>
<InfoCell label="银行账号"></InfoCell>
<InfoCell label="账户名称">{{accountPersonInfo.accountName}}</InfoCell>
<InfoCell label="开户银行">{{accountPersonInfo.bankName}}</InfoCell>
<InfoCell label="银行账号">{{accountPersonInfo.cardBookCode}}</InfoCell>
</DropdownBox>
<van-button type="danger" class="bottom-btn" v-no-more-click="1000" @click="nextStep">下一步</van-button>
<!-- 字段选择 -->
<van-popup v-model="popupShow" position="bottom">
<van-picker show-toolbar :columns="columns" @confirm="onConfirm" @cancel="popupShow = false" />
</van-popup>
<!-- 联系地址选择 -->
<van-popup v-model="homeShow" position="bottom">
<van-area :area-list="areaLists" value="450000" @confirm="sureArea($event, '2')" @cancel="homeShow = false" />
</van-popup>
</div>
</template>
<script>
import { Field } from 'vant'
import { Field, Area } from 'vant'
import ProgressBar from '@/components/ebiz/insureAgain/ProgressBar'
import DropdownBox from '@/components/ebiz/insureAgain/DropdownBox'
import InfoCell from '@/components/ebiz/insureAgain/InfoCell'
@@ -108,22 +111,32 @@ import { getOrderDetail } from '@/api/ebiz/sale/sale'
import DataDictionary from '@/assets/js/utils/data-dictionary'
import SelectRadio from '@/components/ebiz/SelectRadio'
import getAreaName from '@/assets/js/utils/getAreaNameForSale'
import areaLists from '@/assets/js/utils/areaNewForSale'
import { selectComp, getIdentityInfo } from './js/methods'
import OccupationPicker from '@/components/ebiz/occipation/OccupationPicker'
export default {
name: 'InsureInformation',
components: {
ProgressBar,
DropdownBox,
InfoCell,
OccupationPicker,
[SelectRadio.name]: SelectRadio,
[Field.name]: Field
[Field.name]: Field,
[Area.name]: Area
},
computed: {},
data() {
return {
homeName: '', //联系地址
homeName: '', //投保人联系地址
insuredHomeName: '', //被投保人联系地址
bnfHomeName: [], //受益人联系地址
isSpecialRead: false,
active: 0,
userInfo: {},
userInfo: {}, //投保人信息
insuredPersonInfo: {}, //被投保人信息
bnfPersonInfo: {}, //受益人信息
accountPersonInfo: {}, //账户信息
sexRadio: [
{
label: '男',
@@ -145,7 +158,13 @@ export default {
}
],
columns: [],
popupShow: false
popupShow: false,
userType: '', //保险人类型
bnftype: '', //受益人类型
bnfIndex: '', //受益人索引
homeShow: false, //联系地址搜索栏显示
areaLists: areaLists, //地址信息
occupationShowPicker: false //职业类别
}
},
created() {
@@ -183,39 +202,93 @@ export default {
this.userInfo.effectiveDateType = res.orderDTO.appntDTO.effectiveDateType == 'false' ? false : true
//有无社保
this.userInfo.medical = res.orderDTO.appntDTO.medical
//设为联系地址
// this.userInfo.addressStatus = '0'
//证件类型
// this.userInfo.idType = '1'
//国家/地区
// this.userInfo.nativeplace = '1'
this.$utils.intLocalStorage(res)
this.sureArea([{ code: this.userInfo.homeProvince }, { code: this.userInfo.homeCity }, { code: this.userInfo.homeArea }], '2')
// ------------------------专为桂企写死--begin---------------//
if (res.orderDTO.insuredDTOs[0] && res.orderDTO.insuredDTOs[0].riskDTOLst) {
this.specilFlag = res.orderDTO.insuredDTOs[0].riskDTOLst.some(v => {
return v.riskCode == 'GFRS_M0024'
})
? '1'
: '0'
} else if (res.orderDTO.orderInfoDTO.productCode == 'GFRS_M0024') {
this.specilFlag = '1'
this.homeName = getAreaName([{ code: this.userInfo.homeProvince }, { code: this.userInfo.homeCity }, { code: this.userInfo.homeArea }])
// 被投保人信息
this.insuredPersonInfo = res.orderDTO.insuredDTOs[0]
if (this.insuredPersonInfo.homeProvince.length) {
this.insuredHomeName = getAreaName([
{ code: this.insuredPersonInfo.homeProvince },
{ code: this.insuredPersonInfo.homeCity },
{ code: this.insuredPersonInfo.homeArea }
])
}
// ------------------------专为桂企写死--end---------------//
//受益人信息
//bnfFlag 0-法定受益人 1-指定受益人
let btnasd = `[
{
"area": "450103",
"birthday": "1980-01-02",
"bnfLot": 50,
"bnfOrder": 1,
"bnfType": "0",
"certiexpiredate": "2035-03-31",
"city": "450100",
"effectiveDateType": "false",
"healthGrade": "1",
"idNo": "110101198001020219",
"idType": "1",
"lifeGrade": "2",
"marriage": "2",
"mobile": "13707711024",
"name": "爱来",
"nativeplace": "1",
"occupationCode": "2070202",
"occupationName": "保险推销员",
"province": "450000",
"relationToInsured": "3",
"sex": "1",
"village": "百苑小区101号",
"yearSalary": "23"
},
{
"area": "450103",
"birthday": "1983-03-12",
"bnfLot": 50,
"bnfOrder": 1,
"bnfType": "0",
"certiexpiredate": "2035-03-31",
"city": "450100",
"effectiveDateType": "false",
"healthGrade": "1",
"idNo": "452624198303120727",
"idType": "1",
"lifeGrade": "1",
"marriage": "1",
"mobile": "13707711024",
"name": "艾琳马上来",
"nativeplace": "1",
"occupationCode": "4070103",
"occupationName": "经纪人(内勤)",
"province": "450000",
"relationToInsured": "4",
"sex": "1",
"village": "百苑小区101号",
"yearSalary": "32"
}
]`
res.orderDTO.orderInfoDTO.bnfFlag = '1'
if (res.orderDTO.orderInfoDTO.bnfFlag === '0') {
this.bnftype = '0'
} else if (res.orderDTO.orderInfoDTO.bnfFlag === '1') {
this.bnftype = '1'
res.orderDTO.insuredDTOs[0].bnfDTOs = JSON.parse(btnasd)
if (res.orderDTO.insuredDTOs[0].bnfDTOs) {
this.bnfPersonInfo = res.orderDTO.insuredDTOs[0].bnfDTOs || JSON.parse(btnasd)
this.bnfPersonInfo.forEach((item, index) => {
this.bnfHomeName[index] = getAreaName([{ code: item.province }, { code: item.city }, { code: item.area }])
})
}
}
// 账户信息
this.accountPersonInfo = res.orderDTO.orderAccountDTO
}
})
},
//区域选择
sureArea(area, type) {
switch (type) {
case '2': //联系地址
this.homeName = getAreaName(area)
console.log(this.homeName, '======================this.homeName')
// ;[this.userInfo.homeProvince, this.userInfo.homeCity, this.userInfo.homeArea] = [area[0].code, area[1].code, area[2].code]
break
}
},
setCustomerMarriage(marriageCode) {
for (let status of DataDictionary.marriage) {
if (status.id == marriageCode) {
@@ -224,11 +297,66 @@ export default {
}
}
},
/**
* @description: 弹框选择
* @param {*} pickerType 1、国家地区 2、证件类型 3、文化程度 4、有无社保(弃用) 5、税收居民身份 6、婚姻状况
7、在职情况 8、收入来源
* @param {*} valueKey
* @param {*} userType appntDTO 投保人 insuredDTOs 被投保人 bnfDTOs 受益人 orderAccountDTO 账号信息
* @param {*} bnfIndex 受益人索引
* @return {*}
*/
toSelect(pickerType, valueKey, userType, bnfIndex) {
bnfIndex ? (this.bnfIndex = 1) : (this.bnfIndex = 0)
;[this.popupShow, this.pickerType] = [true, pickerType]
if (valueKey) this.valueKey = valueKey
userType ? (this.userType = userType) : ''
switch (pickerType) {
case '1':
this.columns = DataDictionary.nativeplace
break
case '2':
this.columns = DataDictionary.insuredIdType
break
case '4':
this.columns = [{ id: 0, text: '有' }, { id: 1, text: '无' }]
break
case '5':
this.columns = DataDictionary.taxIdentity
break
case '8':
this.columns = DataDictionary.salarySource
break
case '9':
this.productCodes.length = 0
this.productCodes.push('GFRS_M0024')
getCompany({ productCodes: this.productCodes }).then(res => {
if (res.result == 0) {
this.columns = res.content
} else {
this.$toast(res.resultMessage)
}
})
break
case '10':
this.columns = DataDictionary.marriage
break
}
},
//确认选择字段
onConfirm(value) {
onConfirm(value) {
this.popupShow = false
if (this.pickerType == '1') {
this.userInfo.nativeplace = value.id
if (this.userType === 'appntDTO') {
this.userInfo.nativeplace = value.id
} else if (this.userType === 'insuredDTOs') {
this.insuredPersonInfo.nativeplace = value.id
} else if (this.userType === 'bnfDTOs') {
this.bnfPersonInfo[this.bnfIndex].nativeplace = value.id
} else if (this.userType === 'orderAccountDTO') {
this.accountPersonInfo.nativeplace = value.id
}
} else if (this.pickerType == '2') {
//身份证以外的证件类型可以使用长期
if (value.id != '1') {
@@ -271,62 +399,142 @@ export default {
} else if (this.pickerType == '9') {
this.userInfo.workcompany = value
} else if (this.pickerType === '10') {
this.userInfo.marriageStatus = value.text
if (this.userType === 'appntDTO') {
this.userInfo.marriageStatus = value.text
} else if (this.userType === 'insuredDTOs') {
this.insuredPersonInfo.marriageStatus = value.text
} else if (this.userType === 'bnfDTOs') {
this.bnfPersonInfo[this.bnfIndex].marriageStatus = value.text
} else if (this.userType === 'orderAccountDTO') {
this.accountPersonInfo.marriageStatus = value.text
}
}
},
/**
* @description: 地区选择
* @param {*} pickerType 1户籍 2联系地址 3单位地址
* @param {*} userType appntDTO 投保人 insuredDTOs 被投保人 bnfDTOs 受益人 orderAccountDTO 账号信息
* @param {*} bnfIndex 受益人索引
* @return {*}
*/
areaChoose(pickerType, userType, bnfIndex) {
userType ? (this.userType = userType) : ''
if (this.isAppnt) {
return
}
switch (pickerType) {
// case '1': //户籍
// this.censusShow = true
// break
case '2': //联系地址
this.homeShow = true
if (userType === 'bnfDTOs') {
this.bnfIndex = bnfIndex
}
break
case '3': //单位地址
this.areaShow = true
break
default:
break
}
},
/**
* @description: 区域选择
* @param {*} area 地区信息
* @param {*} pickerType 1户籍 2联系地址 3单位地址
* @return {*}
*/
sureArea(area, pickerType) {
console.log('area :>> ', area)
switch (pickerType) {
// 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': //联系地址
// this.homeName = `${area[0].name}-${area[1].name}-${area[2].name}`;
if (this.userType === 'appntDTO') {
this.homeName = getAreaName(area)[(this.userInfo.homeProvince, this.userInfo.homeCity, this.userInfo.homeArea)] = [
area[0].code,
area[1].code,
area[2].code
]
} else if (this.userType === 'insuredDTOs') {
this.insuredHomeName = getAreaName(area)[
(this.insuredPersonInfo.homeProvince, this.insuredPersonInfo.homeCity, this.insuredPersonInfo.homeArea)
] = [area[0].code, area[1].code, area[2].code]
} else if (this.userType === 'bnfDTOs') {
this.bnfHomeName[this.bnfIndex] = getAreaName(area)
;[this.bnfPersonInfo[this.bnfIndex]['province'], this.bnfPersonInfo[this.bnfIndex]['city'], this.bnfPersonInfo[this.bnfIndex]['area']] = [
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
}
},
/**
* @description: 职业类别
* @param {*}
* @return {*}
*/
chooseOccupation() {
this.$jump({
flag: 'navigation',
extra: {
title: '职业类别',
hiddenRight: '1'
}
})
this.occupationShowPicker = false
},
/**
* @description:
* @param {*} index
* @return {*}
*/
selectClick(index) {
selectComp(this, index, '1')
},
specialRead(payload) {
this.isSpecialRead = payload
},
nextStep(page) {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + `/#/insureAgain`,
forbidSwipeBack: '1',
needRefresh: '1'
},
routerInfo: { path: `/insureAgain` }
})
},
//弹框选择
toSelect(pickerType, valueKey) {
console.log(valueKey)
//pickerType 1、国家地区 2、证件类型 3、文化程度 4、有无社保(弃用) 5、税收居民身份 6、婚姻状况
//7、在职情况 8、收入来源
;[this.popupShow, this.pickerType] = [true, pickerType]
if (valueKey) this.valueKey = valueKey
switch (pickerType) {
case '1':
this.columns = DataDictionary.nativeplace
break
case '2':
this.columns = DataDictionary.insuredIdType
break
case '4':
this.columns = [{ id: 0, text: '有' }, { id: 1, text: '无' }]
break
case '5':
this.columns = DataDictionary.taxIdentity
break
case '8':
this.columns = DataDictionary.salarySource
break
case '9':
this.productCodes.length = 0
this.productCodes.push('GFRS_M0024')
getCompany({ productCodes: this.productCodes }).then(res => {
if (res.result == 0) {
this.columns = res.content
} else {
this.$toast(res.resultMessage)
}
})
break
case '10':
this.columns = DataDictionary.marriage
break
async nextStep(page) {
// 验证
let valid = await this.$validator.validate()
if (true === valid) {
for (let status of DataDictionary.marriage) {
if (status.text === this.userInfo.marriageStatus) {
this.userInfo.marriage = status.id
}
}
this.infoUpdate()
} else {
return this.$toast(this.$validator.errors.all()[0])
}
// this.$jump({
// flag: 'h5',
// extra: {
// url: location.origin + `/#/insureAgain`,
// forbidSwipeBack: '1',
// needRefresh: '1'
// },
// routerInfo: { path: `/insureAgain` }
// })
}
// 信息变更
}
}
</script>

View File

@@ -0,0 +1,94 @@
//点击弹出组件
export function selectComp(that, index, type = '') {
that.currentPopupIndex = index
let title = ''
if (index == 1) {
;[that.customerShowPicker, title] = [true, '客户列表']
} else if (index == 2) {
;[that.occupationShowPicker, title] = [true, '职业类别']
} else if (index == 3) {
if (type == '1') {
//投保人
localStorage.scanFromInsured = 'true'
} else if (type == '2') {
//被保险人
localStorage.scanFromInsured = 'false'
}
;[that.isScan, title] = [true, '身份证扫描']
}
setTimeout(() => {
that.$jump({
flag: 'navigation',
extra: {
title,
hiddenLeft: '1'
}
})
closeBtn(that)
}, 400)
}
// 关闭按钮的显示
function closeBtn(that) {
that.$jump({
flag: 'webview_right_button',
extra: {
btns: [
{
img: that.$assetsUrl + 'images/del-close.png',
route: { flag: '', extra: {} }
}
]
}
})
}
// 获取身份证扫描信息
/**
*
* @param {*} that 上下文
* @param {*} data 扫描数据
* @param {*} type 1 投保人 2 被保险人
*/
export function getIdentityInfo(that, data, type) {
// 正面
if (data.name && data.name != '待识别') {
that.userInfo.name = data.name
that.userInfo.idNo = data.idNo
that.userInfo.birthday = `${data.birthYear}-${data.birthMonth}-${data.birthDay}`
that.userInfo.sex = data.gender == '男' ? '0' : '1'
}
// 反面
if (data.startDate && data.startDate != '待识别') {
that.userInfo.certificateValidate = `${data.startDate.substr(0, 4)}-${data.startDate.substr(5, 2)}-${data.startDate.substr(8, 2)}`
//that.userInfo.certificateValidate = `${data.startDate.substr(0, 4)}-${data.startDate.substr(4, 2)}-${data.startDate.substr(6, 2)}`
// 是否为长期身份证
if (data.endDate != '长期') {
that.userInfo.certiexpiredate = `${data.endDate.substr(0, 4)}-${data.endDate.substr(5, 2)}-${data.endDate.substr(8, 2)}`
// that.userInfo.certiexpiredate = `${data.endDate.substr(0, 4)}-${data.endDate.substr(4, 2)}-${data.endDate.substr(6, 2)}`
that.effectiveDateTypeAble = true
that.idLimit = false
that.isRequired = true
} else {
// 勾选长期
that.userInfo.effectiveDateType = true
// 长期按钮不禁用
that.effectiveDateTypeAble = false
// 证件截止日期不需要校验
that.certiexpiredateRequired = false
//截止日期不可编辑
that.idLimit = true
that.isRequired = false
}
}
that.isScan = false
let title = type == '1' ? '投保人信息' : '被保险人信息'
that.$jump({
flag: 'navigation',
extra: {
title,
hiddenRight: '1'
}
})
}

View File

@@ -0,0 +1,54 @@
import changeFifteenToEighteen from '@/assets/js/utils/changeFifteenToEighteen'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import utilsAge from '@/assets/js/utils/age'
//身份证带出出生日期,性别,年龄
export function idToData(idNo) {
//非空
if (!idNo.trim()) {
return {
text: '证件号码不能为空'
}
}
//如果是15位身份证号先转为18位
if (idNo.length == 15) {
idNo = changeFifteenToEighteen(idNo)
}
if (idNo.length != 18) {
return {
text: '亲居民身份证须为18位哦~'
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(idNo)) {
return {
text: '您填写的证件号码有误'
}
}
let birthday = getBirthById(idNo)
let age = utilsAge.getAge(birthday, new Date())
let sex = getSexById(idNo)
return {
birthday,
age,
sex
}
}
function getBirthById(idNo) {
// 获取生日
var year = idNo.substr(6, 4)
var month = idNo.substr(10, 2)
var day = idNo.substr(12, 2)
return year + '-' + month + '-' + day
}
function getSexById(idNo) {
// 获取性别
if (idNo.charAt(16) >= '0' && idNo.charAt(16) <= '9') {
if (parseInt(idNo.charAt(16)) % 2 == 0) {
return '1'
} else {
return '0'
}
}
}