|
|
@@ -59,10 +59,12 @@
|
|
|
<div>
|
|
|
<a-icon type="user" />{{ item.userNum }}/{{ item.num }}人
|
|
|
</div>
|
|
|
- <div><a-icon type="clock-circle" />00:55</div>
|
|
|
+ <div>
|
|
|
+ <a-icon type="clock-circle" />{{ hours(item.orderTime) }}
|
|
|
+ </div>
|
|
|
</div></template
|
|
|
>
|
|
|
- <template v-else-if="item.state === 2">
|
|
|
+ <template v-else-if="item.state === 2 || item.state === 4">
|
|
|
<div>{{ item.name }}</div>
|
|
|
<div style="margin-top: 10px">
|
|
|
¥{{ item.posOrderGoods ? item.posOrderGoods.money : 0 }}
|
|
|
@@ -77,7 +79,9 @@
|
|
|
<div>
|
|
|
<a-icon type="user" />{{ item.userNum }}/{{ item.num }}人
|
|
|
</div>
|
|
|
- <div><a-icon type="clock-circle" />00:55</div>
|
|
|
+ <div>
|
|
|
+ <a-icon type="clock-circle" />{{ hours(item.orderTime) }}
|
|
|
+ </div>
|
|
|
</div></template
|
|
|
>
|
|
|
<template v-else>
|
|
|
@@ -249,6 +253,20 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
+ console.log("created");
|
|
|
+ this.dataSource = [{ id: "0" }];
|
|
|
+ getAction("/pos/posType/list", { pageNo: 1, pageSize: 99 }).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.posTypeList = res.result.records;
|
|
|
+ if (this.posTypeList && this.posTypeList.length > 0) {
|
|
|
+ this.tabPosTypeId = this.posTypeList[0].id;
|
|
|
+ this.loadRegion();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ activated() {
|
|
|
+ console.log("activated");
|
|
|
this.dataSource = [{ id: "0" }];
|
|
|
getAction("/pos/posType/list", { pageNo: 1, pageSize: 99 }).then((res) => {
|
|
|
if (res.success) {
|
|
|
@@ -261,6 +279,17 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ hours(start) {
|
|
|
+ var beginDate = new Date(start);
|
|
|
+ var endDate = new Date();
|
|
|
+ let hours = parseInt((endDate - beginDate) / (1000 * 60 * 60));
|
|
|
+ let leave1 =
|
|
|
+ (endDate.getTime() - beginDate.getTime()) % (24 * 3600 * 1000);
|
|
|
+ let leave2 = leave1 % (3600 * 1000);
|
|
|
+ let minutes = Math.floor(leave2 / (60 * 1000));
|
|
|
+ // return minutes == 0 ? hours : hours + 1;
|
|
|
+ return hours.toString().padStart(2, "0") + ":" + minutes.toString().padStart(2, "0");
|
|
|
+ },
|
|
|
getStatusColor(status) {
|
|
|
var find = this.statusColorList.find((t) => t.status == status);
|
|
|
return find ? find.color : "#fff";
|
|
|
@@ -439,7 +468,7 @@ export default {
|
|
|
this.selectRoomOrder = {};
|
|
|
this.loadGoods();
|
|
|
if (callback) {
|
|
|
- callback(res.result);
|
|
|
+ callback(res.result.code);
|
|
|
}
|
|
|
} else {
|
|
|
this.$message.warning(res.message);
|
|
|
@@ -455,12 +484,31 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
itemClick(row) {
|
|
|
+ var that = this;
|
|
|
console.log(row);
|
|
|
this.selectTable = row;
|
|
|
if (row.state === 0) {
|
|
|
this.$refs.modalUserNmumForm.edit({ id: row.id, userNum: 1 });
|
|
|
this.$refs.modalUserNmumForm.title = "就餐人数";
|
|
|
this.$refs.modalUserNmumForm.disableSubmit = false;
|
|
|
+ } else if (row.state === 4) {
|
|
|
+ this.$confirm({
|
|
|
+ content: "确定是否要清除房台?",
|
|
|
+ onOk: function () {
|
|
|
+ var model = JSON.parse(JSON.stringify(row));
|
|
|
+ model.state = 0;
|
|
|
+ model.userNum = 0;
|
|
|
+ model.orderTime = null;
|
|
|
+ postAction("/pos/posTable/edit", model).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ that.$message.success(res.message);
|
|
|
+ that.loadTables();
|
|
|
+ } else {
|
|
|
+ that.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
} else {
|
|
|
this.$router.push({
|
|
|
name: "pos-tablediandan",
|