personCenterData.js
2.07 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* Created by cyc on 2016/11/23.
*/
import {
PERSON_DATA,
ORDER_NUM,
BROWSE_RECORD_LIST,
MY_COLLECTION_LIST,
ADD_CANCEL_COLLECTION,
MY_COUPON_LIST,
MY_COUPON_DETAIL,
BROWSE_RECORD_LIST_CLEAR,
MY_COLLECTION_LIST_CLEAR,
MY_COUPON_LIST_CLEAR,
} from '../mutationTypes';
//import { getCookie } from '../../utils/AuthService';
const state = {
personData: {},
orderNum: {},
browseRecordList: [],
myBrowseCount:-1,
myCollectionList: [],
myCollectionCount:-1,
myCouponList:[],
myCouponCount:-1,
myCouponDetail:{}
};
const mutations = {
//获取个人信息
[PERSON_DATA](state, action){
state.personData = action.personData;
},
//获取订单数
[ORDER_NUM](state, action){
state.orderNum = action.orderNum;
},
//获取浏览记录
[BROWSE_RECORD_LIST](state, action){
state.browseRecordList = state.browseRecordList.concat(action.browseRecordList);
state.myBrowseCount = action.browseRecordList.count;
},
//清除浏览记录
[BROWSE_RECORD_LIST_CLEAR](state,action){
state.browseRecordList = [];
state.myBrowseCount ='';
},
//获取我的收藏记录
[MY_COLLECTION_LIST](state, action){
state.myCollectionList = state.myCollectionList.concat(action.myCollectionList);
state.myCollectionCount = action.myCollectionList.count;
},
//清除收藏记录
[MY_COLLECTION_LIST_CLEAR](state,action){
state.myCollectionList = [];
state.myCollectionCount ='';
},
//获取我的优惠券列表
[MY_COUPON_LIST](state, action){
state.myCouponList = state.myCouponList.concat(action.myCouponList);
state.myCouponCount = action.myCouponList.count;
},
//清除我的优惠券列表
[MY_COUPON_LIST_CLEAR](state,action){
state.myCouponList = [];
state.myCouponCount ='';
},
//获取优惠券详情
[MY_COUPON_DETAIL](state, action){
state.myCouponDetail = action.myCouponDetail;
},
};
export default {
state,
mutations
};