代客下单修改先付费页面逻辑样式

This commit is contained in:
2024-09-27 09:39:25 +08:00
parent a210389439
commit 60bc61d40f
5 changed files with 225 additions and 86 deletions

View File

@@ -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"),