personCenterData.js 2.07 KB
/**
 * 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
};