并桌转桌
This commit is contained in:
parent
535e3834c9
commit
98ae9c5e21
|
|
@ -12,8 +12,9 @@
|
|||
</div>
|
||||
<div v-if="!isFull">
|
||||
<div v-if="itemdata.list.length > 0">
|
||||
<el-table ref="reftransfertoPinpin" :data="itemdata.list" tooltip-effect="dark" style="width: 100%"
|
||||
@selection-change="handleSelectionChange($event)">
|
||||
<h4>购物车商品</h4>
|
||||
<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 label="图片" prop="coverImg">
|
||||
<template slot-scope="scope">
|
||||
|
|
@ -32,7 +33,7 @@
|
|||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="itemdata.old.list.length > 0">
|
||||
<div v-for="(orderItem, orderIndex) in itemdata.old.list" :key="orderIndex">
|
||||
<h4>第{{ orderItem.placeNum }}次下单商品</h4>
|
||||
<el-table ref="reftransfertoPinpin" :data="orderItem.info" tooltip-effect="dark"
|
||||
|
|
@ -69,6 +70,7 @@
|
|||
|
||||
<script>
|
||||
import { placeswitch } from "@/api/Instead";
|
||||
import { forEach } from "lodash";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -80,30 +82,31 @@ export default {
|
|||
targetTableId: '',
|
||||
originTableList: [],//桌台列表
|
||||
multipleSelection: [],
|
||||
refcartSelection: [],
|
||||
isFull: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
toggleSelection() {
|
||||
if (this.itemdata.list.length > 0) {
|
||||
this.$refs.reftransfertoPinpinclearSelection();
|
||||
} else {
|
||||
try {
|
||||
this.$refs.refcart.clearSelection();
|
||||
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||
a.clearSelection();
|
||||
})
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
},
|
||||
handleSelectionChange(val, index) {
|
||||
try {
|
||||
if (this.itemdata.list.length > 0) {
|
||||
this.multipleSelection = val
|
||||
} else {
|
||||
this.itemdata.old.list.forEach((a, i) => {
|
||||
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
|
||||
})
|
||||
}
|
||||
} catch (error) { }
|
||||
},
|
||||
handlerefcart(val) {
|
||||
this.refcartSelection = val
|
||||
},
|
||||
async confirm() {
|
||||
console.log(this.itemdata, this.multipleSelection)
|
||||
if (!this.targetTableId) {
|
||||
|
|
@ -113,10 +116,17 @@ export default {
|
|||
})
|
||||
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({
|
||||
masterId: this.masterId,
|
||||
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 可选
|
||||
currentTableId: this.currentTableId,
|
||||
targetTableId: this.targetTableId,
|
||||
|
|
@ -128,18 +138,17 @@ export default {
|
|||
|
||||
},
|
||||
open(item, masterId, currentTableId, originTableList) {
|
||||
// 订单信息,取餐码,用餐类型,桌台号id,台桌列表
|
||||
console.log(item, masterId, currentTableId, originTableList)
|
||||
this.itemdata = item
|
||||
this.masterId = masterId//取餐码
|
||||
this.currentTableId = currentTableId//当前桌台id
|
||||
this.originTableList = originTableList//台桌列表
|
||||
this.originTableList = originTableList.filter((i) => i.tableId != currentTableId && i.status == 'using')//台桌列表
|
||||
try {
|
||||
if (this.itemdata.list.length > 0) {
|
||||
this.$refs.reftransfertoPinpinclearSelection();
|
||||
} else {
|
||||
this.$refs.refcart.clearSelection();
|
||||
this.$refs.reftransfertoPinpin.forEach((a) => {
|
||||
a.clearSelection();
|
||||
})
|
||||
}
|
||||
} catch (error) { }
|
||||
this.show = true;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@
|
|||
{{ returnWaingAllText }}
|
||||
</div>
|
||||
<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>
|
||||
<!-- -->
|
||||
|
|
@ -1027,7 +1027,7 @@
|
|||
<!-- 可选套餐 -->
|
||||
<dialogpackage ref="refdialogpackage" @dialogpackageconfirm="dialogpackageconfirm"></dialogpackage>
|
||||
<!-- 并桌/转桌 -->
|
||||
<transfertoPinpin ref="refransfertoPinpin" @transfertoPinpin="xiadanClick"></transfertoPinpin>
|
||||
<transfertoPinpin ref="refransfertoPinpin" @transfertoPinpin="reset"></transfertoPinpin>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -2891,16 +2891,25 @@ export default {
|
|||
// });
|
||||
// },
|
||||
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({
|
||||
message: '请先选择商品!',
|
||||
message: '暂无可转台桌!',
|
||||
type: 'warning'
|
||||
})
|
||||
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) {
|
||||
|
|
@ -3491,6 +3500,7 @@ export default {
|
|||
this.order.orderId = "";
|
||||
this.perpole = "";
|
||||
this.useTypes.sel = "dine-in";
|
||||
this.getTable()
|
||||
},
|
||||
//设置购物车数据
|
||||
setCart(res) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue