diff --git a/pagesCreateOrder/index/index.vue b/pagesCreateOrder/index/index.vue index 83af750..f377ea4 100644 --- a/pagesCreateOrder/index/index.vue +++ b/pagesCreateOrder/index/index.vue @@ -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 {