增加就餐人数限制处理
This commit is contained in:
@@ -273,7 +273,9 @@
|
|||||||
computed,
|
computed,
|
||||||
watch
|
watch
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {getSafeBottomHeight} from '@/commons/utils/safe-bottom.js'
|
import {
|
||||||
|
getSafeBottomHeight
|
||||||
|
} from '@/commons/utils/safe-bottom.js'
|
||||||
import modelDiscount from './components/discount'
|
import modelDiscount from './components/discount'
|
||||||
import giveFood from './components/give-food'
|
import giveFood from './components/give-food'
|
||||||
import oneRemark from './components/remark'
|
import oneRemark from './components/remark'
|
||||||
@@ -291,7 +293,9 @@
|
|||||||
import {
|
import {
|
||||||
getNowCart
|
getNowCart
|
||||||
} from '@/pagesCreateOrder/util.js'
|
} from '@/pagesCreateOrder/util.js'
|
||||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js'
|
||||||
const models = new Map();
|
const models = new Map();
|
||||||
const modelData = reactive({
|
const modelData = reactive({
|
||||||
data: {},
|
data: {},
|
||||||
@@ -336,12 +340,20 @@
|
|||||||
//更新就餐人数
|
//更新就餐人数
|
||||||
async function updateChoseCount() {
|
async function updateChoseCount() {
|
||||||
console.log($shop.value);
|
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) {
|
if (!$shop.value.isTableFee && table.value.tableId) {
|
||||||
//不免餐位费
|
//不免餐位费
|
||||||
const res = await Api.$choseCount({
|
const res = await Api.$choseCount({
|
||||||
masterId: option.masterId,
|
masterId: option.masterId,
|
||||||
tableId: table.value.tableId || '',
|
tableId: table.value.tableId || '',
|
||||||
num: userNumbers.defaultCateIndex+1,
|
num: userNumbers.defaultCateIndex * 1 + 1,
|
||||||
})
|
})
|
||||||
Object.assign($seatFee, res)
|
Object.assign($seatFee, res)
|
||||||
userNumbers.defaultCateIndex = res.totalNumber - 1
|
userNumbers.defaultCateIndex = res.totalNumber - 1
|
||||||
@@ -362,7 +374,8 @@
|
|||||||
skuId,
|
skuId,
|
||||||
id,
|
id,
|
||||||
number,
|
number,
|
||||||
isPack,isGift
|
isPack,
|
||||||
|
isGift
|
||||||
} = item
|
} = item
|
||||||
const par = {
|
const par = {
|
||||||
cartId: id,
|
cartId: id,
|
||||||
@@ -576,8 +589,7 @@
|
|||||||
return go.to('PAGES_ORDER_PAY', {
|
return go.to('PAGES_ORDER_PAY', {
|
||||||
orderId: res.id,
|
orderId: res.id,
|
||||||
isNowPay: true
|
isNowPay: true
|
||||||
},'redirect'
|
}, 'redirect')
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
//后付
|
//后付
|
||||||
console.log(option.isCreateOrderToDetail);
|
console.log(option.isCreateOrderToDetail);
|
||||||
@@ -634,12 +646,17 @@
|
|||||||
|
|
||||||
onLoad((opt) => {
|
onLoad((opt) => {
|
||||||
Object.assign(option, opt)
|
Object.assign(option, opt)
|
||||||
console.log(option,);
|
console.log(opt);
|
||||||
if (opt) {
|
if (opt) {
|
||||||
table.value = {
|
table.value = {
|
||||||
|
...option,
|
||||||
tableId: opt.tableId || '',
|
tableId: opt.tableId || '',
|
||||||
name: opt.name
|
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()
|
init()
|
||||||
|
|
||||||
@@ -712,6 +729,7 @@
|
|||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
margin-bottom: 32rpx;
|
margin-bottom: 32rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.textarea {
|
.textarea {
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
padding: 32rpx 0 32rpx 24rpx;
|
padding: 32rpx 0 32rpx 24rpx;
|
||||||
@@ -722,6 +740,7 @@
|
|||||||
.goods {
|
.goods {
|
||||||
// padding-bottom: 30rpx;
|
// padding-bottom: 30rpx;
|
||||||
border-bottom: 1px dashed #E5E5E5;
|
border-bottom: 1px dashed #E5E5E5;
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
.img {
|
.img {
|
||||||
width: 84rpx;
|
width: 84rpx;
|
||||||
|
|||||||
Reference in New Issue
Block a user