修复代客下单起售数量问题

This commit is contained in:
2024-10-12 15:18:27 +08:00
parent 1bf3334127
commit 68c23e6e48
2 changed files with 20 additions and 6 deletions

View File

@@ -298,13 +298,14 @@
return Api.getGoodsLists(par)
}
//获取购物车数据
function getCart(par = {
async function getCart(par = {
page: 0,
size: 300,
masterId: data.masterId,
tableId: data.table.tableId
}) {
return Api.getCart(par)
const res= await Api.getCart(par)
return res
}
//获取取餐码
function getMasterId() {
@@ -742,7 +743,9 @@
const cartId = goods.id
const tabbarIndex = data.tabbar.findIndex(v => v.id == categoryId)
const $goods = data.tabbar[tabbarIndex].foods.find(v => v.id == productId)
if (num === 0) {
const $sku = $goods.specList.find(v => v.id == skuId)
if (num === 0||num<$sku.suit) {
//移除
await removeCartGoods({
cartId
@@ -793,13 +796,14 @@
});
const productId = $goods.id
const skuId = $goods.specList[0].id
const suit=$goods.specList[0].suit||1
if (goodsInCarIndex !== -1) {
//更新
const carGoods = cars[goodsInCarIndex]
const cartId = carGoods.id
const step = isAdd ? 1 : -1
const num = carGoods.number * 1 + step
if (num === 0) {
if (num === 0||num<suit) {
//移除
cars.splice(goodsInCarIndex, 1)
$goods.chooseNumber = 0
@@ -819,7 +823,7 @@
$goods.chooseNumber = number
} else {
//增加
const num = 1
const num = suit
const cartGoods = await addCart({
num,
productId,