couponCenterData.js 1.39 KB
/*
 * Created by shipfi on 2016/5/31.
 */
import {
    COUPON_CENTER_LIST,
    COUPON_CENTER_DETAIL,
    MATCH_NET_LIST,
    COUPON_TAB,
    COUPON_EXCHANGE,
    COUPON_CENTER_LIST_CLEAR
} from '../mutationTypes';


const state = {
    couponCenterList: [],
    couponCenterDetail: {},
    matchNetList: [],
    couponTab: {},
    couponExchange: {}
};

const mutations = {
    //获取优惠券中心列表
    [COUPON_CENTER_LIST](state, action){
        state.couponCenterList = state.couponCenterList.concat(action.couponCenterList);
        state.couponCenterCount = action.couponCenterList.count;
    },
    //获取优惠券详情
    [COUPON_CENTER_DETAIL](state, action){
        state.couponCenterDetail = action.couponCenterDetail;
    },
    //获取优惠券适用网点
    [MATCH_NET_LIST](state, action){
        state.matchNetList = state.matchNetList.concat(action.matchNetList);
        state.matchNetCount = action.matchNetList.count;
    },
    //获取优惠券中心标题背景
    [COUPON_TAB](state, action){
        state.couponTab = action.couponTab;
    },
    //优惠券兑换
    [COUPON_EXCHANGE](state, action){
        state.couponExchange = action.couponExchange;
    },
    //清除优惠券中心列表
    [COUPON_CENTER_LIST_CLEAR](state,action){
        state.couponCenterList = [];
        state.couponCenterCount ='';
    }

};

export default {
    state,
    mutations
};