|
|
export default function() {
|
|
|
return {
|
|
|
namespaced: true,
|
|
|
state: {
|
|
|
entryOrder: {
|
|
|
page: 1,
|
|
|
pageSize: 10,
|
|
|
pagetotal: 0,
|
|
|
list: [], // 订单列表
|
|
|
pullUpload: true,
|
|
|
},
|
|
|
notEntryOrder: {
|
|
|
page: 1,
|
|
|
pageSize: 10,
|
|
|
pagetotal: 0,
|
|
|
list: [], // 订单列表
|
|
|
pullUpload: true,
|
|
|
},
|
|
|
},
|
|
|
mutations: {
|
|
|
setEntryOrder(state, res) {
|
|
|
let { page, pagetotal, data = [] } = res;
|
|
|
|
|
|
state.entryOrder.page = ++page;
|
|
|
state.entryOrder.pagetotal = pagetotal;
|
|
|
state.entryOrder.list = state.entryOrder.list.concat(data);
|
|
|
|
|
|
// 分页结束
|
|
|
if (page > pagetotal) {
|
|
|
state.entryOrder.pullUpload = false;
|
|
|
}
|
|
|
},
|
|
|
setNotEntryOrder(state, res) {
|
|
|
let { page, pagetotal, data = [] } = res;
|
|
|
|
|
|
state.notEntryOrder.page = ++page;
|
|
|
state.notEntryOrder.pagetotal = pagetotal;
|
|
|
state.notEntryOrder.list = state.entryOrder.list.concat(data);
|
|
|
|
|
|
// 分页结束
|
|
|
if (page > pagetotal) {
|
|
|
state.notEntryOrder.pullUpload = false;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
getters: {
|
|
|
// scroll 组件参数,是否触发上拉事件
|
|
|
pullUpload: state =>
|
|
|
state.entryOrder.pullUpload || state.notEntryOrder.pullUpload,
|
|
|
orderList: state => {
|
|
|
const {
|
|
|
entryOrder: { list: entryOrderList },
|
|
|
notEntryOrder: { list: notEntryOrderList },
|
|
|
} = state;
|
|
|
|
|
|
return entryOrderList.concat(notEntryOrderList);
|
|
|
},
|
|
|
},
|
|
|
actions: {
|
|
|
async fetchEntryOrderList(
|
|
|
{
|
|
|
commit,
|
|
|
state: { entryOrder },
|
|
|
},
|
|
|
params,
|
|
|
) {
|
|
|
const { page } = entryOrder;
|
|
|
const { type = 1 } = params;
|
|
|
const res = await this.$api.get('/api/ufo/seller/entryPrdList', {
|
|
|
page,
|
|
|
type: +type,
|
|
|
});
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
commit('setEntryOrder', res.data);
|
|
|
}
|
|
|
},
|
|
|
async fetchNotEntryOrderList(
|
|
|
{
|
|
|
commit,
|
|
|
state: { notEntryOrder },
|
|
|
},
|
|
|
params,
|
|
|
) {
|
|
|
const { page } = notEntryOrder;
|
|
|
const { type = 1 } = params;
|
|
|
const res = await this.$api.get('/api/ufo/seller/notEntryPrdList', {
|
|
|
page,
|
|
|
type: +type,
|
|
|
});
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
commit('setEntryOrder', res.data);
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
} |
...
|
...
|
|