diff --git a/src/views/ebiz/cardList/Pay.vue b/src/views/ebiz/cardList/Pay.vue index 05435b3ba..d6f0cfa47 100644 --- a/src/views/ebiz/cardList/Pay.vue +++ b/src/views/ebiz/cardList/Pay.vue @@ -6,7 +6,7 @@ -
+ + + + + + + + + + + + + + + + + + - +
支付
+
+ 支付 + 分享 +
@@ -134,6 +155,8 @@ + + @@ -146,6 +169,7 @@ Vue.use(Button) import { acceptInsurance, getBankList, underWrite, getOrderDetail } from '@/api/ebiz/sale/sale' import { saveOrUpdateAccount, getPayTemp } from '@/api/ebiz/cardList/cardList.js' import BankCardScan from '@/components/ebiz/sale/BankCardScan' +import Loading from '@/components/ebiz/Loading' import config from '@/config' export default { name: 'pay', @@ -157,10 +181,16 @@ export default { [List.name]: List, [Cell.name]: Cell, [RadioGroup.name]: RadioGroup, - [Radio.name]: Radio + [Radio.name]: Radio, + Loading }, data() { + let isWeixin = this.$utils.device().isWeixin //判断环境 return { + // 银行卡支付图片地址 + src: this.$assetsUrl + 'images/cardImg.png', + // 微信支付图片地址 + vxSrc: this.$assetsUrl + 'images/vxImg.png', // trialList: JSON.parse(localStorage.trialList), // 核保数据 orderStatus: '', @@ -171,7 +201,7 @@ export default { bankCode: '', //银行卡号 bankName: '' //开户银行 }, - radio: '1', + radio: '3', result: [], isScan: false, //是否显示证件扫描组件 isClear: false, //是否清空 @@ -218,10 +248,32 @@ export default { }, gotPayParam: false, // 是否已正确获取支付参数, payStatus: '', // 接口返回的支付状态 - noEdit: true + noEdit: true, //是否为编辑 + isWeixin, // 是否为微信环境 + isLoading: false // 分享到微信后的页面loading } }, - created() {}, + created() { + if (this.isWeixin) { + this.radio = '3' + let token = this.$route.query.token + let orderNo = this.$route.query.orderNo + localStorage.token = token + localStorage.orderNo = orderNo + this.isLoading = true + this.$toast.loading({ + duration: 0, // 持续展示 toast + forbidClick: true, // 禁用背景点击 + loadingType: 'spinner', + message: '加载中……' + }) + setTimeout(() => { + this.pay() + }, 500) + } + // 再次支付 调详情 获取信息 + this.getOrderDetail() + }, mounted() { setTimeout(() => { // eslint-disable-next-line no-undef @@ -235,6 +287,9 @@ export default { // this.underWrite.orderAmount = this.trialList[0].prem document.body.style.backgroundColor = '#fff' window.appCallBack = this.appCallBack + + // 不在微信环境下 + // if (!this.isWeixin) { // 获取银行卡 this.getBankList() // this.getOrderDetail() @@ -246,11 +301,13 @@ export default { // } else { // 再次支付 调详情 获取信息 this.getOrderDetail() - - this.getPayTemp() // this.underWriteData = JSON.parse(window.localStorage.getItem('underWriteData')) // } // console.log('--自核结果--支付信息:', JSON.stringify(this.underWriteData)) + this.getPayTemp() + + + // } }, beforeRouteLeave(to, from, next) { document.body.style.backgroundColor = '' @@ -394,26 +451,48 @@ export default { console.log('getOrderDetail', res) if (res.result == '0') { this.orderStatus = res.orderDTO.orderInfoDTO.orderStatus + try { + if (this.noEdit) { + if (res.orderDTO.paymentDTO.cardBookType == '3') { + this.radio = '3' + } else { + this.radio = '' + } + } + } catch (e) { + //TODO handle the exception + } this.$toast.clear() console.log(res.orderDTO.orderAccountDTO.bankCode) this.underWriteData = { appntName: res.orderDTO.insuredDTOs[0].riskDTOLst[0].riskName, name: res.orderDTO.appntDTO.name, - bankCode: res.orderDTO.orderAccountDTO.cardBookCode, - bankName: res.orderDTO.orderAccountDTO.bankCode, - cardBookCode: res.orderDTO.orderAccountDTO.cardBookCode, + // bankName: res.orderDTO.orderAccountDTO.bankCode, + // bankCode: res.orderDTO.orderAccountDTO.cardBookCode, + // cardBookCode: res.orderDTO.orderAccountDTO.cardBookCode, + idType: res.orderDTO.appntDTO.idType, orderAmount: res.orderDTO.orderInfoDTO.orderAmount, orderNo: res.orderDTO.orderAccountDTO.orderNo, result: '', resultMessage: '交易处理成功', uwResult: '02' } - this.bankListName = res.orderDTO.orderAccountDTO.bankName - // window.localStorage.setItem('underWriteData', JSON.stringify(underWriteData)) + // this.bankListName = res.orderDTO.orderAccountDTO.bankName + this.underWriteData.bankCode = + res.orderDTO.orderAccountDTO.cardBookCode !== null ? res.orderDTO.orderAccountDTO.cardBookCode : this.$route.query.bankCode + this.underWriteData.bankName = res.orderDTO.orderAccountDTO.bankCode !== null ? res.orderDTO.orderAccountDTO.bankCode : this.$route.query.bankName + this.underWriteData.cardBookCode = + res.orderDTO.orderAccountDTO.cardBookCode !== null ? res.orderDTO.orderAccountDTO.cardBookCode : this.$route.query.bankCode + this.bankListName = res.orderDTO.orderAccountDTO.bankName !== null ? res.orderDTO.orderAccountDTO.bankName : this.$route.query.bankListName + + // if (this.isWeixin) { + // this.pay() + // } } else { this.underWriteData = { accountName: '', appntName: '', + idType: '', bankCode: '', bankName: '', cardBookCode: '', @@ -429,35 +508,35 @@ export default { }) }, // 获取支付信息 - async underWrite() { - let data = { - platform: 'app', - type: '1', - orderDTO: { - orderInfoDTO: { - orderNo: window.localStorage.getItem('orderNo') - } - } - } - return underWrite(data) - // .then(res => { - // console.log(res); - // if (res.result == '0') { - // this.$toast.clear() - // if (res.uwResult == '33') { - // window.localStorage.setItem('uwResult', res.uwResult) - // window.localStorage.setItem('resultMessage', res.message) - // } else { - // window.localStorage.setItem('uwResult', res.uwResult) - // } - // this.underWriteData = res - // return true - // } else { - // return false - // this.$toast(res.resultMessage) - // } - // }) - }, + // async underWrite() { + // let data = { + // platform: 'app', + // type: '1', + // orderDTO: { + // orderInfoDTO: { + // orderNo: window.localStorage.getItem('orderNo') + // } + // } + // } + // return underWrite(data) + // // .then(res => { + // // console.log(res); + // // if (res.result == '0') { + // // this.$toast.clear() + // // if (res.uwResult == '33') { + // // window.localStorage.setItem('uwResult', res.uwResult) + // // window.localStorage.setItem('resultMessage', res.message) + // // } else { + // // window.localStorage.setItem('uwResult', res.uwResult) + // // } + // // this.underWriteData = res + // // return true + // // } else { + // // return false + // // this.$toast(res.resultMessage) + // // } + // // }) + // }, async pay() { let valid = await this.$validator.validate() console.log(valid) @@ -465,7 +544,6 @@ export default { console.log(this.$validator) return this.$toast(this.$validator.errors.all()[0]) } - switch (this.orderStatus) { case '56': case '57': @@ -486,7 +564,8 @@ export default { acceptInsurance() { let data = { orderNo: window.localStorage.getItem('orderNo'), - cardOrder: 'cardOrder' + cardOrder: 'cardOrder', + payType: this.radio } acceptInsurance(data).then(res => { console.log('----取支付参数结果:', JSON.stringify(res)) @@ -517,6 +596,9 @@ export default { window.localStorage.setItem('payStatus', res.payStatus) window.localStorage.setItem('payInfo', JSON.stringify(res)) this.underWriteData.bankListName = this.bankListName + if(this.radio == '3'){ + this.underWriteData.bankCode = '' + } localStorage['cardList-detail'] = JSON.stringify(this.underWriteData) let thisRef = this this.$nextTick(() => { @@ -529,44 +611,76 @@ export default { }, 100) }) } else { - this.$toast.clear() + if (!this.isWeixin) { + this.$toast.clear() + } else { + this.isLoading = false + } this.$toast(res.resultMessage) } }) }, // 点击支付 async payMent(flag) { - let data = { - orderDTO: { - orderInfoDTO: { - orderNo: window.localStorage.getItem('orderNo') - }, - orderAccountDTO: { - accountType: '0', - accountName: this.underWriteData.name, - bankName: this.bankListName, - bankCode: this.underWriteData.bankName, - cardBookType: '1', - cardBookCode: this.underWriteData.bankCode, - isAutoPay: '0', - isAutoRenewal: '1' + if (this.radio == '') { + let data = { + orderDTO: { + orderInfoDTO: { + orderNo: window.localStorage.getItem('orderNo') + }, + orderAccountDTO: { + accountType: '0', + accountName: this.underWriteData.name, + bankName: this.bankListName, + bankCode: this.underWriteData.bankName, + cardBookType: '1', + cardBookCode: this.underWriteData.bankCode, + isAutoPay: '0', + isAutoRenewal: '1' + } } } - } - this.$toast.loading({ - duration: 0, // 持续展示 toast - forbidClick: true, // 禁用背景点击 - loadingType: 'spinner', - message: '加载中……' - }) - /* - 支付之前要先保存银行账户信息 - */ - let res = await saveOrUpdateAccount(data) - // .then(res => { - console.log('res', res) - this.$toast.clear() - if (res.result == '0') { + this.$toast.loading({ + duration: 0, // 持续展示 toast + forbidClick: true, // 禁用背景点击 + loadingType: 'spinner', + message: '加载中……' + }) + /* + 支付之前要先保存银行账户信息 + */ + let res = await saveOrUpdateAccount(data) + // .then(res => { + console.log('res', res) + this.$toast.clear() + if (res.result == '0') { + this.$toast.loading({ + duration: 0, // 持续展示 toast + forbidClick: true, // 禁用背景点击 + loadingType: 'spinner', + message: '加载中……' + }) + + // if (!flag) { + // let rs = await this.underWrite() + + // if (rs.result != '0') { + // this.$toast.clear() + // return this.$toast(rs.resultMessage) + // } + + // if (rs.uwResult != '02') { + // return this.$toast(rs.message) + // } + // } + + this.acceptInsurance() + } else { + this.$toast(res.resultMessage) + this.isLoading = false + } + // }) + } else { this.$toast.loading({ duration: 0, // 持续展示 toast forbidClick: true, // 禁用背景点击 @@ -574,24 +688,59 @@ export default { message: '加载中……' }) - if (!flag) { - let rs = await this.underWrite() + // if (!flag) { + // let rs = await this.underWrite() - if (rs.result != '0') { - this.$toast.clear() - return this.$toast(rs.resultMessage) - } + // if (rs.result != '0') { + // this.$toast.clear() + // return this.$toast(rs.resultMessage) + // } - if (rs.uwResult != '02') { - return this.$toast(rs.message) - } - } + // if (rs.uwResult != '02') { + // return this.$toast(rs.message) + // } + // } this.acceptInsurance() - } else { - this.$toast(res.resultMessage) } - // }) + }, + // 选择微信支付校验身份证类型 + vxVerify() { + if (this.underWriteData.idType != '1') { + this.$dialog + .confirm({ + message: '证件类型不是身份证,无法使用微信支付', + showCancelButton: false + }) + .then(() => { + this.radio = '' + }) + } + }, + async share() { + let valid = await this.$validator.validate() + console.log(valid) + if (true !== valid) { + console.log(this.$validator) + return this.$toast(this.$validator.errors.all()[0]) + } + let shareName = this.underWriteData.name + localStorage.name = this.underWriteData.name + localStorage.bankName = this.underWriteData.bankName + localStorage.bankCode = this.underWriteData.bankCode + localStorage.bankListName = this.bankListName + console.log(this.underWriteData.bankName, this.underWriteData.bankCode, this.bankListName, this.underWriteData.name) + let url = location.origin + '/#/cardList/pay?orderNo=' + localStorage.orderNo + '&token=' + localStorage.token + console.log(url) + EWebBridge.webCallAppInJs('bridge', { + flag: 'share', + extra: { + title: `国富人寿卡单投保(${shareName})付款`, + content: '付款进行', + url: url, + img: this.$assetsUrl + 'images/logo.png' + } + }) } } } @@ -602,36 +751,12 @@ export default { * { box-sizing: border-box; } -.oi { - font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑'; - font-weight: 700; - font-style: normal; - color: #666666; -} -.money { - display: flex; - width: 100%; - align-items: center; - justify-content: space-between; - z-index: 100; - background: white; - height: 40px; - overflow: hidden; - > div:nth-of-type(1) { - display: flex; - align-items: center; - img { - width: 33px; - height: 32px; - } - span { - font-size: 14px; - } - } - > div:nth-of-type(2) { - display: flex; - align-items: center; - } +.vximg { + width: 23px; + height: 23px; + padding-left: 13px; + padding-right: 3px; + box-sizing: content-box; } diff --git a/src/views/ebiz/cardList/PayResult.vue b/src/views/ebiz/cardList/PayResult.vue index 26e9f0381..26e0dd0eb 100644 --- a/src/views/ebiz/cardList/PayResult.vue +++ b/src/views/ebiz/cardList/PayResult.vue @@ -14,7 +14,7 @@ - + -
- 返回首页 -
-
- 重新支付 - 返回首页 -
+ +