初始化代码
This commit is contained in:
47
uniapp/uni-app/store/modules/order.js
Normal file
47
uniapp/uni-app/store/modules/order.js
Normal file
@@ -0,0 +1,47 @@
|
||||
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
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user