Merge branch 'feature/GFRS-718【0319】电投添加短信验证码验证身份' into dev

# Conflicts:
#	src/assets/js/business-common.js
#	src/views/ebiz/sale/SignatureConfirmation.vue
This commit is contained in:
ding.zhou
2020-03-16 23:24:03 +08:00
committed by 28CD73C051F645E8132835671423A23F
5 changed files with 237 additions and 40 deletions

View File

@@ -18,7 +18,14 @@ export function updateCustomerInfo(data) {
data
})
}
//本人实名认证
export function checkPhone(data) {
return request({
url: getUrl('/customer/checkPhone', 1),
method: 'post',
data
})
}
//查询代理人客户信息
export function getAgentCustomerInfo(data) {
return request({

View File

@@ -61,7 +61,14 @@ export function getAuthCode(data) {
data
})
}
// 验证验证码
export function autchCodeCheck(data) {
return request({
url: getUrl('/customer/authcode/check', 1),
method: 'post',
data
})
}
// 上传图片
export function uploadImg(data) {
return request({

View File

@@ -514,7 +514,10 @@ export default {
occupationName: appntDTO.occupationName,
occupationCode: appntDTO.occupationCode,
marriage: appntDTO.marriage,
medical: appntDTO.medical
medical: appntDTO.medical,
healthGrade: appntDTO.healthGrade,
lifeGrade: appntDTO.lifeGrade,
mobile: appntDTO.mobile
})
if (insuredDTO) {
@@ -533,7 +536,8 @@ export default {
insuredId: insuredDTO.insuredId,
idNo: insuredDTO.idNo,
healthGrade: insuredDTO.healthGrade,
lifeGrade: insuredDTO.lifeGrade
lifeGrade: insuredDTO.lifeGrade,
mobile: appntDTO.mobile
})
let [chooseProductCodes, mainRiskCodes, addRiskCodes] = [[], [], []]

View File

@@ -65,6 +65,14 @@ export default {
this.$refs.file.dispatchEvent(new MouseEvent('click'))
},
addImg(e) {
this.$toast.loading({
// 持续展示 toast
duration: 0,
// 禁用背景点击s
forbidClick: true,
loadingType: 'spinner',
message: '加载中……'
})
let that = this
this.file = this.$refs.file.files[0]
var reader = new FileReader()

View File

@@ -215,24 +215,57 @@
</div>
</div>
</div>
<UploadImageFile :typeface="idcardData.typeface" :realName="idcardData.idcardName" :idno="idcardData.idcardNumber" @sendimage="sendimage">
<!-- 短信验证 -->
<van-dialog
v-model="show"
title="提示"
show-cancel-button
@confirm="authConfirm(authCode)"
@cancel="clearTimer"
>
<p class="p10 fs14">抱歉因光线拍照角度等原因导致您人脸识别不成功
为确保是您本人操作短信验证码已发送至您手机号{{ encyCustomerMobile }}请您输入验证码以完成后续投保操作
</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>
<UploadImageFile :typeface="idcardData.typeface && (faceAuthCount.weixin <= smsAuthNum)" :realName="idcardData.idcardName" :idno="idcardData.idcardNumber" @sendimage="sendimage">
</UploadImageFile>
</div>
</template>
<script>
import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import { Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import { underWrite, getOrderDetail, getSignInvalid, checkSignInvalid } from '@/api/ebiz/sale/sale'
import { Field, Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import { underWrite, getOrderDetail, getSignInvalid, checkSignInvalid, getAuthCode, autchCodeCheck} from '@/api/ebiz/sale/sale'
import { checkPhone } from '@/api/ebiz/customer/customer'
import { weixinShare } from '@/assets/js/utils/wxShare.js'
import IndexBar from '@/components/ebiz/sale/IndexBar'
// import axios from 'axios'
// import device from '@/assets/js/commons.js'
export default {
data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return {
show: false, // 获取短信验证码
codeDisabled: false, // 获取验证码按钮是否禁用
timeId: null, // 计时器ID
countDown: 60, // 倒计时
authCode: '', // 验证码
smsAuthNum: 3,
operaFlag:null,
encyCustomerMobile:null,
sid:null,
//人脸识别认证次数
faceAuthCount:{
appnt:0,
insured:0,
weixin:0
},
customerMobile:'',
//保险产品名称
riskName: '',
// 员工信息
@@ -365,6 +398,119 @@ export default {
this.isShow = true
}
},
// 获取消息和阅读状态
realPeopelCheck() {
let that = this
this.$toast.loading({
// 持续展示 toast
duration: 0,
// 禁用背景点击s
forbidClick: true,
loadingType: 'spinner',
message: '加载中……'
})
let data = {};
this.authCode = null;
if("appnt" == this.operaFlag){
let appntData = JSON.parse(localStorage.saleInsuredInfo);
data = {
name: appntData.name,
idType: appntData.idType,
idNo: appntData.idNo,
mobile: appntData.mobile
}
this.customerMobile = appntData.mobile;
this.encyCustomerMobile = this.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/,'$1****$2');
}else if("insured" == this.operaFlag){
let insuredData = JSON.parse(localStorage.saleInsuredPersonInfo);
data = {
name: insuredData.name,
idType: insuredData.idType,
idNo: insuredData.idNo,
mobile: insuredData.mobile
}
this.customerMobile = insuredData.mobile;
this.encyCustomerMobile = this.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/,'$1****$2');
}
return new Promise((resolve, reject) => {
checkPhone(data).then(res => {
if (res.result == '0') {
console.log(res);
this.show = true;
}else{
Dialog.confirm({
title: '提示',
message: '抱歉,您预留的手机号非您本人的手机号,请进行线下投保!',
showCancelButton: false
})
}
})
})
},
// 验证码确认事件
async authConfirm() {
//清理计时器
this.clearTimer()
this.changeSubmit()
},
// 获取短信验证码
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',
type: 'H5',
operateCode: this.customerMobile,
system: 'agentApp',
operateCodeType: '0'
}).then(res => {
console.log(res)
if (res.result == 0) {
this.sid = res.sessionId
} else {
this.$toast(res.resultMessage)
}
})
},
// 清理计时器
clearTimer() {
window.clearInterval(this.timeId)
this.timeId = null
this.countDown = 60
this.codeDisabled = false
},
//提交变更申请
async changeSubmit() {
if(null == this.sid){
this.$toast("请先进行发送短信验证码")
return;
}
let res = await autchCodeCheck({
smsId: this.sid,
code: this.authCode
})
if (res.result == 0) {
if("appnt" == this.operaFlag){
this.goUrl()
}else if("insured" == this.operaFlag){
this.insuredUrl()
}
} else {
this.$toast(res.resultMessage)
}
},
beforeDestroy() {
//清理计时器
this.clearTimer()
},
// 人脸识别
start_ocr(val) {
// val 0投保人 1被保险人 2本人
@@ -378,9 +524,14 @@ export default {
if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1') {
that.goUrl()
} else {
if(this.faceAuthCount.appnt <= this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo
}else{
this.operaFlag = "appnt";
this.realPeopelCheck();
}
}
} else {
window.localStorage.setItem('sign-val', val)
@@ -389,9 +540,14 @@ export default {
// if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1') {
that.insuredUrl()
} else {
if(this.faceAuthCount.insured <= this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
}else{
this.operaFlag = "insured";
this.realPeopelCheck();
}
}
}
} else {
@@ -402,6 +558,7 @@ export default {
// if (this.saleInsuredInfo.idType != '1' || this.saleInsuredInfo.age < '18') {
that.goUrl()
} else {
if(this.faceAuthCount.appnt <= this.smsAuthNum){
// 原人脸识别
EWebBridge.webCallAppInJs('face_auth', {
number: that.saleInsuredInfo.idNo, //身份证号码
@@ -410,9 +567,14 @@ export default {
if (JSON.parse(data).state == '1') {
that.goUrl()
} else {
// EWebBridge.webCallAppInJs('webview_toast', '人脸检测失败')
that.$toast(JSON.parse(data).error)
that.faceAuthCount.appnt++;
}
})
}else{
this.operaFlag = "appnt";
this.realPeopelCheck();
}
}
} else {
window.localStorage.setItem('sign-val', val)
@@ -421,6 +583,7 @@ export default {
if (this.saleInsuredPersonInfo.idType != '1' || this.saleInsuredPersonInfo.age < '18') {
that.insuredUrl()
} else {
if(this.faceAuthCount.insured <= this.smsAuthNum) {
// 调原生人脸识别
EWebBridge.webCallAppInJs('face_auth', {
number: that.saleInsuredPersonInfo.idNo, //身份证号码
@@ -429,9 +592,14 @@ export default {
if (JSON.parse(data).state == '1') {
that.insuredUrl()
} else {
// this.$toast(JSON.parse(data).error)
that.$toast(JSON.parse(data).error)
that.faceAuthCount.insured++;
}
})
}else{
this.operaFlag = "insured";
this.realPeopelCheck();
}
}
}
}
@@ -716,7 +884,7 @@ export default {
orderNo: window.localStorage.getItem('orderNo')
}
localStorage.setItem('riskName', '')
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
getOrderDetail(data).then(res => {
if (res.result == '0') {
//弹框展示是否有社保、赔付比例和免赔额信息
@@ -899,6 +1067,8 @@ export default {
} else {
this.goUrl()
}
}else{
this.faceAuthCount.weixin++;
}
}
},
@@ -945,7 +1115,8 @@ export default {
UploadImageFile: UploadImageFile,
[CollapseItem.name]: CollapseItem,
[Dialog.name]: Dialog,
[IndexBar.name]: IndexBar
[IndexBar.name]: IndexBar,
[Field.name]: Field
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''