Authored by 邱骏

Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop

... ... @@ -9,6 +9,10 @@ import Notice from './notice';
import Category from './category';
export default [
{
path: '/xianyu',
redirect: { name: 'ChannelPage' },
},
...Order,
...Common,
...List,
... ...
... ... @@ -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) {
... ...
... ... @@ -8,7 +8,7 @@
<ProductInfo class="product-info" :data="product"></ProductInfo>
<YohoButton :txt="txt" class="btn-class" @on-click="onClick"></YohoButton>
<YohoButton :txt="txt" class="btn-class" @click="onClick"></YohoButton>
<div class="info">
<div class="item" @click="goPublish">继续发布</div>
... ...
... ... @@ -222,6 +222,12 @@ export default function() {
return this.$api.get('/api/order/goods', {
orderCode
});
},
async fetchOrderStatus(ctx, { orderCode }) {
return this.$api.get('/api/order/status', {
orderCode
});
}
},
getters: {},
... ...
... ... @@ -306,7 +306,14 @@ module.exports = {
'/api/order/goods': {
ufo: true,
auth: true,
api: 'ufo.buyerOrder.goodsDetail',
api: 'ufo.order.goodsDetail',
params: {}
},
'/api/order/status': {
ufo: true,
auth: true,
api: 'ufo.order.payDetail',
params: {}
},
... ...