代客下单更新

This commit is contained in:
YeMingfei666 2024-10-31 09:54:29 +08:00
parent b92aaf3564
commit be0b3af8dd
1 changed files with 29 additions and 16 deletions

View File

@ -448,21 +448,20 @@
})
console.log(res);
if (res && res.content[0]) {
// data.table=res.content[0]
data.table={...res.content[0],...data.table}
}
}
}
let $originGoods = []
let $category = []
async function init() {
const masterRes = await getMasterId()
data.masterId = masterRes.masterId
const shopInfo = await tbShopInfo()
$shop.value = shopInfo
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(shopInfo)
uni.setStorageSync('useType', useType)
console.log(shopInfo);
getTableInfo()
await getTableInfo()
const categoryRes = await getCategory()
const category = categoryRes.content.reduce((prve, cur) => {
prve.push({
@ -482,20 +481,32 @@
return isShow;
});
$originGoods = goods
// if (!data.table.tableId) {
// //
// setTabBar(category, goods, [])
// return
// }
// const {
// masterId
// } = await getMasterId()
// data.masterId = masterId
if(data.table.tableId){
console.log(option);
if(option.type=='add'){
// await getTableInfo()
const masterRes = await getMasterId()
data.masterId = masterRes.masterId
cars.length = 0
setTabBar(category, goods, [])
return
}
if (!data.table.tableId) {
const masterRes = await getMasterId()
data.masterId = masterRes.masterId
//
const cartRes = await getCart()
cars.length = 0
const cartArr = getNowCart(cartRes.records)
for (let i in cartArr) {
cars.push(cartArr[i])
}
setTabBar(category, goods, cars)
return
}
const {
masterId
} = await getMasterId()
data.masterId = masterId
const cartRes = await getCart()
cars.length = 0
const cartArr = getNowCart(cartRes.records)
@ -1093,7 +1104,9 @@
})
}
watch(() => data.table.tableId, (newval, oldval) => {
onSelTable()
if(option.type!='add'){
onSelTable()
}
})
async function onSelTable() {
const {