Authored by lea guo

订单列表状态

... ... @@ -4,9 +4,7 @@
<ul class="list-wrapper">
<li
:class="
currentStatus === statusInfo.value
? 'list-item active'
: 'list-item'
status === statusInfo.value ? 'list-item active' : 'list-item'
"
v-for="(statusInfo, i) in statusList"
:key="i"
... ... @@ -39,12 +37,15 @@ export default {
Scroll
},
computed: {
...mapState(["currentStatus"]),
...mapState(["currentStatus", "routeParamStatus"]),
statusList: function() {
const { owner } = this.$route.params;
return owner === ownType.BUY
? buyerOrderStatusList
: sellerOrderStatusList;
},
status() {
return this.currentStatus || this.routeParamStatus;
}
},
methods: {
... ...
... ... @@ -79,7 +79,7 @@ export default {
asyncData({ store, router }) {
const { status } = router.params;
store.commit(`${STORE_PATH}/resetData`);
store.commit(`${STORE_PATH}/setOrderStatus`, status);
store.commit(`${STORE_PATH}/setRouteParamStatus`, status);
return store.dispatch(`${STORE_PATH}/fetchOrderList`, router.params);
},
... ...
... ... @@ -7,7 +7,8 @@ const initailData = () => ({
pullUpLoad: true,
// 当前查询订单状态
currentStatus: 1,
currentStatus: null,
routeParamStatus: null,
isShowEmpty: false,
});
... ... @@ -37,9 +38,10 @@ export default function() {
state.isShowEmpty = state.orderList.length === 0;
},
setOrderStatus(state, currentStatus) {
if (currentStatus) {
state.currentStatus = +currentStatus;
}
state.currentStatus = +currentStatus;
},
setRouteParamStatus(state, status = 1) {
state.routeParamStatus = +status;
},
resetPartialData(state) {
state.page = 1;
... ... @@ -70,14 +72,14 @@ export default function() {
async fetchOrderList(
{
commit,
state: { page, currentStatus },
state: { page, currentStatus, routeParamStatus },
},
param = {},
) {
const { owner, status } = param;
const { owner } = param;
const res = await this.$api.get('/api/order/list', {
tabType: owner,
type: status || currentStatus,
type: currentStatus || routeParamStatus,
page,
});
... ...