diff --git a/pages.json b/pages.json index b5248ea..eaaa5e2 100644 --- a/pages.json +++ b/pages.json @@ -207,6 +207,12 @@ "style": { "navigationBarTitleText": "适用门店" } + }, + { + "path": "pages/mesaage/index", + "style": { + "navigationBarTitleText": "消息" + } } ], "subPackages": [{ diff --git a/pages/mesaage/index.vue b/pages/mesaage/index.vue new file mode 100644 index 0000000..ae94e58 --- /dev/null +++ b/pages/mesaage/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/pages/product/choosetable.vue b/pages/product/choosetable.vue index fbaba4b..7e4eb9a 100644 --- a/pages/product/choosetable.vue +++ b/pages/product/choosetable.vue @@ -1,30 +1,24 @@ \ No newline at end of file + + ::v-deep .num.active input { + color: #fff !important; + border-radius: 12rpx; + background-color: #e8ad7b !important; + } +} + +.startBtn { + width: 100%; + height: 96rpx; + line-height: 96rpx; + text-align: center; + background-color: #e8ad7b; + border-radius: 48rpx; + font-weight: bold; + font-size: 32rpx; + color: #ffffff; +} + diff --git a/pages/product/index.vue b/pages/product/index.vue index 8e7ad92..cbbe7fa 100644 --- a/pages/product/index.vue +++ b/pages/product/index.vue @@ -513,6 +513,42 @@ + + + + + + + 请选择就餐人数 + 桌号{{ shopTable.name }} + + + + + {{ item }} + + + + + + + + + 取消 + + + 确认 + + + + + @@ -541,6 +577,7 @@ import Loading from '@/components/Loading.vue'; import dayjs from 'dayjs'; import isBetween from 'dayjs/plugin/isBetween'; dayjs.extend(isBetween); +import { filterNumberInput } from '@/utils/util.js'; //点单智能推荐 function onBuyClick(item) { @@ -1461,8 +1498,19 @@ async function onMessage(Message) { // 转桌成功 if (Message.operate_type == 'rottable' && Message.status == 1) { console.log('转桌成功了'); + + uni.showToast({ + title: '扫码成功,请下单', + icon: 'none' + }); + orderType.value = 'scan'; uni.cache.set('tableCode', Message.data.new_table_code); + + if (showTableInfoPeopleNumPopup.value == true) { + showTableInfoPeopleNumPopup.value = false; + } + websocketsendMessage(options.initMessage); } @@ -1860,27 +1908,78 @@ provide('shopInfo', shopInfo); const orderType = ref('scan'); // 扫码下单 + +// 台桌信息 +const showTableInfoPeopleNumPopup = ref(false); +const tableInfo = ref(''); + +// 选择的人数 +const tableInfoPeopleActive = ref(-1); +const tableInfoPeopleNum = ref(''); + +// 选择人数 +function tableInfoPeopleNumHandle(num, index) { + tableInfoPeopleActive.value = index; + tableInfoPeopleNum.value = num; +} + +// 人数输入框 +function tableInfoPeopleNumInput(e) { + tableInfoPeopleActive.value = -1; + setTimeout(() => { + tableInfoPeopleNum.value = filterNumberInput(e, 1); + }, 50); +} + +// 取消选择人数 +function closeTableInfoPeopleNum() { + showTableInfoPeopleNumPopup.value = false; + tableInfoPeopleActive.value = -1; + tableInfoPeopleNum.value = ''; +} + +// 确认选择人数 +function tableInfoPeopleNumConfirm() { + uni.cache.set('dinersNum', tableInfoPeopleNum.value); + startUseTable(); +} + +// 开始换桌 +function startUseTable() { + const shopInfo = uni.cache.get('shopInfo'); + const oldTableCode = uni.cache.get('tableCode'); + const cartIds = cartStore.carts.map((item) => item.id); + + const data = { + type: 'onboc', + operate_type: 'rottable', + account: shopInfo.phone, + table_code: oldTableCode, + new_table_code: tableInfo.value.tableCode, + cart_id: cartIds, + shop_id: shopInfo.id + }; + + websocketsendMessage(data); +} + +// 预点单扫码下单 function beforehandHandle() { uni.scanCode({ - success(res) { - const shopInfo = uni.cache.get('shopInfo'); - const oldTableCode = uni.cache.get('tableCode'); - const newTableCode = userStore.getQueryString(res.result, 'code'); - const cartIds = cartStore.carts.map((item) => item.id); + success: async (res) => { + try { + const newTableCode = userStore.getQueryString(res.result, 'code'); - const data = { - type: 'onboc', - operate_type: 'rottable', - account: shopInfo.phone, - table_code: oldTableCode, - new_table_code: newTableCode, - cart_id: cartIds, - shop_id: shopInfo.id - }; - - console.log('scanCode.data===', data); - // return; - websocketsendMessage(data); + if (shopInfo.isTableFee) { + startUseTable(); + } else { + await userStore.actionsproductqueryShop(newTableCode); + tableInfo.value = uni.cache.get('shopTable'); + showTableInfoPeopleNumPopup.value = true; + } + } catch (error) { + console.log(error); + } } }); } @@ -2961,4 +3060,81 @@ function toHistory() { z-index: 9; color: #fff; } +.select_num_wrap { + width: 100vw; + height: 100vh; + position: relative; + .top_bg { + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + z-index: 1; + } + .sn-bnottom { + width: 90vw; + border-radius: 20upx; + background-color: #fff; + position: absolute; + left: 5vw; + bottom: 20vw; + z-index: 2; + .sn-header { + height: 120upx; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid #ececec; + padding: 0 28upx; + .t1 { + color: #333; + font-size: 32upx; + } + .t2 { + color: #999; + font-size: 28upx; + } + } + .sn-num-wrap { + padding: 38upx 28upx; + border-bottom: 1px solid #ececec; + .sn-num { + display: grid; + grid-template-columns: repeat(5, 1fr); + gap: 14px; + .item { + height: 40px; + border-radius: 6px; + background-color: #fef4eb; + display: flex; + align-items: center; + justify-content: center; + &.active { + background-color: #e8ad7b; + .t { + color: #fff; + } + } + .t { + color: #333333; + font-size: 32upx; + } + } + } + .input { + display: flex; + padding-top: 28upx; + } + } + .sn-footer-wrap { + display: flex; + gap: 28upx; + padding: 28upx; + .btn { + flex: 1; + } + } + } +} diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue index 72758e0..ae7f814 100644 --- a/pages/user/coupon.vue +++ b/pages/user/coupon.vue @@ -1,7 +1,7 @@