并桌转桌
This commit is contained in:
parent
535e3834c9
commit
98ae9c5e21
|
|
@ -12,8 +12,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!isFull">
|
<div v-if="!isFull">
|
||||||
<div v-if="itemdata.list.length > 0">
|
<div v-if="itemdata.list.length > 0">
|
||||||
<el-table ref="reftransfertoPinpin" :data="itemdata.list" tooltip-effect="dark" style="width: 100%"
|
<h4>购物车商品</h4>
|
||||||
@selection-change="handleSelectionChange($event)">
|
<el-table ref="refcart" :data="itemdata.list" tooltip-effect="dark" style="width: 100%"
|
||||||
|
@selection-change="handlerefcart($event)">
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column label="图片" prop="coverImg">
|
<el-table-column label="图片" prop="coverImg">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
@ -32,7 +33,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-if="itemdata.old.list.length > 0">
|
||||||
<div v-for="(orderItem, orderIndex) in itemdata.old.list" :key="orderIndex">
|
<div v-for="(orderItem, orderIndex) in itemdata.old.list" :key="orderIndex">
|
||||||
<h4>第{{ orderItem.placeNum }}次下单商品</h4>
|
<h4>第{{ orderItem.placeNum }}次下单商品</h4>
|
||||||
<el-table ref="reftransfertoPinpin" :data="orderItem.info" tooltip-effect="dark"
|
<el-table ref="reftransfertoPinpin" :data="orderItem.info" tooltip-effect="dark"
|
||||||
|
|
@ -69,6 +70,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { placeswitch } from "@/api/Instead";
|
import { placeswitch } from "@/api/Instead";
|
||||||
|
import { forEach } from "lodash";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -80,30 +82,31 @@ export default {
|
||||||
targetTableId: '',
|
targetTableId: '',
|
||||||
originTableList: [],//桌台列表
|
originTableList: [],//桌台列表
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
|
refcartSelection: [],
|
||||||
isFull: false
|
isFull: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toggleSelection() {
|
toggleSelection() {
|
||||||
if (this.itemdata.list.length > 0) {
|
try {
|
||||||
this.$refs.reftransfertoPinpinclearSelection();
|
this.$refs.refcart.clearSelection();
|
||||||
} else {
|
|
||||||
this.$refs.reftransfertoPinpin.forEach((a) => {
|
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||||
a.clearSelection();
|
a.clearSelection();
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSelectionChange(val, index) {
|
handleSelectionChange(val, index) {
|
||||||
try {
|
try {
|
||||||
if (this.itemdata.list.length > 0) {
|
this.itemdata.old.list.forEach((a, i) => {
|
||||||
this.multipleSelection = val
|
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
|
||||||
} else {
|
})
|
||||||
this.itemdata.old.list.forEach((a, i) => {
|
|
||||||
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) { }
|
} catch (error) { }
|
||||||
},
|
},
|
||||||
|
handlerefcart(val) {
|
||||||
|
this.refcartSelection = val
|
||||||
|
},
|
||||||
async confirm() {
|
async confirm() {
|
||||||
console.log(this.itemdata, this.multipleSelection)
|
console.log(this.itemdata, this.multipleSelection)
|
||||||
if (!this.targetTableId) {
|
if (!this.targetTableId) {
|
||||||
|
|
@ -113,10 +116,17 @@ export default {
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.refcartSelection.length) {
|
||||||
|
this.refcartSelection.forEach((i) => {
|
||||||
|
i.cartId = i.id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let cartIds = [...this.multipleSelection, [...this.refcartSelection]]
|
||||||
|
console.log(cartIds)
|
||||||
await placeswitch({
|
await placeswitch({
|
||||||
masterId: this.masterId,
|
masterId: this.masterId,
|
||||||
orderId: this.itemdata.orderId,//当前台桌订单id 可选
|
orderId: this.itemdata.orderId,//当前台桌订单id 可选
|
||||||
cartIds: this.isFull ? '' : this.multipleSelection.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选
|
cartIds: this.isFull ? '' : cartIds.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选
|
||||||
isFull: this.isFull,//并台会将全部购物车商品转入,默认为false 可选
|
isFull: this.isFull,//并台会将全部购物车商品转入,默认为false 可选
|
||||||
currentTableId: this.currentTableId,
|
currentTableId: this.currentTableId,
|
||||||
targetTableId: this.targetTableId,
|
targetTableId: this.targetTableId,
|
||||||
|
|
@ -128,18 +138,17 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
open(item, masterId, currentTableId, originTableList) {
|
open(item, masterId, currentTableId, originTableList) {
|
||||||
|
// 订单信息,取餐码,用餐类型,桌台号id,台桌列表
|
||||||
|
console.log(item, masterId, currentTableId, originTableList)
|
||||||
this.itemdata = item
|
this.itemdata = item
|
||||||
this.masterId = masterId//取餐码
|
this.masterId = masterId//取餐码
|
||||||
this.currentTableId = currentTableId//当前桌台id
|
this.currentTableId = currentTableId//当前桌台id
|
||||||
this.originTableList = originTableList//台桌列表
|
this.originTableList = originTableList.filter((i) => i.tableId != currentTableId && i.status == 'using')//台桌列表
|
||||||
try {
|
try {
|
||||||
if (this.itemdata.list.length > 0) {
|
this.$refs.refcart.clearSelection();
|
||||||
this.$refs.reftransfertoPinpinclearSelection();
|
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||||
} else {
|
a.clearSelection();
|
||||||
this.$refs.reftransfertoPinpin.forEach((a) => {
|
})
|
||||||
a.clearSelection();
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch (error) { }
|
} catch (error) { }
|
||||||
this.show = true;
|
this.show = true;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -435,7 +435,7 @@
|
||||||
{{ returnWaingAllText }}
|
{{ returnWaingAllText }}
|
||||||
</div>
|
</div>
|
||||||
<div class="btn no-wrap u-font-12" @click="clicktransfertoPinpin()"
|
<div class="btn no-wrap u-font-12" @click="clicktransfertoPinpin()"
|
||||||
v-if="table.name && useTypes.sel == 'dine-in'">
|
v-if="table.name && useTypes.sel == 'dine-in' && payAfter">
|
||||||
转桌/并桌
|
转桌/并桌
|
||||||
</div>
|
</div>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
@ -1027,7 +1027,7 @@
|
||||||
<!-- 可选套餐 -->
|
<!-- 可选套餐 -->
|
||||||
<dialogpackage ref="refdialogpackage" @dialogpackageconfirm="dialogpackageconfirm"></dialogpackage>
|
<dialogpackage ref="refdialogpackage" @dialogpackageconfirm="dialogpackageconfirm"></dialogpackage>
|
||||||
<!-- 并桌/转桌 -->
|
<!-- 并桌/转桌 -->
|
||||||
<transfertoPinpin ref="refransfertoPinpin" @transfertoPinpin="xiadanClick"></transfertoPinpin>
|
<transfertoPinpin ref="refransfertoPinpin" @transfertoPinpin="reset"></transfertoPinpin>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -2891,16 +2891,25 @@ export default {
|
||||||
// });
|
// });
|
||||||
// },
|
// },
|
||||||
clicktransfertoPinpin() {
|
clicktransfertoPinpin() {
|
||||||
if (this.order.list.length < 0) {
|
// 使用 reduce 方法统计指定值出现的次数
|
||||||
|
const count = this.tableList.reduce((acc, cur) => {
|
||||||
|
if (cur.status == 'using') {
|
||||||
|
return acc + 1;
|
||||||
|
}
|
||||||
|
return acc;
|
||||||
|
}, 0);
|
||||||
|
console.log(count)
|
||||||
|
if (count >= 2) {
|
||||||
|
// console.log(this.order, this.masterId, this.table.tableId, this.tableList)
|
||||||
|
// 订单信息,取餐码,用餐类型,桌台号id,台桌列表
|
||||||
|
this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
|
||||||
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请先选择商品!',
|
message: '暂无可转台桌!',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(this.order, this.masterId, this.table.tableId, this.tableList)
|
|
||||||
// 订单信息,取餐码,用餐类型,台桌列表,桌台号id
|
|
||||||
this.$refs.refransfertoPinpin.open(this.order, this.masterId, this.table.tableId, this.tableList);
|
|
||||||
},
|
},
|
||||||
//右侧控制按钮点击事件
|
//右侧控制按钮点击事件
|
||||||
async orderBtnsClick(key) {
|
async orderBtnsClick(key) {
|
||||||
|
|
@ -3491,6 +3500,7 @@ export default {
|
||||||
this.order.orderId = "";
|
this.order.orderId = "";
|
||||||
this.perpole = "";
|
this.perpole = "";
|
||||||
this.useTypes.sel = "dine-in";
|
this.useTypes.sel = "dine-in";
|
||||||
|
this.getTable()
|
||||||
},
|
},
|
||||||
//设置购物车数据
|
//设置购物车数据
|
||||||
setCart(res) {
|
setCart(res) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue