import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
      showLoginBox:false,
      userinfo:'',
      banners:[],
      cart:[],
      showPayBox:false,
      payBoxType:'',
      vipPayData:'',
      productPayData:'',
  },
  mutations: {
      UPDATE_LOGIN_INFO(state,param){
         state.userinfo = param;
      },
      UPDATE_BANNER(state,param){
          state.banners = param;
      },
      ADD_CART(state,param){
          state.cart.push(param);
      },
      HIDE_LOGIN_BOX(state,param){
          state.showLoginBox = false;
      },
      SHOW_LOGIN_BOX(state,param){
          state.showLoginBox = true;
      },
      HIDE_PAY_BOX(state){
          state.showPayBox = false;
      },
      SHOW_PAY_BOX(state,param){
          state.showPayBox = param.show;
          state.payBoxType = param.type;
          state.vipPayData = param.vipPayData;
          state.productPayData = param.productPayData;
      }
  },
  actions: {
      SHOW_PAY_BOX(ctx,param){
          ctx.commit('SHOW_PAY_BOX',{show:true,type:param.type,vipPayData:param.vipPayData,productPayData:param.productPayData})
          console.log(param);
      }
  }
})
