deming/common/store/index.js
2020-07-21 21:02:28 +08:00

46 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
orderType: '', // 订单类型 1 普通订单 2 购物车订单 3 拼团订单 4 秒杀订单
orderInfo: {}, // 订单数据 订单步骤1展示结算数据
orderAddress: {}, // 下单时选择的地址
goodsDetails: {}, // 商品详情 1普通 2拼团 3秒杀 4优惠券
goods_id: '', // 拼团商品 id
groupbuyInfo: {}, // 秒杀详情
},
getters: {
getOrderAddress(state) {
return state.orderAddress;
},
getGoodsType(state) {
return state.goodsDetails.type;
},
getGoodsInfo(state) {
return state.goodsDetails.goods;
}
},
mutations: {
setOrderType(state, type) {
state.orderType = type;
},
updateOrderInfo(state, info) {
state.orderInfo = info;
},
updateAddress(state, address) {
state.orderAddress = address;
},
setGoodsDetails(state, goods) {
state.goodsDetails = goods;
},
setGoodsId(state, id) {
state.goods_id = id;
},
setGroupbuyInfo(state, info) {
state.groupbuyInfo = info;
},
}
})
export default store;