支付结果

msb_prod
ch 2 years ago
parent b09fe7ff15
commit 2825d80ea1

@ -2,7 +2,7 @@
* @Author: ch
* @Date: 2022-07-08 11:46:30
* @LastEditors: ch
* @LastEditTime: 2022-07-08 18:21:00
* @LastEditTime: 2022-07-09 15:43:47
* @Description: file content
-->
<template>
@ -44,7 +44,8 @@ const ENV = process.env;
value : 'alipay'
}
],
orderInfo : {}
orderInfo : {},
payOrderNo : this.$route.query.payOrderNo
}
},
onLoad() {
@ -53,11 +54,14 @@ const ENV = process.env;
methods: {
getOrderInfo (){
uni.request({
url: `${process.env.VUE_APP_BASE_URL}/payCenter/payCenter/prepayOrder/prepay000010`,
url: `${process.env.VUE_APP_BASE_URL}/payCenter/payCenter/prepayOrder/${this.payOrderNo}`,
success:(res)=> {
let data = res.data.data;
if(res.data.code === 'SUCCESS'){
this.orderInfo = data
}else{
alert(data.message);
uni.navigateBack();
}
},
fail(){
@ -86,7 +90,7 @@ const ENV = process.env;
success:(res)=>{
let data = res.data.data;
if(res.data.code === 'SUCCESS'){
window.location.href = data.payDataInfo.h5Url;
window.location.replace(data.payDataInfo.h5Url);
}
}
@ -105,7 +109,7 @@ const ENV = process.env;
success:(res)=>{
let data = res.data.data;
if(res.data.code === 'SUCCESS'){
window.location.href = data.payDataInfo.payUrl;
window.location.replace(data.payDataInfo.payUrl);
}
}

@ -2,31 +2,70 @@
* @Author: ch
* @Date: 2022-07-08 15:30:29
* @LastEditors: ch
* @LastEditTime: 2022-07-08 17:00:04
* @LastEditTime: 2022-07-09 15:39:22
* @Description: file content
-->
<template>
<view>
<template v-if="status === 'await'">
<view class="icon icon__await"></view>
<view class="title">支付成功</view>
<view class="title">支付结果查询中</view>
</template>
<template v-else-if="status === 'fail'">
<view class="icon icon__fail"></view>
<view class="title">支付成功</view>
<view class="title">{{errorMsg}}</view>
</template>
<template v-else>
<view class="icon icon__success"></view>
<view class="title">支付成功</view>
</template>
<view class="btn">返回商</view>
<view class="btn" @click="back"></view>
</view>
</template>
<script>
const ENV = process.env;
export default {
data(){
return {
status : 'success'
status : 'await',
payOrderNo : this.$route.query.payOrderNo,
payStatus : {
await : [0,1],
success : [3],
fail : [2,4,5,6]
},
errorMsg : ''
}
},
mounted(){
this.getOrderInfo();
},
methods:{
getOrderInfo(){
uni.request({
url : `${ENV.VUE_APP_BASE_URL}/payCenter/payCenter/payResult/${this.payOrderNo}`,
method : 'GET',
success : (res) =>{
let data = res.data.data;
if(res.data.code === 'SUCCESS'){
if(this.payStatus.success.includes(data.payStatus)){
this.status = 'success';
}else if(this.payStatus.await.includes(data.payStatus)){
this.status = 'await';
setTimeout(this.getOrderInfo,3000);
}else{
this.status = 'fail';
this.errorMsg = data.payStatusText
}
}else{
this.status = 'fail';
this.errorMsg = '支付结果出错,请联系商家';
}
}
})
},
back(){
uni.navigateBack();
}
}
}

Loading…
Cancel
Save