...
|
...
|
@@ -18,17 +18,18 @@ |
|
|
|
|
|
import config from 'config';
|
|
|
import { UserType } from 'store/order/order-confirm';
|
|
|
import YohoButton from '../../components/button';
|
|
|
import { createNamespacedHelpers } from 'vuex';
|
|
|
|
|
|
const { mapActions: mapOrderAction } = createNamespacedHelpers('order/orderConfirm');
|
|
|
|
|
|
export default {
|
|
|
name: 'PayPage',
|
|
|
components: { YohoButton },
|
|
|
props: ['orderCode', 'payParams', 'extra'],
|
|
|
data() {
|
|
|
return {
|
|
|
count: 60,
|
|
|
page: null,
|
|
|
timer: null
|
|
|
timer: null,
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
...
|
...
|
@@ -41,6 +42,12 @@ export default { |
|
|
if (this.extra) {
|
|
|
this.page = JSON.parse(this.extra || '{}');
|
|
|
}
|
|
|
|
|
|
this.check().catch((result) => {
|
|
|
if (result?.data?.statusDetail?.leftTime < 60) {
|
|
|
this.count = result?.data?.statusDetail?.leftTime;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
beforeRouteLeave(to, from, next) {
|
|
|
if (this.timer) {
|
...
|
...
|
@@ -50,6 +57,7 @@ export default { |
|
|
next();
|
|
|
},
|
|
|
methods: {
|
|
|
...mapOrderAction(['fetchOrderStatus']),
|
|
|
openPay() {
|
|
|
const url = config.alipayUrl + '?' + this.payParams;
|
|
|
|
...
|
...
|
@@ -63,15 +71,29 @@ export default { |
|
|
this.count = this.count - 1;
|
|
|
this.setCount();
|
|
|
}, 1000);
|
|
|
|
|
|
if (this.count % 5 === 0) {
|
|
|
this.check().catch(() => {});
|
|
|
}
|
|
|
} else {
|
|
|
this.goOk();
|
|
|
}
|
|
|
},
|
|
|
check() {
|
|
|
|
|
|
return this.fetchOrderStatus({
|
|
|
orderCode: this.orderCode
|
|
|
}).then((result) => {
|
|
|
if (result?.data?.statusDetail?.status === 1) {
|
|
|
this.$router.replace(this.page?.forward);
|
|
|
} else {
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
goOk() {
|
|
|
this.$router.replace(this.page?.forward);
|
|
|
async goOk() {
|
|
|
this.check().catch(() => {
|
|
|
this.goDetail();
|
|
|
});
|
|
|
},
|
|
|
goDetail() {
|
|
|
switch (this.page.type) {
|
...
|
...
|
|