保全银行卡鉴权白名单+短信验证

This commit is contained in:
mengxiaolong
2020-12-09 14:30:47 +08:00
parent 615afee245
commit f4c17d6e63
3 changed files with 361 additions and 27 deletions

View File

@@ -122,6 +122,20 @@
</div>
<!-- 银行卡扫描 -->
<BankCardScan :scanShow="isScan" :clear="false" @getScanInfo="getBankCardInfo"></BankCardScan>
<!-- 短信验证弹窗 -->
<van-dialog v-model="isCaptchaModalShow" title="提示" show-cancel-button :before-close="onCaptchaConfirm" @cancel="onCaptchaCancel">
<van-cell>
<p class="fs14">为确保是您本人操作短信验证码将发送至您手机号{{ encryptMobile }}请您输入验证码以完成后续操作</p>
</van-cell>
<van-field v-model="code" type="number" :maxlength="6" center clearable label="短信验证码" placeholder="请输入短信验证码">
<template #button>
<van-button size="small" type="danger" :disabled="countDownNum !== 0" @click="getCaptcha">{{
countDownNum === 0 ? '获取验证码' : countDownNum | countDownText
}}</van-button>
</template>
</van-field>
</van-dialog>
</div>
</template>
@@ -129,7 +143,7 @@
import { Field, Cell, CellGroup, Popup, Row, Col, Picker, Area } from 'vant'
import BankCardScan from '@/components/ebiz/sale/BankCardScan'
import { policyInfo, trial, changeEdor } from '@/api/ebiz/preserve/preserve'
import { getBankList, checkCard } from '@/api/ebiz/sale/sale'
import { getBankList, checkCard, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
import dataDic from '../js/data-dictionary.js'
import filters from '@/views/ebiz/preserve/filters'
import getAreaName from '@/views/ebiz/preserve/js/utils/get-area-name'
@@ -151,6 +165,13 @@ export default {
},
data() {
return {
cardAuthCount: 0,
isCaptchaModalShow: false,
code: '',
sid: '',
countDownNum: 0,
countDownTimer: null,
isPassedCardCheck: false,
valueKey: '',
popupShow: false,
pickerType: '',
@@ -202,6 +223,14 @@ export default {
}
}
},
computed: {
encryptMobile() {
if (this.customerInfo && this.customerInfo.customerMobile) {
return this.customerInfo.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
}
return ''
}
},
created() {
this.customerInfo = JSON.parse(localStorage['preserve-customerInfo']) //客户详情
this.policy = JSON.parse(localStorage['preserve-policy'])
@@ -219,9 +248,85 @@ export default {
},
filters: {
idToText: filters.idToText,
amtFormat1: filters.amtFormat1
amtFormat1: filters.amtFormat1,
countDownText(val) {
if (isNaN(parseFloat(val))) {
return val
} else {
return `${val} s`
}
}
},
methods: {
async getCaptcha() {
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.customerInfo.customerMobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
try {
let res = await getAuthCode(data)
if (res.result === '0') {
this.$toast(res.resultMessage)
this.sid = res.sessionId
this.countDownNum = 60
this.countDownTimer = setInterval(() => {
this.countDownNum--
if (this.countDownNum <= 0) {
clearInterval(this.countDownTimer)
this.countDownTimer = null
}
}, 1000)
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
console.log(error)
this.$toast('网络异常')
}
},
async onCaptchaConfirm(action, done) {
if (!this.sid) {
if (!this.isCancel) {
this.$toast('请先获取验证码')
}
done(false)
return
}
if (!this.code.trim()) {
done(false)
return this.$toast('请输入验证码')
}
try {
let res = await autchCodeCheck({
smsId: this.sid,
code: this.code
})
if (res.result === '0') {
this.isPassedCardCheck = true
this.nextStep()
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
this.$toast('网络异常')
console.log(error)
}
this.onCaptchaCancel()
done()
},
onCaptchaCancel() {
this.isCancel = true
this.isCaptchaModalShow = false
clearInterval(this.countDownTimer)
this.countDownTimer = null
this.countDownNum = 0
this.sid = ''
this.code = ''
},
//获取试算信息
getTrial(data) {
return new Promise((resolve, reject) => {
@@ -454,10 +559,22 @@ export default {
}
// 用户不再白名单内做银行卡鉴权
else {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
return this.$toast(res.resultMessage)
// 没通过鉴权进行银行卡鉴权
if (!this.isPassedCardCheck) {
// 鉴权失败未达到3次调接口鉴权
if (this.cardAuthCount < 3) {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
this.cardAuthCount++
return this.$toast(res.resultMessage)
}
}
// 超过3次调用短信验证
else {
this.isCaptchaModalShow = true
return
}
}
}
} else {

View File

@@ -86,6 +86,20 @@
<p class="p15 pb20 fs14 text-center">该客户涉及到的所有保单相应信息将变更</p>
</van-dialog>
</div>
<!-- 短信验证弹窗 -->
<van-dialog v-model="isCaptchaModalShow" title="提示" show-cancel-button :before-close="onCaptchaConfirm" @cancel="onCaptchaCancel">
<van-cell>
<p class="fs14">为确保是您本人操作短信验证码将发送至您手机号{{ encryptMobile }}请您输入验证码以完成后续操作</p>
</van-cell>
<van-field v-model="code" type="number" :maxlength="6" center clearable label="短信验证码" placeholder="请输入短信验证码">
<template #button>
<van-button size="small" type="danger" :disabled="countDownNum !== 0" @click="getCaptcha">{{
countDownNum === 0 ? '获取验证码' : countDownNum | countDownText
}}</van-button>
</template>
</van-field>
</van-dialog>
</div>
</template>
@@ -93,7 +107,7 @@
import { Field, Collapse, CollapseItem, Area, Picker, Cell, CellGroup, Dialog, Popup, List } from 'vant'
import BankCardScan from '@/components/ebiz/sale/BankCardScan'
import { changeEdor } from '@/api/ebiz/preserve/preserve'
import { getBankList, checkCard } from '@/api/ebiz/sale/sale'
import { getBankList, checkCard, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
import filters from '@/views/ebiz/preserve/filters'
import getAreaName from '@/views/ebiz/preserve/js/utils/get-area-name'
import areaList from '@/views/ebiz/preserve/js/utils/area'
@@ -117,6 +131,13 @@ export default {
},
data() {
return {
cardAuthCount: 0,
isCaptchaModalShow: false,
code: '',
sid: '',
countDownNum: 0,
countDownTimer: null,
isPassedCardCheck: false,
dialogShow: true, //信息变更弹窗是否显示
valueKey: '',
pickerType: '',
@@ -139,17 +160,15 @@ export default {
customerInfo: JSON.parse(localStorage.getItem('preserve-customerInfo'))
}
},
computed: {
encryptMobile() {
if (this.customerInfo && this.customerInfo.customerMobile) {
return this.customerInfo.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
}
return ''
}
},
created() {
/*
this.getPolicyList({
customerNo: this.customerInfo.customerNo,
edorType: 'PC', //续期账号变更
idno: this.customerInfo.idNo,
mobile: this.customerInfo.customerMobile,
name: this.customerInfo.customerName
})
*/
// this.list = this.$store.getters.getPcPolicyInfo
this.getBank()
},
mounted() {
@@ -157,6 +176,75 @@ export default {
window.appCallBack = this.appCallBack
},
methods: {
async getCaptcha() {
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.customerInfo.customerMobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
try {
let res = await getAuthCode(data)
if (res.result === '0') {
this.$toast(res.resultMessage)
this.sid = res.sessionId
this.countDownNum = 60
this.countDownTimer = setInterval(() => {
this.countDownNum--
if (this.countDownNum <= 0) {
clearInterval(this.countDownTimer)
this.countDownTimer = null
}
}, 1000)
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
console.log(error)
this.$toast('网络异常')
}
},
async onCaptchaConfirm(action, done) {
if (!this.sid) {
if (!this.isCancel) {
this.$toast('请先获取验证码')
}
done(false)
return
}
if (!this.code.trim()) {
done(false)
return this.$toast('请输入验证码')
}
try {
let res = await autchCodeCheck({
smsId: this.sid,
code: this.code
})
if (res.result === '0') {
this.isPassedCardCheck = true
this.change()
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
this.$toast('网络异常')
console.log(error)
}
this.onCaptchaCancel()
done()
},
onCaptchaCancel() {
this.isCancel = true
this.isCaptchaModalShow = false
clearInterval(this.countDownTimer)
this.countDownTimer = null
this.countDownNum = 0
this.sid = ''
this.code = ''
},
//弹框选择
toSelect(valueKey) {
this.bankPopup = true
@@ -340,10 +428,22 @@ export default {
}
// 用户不再白名单内做银行卡鉴权
else {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
return this.$toast(res.resultMessage)
// 没通过鉴权进行银行卡鉴权
if (!this.isPassedCardCheck) {
// 鉴权失败未达到3次调接口鉴权
if (this.cardAuthCount < 3) {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
this.cardAuthCount++
return this.$toast(res.resultMessage)
}
}
// 超过3次调用短信验证
else {
this.isCaptchaModalShow = true
return
}
}
}
} else {
@@ -417,7 +517,14 @@ export default {
}
},
filters: {
idToText: filters.idToText
idToText: filters.idToText,
countDownText(val) {
if (isNaN(parseFloat(val))) {
return val
} else {
return `${val} s`
}
}
}
}
</script>

View File

@@ -122,6 +122,20 @@
</div>
<!-- 银行卡扫描 -->
<BankCardScan :scanShow="isScan" :clear="false" @getScanInfo="getBankCardInfo"></BankCardScan>
<!-- 短信验证弹窗 -->
<van-dialog v-model="isCaptchaModalShow" title="提示" show-cancel-button :before-close="onCaptchaConfirm" @cancel="onCaptchaCancel">
<van-cell>
<p class="fs14">为确保是您本人操作短信验证码将发送至您手机号{{ encryptMobile }}请您输入验证码以完成后续操作</p>
</van-cell>
<van-field v-model="code" type="number" :maxlength="6" center clearable label="短信验证码" placeholder="请输入短信验证码">
<template #button>
<van-button size="small" type="danger" :disabled="countDownNum !== 0" @click="getCaptcha">{{
countDownNum === 0 ? '获取验证码' : countDownNum | countDownText
}}</van-button>
</template>
</van-field>
</van-dialog>
</div>
</template>
@@ -129,7 +143,7 @@
import { Field, Cell, CellGroup, Popup, Row, Col, Picker, Area } from 'vant'
import BankCardScan from '@/components/ebiz/sale/BankCardScan'
import { policyInfo, trial, changeEdor } from '@/api/ebiz/preserve/preserve'
import { getBankList, checkCard } from '@/api/ebiz/sale/sale'
import { getBankList, checkCard, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale'
import dataDic from '../js/data-dictionary.js'
import filters from '@/views/ebiz/preserve/filters'
import getAreaName from '@/views/ebiz/preserve/js/utils/get-area-name'
@@ -151,6 +165,13 @@ export default {
},
data() {
return {
cardAuthCount: 0,
isCaptchaModalShow: false,
code: '',
sid: '',
countDownNum: 0,
countDownTimer: null,
isPassedCardCheck: false,
valueKey: '',
popupShow: false,
pickerType: '',
@@ -199,6 +220,14 @@ export default {
}
}
},
computed: {
encryptMobile() {
if (this.customerInfo && this.customerInfo.customerMobile) {
return this.customerInfo.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
}
return ''
}
},
created() {
this.customerInfo = JSON.parse(localStorage['preserve-customerInfo']) //客户详情
this.policy = JSON.parse(localStorage['preserve-policy'])
@@ -219,6 +248,75 @@ export default {
amtFormat1: filters.amtFormat1
},
methods: {
async getCaptcha() {
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.customerInfo.customerMobile,
system: 'agentApp',
operateCodeType: '0'
}
//获取验证码
try {
let res = await getAuthCode(data)
if (res.result === '0') {
this.$toast(res.resultMessage)
this.sid = res.sessionId
this.countDownNum = 60
this.countDownTimer = setInterval(() => {
this.countDownNum--
if (this.countDownNum <= 0) {
clearInterval(this.countDownTimer)
this.countDownTimer = null
}
}, 1000)
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
console.log(error)
this.$toast('网络异常')
}
},
async onCaptchaConfirm(action, done) {
if (!this.sid) {
if (!this.isCancel) {
this.$toast('请先获取验证码')
}
done(false)
return
}
if (!this.code.trim()) {
done(false)
return this.$toast('请输入验证码')
}
try {
let res = await autchCodeCheck({
smsId: this.sid,
code: this.code
})
if (res.result === '0') {
this.isPassedCardCheck = true
this.nextStep()
} else {
this.$toast(res.resultMessage)
}
} catch (error) {
this.$toast('网络异常')
console.log(error)
}
this.onCaptchaCancel()
done()
},
onCaptchaCancel() {
this.isCancel = true
this.isCaptchaModalShow = false
clearInterval(this.countDownTimer)
this.countDownTimer = null
this.countDownNum = 0
this.sid = ''
this.code = ''
},
//获取试算信息
getTrial(data) {
return new Promise((resolve, reject) => {
@@ -449,10 +547,22 @@ export default {
}
// 用户不再白名单内做银行卡鉴权
else {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
return this.$toast(res.resultMessage)
// 没通过鉴权进行银行卡鉴权
if (!this.isPassedCardCheck) {
// 鉴权失败未达到3次调接口鉴权
if (this.cardAuthCount < 3) {
let res = await checkCard(params)
this.$toast.clear()
if (res.result != '0') {
this.cardAuthCount++
return this.$toast(res.resultMessage)
}
}
// 超过3次调用短信验证
else {
this.isCaptchaModalShow = true
return
}
}
}
} else {