actions.js
1.04 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
import * as Types from './types';
export default {
async fetchProduct({commit}, {orderId}) {
commit(Types.FETCH_ORDER_PRODUCT_REQUEST);
// const result = await this.$api.get('/getproductxxx', {orderId});
const result = await Promise.resolve({
code: 200,
data: {
name: '测试产品',
image: 'xxx'
}
});
if (result && result.code === 200) {
commit(Types.FETCH_ORDER_PRODUCT_SUCCESS, {
product: result.data
});
} else {
commit(Types.FETCH_ORDER_PRODUCT_FAILD);
}
},
async fetchOrderDetail({commit}, {orderId}) {
commit(Types.FETCH_ORDERDETAIL_REQUEST);
// const result = await this.$api.get('/getproductxxx', {orderId});
const result = await Promise.resolve({
code: 200,
data: {
name: '测试订单',
image: 'xxx'
}
});
if (result && result.code === 200) {
commit(Types.FETCH_ORDERDETAIL_SUCCESS, {
order: result.data
});
} else {
commit(Types.FETCH_ORDERDETAIL_FAILD);
}
}
};