diff --git a/pages/goods/cashier/index.vue b/pages/goods/cashier/index.vue
index 0805eb82..e53d7a5c 100644
--- a/pages/goods/cashier/index.vue
+++ b/pages/goods/cashier/index.vue
@@ -32,7 +32,7 @@
确认支付
- 暂不支付
+ 暂不支付
@@ -108,6 +108,21 @@
});
PayOrderApi.getOrder(this.orderId).then(res => {
// TODO 芋艿:如果已支付,则跳转回
+ if (res.data.status === 10) {
+ uni.showToast({
+ title: '支付成功'
+ })
+ this.goReturnUrl('success');
+ uni.hideLoading();
+ return;
+ } else if (res.data.status === 20) {
+ uni.showToast({
+ title: '无法支付,原因:订单已关闭'
+ })
+ this.goReturnUrl('close');
+ uni.hideLoading();
+ return;
+ }
console.log(res)
this.payPrice = res.data.price
@@ -374,7 +389,6 @@
// #endif
break;
}
-
}).catch(err => {
uni.hideLoading();
return that.$util.Tips({
@@ -409,21 +423,26 @@
*/
getPayReturnUrl() {
// #ifdef H5
- return location.port
- ? location.protocol + '//' + location.hostname + ':' + location.port + '/pages/goods/cashier/index?order_id=' + this.orderId
- : location.protocol + '//' + location.hostname + '/pages/goods/cashier/index?order_id=' + this.orderId;
- // #endif
+ return location.href
+ // #endif
// #ifdef APP-PLUS
- return '/pages/goods/order_details/index?order_id=' + this.orderId;
+ return '/pages/goods/order_details/index?order_id=' + this.orderId + '&returnUrl=' + this.returnUrl;
// #endif
return '';
},
/**
* 回到业务的 URL
+ *
+ * @param payResult 支付结果
+ * ① success:支付成功
+ * ② cancel:取消支付
+ * ③ close:支付已关闭
*/
- goReturnUrl() {
+ goReturnUrl(payResult) {
uni.reLaunch({
- url: this.returnUrl
+ url: this.returnUrl.indexOf('?') >= 0
+ ? this.returnUrl + '&payResult=' + payResult
+ : this.returnUrl + '?payResult=' + payResult
})
},
}
diff --git a/pages/order_details/index.vue b/pages/order_details/index.vue
index 7173f7d8..5affdf56 100644
--- a/pages/order_details/index.vue
+++ b/pages/order_details/index.vue
@@ -425,8 +425,9 @@
* 打开支付组件
*/
goPay() {
+ const returnUrl = '/pages/order_pay_status/index?order_id=' + this.orderInfo.id;
uni.navigateTo({
- url: `/pages/goods/cashier/index?order_id=${this.orderInfo.payOrderId}&from_type=order`
+ url: `/pages/goods/cashier/index?order_id=${this.orderInfo.payOrderId}&returnUrl=${returnUrl}`
})
},
/**
diff --git a/pages/order_pay_status/index.vue b/pages/order_pay_status/index.vue
index 268cea27..97f03ca8 100644
--- a/pages/order_pay_status/index.vue
+++ b/pages/order_pay_status/index.vue
@@ -16,7 +16,7 @@
下单时间
{{ order_pay_info.createTime ? formatDate(order_pay_info.createTime) : '-' }}
-
+
支付方式
{{ order_pay_info.payChannelName }}
@@ -27,7 +27,10 @@
失败原因
- {{ msg || '取消支付' }}
+ 获取支付结果失败,请稍后刷新
+ 支付已关闭
+ 取消支付
+ 未知原因
@@ -63,7 +66,7 @@
payStatus: true,
},
status: 0,
- msg: ''
+ payResult: ''
};
},
computed: mapGetters(['isLogin']),
@@ -92,7 +95,7 @@
});
}
this.orderId = options.order_id;
- this.msg = options.msg || '';
+ this.payResult = options.payResult;
this.getOrderPayInfo();
},
methods: {
diff --git a/pages/users/order_confirm/index.vue b/pages/users/order_confirm/index.vue
index b91b9dd0..77340d66 100644
--- a/pages/users/order_confirm/index.vue
+++ b/pages/users/order_confirm/index.vue
@@ -337,8 +337,9 @@
...this.getSettlementReqVO(),
mark: this.mark,
}).then(res => {
+ const returnUrl = '/pages/order_pay_status/index?order_id=' + res.data.id;
uni.navigateTo({
- url: `/pages/goods/cashier/index?order_id=${res.data.payOrderId}&from_type=order`
+ url: `/pages/goods/cashier/index?order_id=${res.data.payOrderId}&returnUrl=${returnUrl}`
});
}).catch(err => {
uni.hideLoading();
diff --git a/pages/users/order_list/index.vue b/pages/users/order_list/index.vue
index 1c4b2b90..3745ec45 100644
--- a/pages/users/order_list/index.vue
+++ b/pages/users/order_list/index.vue
@@ -217,8 +217,9 @@
* 打开支付组件
*/
goPay(id, payOrderId) {
+ const returnUrl = '/pages/order_pay_status/index?order_id=' + id;
uni.navigateTo({
- url: `/pages/goods/cashier/index?order_id=${payOrderId}&from_type=order`
+ url: `/pages/goods/cashier/index?order_id=${payOrderId}&returnUrl=${returnUrl}`
})
},
/**