Authored by 张文文

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

... ... @@ -53,7 +53,6 @@ export default {
store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
mounted() {
console.log("-------------------", this.$route.params);
const { owner, status } = this.$route.params;
this.fetchOrderList({ owner, status });
},
... ... @@ -63,6 +62,11 @@ export default {
const { owner, status } = this.$route.params;
this.fetchOrderList({ owner, status });
}
},
watch: {
orderList(v) {
console.log("----------orderList---------", v);
}
}
};
</script>
... ...
... ... @@ -11,19 +11,19 @@ export default function() {
currentStatus: 1,
},
mutations: {
setOrderList(state, res = {}) {
let { page, pagetotal, data = [] } = res;
setOrderList(state, { fetchData, isStatusChange }) {
let { page, pagetotal, data = [] } = fetchData;
state.page = ++page;
state.pagetotal = pagetotal;
state.orderList = state.orderList.concat(data);
state.orderList = isStatusChange ? data : state.orderList.concat(data);
// 分页结束
if (page > pagetotal) {
state.pullUpLoad = false;
}
},
setOrderState(state, currentStatus) {
setOrderStatus(state, currentStatus) {
state.currentStatus = +currentStatus;
},
},
... ... @@ -40,14 +40,15 @@ export default function() {
async fetchOrderList(
{
commit,
state: { page },
state: { page, currentStatus },
},
{ owner, status = 1 } = {},
) {
const isStatusChange = currentStatus !== +status;
const res = await this.$api.get('/api/order/list', {
tabType: owner,
type: status,
page,
page: isStatusChange ? 1 : page,
limit: 5,
// Todo 删除
... ... @@ -55,8 +56,8 @@ export default function() {
});
if (res.code === 200) {
commit('setOrderList', res.data);
commit('setOrderState', status);
commit('setOrderList', { fetchData: res.data, isStatusChange });
commit('setOrderStatus', status);
}
},
},
... ...