Merge branch 'feature/GFRS-2215【待完成】重新投保' into dev

This commit is contained in:
pangxingyue
2021-03-25 19:47:55 +08:00
3 changed files with 393 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
<!-- <!--
* @Author: PangXingYue * @Author: PangXingYue
* @Date: 2021-03-23 17:07:03 * @Date: 2021-03-23 17:07:03
* @LastEditTime: 2021-03-24 18:23:20 * @LastEditTime: 2021-03-25 19:03:38
* @LastEditors: PangXingYue * @LastEditors: PangXingYue
* @Description: * @Description:
* @FilePath: \ebiz-h5\src\components\ebiz\insureAgain\ProgressBar.vue * @FilePath: \ebiz-h5\src\components\ebiz\insureAgain\ProgressBar.vue
@@ -52,13 +52,13 @@ export default {
url = 'InsureInformation'; url = 'InsureInformation';
break; break;
case 1: case 1:
url = 'productInformation'; url = 'ProductInformation';
break; break;
case 2: case 2:
url = 'notification'; url = 'Notification';
break; break;
case 3: case 3:
url = 'signConfirmation'; url = 'SignatureConfirmation';
break; break;
default: default:
url = 'InsureInformation'; url = 'InsureInformation';

View File

@@ -1,98 +1,414 @@
<template> <template>
<div class="payMent-container redRadioCheckbox">
<div> <div>
<van-cell-group> <van-cell-group>
<van-cell title="投保人" value="李磊" /> <van-cell title="投保人" :value="underWriteData.appntName" />
<van-cell title="支付金额" value="2,000.00" /> <van-cell title="支付金额" :value="underWriteData.orderAmount == undefined ? '' : `${underWriteData.orderAmount}元`" class="payMent-title" />
<van-cell value="2,000.00"> <van-cell-group class="flex align-items-c">
<template #title> <img :src="src" class="pl10" />
<img class="icon mr5" :src="src" /> <van-cell title="银行卡支付" clickable>
<span class="custom-title">银行卡支付</span> <!-- <van-checkbox v-model="checked" class="flex justify-content-fe"></van-checkbox> -->
</template> <van-radio-group v-model="radio" class="flex justify-content-fe">
<template #default> <van-radio name=""></van-radio>
<van-radio name="bank" v-model="checked" /> </van-radio-group>
</template>
</van-cell> </van-cell>
<van-cell value="2,000.00">
<template #title>
<img class="icon mr5" :src="vxSrc" />
<span class="custom-title">银行卡支付</span>
</template>
<template #default>
<van-radio disabled name="vx" v-model="checked" />
</template>
</van-cell>
<van-cell title="姓名" value="静静" />
<van-cell title="卡号" value="563353455325345345" />
<van-cell title="银行" value="交通银行" />
</van-cell-group> </van-cell-group>
<div class="action-bar"> <van-cell-group class="flex align-items-c">
<div class="btns"> <img :src="vxSrc" class="vximg" />
<van-button type="danger" v-no-more-click="1000" @click="backToList">返回可重新转保保单列表</van-button> <van-cell title="微信支付" clickable>
<van-button type="danger" v-no-more-click="1000" @click="nextStep">去支付</van-button> <van-radio-group v-model="radio" class="flex justify-content-fe">
<van-radio name="3" @click="vxVerify"></van-radio>
</van-radio-group>
</van-cell>
</van-cell-group>
<van-cell title="姓名" :value="underWriteData.accountName" v-if="radio == '' && !isWeixin" />
<van-cell title="卡号" :value="underWriteData.cardBookCode" v-if="radio == '' && !isWeixin" />
<van-cell title="银行" v-if="radio == '' && !isWeixin">
<!-- <van-icon slot="right-icon" name="search" style="line-height: inherit;" /> -->
<div class="flex align-items-c justify-content-fe">
<img :src="srcImg" class="imgItem mr10" />
<span>{{ underWriteData.bankName }}</span>
</div> </div>
</van-cell>
</van-cell-group>
<!-- 第三方支付所需表单 -->
<form ref="payForm" :action="formActionUrl" method="post">
<input name="TransSource" type="hidden" v-model="payParam.TransSource" />
<input name="TransDate" type="hidden" v-model="payParam.TransDate" />
<input name="TransTime" type="hidden" v-model="payParam.TransTime" />
<input name="TransSeq" type="hidden" v-model="payParam.TransSeq" />
<input name="Version" type="hidden" v-model="payParam.Version" />
<input name="RdSeq" type="hidden" v-model="payParam.RdSeq" />
<input name="PaymentCode" type="hidden" v-model="payParam.PaymentCode" />
<input name="PayType" type="hidden" v-model="payParam.PayType" />
<input name="SettleMode" type="hidden" v-model="payParam.SettleMode" />
<input name="ApplyEntity" type="hidden" v-model="payParam.ApplyEntity" />
<input name="Cur" type="hidden" v-model="payParam.Cur" />
<input name="OurAmount" type="hidden" v-model="payParam.OurAmount" />
<input name="FixUser" type="hidden" v-model="payParam.FixUser" />
<input name="Insurer" type="hidden" v-model="payParam.Insurer" />
<input name="CertType" type="hidden" v-model="payParam.CertType" />
<input name="CertNum" type="hidden" v-model="payParam.CertNum" />
<input name="OppBank" type="hidden" v-model="payParam.OppBank" />
<input name="OppAct" type="hidden" v-model="payParam.OppAct" />
<input name="OppActName" type="hidden" v-model="payParam.OppActName" />
<input name="CellPhone" type="hidden" v-model="payParam.CellPhone" />
<input name="ExpireDate" type="hidden" v-model="payParam.ExpireDate" />
<input name="Purpose" type="hidden" v-model="payParam.Purpose" />
<input name="Memo" type="hidden" v-model="payParam.Memo" />
<input name="Description" type="hidden" v-model="payParam.Description" />
<input name="SourceNotecode" type="hidden" v-model="payParam.SourceNotecode" />
<input name="ReturnURL" type="hidden" v-model="payParam.ReturnURL" />
<input name="NotifyURL" type="hidden" v-model="payParam.NotifyURL" />
<input name="SaleChannel" type="hidden" v-model="payParam.SaleChannel" />
<input name="ReqReserved1" type="hidden" v-model="payParam.ReqReserved1" />
<input name="ReqReserved2" type="hidden" v-model="payParam.ReqReserved2" />
<input name="ReqReserved3" type="hidden" v-model="payParam.ReqReserved3" />
<input name="ReqReserved4" type="hidden" v-model="payParam.ReqReserved4" />
<input name="ReqReserved5" type="hidden" v-model="payParam.ReqReserved5" />
<input name="S3Sign" type="hidden" v-model="payParam.S3Sign" />
</form>
</div> </div>
<!-- <van-button class="m-btn fr" type="danger" @click="submit">确定</van-button>
<van-button class="m-btn fr green" @click="reset">重置</van-button>-->
<div class="bg-white bottom-btn" v-if="radio == '' && !isWeixin">
<van-button type="danger" style="width: 50vw" @click="cancel" v-no-more-click="1000">返回投保单列表</van-button>
<van-button type="danger" style="width: 50vw" @click="payMent" v-no-more-click="1000" :disabled="payStatus == '1' || payStatus == '2' || payStatus == '8'"
>去支付</van-button
>
</div>
<div class="bg-white bottom-btn" v-if="radio == '3' && !isWeixin">
<van-button type="danger" style="width: 50vw" @click="payMent" v-no-more-click="1000" :disabled="payStatus == '1' || payStatus == '2' || payStatus == '8'"
>去支付</van-button
>
<van-button type="danger" style="width: 50vw" @click="share" v-no-more-click="1000">分享</van-button>
</div>
<!-- 分享到微信的页面loading -->
<Loading :isLoading="isLoading"></Loading>
</div> </div>
</template> </template>
<script> <script>
import { Radio } from 'vant' import { Cell, CellGroup, RadioGroup, Radio, Dialog } from 'vant'
import { acceptInsurance } from '@/api/ebiz/sale/sale'
import { payFlag, underWrite, getOrderDetail } from '@/api/ebiz/sale/sale'
import Loading from '@/components/ebiz/Loading'
import config from '@/config'
export default { export default {
name: 'InsureAgainPayment',
components: {
[Radio.name]: Radio
},
data() { data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return { return {
checked: 'bank', orderNo: '', //订单号
// 支付表单
formActionUrl: config.payUrl,
// 单选
radio: '',
// 银行卡支付图片地址 // 银行卡支付图片地址
src: this.$assetsUrl + 'images/cardImg.png', src: this.$assetsUrl + 'images/cardImg.png',
// 微信支付图片地址 // 微信支付图片地址
vxSrc: this.$assetsUrl + 'images/vxImg.png' vxSrc: this.$assetsUrl + 'images/vxImg.png',
// 核保数据
underWriteData: {},
srcImg: '',
payParam: {
TransSource: '', // 对接系统
TransDate: '', // 请求日期
TransTime: '', // 请求时间
TransSeq: '', // 时间戳
Version: '', // 版本号
RdSeq: '', // 指令流水号
PaymentCode: '', // 业务唯一号
PayType: '', // 交易类型
SettleMode: '', // 支付方式
ApplyEntity: '', // 业务发生机构
Cur: '', // 币种
OurAmount: '', // 金额
FixUser: '', // 实名认证标识
Insurer: '', // 对接系统
CertType: '', // 证件类型
CertNum: '', // 证件号码
OppBank: '', // 交易方银行
OppAct: '', // 交易方账号
OppActName: '', // 交易方名称
CellPhone: '', // 手机号码
ExpireDate: '', // 订单失效时间
Purpose: '', // 用途
Memo: '', // 备注
Description: '', // 描述
SourceNotecode: '', // 外部系统业务单据号
ReturnURL: '', // 页面跳转同步通知地址
NotifyURL: '', // 后台通知地址
SaleChannel: '', // 销售渠道
ReqReserved1: '', // 备用字段1
ReqReserved2: '', // 备用字段2
ReqReserved3: '', // 备用字段3
ReqReserved4: '', // 备用字段4
ReqReserved5: '', // 备用字段5
S3Sign: '', // 验签信息
tradeState: '' // 状态
},
gotPayParam: false, // 是否已正确获取支付参数,
payStatus: '', // 接口返回的支付状态
isWeixin, // 是否为微信环境
isLoading: false // 分享到微信后的页面loading
}
},
created() {
if (this.isWeixin) {
this.radio = '3'
this.isLoading = true
}
},
mounted() {
this.orderNo = window.localStorage.getItem('newOrderNo')
console.log('----保融form.action', config.payUrl)
document.body.style.backgroundColor = '#fff'
// 不在微信环境下
if (!this.isWeixin) {
if (localStorage.salelist == '1') {
// 第一次支付 调核保获取
this.underWrite().then(() => {
this.underWriteData = JSON.parse(window.localStorage.getItem('underWriteData'))
this.underWriteData.idType = window.localStorage.getItem('AppntidType')
this.srcImg = this.$assetsUrl + `images/bank/${JSON.parse(window.localStorage.getItem('underWriteData')).bankCode}.png`
})
} else {
// 再次支付 调详情 获取信息
this.twounderWrite()
// this.underWriteData = JSON.parse(window.localStorage.getItem('underWriteData'))
// this.srcImg = this.$assetsUrl + `images/bank/bank_${JSON.parse(window.localStorage.getItem('underWriteData')).bankCode}.png`
}
console.log('--自核结果--支付信息:', JSON.stringify(this.underWriteData))
} else {
let token = this.$route.query.token
let orderNo = this.$route.query.orderNo
localStorage.token = token
localStorage.orderNo = orderNo
this.payMent()
} }
}, },
methods: { methods: {
backToList() { getAcceptInsurance() {
let that = this
let data = {
orderNo: this.orderNo,
payType: this.radio
}
acceptInsurance(data).then(res => {
console.log('----取支付参数结果:', JSON.stringify(res))
// res = {'result':'0','resultMessage':'','content':null,'prtNo':'8186270000000008','payStatus':'4','amnt':'63700.00','appntName':'投保人','message':null,'brPayReturnData':{'result':'','resultMessage':'','content':null,'businessId':'1569125393518','businessNo':'8186270000000008','tradeSubType':'COMM','businessType':'SALE','systemType':'GF','money':63700,'businessSubType':'XDCB','thirdType':'0002','thirdName':null,'bankCode':'ABC','epayOrderNo':'1909221209536259999900','companyAccount':null,'tradeState':'TRADING','standardCode':'DEALING','standardMsg':null,'thirdOrderNo':null,'respRemark':null,'tradeTime':'2019-09-22T04:09:53.518+0000','description':'','version':'1','sourceNotecode':'8186270000000008','payType':'MIT01','expireDate':'20191010101010','transSeq':'20190922120953782','transSource':'MIT','applyEntity':'11860000','paymentCode':'8186270000000008','transDate':'20190922','rdSeq':'1909221209536259999900','settleMode':null,'cur':'CNY','transTime':'120953','ourAmount':63700,'fixUser':'1','insurer':'投保人','certType':'0','certNum':'110101199009210011','oppBank':'ABC','oppAct':'6228481200290317812','oppActName':'投保人','cellPhone':null,'purpose':null,'memo':null,'returnURL':'http://139.199.50.151/#/sale/payResult','notifyURL':'http://139.199.50.151:7000/api/v1/epay/epay/payResult','s3Sign':'e3f0581ec6b751337e8eca360a0746bc'}}
if (res.result == '0') {
// 1成 4支付中 2支付失败 8转批扣(无此情况)
this.payStatus = res.payStatus
if (this.payStatus == '1') {
this.$toast({ message: '当前投保单已支付成功,请返回列表页查询', duration: 5000 })
return
}
// 支付参数大小写转换
let keyMap = {}
for (let key in this.payParam) {
keyMap[key.toLowerCase()] = key
}
let paramKey
for (let rKey in res.brPayReturnData) {
if (keyMap.hasOwnProperty(rKey.toLowerCase())) {
paramKey = keyMap[rKey.toLowerCase()]
this.payParam[paramKey] = res.brPayReturnData[rKey]
}
}
console.log('----支付参数this.payParam:', JSON.stringify(this.payParam))
this.gotPayParam = true
this.$forceUpdate()
let thisRef = this
this.$nextTick(() => {
thisRef.$refs.payForm.submit() // 表单提交,发起支付,跳至收银台
})
window.localStorage.setItem('resMessage', res.resultMessage)
window.localStorage.setItem('payStatus', res.payStatus)
window.localStorage.setItem('payInfo', JSON.stringify(res))
} else {
if (!this.isWeixin) {
that.$toast.clear()
} else {
this.isLoading = false
}
that.$toast(res.resultMessage)
}
})
},
// 点击支付
async payMent() {
if (!this.isWeixin) {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
}
const res = await payFlag({ orderNo: this.orderNo })
console.dir(res)
if (res.content.payFlag == 'Y') {
this.getAcceptInsurance()
} else {
this.$toast(res.resultMessage)
setTimeout(() => {
this.$router.push({ path: '/sale/payResultFail' })
}, 2000)
}
},
// 取消支付
cancel() {
this.$toast.clear()
this.$jump({ this.$jump({
flag: 'h5', flag: 'h5',
extra: { extra: {
url: location.origin + `/#/insureAgain`, url: location.origin + '/#/sale/list',
forbidSwipeBack: '1', backToFirst: '1'
needRefresh: '1'
}, },
routerInfo: { path: `/insureAgain` } routerInfo: {
path: '/sale/list'
}
}) })
}, },
nextStep(){} // 再次支付
twounderWrite() {
let _this = this
getOrderDetail({ orderNo: window.localStorage.getItem('orderNo') }).then(res => {
console.log(res)
if (res.result == '0') {
this.$toast.clear()
console.log(res.orderDTO.orderAccountDTO.bankCode)
let underWriteData = {
accountName: res.orderDTO.orderAccountDTO.accountName,
appntName: res.orderDTO.appntDTO.name,
idType: res.orderDTO.appntDTO.idType,
bankCode: res.orderDTO.orderAccountDTO.bankCode,
bankName: res.orderDTO.orderAccountDTO.bankName,
cardBookCode: res.orderDTO.orderAccountDTO.cardBookCode,
orderAmount: res.orderDTO.orderInfoDTO.orderAmount,
orderNo: res.orderDTO.orderAccountDTO.orderNo,
result: '',
resultMessage: '交易处理成功',
uwResult: '02'
}
window.localStorage.setItem('underWriteData', JSON.stringify(underWriteData))
this.underWriteData = JSON.parse(window.localStorage.getItem('underWriteData'))
this.srcImg = this.$assetsUrl + `images/bank/${JSON.parse(window.localStorage.getItem('underWriteData')).bankCode}.png`
} else {
let underWriteData = {
accountName: '',
appntName: '',
idType: '',
bankCode: '',
bankName: '',
cardBookCode: '',
orderAmount: '',
orderNo: '',
result: '',
resultMessage: '交易处理失败',
uwResult: '00'
}
window.localStorage.setItem('underWriteData', JSON.stringify(underWriteData))
this.underWriteData = JSON.parse(window.localStorage.getItem('underWriteData'))
this.srcImg = this.$assetsUrl + `images/bank/${JSON.parse(window.localStorage.getItem('underWriteData')).bankCode}.png`
this.$toast(res.resultMessage)
}
})
},
// 获取支付信息
underWrite() {
let data = {
platform: 'app',
type: '1',
orderDTO: {
orderInfoDTO: {
orderNo: window.localStorage.getItem('orderNo')
}
}
}
return underWrite(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
if (res.uwResult == '02') {
// window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('underWriteData', JSON.stringify(res))
} else if (res.uwResult == '33') {
window.localStorage.setItem('underWriteData', JSON.stringify(res))
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
} else {
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('underWriteData', JSON.stringify(res))
// window.localStorage.setItem('resultMessage', res.resultMessage)
}
} else {
this.$toast(res.resultMessage)
}
})
},
// 选择微信支付校验身份证类型
vxVerify() {
if (this.underWriteData.idType != '1') {
Dialog.confirm({
message: '证件类型不是身份证,无法使用微信支付',
showCancelButton: false
}).then(() => {
this.radio = ''
})
}
},
share() {
let shareName = this.underWriteData.appntName
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
title: `国富人寿电子投保单(${shareName})付款`,
content: '付款进行',
url: location.origin + '/#/sale/payMent?orderNo=' + localStorage.orderNo + '&token=' + localStorage.token,
img: this.$assetsUrl + 'images/logo.png'
}
})
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Dialog.name]: Dialog,
[Loading.name]: Loading
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .van-cell__title { @import '@/assets/sass/variables.scss';
display: flex; .payMent-title {
align-items: center; .van-cell__value {
} /deep/ span {
color: $red;
.icon { }
width: 20px;
}
/deep/ .van-radio {
justify-content: flex-end;
}
.action-bar {
position: fixed;
bottom: 0;
background: #fff;
width: 100vw;
}
.btns {
display: flex;
/deep/ .van-button--danger {
flex: 1;
} }
} }
.imgItem {
width: 20px;
height: 20px;
}
.vximg {
width: 25px;
height: 25px;
padding-left: 13px;
padding-right: 3px;
}
</style> </style>

View File

@@ -1107,10 +1107,10 @@ export default {
this.$jump({ this.$jump({
flag: 'h5', flag: 'h5',
extra: { extra: {
url: location.origin + '/#/sale/payMent' url: location.origin + '/#/insureAgain/Payment'
}, },
routerInfo: { routerInfo: {
path: '/sale/payMent' path: '/insureAgain/PayMent'
} }
}) })
}, },