let state = {
	userInfo: {}, //用户信息
	orderNumber: 0, //订单信息
	hasLogin: false, //是否登录
	orderList:[],
}

let mutations = {
	// 登录
	login(state) {
		state.hasLogin = true;
	},
	// 退出登录
	logout(state, provider) {
		state.hasLogin = false;
		// 清空基础信息
		state.userInfo = {};
		// 清除缓存用户信息
		uni.removeStorage({
			key: 'userInfo'
		})
		// 清除缓存token
		uni.removeStorage({
			key: 'token'
		})
	},
	// 保存用户信息
	setUserInfo(state, provider) {
		state.userInfo = provider;
		state.userInfo.USDT = +provider.USDT;
		state.userInfo.VGT = +provider.VGT;
		state.userInfo.real_ratio = +provider.real_ratio;
		uni.setStorageSync( 'userInfo', provider)
	},
	// 保存订单信息
	setOrderNumber(state, provider) {
		state.orderNumber = provider;
	},
	setOrderSn(state, provider){
		state.orderList.push(provider);
	}

}

let getters = {}

export default {
	namespaced: true,
	state,
	mutations,
	getters
}
