From 80dec42d2704bb055e021259232a7d645004c694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9A=AE=E4=BC=9F?= Date: Tue, 26 Nov 2019 14:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A1=E5=8D=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/ebiz/cardList/cardList.js | 4 + src/assets/js/utils/request.js | 5 +- src/config/cardList.js | 1 + src/router/ebiz/cardList.js | 13 + src/router/ebiz/index.js | 3 +- src/views/ebiz/cardList/information.vue | 1146 ++++++++++++++++++++ src/views/ebiz/cardList/js/methods.js | 89 ++ src/views/ebiz/cardList/js/verification.js | 52 + src/views/ebiz/sale/InsuredInfo.vue | 2 +- 9 files changed, 1312 insertions(+), 3 deletions(-) create mode 100644 src/api/ebiz/cardList/cardList.js create mode 100644 src/config/cardList.js create mode 100644 src/router/ebiz/cardList.js create mode 100644 src/views/ebiz/cardList/information.vue create mode 100644 src/views/ebiz/cardList/js/methods.js create mode 100644 src/views/ebiz/cardList/js/verification.js diff --git a/src/api/ebiz/cardList/cardList.js b/src/api/ebiz/cardList/cardList.js new file mode 100644 index 000000000..28dac83d8 --- /dev/null +++ b/src/api/ebiz/cardList/cardList.js @@ -0,0 +1,4 @@ +// 卡单接口 + +import request from '@/assets/js/utils/request' +import getUrl from '@/assets/js/utils/get-url' diff --git a/src/assets/js/utils/request.js b/src/assets/js/utils/request.js index 0fe1f1100..5e2dac6de 100644 --- a/src/assets/js/utils/request.js +++ b/src/assets/js/utils/request.js @@ -1,5 +1,6 @@ import axios from 'axios' import { Dialog, Toast } from 'vant' +//建议书 let proposal = [ '/proposal/proposal/list', '/proposal/proposal/toInsurance', @@ -9,7 +10,9 @@ let proposal = [ '/proposal/proposal/updateInsured', '/proposal/file/getFile', '/proposal/proposal/deleteProposal' -] //建议书 +] +// 卡单 +let cardList = [] let sale = ['/sale/order/orderList', '/sale/order/saveOrUpdateOrderInfo'] //在线投保 let whiteList = ['/customer/agent/getCustomersList', ...proposal, ...sale] diff --git a/src/config/cardList.js b/src/config/cardList.js new file mode 100644 index 000000000..2f89c5c05 --- /dev/null +++ b/src/config/cardList.js @@ -0,0 +1 @@ +// 卡单 diff --git a/src/router/ebiz/cardList.js b/src/router/ebiz/cardList.js new file mode 100644 index 000000000..e65351aae --- /dev/null +++ b/src/router/ebiz/cardList.js @@ -0,0 +1,13 @@ +// 卡单路由 +const information = () => import('@/views/ebiz/cardList/information') +export default [ + { + path: '/cardList/information', + name: 'information', + component: information, + meta: { + title: '投被保人信息', + index: 1 + } + } +] diff --git a/src/router/ebiz/index.js b/src/router/ebiz/index.js index 9be0c4106..0ef1fa792 100644 --- a/src/router/ebiz/index.js +++ b/src/router/ebiz/index.js @@ -6,4 +6,5 @@ import my from './my' import serve from './serve' import common from './common' import product from './product' -export default [...proposal, ...sale, ...customer, ...my, ...serve, ...common, ...product] //根据需要进行删减 +import cardList from './cardList' +export default [...proposal, ...sale, ...customer, ...my, ...serve, ...common, ...product, ...cardList] //根据需要进行删减 \ No newline at end of file diff --git a/src/views/ebiz/cardList/information.vue b/src/views/ebiz/cardList/information.vue new file mode 100644 index 000000000..f6959ecc3 --- /dev/null +++ b/src/views/ebiz/cardList/information.vue @@ -0,0 +1,1146 @@ + + + diff --git a/src/views/ebiz/cardList/js/methods.js b/src/views/ebiz/cardList/js/methods.js new file mode 100644 index 000000000..b2cda7c38 --- /dev/null +++ b/src/views/ebiz/cardList/js/methods.js @@ -0,0 +1,89 @@ +//点击弹出组件 +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 + } else { + // 勾选长期 + that.userInfo.effectiveDateType = true + // 长期按钮不禁用 + that.effectiveDateTypeAble = false + // 证件截止日期不需要校验 + that.certiexpiredateRequired = false + } + } + that.isScan = false + let title = type == '1' ? '投保人信息' : '被保人信息' + that.$jump({ + flag: 'navigation', + extra: { + title, + hiddenRight: '1' + } + }) +} diff --git a/src/views/ebiz/cardList/js/verification.js b/src/views/ebiz/cardList/js/verification.js new file mode 100644 index 000000000..b42c40b4b --- /dev/null +++ b/src/views/ebiz/cardList/js/verification.js @@ -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' + } + } +} diff --git a/src/views/ebiz/sale/InsuredInfo.vue b/src/views/ebiz/sale/InsuredInfo.vue index 3694cf47a..1a7198ac9 100644 --- a/src/views/ebiz/sale/InsuredInfo.vue +++ b/src/views/ebiz/sale/InsuredInfo.vue @@ -317,7 +317,7 @@ import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan' import idNoCheck from '@/assets/js/utils/idNoCheck' import beforeDate from '@/assets/js/utils/getBeforeDate.js' import { idToData } from './js/verification' -import { selectComp,getIdentityInfo } from './js/methods' +import { selectComp } from './js/methods' export default { name: 'insuredInfo',