【new】 保全:受益人变更 页面部分粗略完成,还需优化

This commit is contained in:
tian.guangyuan
2020-04-13 16:12:36 +08:00
parent 6a2f39d87f
commit 224fdeb589
8 changed files with 1950 additions and 8 deletions

View File

@@ -10,6 +10,7 @@ const contactInfo = () => import('@/views/ebiz/preserve/ContactInfo')
const contacAgreement = () => import('@/views/ebiz/preserve/ContacAgreement')
const contactConfirmation = () => import('@/views/ebiz/preserve/ContactConfirmation')
const beneficiaryInfo = () => import('@/views/ebiz/preserve/BeneficiaryInfo')
const beneficiaryInfoAdd = () => import('@/views/ebiz/preserve/BeneficiaryInfoAdd')
const beneficiaryConfirmation = () => import('@/views/ebiz/preserve/BeneficiaryConfirmation')
const surrenderInfo = () => import('@/views/ebiz/preserve/SurrenderInfo')
const surrenderConfirmation = () => import('@/views/ebiz/preserve/SurrenderConfirmation')
@@ -70,6 +71,15 @@ export default [
index: 5
}
},
{
path: '/preserve/beneficiaryInfoAdd',
name: 'beneficiaryInfoAdd',
component: beneficiaryInfoAdd,
meta: {
title: '指定受益人信息',
index: 105
}
},
{
path: '/preserve/surrenderInfo',
name: 'surrenderInfo',

View File

@@ -1 +1,403 @@
<!--受益人变更-保全代办确认页-->
<!--受益人变更-保全代办确认页-->
<template>
<div class="beneficiary-container">
<div h10></div>
<div class="fs14 flex justify-content-s pv12 ph15 van-hairline--bottom">
<label class="c-gray-dark">被保险人</label>
<span class="c-gray-darker">{{ insuredPerson }}</span>
</div>
<div class="fs14 pv12 ph15 van-hairline--bottom flex">
<label class="c-gray-dark">身故受益人</label>
<div class="ml20 c-gray-darker">
<van-radio-group :disabled="true" v-model="type" class="flex" @change="radioChange">
<van-radio name="1">法定受益人</van-radio>
<van-radio name="2" class="ml10">指定受益人</van-radio>
</van-radio-group>
</div>
</div>
<!-- 受益人列表 -->
<div class="fs14 beneficiary-list" v-if="type == 2">
<ul>
<li class="pv20 ph15 item" v-for="(item, index) in beneficiaries" :key="index">
<div class="bg-white p15">
<div class="flex justify-content-s c-gray-darker">
<div>
<img
src="@/assets/images/bnf_avatar.png"
width="40"
height="40"
class="radius50 v-middle"
/>
<span class="ml10 c-gray-base">{{ item.name }}</span>
</div>
</div>
<p class="mt20">
<span class="c-gray-dark">是被保险人的</span>
<span class="ml20">{{ item.relationToInsured | idToText('relationToAppnt') }}</span>
</p>
<p class="mt10">
<span class="c-gray-dark">受益份额</span>
<span class="ml35">{{ item.bnfLot }}%</span>
</p>
</div>
</li>
</ul>
</div>
<!-- 短信验证 -->
<!-- cancelButtonColor="#4FC6B3" -->
<van-dialog
v-model="show"
title="短信确认"
show-cancel-button
class="dialog-delete"
cancelButtonColor="#4FC6B3"
confirmButtonColor="#FFFFFF"
@confirm="authConfirm(authCode)"
@cancel="clearTimer"
>
<p class="p10 fs14">向此手机发送验证码确认用户身份</p>
<p class="p10 fs14" style="border-bottom: 1px solid #ebedf0;">{{ '17512341234' | Mask }}</p>
<van-cell-group class="flex align-items-c pr5 mb15">
<van-field maxlength="6" placeholder="请输入手机验证码" v-model="authCode" clearable label-width="0" />
<van-button type="danger" plain size="small" class="w160 p0" @click="getAuthCode" :disabled="codeDisabled" v-no-more-click="2000">
{{ codeDisabled ? `${countDown}s后重新获取` : '获取验证码' }}
</van-button>
</van-cell-group>
</van-dialog>
<van-button type="danger" class="bottom-btn" @click="showAuth">提交申请</van-button>
</div>
</template>
<script>
import { RadioGroup, Radio, Icon, Dialog, Field, CellGroup } from 'vant'
import dataDictionary from '@/assets/js/utils/data-dictionary'
import { saveOrUpdateOrderInfo, getOrderDetail, getAuthCode } from '@/api/ebiz/sale/sale'
export default {
name: 'beneficiary',
components: {
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Field.name]: Field,
[CellGroup.name]: CellGroup,
[Icon.name]: Icon,
[Dialog.name]: Dialog
},
data() {
return {
type: '1',
show: false, // 获取短信验证码
codeDisabled: false, // 获取验证码按钮是否禁用
insuredPerson: '', //被保险人
isAssign: false, // 是否指定受益人
timeId: null, // 计时器ID
countDown: 60, // 倒计时
authCode: '', // 验证码
beneficiaries: [
// {
// name: '陈明',
// relationToAppnt: '1',
// beneRatio: '99'
// }
], // 指定受益人列表
bnfFlag: '0', // 受益人类型
bnfType: '0' // 0 身故受益人 1 身前受益人
}
},
created() {
// 是否从添加指定受益人页面跳转
if (localStorage.fromAddBeneficiaryInfo) {
this.type = '2'
this.beneficiaries = this.beneficiaries.concat(JSON.parse(localStorage.beneficiaryInfo))
this.type = '2'
console.log(this.beneficiaries)
}
//如果是从编辑进来
if (this.$route.query.edit) {
getOrderDetail({ orderNo: localStorage.orderNo }).then(res => {
if (res.result == 0) {
this.$utils.intLocalStorage(res)
}
})
}
this.insuredPerson = JSON.parse(localStorage.saleInsuredPersonInfo).name
},
mounted() {
// EWebBridge.webCallAppInJs('webview_left_button', {
// intercept: '1' //是否拦截原生返回事件 1是 其他否
// })
// window.appCallBack = this.appCallBack
document.body.style.backgroundColor = '#fff'
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
},
methods: {
// appCallBack() {
// this.$jump({
// flag: 'goBack',
// extra: {
// refresh: '1', //是否返回后刷新01
// index: '-1'
// }
// })
// },
// 显示验证码 van-dialog
showAuth() {
this.show = true
},
//告知信息
nextStep() {
if (this.type == 2 && this.beneficiaries.length == 0) {
this.$toast('受益人列表不能为空')
return
}
},
// 获取短信验证码
getAuthCode() {
this.codeDisabled = true
//倒计时
this.timeId = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
window.clearInterval(this.timeId)
this.codeDisabled = false
this.countDown = 60
}
}, 1000)
getAuthCode({
operateType: 'appntInfoEntry',
sessionId: '',
validateCode: '',
operateCode: this.customerMobile,
system: '',
operateCodeType: '0'
}).then(res => {
if (res.result == 0) {
this.sessionId = res.sessionId
} else {
this.$toast(res.resultMessage)
}
})
},
// 验证码确认事件
async authConfirm() {
//清理计时器
this.clearTimer()
// this.$dialog
// .alert({
// title: '提示',
// className: 'dialog-alert',
// message: '您所有保单的相应信息均将变更',
// confirmButtonColor: '#FFFFFF',
// })
// .then(() => {
// this.changeSubmit()
// })
this.changeSubmit()
},
// 清理计时器
clearTimer() {
window.clearInterval(this.timeId)
this.timeId = null
this.countDown = 60
this.codeDisabled = false
},
async changeSubmit() {
// this.bnfFlag = this.type == 2 ? '1' : '0'
// //生成接口数据
// let data = {
// orderType: 'BNF_ORDER',
// orderDTO: {
// productDTO: null,
// orderInfoDTO: {
// bnfFlag: this.bnfFlag,
// orderNo: localStorage.orderNo
// },
// appntDTO: {},
// insuredDTOs: [
// {
// insuredId: JSON.parse(localStorage.saleInsuredPersonInfo).insuredId,
// bnfDTOs: this.beneficiaries
// }
// ],
// paymentDTO: {},
// orderAccountDTO: {},
// channelDTO: null,
// orderExpandDTO: null,
// thirdOrderDTO: null
// }
// }
// console.log(this.beneficiaries)
// //调接口保存受益人
// saveOrUpdateOrderInfo(data).then(res => {
// // console.log(res)
// if (res.result == 0) {
// localStorage.removeItem('applicant')
// //页面跳转
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/preserve/submitResult',
needRefresh: '1'
},
routerInfo: {
path: '/preserve/submitResult'
}
})
// } else {
// this.$toast(res.resultMessage)
// }
// })
},
//添加受益人
add() {
let beneRatio = 0
console.log(this.beneficiaries)
this.beneficiaries.forEach(item => {
beneRatio += parseInt(item.bnfLot)
})
console.log(beneRatio)
if (beneRatio >= 100) {
return this.$toast('受益份额已满~')
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/preserve/BeneficiaryInfoAdd'
},
routerInfo: {
path: '/preserve/BeneficiaryInfoAdd'
}
})
},
// 单选按钮切换
radioChange(val) {
console.log(val)
},
// 删除受益人
deleteBeneficiary(index) {
Dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '您确认要删除该受益人吗?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
// on confirm
// console.log('删除受益人')
console.log(this.beneficiaries[index].idNo)
if (this.beneficiaries[index].asAppntAddress == true) {
localStorage.removeItem('applicant')
}
// 删除 localStorage 中的对应数据
// console.log(this.beneficiaries)
let beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// console.log(JSON.parse(localStorage.beneficiaryInfo))
console.log(beneficiaries)
let delIdx = beneficiaries.findIndex(item => {
return item.idNo == this.beneficiaries[index].idNo
})
beneficiaries.splice(delIdx, 1)
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
// 删除页面中的对应数据
this.beneficiaries.splice(index, 1)
})
.catch(() => {
// on cancel
return
})
},
// 删除受益人
editBeneficiary(index) {
Dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '您确认要修改该受益人吗?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
// on confirm
// console.log('修改受益人')
console.log(this.beneficiaries[index].idNo)
if (this.beneficiaries[index].asAppntAddress == true) {
localStorage.removeItem('applicant')
}
// 修改 localStorage 中的对应数据
// console.log(this.beneficiaries)
let beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// console.log(JSON.parse(localStorage.beneficiaryInfo))
console.log(beneficiaries)
let delIdx = beneficiaries.findIndex(item => {
return item.idNo == this.beneficiaries[index].idNo
})
beneficiaries.splice(delIdx, 1)
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
// 修改页面中的对应数据
this.beneficiaries.splice(index, 1)
})
.catch(() => {
// on cancel
return
})
},
//获取受益人列表
async getBeneficiaryList() {
const res = await getOrderDetail({ orderNo: localStorage.orderNo })
console.log(res)
if (res.result == 0 && res.orderDTO) {
this.beneficiaries = res.orderDTO.inuseredDTOs[0].bnfDTOs
}
}
},
beforeDestroy() {
//清理计时器
this.clearTimer()
},
filters: {
relationTransfer(relationIdx) {
let relationText = ''
dataDictionary.relationToAppnt.some(item => {
if (item.id == relationIdx) {
relationText = item.text
}
})
return relationText
},
Mask: function(value) {
if (value) {
return value.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
} else {
return ''
}
}
}
}
</script>
<style lang="scss" scoped>
.beneficiary-container {
.add-btn {
width: 80%;
margin: 20px auto;
border: 1px dashed #999;
}
.beneficiary-list {
margin-bottom: 65px;
}
.item {
background-color: #f5f5f5;
}
}
</style>

