95 lines
2.4 KiB
Vue
95 lines
2.4 KiB
Vue
<template>
|
|
<view>
|
|
<Header leftTitle="H5支付" leftPathType="switchTab" leftPath="/pages/mine/mine" />
|
|
<view class="payment_processing_warp">
|
|
<up-loading-icon :show="loadingShow" color="#009A4F"></up-loading-icon>
|
|
<view class="payment_processing_msg">{{ orderMsg }}</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import Header from '@/components/header.vue';
|
|
import { queryResult } from '@/api/payment.js'
|
|
|
|
export default {
|
|
components: {
|
|
Header,
|
|
},
|
|
data() {
|
|
return {
|
|
orderNum: 0,// 支付处理ID
|
|
paymentLink: null,// H5支付处理页面
|
|
orderMsg: "支付处理中...",
|
|
loadingShow: true,
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
console.log("options", options);
|
|
this.orderNum = options.orderNum || 0;
|
|
const paymentLink = options.link;
|
|
if (paymentLink && paymentLink !== "null") {
|
|
this.paymentLink = paymentLink; // 解码并设置支付链接
|
|
uni.navigateTo({
|
|
url: `/pages/other_package/zfb_payment/zfb_payment?link=${paymentLink}` // 假设有一个专门的支付页面来处理支付链接
|
|
});
|
|
}
|
|
},
|
|
onShow() {
|
|
if (this.orderNum) {
|
|
this.getOrderById();
|
|
}
|
|
},
|
|
methods: {
|
|
async getOrderById() {
|
|
const params = {
|
|
orderNum: this.orderNum,
|
|
};
|
|
console.log("params", params);
|
|
const resp = await queryResult(params);
|
|
console.log("queryResult resp", resp);
|
|
if (resp && resp.bizcode === 100) {
|
|
const data = resp.data || {};
|
|
if (data.state === 0) { // 订单不存在
|
|
this.loadingShow = false;
|
|
this.orderMsg = "订单不存在";
|
|
} else if (data.state === 1) {// 支付中
|
|
this.orderMsg = "支付处理中...";
|
|
} else if (data.state === 2) {// 支付成功
|
|
this.loadingShow = false;
|
|
this.orderMsg = "支付成功";
|
|
this.jumpWayOk();
|
|
} else if (data.state === 3) {// 支付失败
|
|
this.loadingShow = false;
|
|
this.orderMsg = "支付失败";
|
|
this.jumpWayError();
|
|
}
|
|
}
|
|
},
|
|
// 跳转到支付成功页面
|
|
jumpWayOk() {
|
|
uni.navigateTo({
|
|
url: "/pages/order_package/order_submit_ok/order_submit_ok",
|
|
})
|
|
},
|
|
// 跳转到支付失败页面
|
|
jumpWayError() {
|
|
uni.navigateTo({
|
|
url: "/pages/order_package/order_submit_error/order_submit_error",
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.payment_processing_warp {
|
|
text-align: center;
|
|
margin-top: 200rpx;
|
|
|
|
.payment_processing_msg {
|
|
margin-top: 20rpx;
|
|
}
|
|
}
|
|
</style>
|