From 9eb875ea08340806b34bdb3e1255ff0af741cc60 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 11 Oct 2024 17:03:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A1=8C=E5=8F=B0=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E6=9D=A1=E4=BB=B6=E4=B8=BA=E5=B9=B6=E7=9A=84=E5=85=B3?= =?UTF-8?q?=E7=B3=BB=20=E4=BF=AE=E5=A4=8D=E6=A1=8C=E5=8F=B0=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E6=9C=AA=E6=A0=B9=E6=8D=AE=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E7=AD=9B=E9=80=89=E5=8F=B0=E6=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pageTable/index/index.vue | 80 +++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/pageTable/index/index.vue b/pageTable/index/index.vue index 4cf02f5..df9c5db 100644 --- a/pageTable/index/index.vue +++ b/pageTable/index/index.vue @@ -4,19 +4,16 @@ {{times.list[times.active]}}秒 - + {{status.list[status.active].label }} - + - @@ -112,7 +109,7 @@ import infoBox from '@/commons/utils/infoBox.js' const refMoreSheet = ref(null) const actionSheet = reactive({ - list: ['结账', '清台','增减菜','换台','打印订单','历史订单'], + list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单'], title: '', selTable: '' }) @@ -122,14 +119,14 @@ actionSheet.selTable = table refMoreSheet.value.open() } - + async function actionSheetClick(index) { console.log(index); - const item=actionSheet.selTable + const item = actionSheet.selTable //编辑 // refTableShow() if (index == 0) { - if(!item.orderId){ + if (!item.orderId) { return infoBox.showToast('该桌台暂无要结账的订单!') } return @@ -137,21 +134,21 @@ if (index == 1) { //清台 return uni.showModal({ - title: '提示', - content: '确定要清台:' + item.name + '?', - success(res) { - if (res.confirm) { - $table.update({ - ...item, - status: "idle", - qrcode: item.tableId, - }).then(res=>{ - infoBox.showToast('清台成功') - tableUpdate() - }) - } + title: '提示', + content: '确定要清台:' + item.name + '?', + success(res) { + if (res.confirm) { + $table.update({ + ...item, + status: "idle", + qrcode: item.tableId, + }).then(res => { + infoBox.showToast('清台成功') + tableUpdate() + }) } - }) + } + }) } if (index == 2) { return @@ -161,8 +158,8 @@ } if (index == 4) { //打印订单 - const res=await $fun.printOrder(actionSheet.selTable.tableId) - return + const res = await $fun.printOrder(actionSheet.selTable.tableId) + return } } @@ -184,9 +181,10 @@ function searchConfirm() { hideSearch() - tables.list = tables.originList.filter((v) => - v.name.includes(search.keyword.trim()) - ); + filterTableList() + // tables.list = tables.originList.filter((v) => + // v.name.includes(search.keyword.trim()) + // ); } function hideSearch() { @@ -340,8 +338,8 @@ content } = await $table.get(query) tables.hasAjax = true - tables.list = content tables.originList = content + filterTableList() } const areaMap = ref({}) async function getArea() { @@ -364,13 +362,23 @@ }) watch(() => status.active, (newval) => { query.page = 0 - if (newval === 0) { - return tables.list = tables.originList - } - tables.list = tables.originList.filter((v) => { - return v.status == status.list[status.active].key - }); + // if (newval === 0) { + // return tables.list = tables.originList + // } + // tables.list = tables.originList.filter((v) => { + // return v.status == status.list[status.active].key + // }); + filterTableList() }) + + function filterTableList() { + tables.list = tables.originList.filter((v) => { + console.log(status.list[status.active].key); + return (status.active == 0 ? true : v.status == status.list[status.active].key) && ( + v.name.includes(search.keyword.trim()) + ) + }); + } watch(() => times.active, (newval) => { setTimer() }) @@ -397,7 +405,7 @@ watch(() => times.active, (newval) => { setTimer() }) - onBeforeUnmount(()=>{ + onBeforeUnmount(() => { console.log('table page onBeforeUnmount'); clearInterval(timer) })