Merge branch 'feature/电投自动撤单添加验证码校验' into release/1215

# Conflicts:
#	src/views/ebiz/sale/List.vue
This commit is contained in:
mengxiaolong
2020-12-15 10:31:02 +08:00

View File

@@ -164,6 +164,25 @@
<!-- 短信验证 --> <!-- 短信验证 -->
<check-agent @checModelSuccessMethod="initThisPage" /> <check-agent @checModelSuccessMethod="initThisPage" />
<van-dialog
class="dialog-delete"
@confirm="checkCaptchaCode"
@cancel="cancelCaptchaCode"
:before-close="beforeClose"
confirm-button-color="#fff"
v-model="revokePanelShow"
title="短信验证"
show-cancel-button
>
<p class="captchaReceiver">投保人手机号: {{ captchaReceiver | phoneNumFilter }}</p>
<van-field v-model="sms" center clearable placeholder="请输入短信验证码">
<template #button>
<van-button :disabled="sendTime !== 0" v-no-more-click="1000" @click="getCaptchaCode" size="small" type="danger">{{
sendTime ? `${sendTime}s后获取` : '获取验证码'
}}</van-button>
</template>
</van-field>
</van-dialog>
</div> </div>
</template> </template>
@@ -173,6 +192,7 @@ import { orderList, deleteOrderInfo, revokeOrder } from '@/api/ebiz/sale/sale'
import { formatRiskList } from '@/assets/js/utils/formatRiskList.js' import { formatRiskList } from '@/assets/js/utils/formatRiskList.js'
import dataDictionary from '@/assets/js/utils/data-dictionary' //根据数据字典找到用户等级 import dataDictionary from '@/assets/js/utils/data-dictionary' //根据数据字典找到用户等级
import CheckAgent from '@/components/common/CheckAgent' import CheckAgent from '@/components/common/CheckAgent'
import { getAuthCode } from '@/api/ebiz/sale/sale'
export default { export default {
name: 'saleList', name: 'saleList',
@@ -185,7 +205,8 @@ export default {
[List.name]: List, [List.name]: List,
[Tag.name]: Tag, [Tag.name]: Tag,
[Sticky.name]: Sticky, [Sticky.name]: Sticky,
[Dialog.name]: Dialog [Dialog.name]: Dialog,
[Field.name]: Field
}, },
data() { data() {
return { return {
@@ -202,13 +223,22 @@ export default {
pageSize: 5, //每页数据条数 pageSize: 5, //每页数据条数
isSuccess: false, isSuccess: false,
canRevoke: { canRevoke: {
'02': true,
'14': true,
'19': true, '19': true,
'02': true,
'48': true, '48': true,
'49': true, '49': true,
'55': true '55': true,
} '58': true
},
revokePanelShow: false,
sms: '',
smsId: '',
sendTime: 0,
getCaptcha: false,
captchaTimer: null,
captchaReceiver: '',
revokeOrderNo: '',
captchaMaped: false
} }
}, },
mounted() { mounted() {
@@ -221,6 +251,76 @@ export default {
window.appCallBack = this.appCallBack window.appCallBack = this.appCallBack
}, },
methods: { methods: {
beforeClose(action, done) {
this.captchaMaped ? done() : done(false)
},
async getCaptchaCode() {
if (this.sendTime !== 0) return
this.getCaptcha = true
this.sendTime = 60
let data = {
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.captchaReceiver,
system: 'agentApp',
operateCodeType: '0'
}
let res = await getAuthCode(data)
if (res.result === '0') {
this.$toast('获取验证码成功')
}
this.smsId = res.sessionId
this.captchaTimer = setInterval(() => {
this.sendTime--
if (this.sendTime === 0) {
clearInterval(this.captchaTimer)
this.captchaTimer = null
}
}, 1000)
},
async checkCaptchaCode() {
if (!this.getCaptcha) {
return this.$toast('请先获取验证码')
}
if (!this.sms.trim()) {
return this.$toast('请输入验证码')
}
clearInterval(this.captchaTimer)
this.captchaTimer = null
let revokeResult = await revokeOrder({
id: this.revokeOrderNo,
smsId: this.smsId,
code: this.sms
})
if (revokeResult.result == 0) {
this.$toast('撤单成功!')
setTimeout(() => {
this.saleList = []
this.isSuccess = false
this.currentPage = 1
;[this.loading, this.finished] = [true, false]
let pageInfo = {
pageNum: this.currentPage,
pageSize: this.pageSize,
orderType: this.active
}
this.loadMore(pageInfo)
}, 1000)
} else {
Toast.fail(revokeResult.resultMessage)
}
this.cancelCaptchaCode()
this.sms = ''
},
cancelCaptchaCode() {
this.sendTime = 0
this.revokePanelShow = false
clearInterval(this.captchaTimer)
this.captchaTimer = null
this.getCaptcha = false
this.captchaMaped = false
this.captchaReceiver = ''
},
initThisPage(showFlag) { initThisPage(showFlag) {
this.showFlag = showFlag this.showFlag = showFlag
if (this.showFlag) { if (this.showFlag) {
@@ -359,7 +459,6 @@ export default {
// }) // })
orderList(pageInfo).then(res => { orderList(pageInfo).then(res => {
console.log('调用了一次')
// this.$toast.clear() // this.$toast.clear()
if (res.result == '0') { if (res.result == '0') {
this.isSuccess = true this.isSuccess = true
@@ -385,7 +484,6 @@ export default {
}) })
}) })
this.saleList = this.saleList.concat(list) this.saleList = this.saleList.concat(list)
console.log(this.saleList.length)
if (this.saleList.length == 0) { if (this.saleList.length == 0) {
this.isSuccess = false this.isSuccess = false
} }
@@ -431,7 +529,6 @@ export default {
localStorage.orderNo = orderNo localStorage.orderNo = orderNo
localStorage.isFrom = 'sale' localStorage.isFrom = 'sale'
localStorage.removeItem('changeCard') localStorage.removeItem('changeCard')
console.log('---orderStatus', orderStatus, orderNo)
switch (orderStatus) { switch (orderStatus) {
case '01': //已签名待客户确认, 跳到签名确认页面 case '01': //已签名待客户确认, 跳到签名确认页面
url = '/sale/SignatureConfirmation?edit=1' url = '/sale/SignatureConfirmation?edit=1'
@@ -476,7 +573,7 @@ export default {
}) })
}, },
//删除投保单 //删除投保单
del(order, index) { del(order) {
let params = { let params = {
orderType: 'DEL_ORDER', //列表页 此值为固定 orderType: 'DEL_ORDER', //列表页 此值为固定
id: order.orderInfoDTO.orderNo, id: order.orderInfoDTO.orderNo,
@@ -497,7 +594,6 @@ export default {
.then(() => { .then(() => {
deleteOrderInfo(params).then(res => { deleteOrderInfo(params).then(res => {
if (res.result == 0) { if (res.result == 0) {
console.log(index)
this.saleList = [] this.saleList = []
this.isSuccess = false this.isSuccess = false
this.currentPage = 1 this.currentPage = 1
@@ -535,39 +631,55 @@ export default {
}) })
}, },
revokeOrder(order) { revokeOrder(order) {
console.dir(order)
this.$dialog this.$dialog
.confirm({ .confirm({
className: 'dialog-delete', className: 'dialog-delete',
title: '提示', title: '提示',
message: '确认撤销投保单吗', message: '撤单后,数据将不可恢复,您确定要撤单吗?',
cancelButtonColor: '#E9332E', cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF' confirmButtonColor: '#FFFFFF'
}) })
.then(() => { .then(() => {
return revokeOrder({ id: order.orderInfoDTO.orderNo }) this.revokePanelShow = true
this.captchaReceiver = order.appntDTO.mobile
this.revokeOrderNo = order.orderInfoDTO.orderNo
}) })
.then(res => { }
if (res.result == 0) { },
this.saleList = [] filters: {
this.isSuccess = false phoneNumFilter(phoneNum) {
this.currentPage = 1 let num = phoneNum.split('')
;[this.loading, this.finished] = [true, false] num.splice(3, 4, '****')
let pageInfo = { return num.join('')
pageNum: this.currentPage,
pageSize: this.pageSize,
orderType: this.active
}
this.loadMore(pageInfo)
} else {
Toast.fail(res.resultMessage)
}
})
.catch(() => {})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .dialog-delete .van-dialog__header {
padding: 0.5em;
margin-bottom: 0;
border-bottom: 1px solid #eaeaea;
}
/deep/ .van-cell {
padding: 0;
padding-bottom: 0.5em;
border-bottom: 1px solid #eaeaea;
}
/deep/ .van-dialog__content {
padding: 1em;
}
.captchaReceiver {
margin-bottom: 1em;
padding-bottom: 1em;
border-bottom: 1px solid #eaeaea;
font-size: 14px;
}
.van-search__content { .van-search__content {
background: #fff !important; background: #fff !important;
border-radius: 10px; border-radius: 10px;