From 60bc61d40f146f76a8ec58da7f01f51367a347c3 Mon Sep 17 00:00:00 2001 From: YeMingfei666 <1619116647@qq.com> Date: Fri, 27 Sep 2024 09:39:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=88=E4=BB=98=E8=B4=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/consumable.js | 8 +- src/views/table/table_list.vue | 63 +++-- .../tool/Instead/components/cart-item.vue | 6 +- .../tool/Instead/components/pay-type.vue | 3 +- src/views/tool/Instead/index.vue | 231 +++++++++++++----- 5 files changed, 225 insertions(+), 86 deletions(-) diff --git a/src/api/consumable.js b/src/api/consumable.js index 6e7eff7..72b19e3 100644 --- a/src/api/consumable.js +++ b/src/api/consumable.js @@ -45,9 +45,13 @@ export function gettbConsInfo(params) { // params // }); return request({ - url: "/api/viewConInfoFlow", + url: "/api/tbConsInfo", method: "get", - params + params:{ + ...params, + shopId: localStorage.getItem("shopId"), + status:1 + } }); } diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue index b074ba0..c3a8bfb 100644 --- a/src/views/table/table_list.vue +++ b/src/views/table/table_list.vue @@ -233,6 +233,8 @@ import { tbShopTable, } from "@/api/table"; import dayjs from "dayjs"; + + export default { components: { addEara, @@ -253,18 +255,48 @@ export default { selTable: "", //当前选中的桌台 areaMap: {}, shopInfo: {}, + timer:null }; }, + beforeDestroy() { + this.clearTimer(); + console.log('beforeDestroy') + }, mounted() { + this.clearTimer(); + this.setTimter(60); this.tbShopAreaGet(); this.getShopInfo(); }, filters: { - formatTime(time) { - return dayjs(time).format("HH小时mm分"); + formatTime(milliseconds) { + if (!milliseconds) { + return ""; + } + const days = Math.floor(milliseconds / (1000 * 60 * 60 * 24)); + const hours = Math.floor( + (milliseconds % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) + ); + const minutes = Math.floor( + (milliseconds % (1000 * 60 * 60)) / (1000 * 60) + ); + return `${days ? days + "天" : ""} ${hours ? hours + "时" : ""} ${ + minutes ? minutes + "分" : "" + }`; }, }, methods: { + clearTimer(){ + console.log('clearTimer') + clearInterval(this.timer); + this.timer=null; + }, + setTimter(time=60){ + this.timer=setInterval(() => { + const showloading=false + this.tbShopTableGet(showloading) + }, time*1000); + }, //获取店铺信息 async getShopInfo() { try { @@ -322,7 +354,7 @@ export default { this.selTable = item; if (this.shopInfo.isTableFee) { //免餐位费 - this.toInstead({num: 0,key}); + this.toInstead({ num: 0, key }); // this.$refs.diancan.open(item, key, ''); return; } @@ -330,20 +362,23 @@ export default { if (item.useNum <= 0) { return this.$refs.refChooseDinersNumber.open(); } - this.toInstead({num: num,key}); + this.toInstead({ num: num, key }); // this.$refs.diancan.open(item, key, num); }, toInstead(query) { - this.$router.push({ path: "/tool/Instead/index", query: { - table_name: this.selTable.name, - tableId: this.selTable.tableId, - maxCapacity:this.selTable.maxCapacity, - useType: this.selTable.useType, - ...query - }}); + this.$router.push({ + path: "/tool/Instead/index", + query: { + table_name: this.selTable.name, + tableId: this.selTable.tableId, + useType: this.selTable.useType, + maxCapacity:this.selTable.maxCapacity, + ...query, + }, + }); }, chooseDinersNumberConfirm(num) { - this.toInstead({num: num}); + this.toInstead({ num: num }); // this.$refs.diancan.open(this.selTable, undefined, num); }, tabClick() { @@ -369,8 +404,8 @@ export default { } }, // 台桌列表 - async tbShopTableGet() { - this.loading = true; + async tbShopTableGet(showloading=true) { + this.loading = showloading; try { const { content, total } = await tbShopTableGet({ shopId: localStorage.getItem("shopId"), diff --git a/src/views/tool/Instead/components/cart-item.vue b/src/views/tool/Instead/components/cart-item.vue index 5c79941..730200d 100644 --- a/src/views/tool/Instead/components/cart-item.vue +++ b/src/views/tool/Instead/components/cart-item.vue @@ -151,9 +151,9 @@ export default { this.$emit("changeOrderNumber", this.index, isReduce); }, itemClick() { - if(this.isSeatFee){ - return - } + // if(this.isSeatFee){ + // return + // } this.$emit("itemClick", this.index,this.canChangeNumber,this.placeNum); }, }, diff --git a/src/views/tool/Instead/components/pay-type.vue b/src/views/tool/Instead/components/pay-type.vue index 692dd8c..f5f672d 100644 --- a/src/views/tool/Instead/components/pay-type.vue +++ b/src/views/tool/Instead/components/pay-type.vue @@ -51,8 +51,7 @@ export default { async init() { const res = await $getPayType(); this.list = res.filter(v=>v.isDisplay); - console.log(res[0]); - this.sel = this.sel ? this.sel : res[0].payType; + this.sel = this.sel ? this.sel : 'scanCode'; }, }, mounted() { diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index 0b594b7..70631e9 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -237,11 +237,8 @@ - 清空 @@ -308,14 +305,14 @@ @@ -349,41 +346,77 @@
-