...
|
...
|
@@ -55,29 +55,44 @@ export default function() { |
|
|
orderState.pullUpLoad = false;
|
|
|
}
|
|
|
},
|
|
|
filterOrderList(state, {
|
|
|
orderCode,
|
|
|
owner = ownType.SELL,
|
|
|
status = 1
|
|
|
}) {
|
|
|
filterOrderList(state, { orderCode, owner = ownType.SELL, status = 1 }) {
|
|
|
let orderState = state.orderListByType[orderStatusKey(owner, status)];
|
|
|
|
|
|
|
|
|
orderState.orderList = orderState.orderList.filter(
|
|
|
order => order.orderCode !== orderCode,
|
|
|
);
|
|
|
orderState.isShowEmpty = orderState.orderList.length === 0;
|
|
|
},
|
|
|
resetOrderListItem(state, { owner, status = 1, order }) {
|
|
|
let orderState = state.orderListByType[orderStatusKey(owner, status)];
|
|
|
|
|
|
orderState.orderList = orderState.orderList.map(item => {
|
|
|
if (item.orderCode === order.orderCode) {
|
|
|
const {
|
|
|
buttons = [],
|
|
|
statusDetail: { statuStr = '' } = {},
|
|
|
} = order;
|
|
|
|
|
|
// 详情接口取消时leftTime任返回值
|
|
|
const isIncludeDeleteAction = !!buttons.find(btn => {
|
|
|
return btn.code === 'del_order';
|
|
|
});
|
|
|
|
|
|
let { leftTime } = item;
|
|
|
|
|
|
leftTime = isIncludeDeleteAction ? 0 : leftTime;
|
|
|
item = { ...item, buttons, statuStr, leftTime };
|
|
|
}
|
|
|
return item;
|
|
|
});
|
|
|
},
|
|
|
setOrderStatus(state, currentStatus) {
|
|
|
state.currentStatus = +currentStatus;
|
|
|
},
|
|
|
setRouteParamStatus(state, status = 1) {
|
|
|
state.routeParamStatus = +status;
|
|
|
},
|
|
|
resetPartialData(state, {
|
|
|
owner = ownType.SELL,
|
|
|
status = 1
|
|
|
}) {
|
|
|
resetPartialData(state, { owner = ownType.SELL, status = 1 }) {
|
|
|
Object.assign(state.orderListByType[orderStatusKey(owner, status)], {
|
|
|
page: 1,
|
|
|
orderList: [],
|
...
|
...
|
@@ -85,10 +100,7 @@ export default function() { |
|
|
pullUpLoad: true,
|
|
|
});
|
|
|
},
|
|
|
resetData(state, {
|
|
|
owner = ownType.SELL,
|
|
|
status = 1
|
|
|
}) {
|
|
|
resetData(state, { owner = ownType.SELL, status = 1 }) {
|
|
|
const orderListState = initialOrderState();
|
|
|
|
|
|
state.orderListByType[orderStatusKey(owner, status)] = orderListState;
|
...
|
...
|
@@ -104,13 +116,10 @@ export default function() { |
|
|
* }
|
|
|
* r
|
|
|
*/
|
|
|
async fetchOrderList({
|
|
|
commit,
|
|
|
state
|
|
|
}, {
|
|
|
owner = ownType.SELL,
|
|
|
status = 1
|
|
|
}) {
|
|
|
async fetchOrderList(
|
|
|
{ commit, state },
|
|
|
{ owner = ownType.SELL, status = 1 },
|
|
|
) {
|
|
|
const { page } = state.orderListByType[orderStatusKey(owner, status)];
|
|
|
|
|
|
const res = await this.$api.post('/api/order/list', {
|
...
|
...
|
@@ -211,7 +220,7 @@ export default function() { |
|
|
});
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
return { errMsg: '', isOk: true, bidData: res.data};
|
|
|
return { errMsg: '', isOk: true, bidData: res.data };
|
|
|
} else {
|
|
|
return { errMsg: res.message, isOk: false };
|
|
|
}
|
...
|
...
|
|