diff --git a/src/views/table/table_list.vue b/src/views/table/table_list.vue index 883fad3..ce99737 100644 --- a/src/views/table/table_list.vue +++ b/src/views/table/table_list.vue @@ -38,7 +38,12 @@ > 下载台桌码 - 下载店铺码 + 下载店铺码
@@ -233,7 +238,7 @@ import { tbShopTable, } from "@/api/table"; import dayjs from "dayjs"; - +import { downloadFile } from "@/utils/index"; export default { components: { @@ -255,12 +260,12 @@ export default { selTable: "", //当前选中的桌台 areaMap: {}, shopInfo: {}, - timer:null + timer: null, }; }, beforeDestroy() { this.clearTimer(); - console.log('beforeDestroy') + console.log("beforeDestroy"); }, mounted() { this.clearTimer(); @@ -270,7 +275,7 @@ export default { }, filters: { formatTime(milliseconds) { - console.log(milliseconds) + console.log(milliseconds); if (!milliseconds) { return ""; } @@ -281,21 +286,37 @@ export default { const minutes = Math.floor( (milliseconds % (1000 * 60 * 60)) / (1000 * 60) ); - return `${days ? days + "天" : ""} ${hours ? hours + "时" : ""} ${minutes + "分" + return `${days ? days + "天" : ""} ${hours ? hours + "时" : ""} ${ + minutes + "分" }`; }, }, methods: { - clearTimer(){ - console.log('clearTimer') - clearInterval(this.timer); - this.timer=null; + async downloadShopCode() { + try { + const link = document.createElement("a"); + link.href = this.shopInfo.smallQrcode; + const fileName = this.shopInfo.shopName +"店铺码"+ ".png"; + console.log(fileName) + link.setAttribute("download", fileName); + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + this.$message.success("下载成功"); + } catch (error) { + console.log(error); + } }, - setTimter(time=60){ - this.timer=setInterval(() => { - const showloading=false - this.tbShopTableGet(showloading) - }, time*1000); + 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() { @@ -372,9 +393,9 @@ export default { table_name: this.selTable.name, tableId: this.selTable.tableId, useType: this.selTable.useType, - maxCapacity:this.selTable.maxCapacity, - masterId:this.selTable.masterId, - orderId:this.selTable.orderId, + maxCapacity: this.selTable.maxCapacity, + masterId: this.selTable.masterId, + orderId: this.selTable.orderId, ...query, }, }); @@ -406,7 +427,7 @@ export default { } }, // 台桌列表 - async tbShopTableGet(showloading=true) { + async tbShopTableGet(showloading = true) { this.loading = showloading; try { const { content, total } = await tbShopTableGet({ diff --git a/src/views/tool/Instead/components/cart-item.vue b/src/views/tool/Instead/components/cart-item.vue index c958b53..9b84f2e 100644 --- a/src/views/tool/Instead/components/cart-item.vue +++ b/src/views/tool/Instead/components/cart-item.vue @@ -1,8 +1,12 @@