48 lines
848 B
JavaScript
48 lines
848 B
JavaScript
import $util from "@/utils/index.js"
|
|
import $api from "@/api/index.js"
|
|
import {
|
|
req
|
|
} from '@/utils/req.js';
|
|
export default {
|
|
state: {
|
|
shopCarList: {},
|
|
restaurantCarList: {},
|
|
orderInfo: {},
|
|
haveOperItem: false
|
|
},
|
|
mutations: {
|
|
updateOrderItem(state, item) {
|
|
let {
|
|
key,
|
|
val
|
|
} = item
|
|
state[key] = val
|
|
}
|
|
},
|
|
actions: {
|
|
// 获取购物车数据
|
|
async getShopCarList({
|
|
commit,
|
|
state
|
|
}, param) {
|
|
let data = await $api.shop.carInfo(param)
|
|
data.selectAll = data.car_count === data.all_count
|
|
commit('updateOrderItem', {
|
|
key: 'shopCarList',
|
|
val: data
|
|
})
|
|
},
|
|
// 获取购物车数据
|
|
async getRestaurantCarList({
|
|
commit,
|
|
state
|
|
}, param) {
|
|
let data = await $api.restaurant.carInfo(param)
|
|
commit('updateOrderItem', {
|
|
key: 'restaurantCarList',
|
|
val: data
|
|
})
|
|
},
|
|
}
|
|
}
|