order-detail.js
1.16 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
export default function() {
return {
namespaced: true,
state: {
orderDetail: {},
},
mutations: {
initData(state, data) {
state.orderDetail = data;
},
},
getters: {
userAddress: state => state.orderDetail.userAddress || {}, // 用户使用地址
statusDetail: state => state.orderDetail.statusDetail || {}, // 订单状态
lastExpressInfo: state => state.orderDetail.lastExpressInfo || {}, // 物流信息
goodsInfo: state => state.orderDetail.goodsInfo || {}, // 商品信息
priceInfo: state => state.orderDetail.priceInfo || {}, // 价格信息
actionList: state => state.orderDetail.buttons || {}, // 允许操作
},
actions: {
/**
* @param {
* owner 订单来源
* code 订单编码
* }
*/
async fetchOrderDetail({ commit }, { owner, code } = {}) {
const res = await this.$api.get('/api/order/detail', {
tabType: owner,
orderCode: +code,
// Todo 删除
uid: 600043484,
});
if (res.code === 200) {
commit('initData', res.data);
}
},
},
};
}