代码更新

This commit is contained in:
GaoHao
2025-03-04 18:30:16 +08:00
parent fd0c452a76
commit 4f65b08c06
32 changed files with 622 additions and 1616 deletions

View File

@@ -152,13 +152,8 @@
if (props.data.length <= 0) {
return infoBox.showToast('还没有选择商品')
}
const {
name,
maxCapacity,
status,
type
} = props.table
const { name, maxCapacity, status, type } = props.table
console.log(props.table)
if (props.table.id == '') {
go.to('PAGES_CONFIRM_ORDER', {
isCreateOrderToDetail: props.isCreateOrderToDetail ? 1 : 0

View File

@@ -94,7 +94,6 @@
})
const goods = computed(() => {
console.log(props.skuMap[selSku.value])
return props.skuMap[selSku.value]
})
watch(() => goods.value, (newval) => {

View File

@@ -185,7 +185,7 @@
},
table: {
tableId: ""
id: ""
},
socketData: {
type:'onboc',
@@ -261,7 +261,7 @@
const useType = data.table.status == 'using' ? data.table.useType : $returnUseType(uni.getStorageSync("shopInfo"))
uni.setStorageSync('useType', useType)
await getTableInfo()
// await getTableInfo()
// 获取分类数据
let categoryRes = await categoryPage({ page: 1, size: 300 })
@@ -294,9 +294,7 @@
websocketUtil.onMessage(res => {
let msg = JSON.parse(res);
let cartItem;
console.log(msg)
if( msg.msg_id ){
// console.log('Received data:', msg);
websocketUtil.send(JSON.stringify({
type: 'receipt',
msg_id: msg.msg_id,
@@ -338,7 +336,6 @@
}
}
break;
}
});
@@ -468,6 +465,7 @@
data.table = {
...item
}
initCart()
return;
}
if (item.status == "unbind") {
@@ -477,6 +475,7 @@
return infoBox.showToast('该台桌已在使用中')
}
data.table = item
initCart()
}
/**
@@ -488,11 +487,11 @@
* @param {Object} showCurrentInput
*/
async function goodsUpdate(foodsindex, index, isAdd, searchGoodsIndex, showCurrentInput) { // showCurrentInput 称重才会传的参数
if (!data.table.id) {
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
chooseTable()
})
}
// if (!data.table.id) {
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
// chooseTable()
// })
// }
let $goods = data.tabbar[index].foods[foodsindex]
if ($goods.type !== 'sku') {
//单规格
@@ -552,6 +551,9 @@
* socket通知购物车商品数量修改处理
*/
function cartControls (cartItem,type) {
if( !data.table.tableCode ){
data.table.tableCode = cartItem.table_code
}
let cartIndex = 0;
let product_id = cartItem.product_id
let sku_id = cartItem.sku_id
@@ -569,7 +571,7 @@
$goods = !product_id ? undefined : tabbarItem.foods.find(v => v.id == product_id)
}
})
console.log($goods)
let $sku;
if( $goods.type != 'package'){
//临时菜没有skuList
@@ -592,8 +594,6 @@
$goods.chooseNumber = cartItem.number
}
}
console.log(cars)
}
/**
@@ -651,11 +651,11 @@
* @param {Object} index
*/
function chooseGuige(foodsindex, index) {
if (!data.table.id) {
return infoBox.showToast('请先选择桌台', 0.5).then(res => {
chooseTable()
})
}
// if (!data.table.id) {
// return infoBox.showToast('请先选择桌台', 0.5).then(res => {
// chooseTable()
// })
// }
const $goods = data.tabbar[index].foods[foodsindex]
console.log($goods)
selGoods.value = $goods
@@ -869,18 +869,6 @@
}
const instance = getCurrentInstance();
let canXiadan = ref(false)
async function xiadanClick() {
@@ -906,7 +894,7 @@
const tableId = par.code
onChooseTable({
tableId
id: tableId
})
} else {
uni.showToast({
@@ -971,40 +959,6 @@
}
//更新购物车
function updateCartGoods(par) {
const submitPar = {
cartId: '',
tableId: data.table.id,
isPack: false,
num: 1,
productId: '',
skuId: '',
vipUserId: data.vipUser.id
}
Object.assign(submitPar, par)
return Api.$updateCart(submitPar)
}
//更新选择用户
function setUser(par) {
const submitPar = {
tableId: data.table.id,
vipUserId: data.vipUser.id ? data.vipUser.id : '',
type: data.vipUser.id ? 0 : 1 //0 设置 1 取消
}
Object.assign(submitPar, par)
return Api.$setUser(submitPar)
}
// 监听选择用户事件
const surcharge = ref(null)