增加就餐人数限制处理

This commit is contained in:
2024-10-30 14:54:23 +08:00
parent 1f099e2174
commit b6d79c9319

View File

@@ -273,7 +273,9 @@
computed,
watch
} from 'vue';
import {getSafeBottomHeight} from '@/commons/utils/safe-bottom.js'
import {
getSafeBottomHeight
} from '@/commons/utils/safe-bottom.js'
import modelDiscount from './components/discount'
import giveFood from './components/give-food'
import oneRemark from './components/remark'
@@ -291,7 +293,9 @@
import {
getNowCart
} from '@/pagesCreateOrder/util.js'
import {hasPermission} from '@/commons/utils/hasPermission.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js'
const models = new Map();
const modelData = reactive({
data: {},
@@ -336,12 +340,20 @@
//更新就餐人数
async function updateChoseCount() {
console.log($shop.value);
const maxCapacity = table.value.tableId ? (table.value.maxCapacity || 0) : 100
if (table.value.tableId && userNumbers.defaultCateIndex * 1 + 1 > maxCapacity) {
uni.showToast({
title: '当前台桌最大人数为: ' + maxCapacity
})
userNumbers.defaultCateIndex=maxCapacity-1
return
}
if (!$shop.value.isTableFee && table.value.tableId) {
//不免餐位费
const res = await Api.$choseCount({
masterId: option.masterId,
tableId: table.value.tableId || '',
num: userNumbers.defaultCateIndex+1,
num: userNumbers.defaultCateIndex * 1 + 1,
})
Object.assign($seatFee, res)
userNumbers.defaultCateIndex = res.totalNumber - 1
@@ -362,7 +374,8 @@
skuId,
id,
number,
isPack,isGift
isPack,
isGift
} = item
const par = {
cartId: id,
@@ -576,8 +589,7 @@
return go.to('PAGES_ORDER_PAY', {
orderId: res.id,
isNowPay: true
},'redirect'
)
}, 'redirect')
} else {
//后付
console.log(option.isCreateOrderToDetail);
@@ -634,12 +646,17 @@
onLoad((opt) => {
Object.assign(option, opt)
console.log(option,);
console.log(opt);
if (opt) {
table.value = {
...option,
tableId: opt.tableId || '',
name: opt.name
}
userNumbers.list = new Array(opt.maxCapacity?opt.maxCapacity*1:100).fill(1).map((v, index) => {
return (index + 1) + '人'
})
// console.log(userNumbers.list);
}
init()
@@ -712,6 +729,7 @@
border-radius: 18rpx;
margin-bottom: 32rpx;
}
.textarea {
border-radius: 12rpx 12rpx 12rpx 12rpx;
padding: 32rpx 0 32rpx 24rpx;
@@ -722,6 +740,7 @@
.goods {
// padding-bottom: 30rpx;
border-bottom: 1px dashed #E5E5E5;
.item {
.img {
width: 84rpx;