|
|
@@ -49,7 +49,9 @@
|
|
|
<p>数量:{{ sum }}</p>
|
|
|
<div v-if="this.posTableState === 1">
|
|
|
<a-button @click="placeOrder" :disabled="btnDisabled">下单</a-button>
|
|
|
- <a-button @click="unionStation" style="margin-left: 10px;">联台</a-button>
|
|
|
+ <a-button @click="unionStation('联台','5')" style="margin-left: 10px;">联台</a-button>
|
|
|
+ <a-button v-if="!btnDisabled && selectGoodsList.length !== 0" @click="unionStation('转菜','2')" :disabled="transferDishesList.length == 0" style="margin-left: 10px;">转菜</a-button>
|
|
|
+ <a-button @click="unionStation('换台','0')" style="margin-left: 10px;">换台</a-button>
|
|
|
<!-- <a-button @click="addClear" :disabled="btnDisabled">清空新加</a-button>-->
|
|
|
</div>
|
|
|
<div v-else style="display: flex; gap: 5px; flex-flow: wrap">
|
|
|
@@ -60,6 +62,15 @@
|
|
|
<a-button v-if="!btnDisabled" @click="pendingOrder">挂单</a-button>
|
|
|
<a-button v-else @click="handlePickingGoodsOrder">取单</a-button>
|
|
|
</div>
|
|
|
+ <div>
|
|
|
+ <a-button v-if="!btnDisabled" @click="unionStation('联台','5')" style="margin-left: 10px;">联台</a-button>
|
|
|
+ <a-button v-if="!btnDisabled && selectGoodsList.length !== 0" @click="unionStation('转菜','2')" :disabled="transferDishesList.length == 0" style="margin-left: 10px;">转菜</a-button>
|
|
|
+ <a-button v-if="!btnDisabled" @click="unionStation('换台','0')" style="margin-left: 10px;">换台</a-button>
|
|
|
+ <a-button v-if="isUnionStation" @click="unlink" style="margin-left: 10px;">取消联台</a-button>
|
|
|
+
|
|
|
+ <!-- <a-button @click="pendingOrder">挂单</a-button> -->
|
|
|
+ <!-- <a-button v-else @click="handlePickingGoodsOrder">取单</a-button> -->
|
|
|
+ </div>
|
|
|
<a-button
|
|
|
v-if="selectRoomOrder && selectRoomOrder.roomName && !btnDisabled"
|
|
|
@click="handleToRoomFeePayment"
|
|
|
@@ -153,7 +164,7 @@
|
|
|
</a-space>
|
|
|
</a-row>
|
|
|
</a-card>
|
|
|
- <a-modal v-model="unionOpen" width="1200px" title="联台" @ok="handleOk">
|
|
|
+ <a-modal v-model="unionOpen" width="1200px" :title="unionTitle" @ok="handleOk">
|
|
|
<a-tabs v-model="tabPosRegionId" @change="tabRegionChange">
|
|
|
<a-tab-pane key="1" tab="全部"></a-tab-pane>
|
|
|
<a-tab-pane
|
|
|
@@ -288,6 +299,14 @@ export default {
|
|
|
tableName: {
|
|
|
type: String,
|
|
|
default: ''
|
|
|
+ },
|
|
|
+ orderId: {
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
+ },
|
|
|
+ isUnionStation: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -363,8 +382,11 @@ export default {
|
|
|
uniteDataSource: [],
|
|
|
model: {
|
|
|
reserveTableList: []
|
|
|
- }
|
|
|
-
|
|
|
+ },
|
|
|
+ // 联台弹框标题文本
|
|
|
+ unionTitle: '',
|
|
|
+ // 转菜储存数组
|
|
|
+ transferDishesList: []
|
|
|
}
|
|
|
},
|
|
|
provide() {
|
|
|
@@ -383,6 +405,10 @@ export default {
|
|
|
)
|
|
|
this.selectedRowKeys = selectedRowKeys
|
|
|
this.selectedRows = selectedRows
|
|
|
+ this.transferDishesList = this.selectedRows.filter(item => {
|
|
|
+ return ('id' in item)
|
|
|
+ })
|
|
|
+ console.log(this.transferDishesList);
|
|
|
},
|
|
|
getCheckboxProps: (record) => ({
|
|
|
props: {
|
|
|
@@ -404,11 +430,16 @@ export default {
|
|
|
}, 0)
|
|
|
},
|
|
|
btnDisabled() {
|
|
|
- var res = this.selectGoodsList && this.selectGoodsList.length > 0
|
|
|
+ console.log(this.selectGoodsList);
|
|
|
+ var res = this.selectGoodsList && this.selectGoodsList.length >= 0
|
|
|
return !res
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
+ console.log(this.tableId);
|
|
|
+ console.log(this.tableState);
|
|
|
+ console.log(this.tableName);
|
|
|
+ console.log(this.orderId);
|
|
|
this.dataSource = [
|
|
|
{
|
|
|
id: '0'
|
|
|
@@ -456,6 +487,7 @@ export default {
|
|
|
/** 通过桌号查询订单 */
|
|
|
getOrderByTableId(tableId) {
|
|
|
getAction('/pos/posOrderGoods/getOrderByTableId', { tableId }).then(resp => {
|
|
|
+ console.log(resp);
|
|
|
if (resp.success) {
|
|
|
this.selectOrderInfo = resp.result
|
|
|
this.selectGoodsList = resp.result.posOrderGoodsDetailList
|
|
|
@@ -835,23 +867,57 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 联台按钮
|
|
|
- unionStation() {
|
|
|
+ unionStation(val,index) {
|
|
|
+ if (val == '转菜' && (this.transferDishesList.length !== this.selectedRows.length)) {
|
|
|
+ this.$message.error('勾选的商品中有未下单的商品,不能进行转菜操作')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.unionTitle = val
|
|
|
this.unionOpen = true
|
|
|
- this.loadRegion()
|
|
|
+ this.uniteDataSource = []
|
|
|
+ this.loadRegion(index)
|
|
|
},
|
|
|
// 联台确认
|
|
|
handleOk() {
|
|
|
- let tempdata = []
|
|
|
- this.model.reserveTableList.forEach(index => {
|
|
|
- tempdata.push(index.posOrderGoods.id)
|
|
|
- })
|
|
|
- console.log(tempdata);
|
|
|
- postAction(`/pos/posOrderGoods/merge-order + ${this.posTableId}`,tempdata).then(res => {
|
|
|
- console.log(res);
|
|
|
- if (res.success) {
|
|
|
- this.$message.success('联台成功')
|
|
|
- }
|
|
|
- })
|
|
|
+ console.log(this.model.reserveTableList);
|
|
|
+ if (this.unionTitle == '换台') {
|
|
|
+ console.log(111);
|
|
|
+ getAction(`/pos/posOrderGoods/change-table?posOrderId=${this.orderId}&tableId=${this.model.reserveTableList[0].id}`).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('换台成功')
|
|
|
+ }
|
|
|
+ this.unionOpen = false
|
|
|
+ })
|
|
|
+ } else if (this.unionTitle == '转菜') {
|
|
|
+ let tempList = []
|
|
|
+ this.transferDishesList.forEach(index => {
|
|
|
+ tempList.push(index.id)
|
|
|
+ })
|
|
|
+ postAction(`/pos/posOrderGoods/transfer-dishes?posOrderId=` + this.model.reserveTableList[0].posOrderGoods.id,tempList).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('转菜成功')
|
|
|
+ }
|
|
|
+ // this.itemClick2()
|
|
|
+ this.getOrderByTableId(this.tableId)
|
|
|
+ this.loadGoods()
|
|
|
+ this.unionOpen = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ let tempdata = []
|
|
|
+ this.model.reserveTableList.forEach(index => {
|
|
|
+ tempdata.push(index.posOrderGoods.id)
|
|
|
+ })
|
|
|
+ postAction(`/pos/posOrderGoods/merge-order?mainPosOrderId=` + this.selectOrderInfo.id,tempdata).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('联台成功')
|
|
|
+ }
|
|
|
+ this.unionOpen = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
console.log(this.posTableId);
|
|
|
},
|
|
|
// 联台大厅tab切换
|
|
|
@@ -859,7 +925,7 @@ export default {
|
|
|
this.loadTables();
|
|
|
},
|
|
|
// 联台大厅tab获取
|
|
|
- loadRegion() {
|
|
|
+ loadRegion(index) {
|
|
|
getAction("/pos/posRegion/list", {
|
|
|
posTypeId: this.tabPosTypeId,
|
|
|
}).then((res) => {
|
|
|
@@ -868,15 +934,15 @@ export default {
|
|
|
this.regionList = res.result.records;
|
|
|
}
|
|
|
});
|
|
|
- this.loadTables();
|
|
|
+ this.loadTables(index);
|
|
|
},
|
|
|
// 联台大厅数据获取
|
|
|
- loadTables() {
|
|
|
+ loadTables(index) {
|
|
|
var obj = {
|
|
|
pageNo: 1,
|
|
|
pageSize: 99999,
|
|
|
posTypeId: this.tabPosTypeId,
|
|
|
- // state: this.state,
|
|
|
+ state: index,
|
|
|
};
|
|
|
if (this.tabPosRegionId != "1") {
|
|
|
obj.posRegionId = this.tabPosRegionId;
|
|
|
@@ -888,7 +954,7 @@ export default {
|
|
|
// console.log(this.uniteDataSource);
|
|
|
// }
|
|
|
// });
|
|
|
- getAction("/pos/posTable/getCanMerge", obj).then((res) => {
|
|
|
+ getAction("/pos/posTable/getCanUseTable", obj).then((res) => {
|
|
|
console.log(res);
|
|
|
if (res.success) {
|
|
|
this.uniteDataSource = res.result.records;
|
|
|
@@ -898,16 +964,37 @@ export default {
|
|
|
},
|
|
|
// 联台点击
|
|
|
orderMeal(item) {
|
|
|
- console.log(item);
|
|
|
- if (this.model.reserveTableList.some((t) => t.id == item.id)) {
|
|
|
- this.model.reserveTableList = this.model.reserveTableList.filter(
|
|
|
- (t) => t.id != item.id
|
|
|
- );
|
|
|
+ console.log(this.unionTitle);
|
|
|
+ if (this.unionTitle == '换台' || this.unionTitle == '转菜') {
|
|
|
+ this.model.reserveTableList = []
|
|
|
+ if (this.model.reserveTableList.some((t) => t.id == item.id)) {
|
|
|
+ this.model.reserveTableList = this.model.reserveTableList.filter(
|
|
|
+ (t) => t.id != item.id
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.model.reserveTableList = [item];
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.model.reserveTableList.push(item);
|
|
|
+ if (this.model.reserveTableList.some((t) => t.id == item.id)) {
|
|
|
+ this.model.reserveTableList = this.model.reserveTableList.filter(
|
|
|
+ (t) => t.id != item.id
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ this.model.reserveTableList.push(item);
|
|
|
+ }
|
|
|
}
|
|
|
console.log(this.model.reserveTableList);
|
|
|
},
|
|
|
+ // 取消联台
|
|
|
+ unlink() {
|
|
|
+ getAction(`/pos/posOrderGoods/return-merge-order?posOrderId=${this.orderId}`).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('取消联台成功')
|
|
|
+ }
|
|
|
+ this.unionOpen = false
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|