View File

@@ -1 +1,311 @@
<!--受益人变更页面-->
<!--受益人变更页面-->
<template>
<div class="beneficiary-container">
<div h10></div>
<div class="fs14 flex justify-content-s pv12 ph15 van-hairline--bottom">
<label class="c-gray-dark">被保险人</label>
<span class="c-gray-darker">{{ insuredPerson }}</span>
</div>
<div class="fs14 pv12 ph15 van-hairline--bottom flex">
<label class="c-gray-dark">身故受益人</label>
<div class="ml20 c-gray-darker">
<van-radio-group v-model="type" class="flex" @change="radioChange">
<van-radio name="1">法定受益人</van-radio>
<van-radio name="2" class="ml10">指定受益人</van-radio>
</van-radio-group>
</div>
</div>
<!-- 受益人列表 -->
<div class="fs14 beneficiary-list" v-if="type == 2">
<ul>
<li class="pv20 ph15 item" v-for="(item, index) in beneficiaries" :key="index">
<div class="bg-white p15">
<div class="flex justify-content-s c-gray-darker">
<div>
<img
src="@/assets/images/bnf_avatar.png"
width="40"
height="40"
class="radius50 v-middle"
/>
<span class="ml10 c-gray-base">{{ item.name }}</span>
</div>
<div>
<van-icon name="delete" class="mr20" size="20" @click="deleteBeneficiary(index)" />
<van-icon name="edit" size="20" @click="editBeneficiary(index)" />
</div>
</div>
<p class="mt20">
<span class="c-gray-dark">是被保险人的</span>
<span class="ml20">{{ item.relationToInsured | idToText('relationToAppnt') }}</span>
</p>
<p class="mt10">
<span class="c-gray-dark">受益份额</span>
<span class="ml35">{{ item.bnfLot }}%</span>
</p>
</div>
</li>
</ul>
<div class="add-btn mt20 text-center p15 c-gray-base" @click="add">+ 添加指定受益人</div>
</div>
<van-button type="danger" class="bottom-btn" @click="nextStep">下一步</van-button>
</div>
</template>
<script>
import { RadioGroup, Radio, Icon, Dialog } from 'vant'
import dataDictionary from '@/assets/js/utils/data-dictionary'
import { saveOrUpdateOrderInfo, getOrderDetail } from '@/api/ebiz/sale/sale'
export default {
name: 'beneficiary',
components: {
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Icon.name]: Icon,
[Dialog.name]: Dialog
},
data() {
return {
type: '1',
insuredPerson: '', //被保险人
isAssign: false, // 是否指定受益人
beneficiaries: [
// {
// name: '陈明',
// relationToAppnt: '1',
// beneRatio: '99'
// }
], // 指定受益人列表
bnfFlag: '0', // 受益人类型
bnfType: '0' // 0 身故受益人 1 身前受益人
}
},
created() {
// 是否从添加指定受益人页面跳转
if (localStorage.fromAddBeneficiaryInfo) {
this.type = '2'
this.beneficiaries = this.beneficiaries.concat(JSON.parse(localStorage.beneficiaryInfo))
this.type = '2'
console.log(this.beneficiaries)
}
//如果是从编辑进来
if (this.$route.query.edit) {
getOrderDetail({ orderNo: localStorage.orderNo }).then(res => {
if (res.result == 0) {
this.$utils.intLocalStorage(res)
}
})
}
this.insuredPerson = JSON.parse(localStorage.saleInsuredPersonInfo).name
},
mounted() {
// EWebBridge.webCallAppInJs('webview_left_button', {
// intercept: '1' //是否拦截原生返回事件 1是 其他否
// })
// window.appCallBack = this.appCallBack
document.body.style.backgroundColor = '#fff'
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
},
methods: {
// appCallBack() {
// this.$jump({
// flag: 'goBack',
// extra: {
// refresh: '1', //是否返回后刷新01
// index: '-1'
// }
// })
// },
//告知信息
nextStep() {
if (this.type == 2 && this.beneficiaries.length == 0) {
this.$toast('受益人列表不能为空')
return
}
// this.bnfFlag = this.type == 2 ? '1' : '0'
// //生成接口数据
// let data = {
// orderType: 'BNF_ORDER',
// orderDTO: {
// productDTO: null,
// orderInfoDTO: {
// bnfFlag: this.bnfFlag,
// orderNo: localStorage.orderNo
// },
// appntDTO: {},
// insuredDTOs: [
// {
// insuredId: JSON.parse(localStorage.saleInsuredPersonInfo).insuredId,
// bnfDTOs: this.beneficiaries
// }
// ],
// paymentDTO: {},
// orderAccountDTO: {},
// channelDTO: null,
// orderExpandDTO: null,
// thirdOrderDTO: null
// }
// }
// console.log(this.beneficiaries)
// //调接口保存受益人
// saveOrUpdateOrderInfo(data).then(res => {
// // console.log(res)
// if (res.result == 0) {
// localStorage.removeItem('applicant')
// //页面跳转
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/preserve/HandleResult?entry=beneficiary',
needRefresh: '1'
},
routerInfo: {
path: '/preserve/HandleResult?entry=beneficiary'
}
})
// } else {
// this.$toast(res.resultMessage)
// }
// })
},
//添加受益人
add() {
let beneRatio = 0
console.log(this.beneficiaries)
this.beneficiaries.forEach(item => {
beneRatio += parseInt(item.bnfLot)
})
console.log(beneRatio)
if (beneRatio >= 100) {
return this.$toast('受益份额已满~')
}
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/preserve/BeneficiaryInfoAdd'
},
routerInfo: {
path: '/preserve/BeneficiaryInfoAdd'
}
})
},
// 单选按钮切换
radioChange(val) {
console.log(val)
},
// 删除受益人
deleteBeneficiary(index) {
Dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '您确认要删除该受益人吗?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
// on confirm
// console.log('删除受益人')
console.log(this.beneficiaries[index].idNo)
if (this.beneficiaries[index].asAppntAddress == true) {
localStorage.removeItem('applicant')
}
// 删除 localStorage 中的对应数据
// console.log(this.beneficiaries)
let beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// console.log(JSON.parse(localStorage.beneficiaryInfo))
console.log(beneficiaries)
let delIdx = beneficiaries.findIndex(item => {
return item.idNo == this.beneficiaries[index].idNo
})
beneficiaries.splice(delIdx, 1)
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
// 删除页面中的对应数据
this.beneficiaries.splice(index, 1)
})
.catch(() => {
// on cancel
return
})
},
// 删除受益人
editBeneficiary(index) {
Dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '您确认要修改该受益人吗?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
// on confirm
// console.log('修改受益人')
console.log(this.beneficiaries[index].idNo)
if (this.beneficiaries[index].asAppntAddress == true) {
localStorage.removeItem('applicant')
}
// 修改 localStorage 中的对应数据
// console.log(this.beneficiaries)
let beneficiaries = JSON.parse(localStorage.beneficiaryInfo)
// console.log(JSON.parse(localStorage.beneficiaryInfo))
console.log(beneficiaries)
let delIdx = beneficiaries.findIndex(item => {
return item.idNo == this.beneficiaries[index].idNo
})
beneficiaries.splice(delIdx, 1)
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
// 修改页面中的对应数据
this.beneficiaries.splice(index, 1)
})
.catch(() => {
// on cancel
return
})
},
//获取受益人列表
async getBeneficiaryList() {
const res = await getOrderDetail({ orderNo: localStorage.orderNo })
console.log(res)
if (res.result == 0 && res.orderDTO) {
this.beneficiaries = res.orderDTO.inuseredDTOs[0].bnfDTOs
}
}
},
filters: {
relationTransfer(relationIdx) {
let relationText = ''
dataDictionary.relationToAppnt.some(item => {
if (item.id == relationIdx) {
relationText = item.text
}
})
return relationText
}
}
}
</script>
<style lang="scss" scoped>
.beneficiary-container {
.add-btn {
width: 80%;
margin: 20px auto;
border: 1px dashed #999;
}
.beneficiary-list {
margin-bottom: 65px;
}
.item {
background-color: #f5f5f5;
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -138,9 +138,9 @@ export default {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/preserve/HandleResult'
url: location.origin + '/#/preserve/HandleResult?entry=contact'
},
routerInfo: '/preserve/HandleResult'
routerInfo: '/preserve/HandleResult?entry=contact'
})
} else {
this.$toast(res.resultMessage)

View File

@@ -31,8 +31,11 @@ export default {
}
// 此处处理 this.path
switch (this.entry) {
case 'basic':
this.path = '1'
case 'contact':
this.path = '/preserve/ContactConfirmation?entry=contact'
break
case 'beneficiary':
this.path = '/preserve/BeneficiaryConfirmation?entry=beneficiary&'
break
case 'renewal':
this.path = '2'
@@ -63,10 +66,10 @@ export default {
// 若被保险人≥18周岁人脸识别录入被保人本人
// 若被保险人18周岁被保险人与投保人为子女关系人脸识别录入未成年人父亲或母亲
// toDo
this.jumpNextPage(this.path)
}
},
jumpNextPage(path) {
path = '/preserve/ContactConfirmation'
jumpNextPage(path = '/preserve/BeneficiaryInfo') {
this.$jump({
flag: 'h5',
extra: {

View File

@@ -0,0 +1,95 @@
//点击弹出组件
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) {
console.log(data)
// 正面
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,52 @@
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: '证件号码不能为空'
}
}
// 证件号码规则校验
if (!idNoCheck.isIdno(idNo)) {
return {
text: '您填写的证件号码有误'
}
}
//如果是15位身份证号先转为18位
if (idNo.length == 15) {
idNo = changeFifteenToEighteen(idNo)
}
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'
}
}
}