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

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
	www: 'https://dingdanzhushou.xyz',
	hasLogin:false,
	userInfo: {},
	baseInfo: {},//基础信息
	addOrderToken: [],//添加订单时的token
	orderToken: [],//订单token
	jsOrderToken: [],//结算订单token
  },
  mutations: {
	login(state) {
		state.hasLogin = true
		
	},
	loginOut(state) {
		state.hasLogin = false
		window.localStorage.removeItem('token');
		window.localStorage.removeItem('user');
	},
	setUserInfo(state,payload) {
		state.userInfo = payload
		window.localStorage.setItem('user', JSON.stringify(payload))
	},
	setBaseInfo(state,payload) {
		state.baseInfo = payload
	},
	jUserMoney(state,payload) {
		state.userInfo.money = (state.userInfo.money*1 + payload).toFixed(2)
	},
	setAddOrderToken(state,payload) {
		state.addOrderToken = payload
	},
	setOrderToken(state,payload) {
		state.orderToken = payload
	},
	setJsOrderToken(state,payload) {
		state.jsOrderToken = payload
	}
  },
  actions: {

  }
})
