mutations.js
1.67 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
46
47
48
49
50
51
52
53
54
55
56
57
import * as Types from './types';
export default {
[Types.FETCH_ORDER_PRODUCT_REQUEST](state) {
state.orderInfo = {};
state.fetchingPro = true;
},
[Types.FETCH_ORDER_PRODUCT_FAILD](state) {
state.fetchingPro = false;
},
[Types.FETCH_ORDER_PRODUCT_SUCCESS](state, {order, refresh, storageId}) {
state.fetchingPro = false;
if (order.productInfo && state.productInfo.productId !== order.productInfo.productId) {
state.productInfo = order.productInfo;
}
if (refresh) {
state.skcs = order.data;
} else if (order.data && storageId) {
const findData = order.data.find(skc => skc.goodsInfo.storageId === storageId);
const findInx = state.skcs.findIndex(skc => skc.goodsInfo.storageId === storageId);
if (findData) {
state.skcs[findInx] = findData;
state.skcs = state.skcs.map(skc => skc);
}
} else if (order.data) {
state.skcs = state.skcs.concat(order.data);
}
},
[Types.POST_NOSALE_REQUEST](state) {
state.fetchingNoSale = true;
},
[Types.POST_NOSALE_FAILD](state) {
state.fetchingNoSale = false;
},
[Types.POST_NOSALE_SUCCESS](state) {
state.fetchingNoSale = false;
},
[Types.POST_CHANGEPRICE_REQUEST](state) {
state.fetchingChangePrice = true;
},
[Types.POST_CHANGEPRICE_FAILD](state) {
state.fetchingChangePrice = false;
},
[Types.POST_CHANGEPRICE_SUCCESS](state) {
state.fetchingChangePrice = false;
},
[Types.POST_CALCPRICE_REQUEST](state) {
state.fetchingCalcPrice = true;
},
[Types.POST_CALCPRICE_FAILD](state) {
state.fetchingCalcPrice = false;
},
[Types.POST_CALCPRICE_SUCCESS](state) {
state.fetchingCalcPrice = false;
},
};