+
第{{ orderItem.placeNum }}次下单商品
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] || []
- })
- }
+ 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.reftransfertoPinpin.forEach((a) => {
- a.clearSelection();
- })
- }
+ this.$refs.refcart.clearSelection();
+ this.$refs.reftransfertoPinpin.forEach((a) => {
+ a.clearSelection();
+ })
} catch (error) { }
this.show = true;
},
diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue
index f7a1f34..212bea4 100644
--- a/src/views/tool/Instead/index.vue
+++ b/src/views/tool/Instead/index.vue
@@ -435,7 +435,7 @@
{{ returnWaingAllText }}
+ v-if="table.name && useTypes.sel == 'dine-in' && payAfter">
转桌/并桌
@@ -1027,7 +1027,7 @@
-
+
@@ -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) {