order-confirm.js
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
export const Types = {
FETCH_ORDER_DETAIL_REQUEST: 'FETCH_ORDER_DETAIL_REQUEST',
FETCH_ORDER_DETAIL_FAIL: 'FETCH_ORDER_DETAIL_FAIL',
FETCH_ORDER_DETAIL_SUCCESS: 'FETCH_ORDER_DETAIL_SUCCESS'
};
export default function() {
return {
namespaced: true,
state: {
orderDetail: {},
fetchOrderDetail: false
},
mutations: {
[Types.FETCH_ORDER_DETAIL_REQUEST](state) {
state.fetchOrderDetail = true;
},
[Types.FETCH_ORDER_DETAIL_SUCCESS](state, data) {
state.fetchOrderDetail = false;
state.orderDetail = data;
},
[Types.FETCH_ORDER_DETAIL_FAIL](state) {
state.fetchOrderDetail = false;
}
},
actions: {
async fetchOrderDetail({ commit }, { tabType = 'sell', orderCode } = {}) {
commit(Types.FETCH_ORDER_DETAIL_REQUEST);
const result = await this.$api.post('/api/order/detail', {
tabType,
orderCode: orderCode
});
if (result.code !== 200) {
commit(Types.FETCH_ORDER_DETAIL_FAIL);
return;
}
commit(Types.FETCH_ORDER_DETAIL_SUCCESS, result.data);
}
},
getters: {},
};
}