优化台桌显示

This commit is contained in:
gyq
2026-03-28 18:29:43 +08:00
parent a5fdbd0c13
commit c9cd3a80d9
3 changed files with 44 additions and 22 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "vite-electron", "name": "vite-electron",
"private": true, "private": true,
"version": "2.0.16", "version": "2.0.17",
"main": "dist-electron/main.js", "main": "dist-electron/main.js",
"scripts": { "scripts": {
"dev": "chcp 65001 && vite", "dev": "chcp 65001 && vite",

View File

@@ -61,6 +61,9 @@
<div class="btn_wrap" v-if="props.tableInfo.status == 'settled'"> <div class="btn_wrap" v-if="props.tableInfo.status == 'settled'">
<el-button type="primary" style="width: 100%;" @click="clearTableStatus">清理完成</el-button> <el-button type="primary" style="width: 100%;" @click="clearTableStatus">清理完成</el-button>
</div> </div>
<div class="btn_wrap" v-if="props.tableInfo.status == 'unbound'">
<el-button type="default" disabled style="width: 100%;">{{ props.tableInfo.statusMsg }}</el-button>
</div>
</div> </div>
<transition name="el-fade-in"> <transition name="el-fade-in">
<div class="people_num_wrap" v-show="showPeopleNum"> <div class="people_num_wrap" v-show="showPeopleNum">

View File

@@ -72,8 +72,8 @@
</div> </div>
</div> </div>
<el-drawer v-model="drawerVisible" <el-drawer v-model="drawerVisible"
:title="`${tableList[tableItemActive].name} | ${tableList[tableItemActive].areaName}`" size="350px" :title="`${tableList[tableItemActive].areaName} | ${tableList[tableItemActive].name} ${tableList[tableItemActive].personNum || 0}/${tableList[tableItemActive].maxCapacity}`"
v-if="tableList.length"> size="35%" v-if="tableList.length">
<tableInfo :tableInfo="tableList[tableItemActive]" @success="paySuccess" /> <tableInfo :tableInfo="tableList[tableItemActive]" @success="paySuccess" />
</el-drawer> </el-drawer>
<!-- <div class="right_card card"> <!-- <div class="right_card card">
@@ -256,16 +256,35 @@ async function shopTableAjax(isLoading = true) {
const refreshKey = ref(0) const refreshKey = ref(0)
// 精准【每分钟 00 秒】自动刷新时间(和时钟完全同步)
let timeTimer = null
function syncMinuteRefresh() {
// 1. 计算当前时间距离下一个 00 秒还剩多少毫秒
const now = new Date()
const seconds = now.getSeconds()
const delay = (60 - seconds) * 1000 // 等到下一个整分钟
// 2. 等到整分钟时,执行一次刷新
setTimeout(() => {
refreshKey.value++ // 刷新时间
// 3. 之后每 60 秒执行一次(永远在 00 秒刷新)
timeTimer = setInterval(() => {
refreshKey.value++
}, 60000)
}, delay)
}
onMounted(() => { onMounted(() => {
shopAreaAjax() shopAreaAjax()
shopTableAjax() shopTableAjax()
syncMinuteRefresh()
})
const timeTimer = setInterval(() => { // 销毁清理
refreshKey.value++ // 强制视图更新时间 onUnmounted(() => {
}, 60000)
onUnmounted(() => {
clearInterval(timeTimer) clearInterval(timeTimer)
})
}) })
</script> </script>