54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import Vue from 'vue'
|
||
import Vuex from 'vuex'
|
||
Vue.use(Vuex)
|
||
|
||
const store = new Vuex.Store({
|
||
state: {
|
||
orderType: '', // 订单类型 1 普通订单 2 拼团订单 3 秒杀订单 4 优惠券 5 购物车订单 和 goodsDetails 的 type 相同
|
||
orderInfo: {}, // 订单数据 订单步骤1:展示结算数据
|
||
orderAddress: {}, // 下单时选择的地址
|
||
goodsDetails: {}, // 商品详情 1普通 2拼团 3秒杀 4优惠券
|
||
goods_id: '', // 拼团商品 id
|
||
pintuangroup_headid: '', // 拼团团长id 有为开团 无为参团
|
||
groupbuyInfo: {}, // 秒杀详情
|
||
loadmore: {}, // 下拉加载返回的数据
|
||
},
|
||
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;
|
||
},
|
||
setGroupHeadId(state, id) {
|
||
state.pintuangroup_headid = id;
|
||
},
|
||
setLoadMore(state, info) {
|
||
state.loadmore = info;
|
||
},
|
||
}
|
||
})
|
||
export default store; |