修复桌台筛选条件为并的关系

修复桌台刷新时未根据筛选条件筛选台桌
This commit is contained in:
2024-10-11 17:03:49 +08:00
parent c9e195c859
commit 9eb875ea08

View File

@@ -4,19 +4,16 @@
<view class="u-flex u-flex-1 u-row-between"> <view class="u-flex u-flex-1 u-row-between">
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showsTimesToggle"> <view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showsTimesToggle">
<text class="u-m-r-12">{{times.list[times.active]}}</text> <text class="u-m-r-12">{{times.list[times.active]}}</text>
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" <image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
mode="">
</image> </image>
</view> </view>
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showstatusToggle"> <view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="showstatusToggle">
<text class="u-m-r-12" <text class="u-m-r-12"
:class="{'color-main':status.active!=0}">{{status.list[status.active].label }}</text> :class="{'color-main':status.active!=0}">{{status.list[status.active].label }}</text>
<image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" <image src="/pageTable/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill" mode="">
mode="">
</image> </image>
</view> </view>
</view> </view>
<view style="width: 164rpx;"></view> <view style="width: 164rpx;"></view>
<view class="search-box"> <view class="search-box">
<view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}"> <view class="search-btn u-flex" @tap="showSearch" :style="{width:search.show?'694rpx':'164rpx'}">
@@ -112,7 +109,7 @@
import infoBox from '@/commons/utils/infoBox.js' import infoBox from '@/commons/utils/infoBox.js'
const refMoreSheet = ref(null) const refMoreSheet = ref(null)
const actionSheet = reactive({ const actionSheet = reactive({
list: ['结账', '清台','增减菜','换台','打印订单','历史订单'], list: ['结账', '清台', '增减菜', '换台', '打印订单', '历史订单'],
title: '', title: '',
selTable: '' selTable: ''
}) })
@@ -122,14 +119,14 @@
actionSheet.selTable = table actionSheet.selTable = table
refMoreSheet.value.open() refMoreSheet.value.open()
} }
async function actionSheetClick(index) { async function actionSheetClick(index) {
console.log(index); console.log(index);
const item=actionSheet.selTable const item = actionSheet.selTable
//编辑 //编辑
// refTableShow() // refTableShow()
if (index == 0) { if (index == 0) {
if(!item.orderId){ if (!item.orderId) {
return infoBox.showToast('该桌台暂无要结账的订单!') return infoBox.showToast('该桌台暂无要结账的订单!')
} }
return return
@@ -137,21 +134,21 @@
if (index == 1) { if (index == 1) {
//清台 //清台
return uni.showModal({ return uni.showModal({
title: '提示', title: '提示',
content: '确定要清台:' + item.name + '', content: '确定要清台:' + item.name + '',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
$table.update({ $table.update({
...item, ...item,
status: "idle", status: "idle",
qrcode: item.tableId, qrcode: item.tableId,
}).then(res=>{ }).then(res => {
infoBox.showToast('清台成功') infoBox.showToast('清台成功')
tableUpdate() tableUpdate()
}) })
}
} }
}) }
})
} }
if (index == 2) { if (index == 2) {
return return
@@ -161,8 +158,8 @@
} }
if (index == 4) { if (index == 4) {
//打印订单 //打印订单
const res=await $fun.printOrder(actionSheet.selTable.tableId) const res = await $fun.printOrder(actionSheet.selTable.tableId)
return return
} }
} }
@@ -184,9 +181,10 @@
function searchConfirm() { function searchConfirm() {
hideSearch() hideSearch()
tables.list = tables.originList.filter((v) => filterTableList()
v.name.includes(search.keyword.trim()) // tables.list = tables.originList.filter((v) =>
); // v.name.includes(search.keyword.trim())
// );
} }
function hideSearch() { function hideSearch() {
@@ -340,8 +338,8 @@
content content
} = await $table.get(query) } = await $table.get(query)
tables.hasAjax = true tables.hasAjax = true
tables.list = content
tables.originList = content tables.originList = content
filterTableList()
} }
const areaMap = ref({}) const areaMap = ref({})
async function getArea() { async function getArea() {
@@ -364,13 +362,23 @@
}) })
watch(() => status.active, (newval) => { watch(() => status.active, (newval) => {
query.page = 0 query.page = 0
if (newval === 0) { // if (newval === 0) {
return tables.list = tables.originList // return tables.list = tables.originList
} // }
tables.list = tables.originList.filter((v) => { // tables.list = tables.originList.filter((v) => {
return v.status == status.list[status.active].key // 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) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
@@ -397,7 +405,7 @@
watch(() => times.active, (newval) => { watch(() => times.active, (newval) => {
setTimer() setTimer()
}) })
onBeforeUnmount(()=>{ onBeforeUnmount(() => {
console.log('table page onBeforeUnmount'); console.log('table page onBeforeUnmount');
clearInterval(timer) clearInterval(timer)
}) })