From 9f72777317e36b331d3f572c847a2121305168f6 Mon Sep 17 00:00:00 2001 From: wwz <114797966@qq.com> Date: Tue, 17 Dec 2024 10:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E5=AE=A2=E4=B8=8B=E5=8D=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AF=BE=E5=BA=A7=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Instead/components/transfertoPinpin.vue | 90 +- src/views/tool/Instead/index.vue | 1157 ++++++++++++----- 2 files changed, 893 insertions(+), 354 deletions(-) diff --git a/src/views/tool/Instead/components/transfertoPinpin.vue b/src/views/tool/Instead/components/transfertoPinpin.vue index 31eff79..7ef5a7d 100644 --- a/src/views/tool/Instead/components/transfertoPinpin.vue +++ b/src/views/tool/Instead/components/transfertoPinpin.vue @@ -1,14 +1,18 @@ - @@ -64,7 +67,6 @@ 取消 - @@ -74,16 +76,17 @@ import { forEach } from "lodash"; export default { data() { return { + selectalllist: [], show: false, itemdata: {}, list: [], - masterId: '', - currentTableId: '', - targetTableId: '', - originTableList: [],//桌台列表 + masterId: "", + currentTableId: "", + targetTableId: "", + originTableList: [], //桌台列表 multipleSelection: [], refcartSelection: [], - isFull: false + isFull: false, }; }, methods: { @@ -92,64 +95,76 @@ export default { this.$refs.refcart.clearSelection(); this.$refs.reftransfertoPinpin.forEach((a) => { a.clearSelection(); - }) - } catch (error) { - - } + }); + } catch (error) { } }, handleSelectionChange(val, index) { try { this.itemdata.old.list.forEach((a, i) => { - this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || [] - }) + this.multipleSelection[index] = + i === index ? val : this.multipleSelection[index] || []; + }); } catch (error) { } }, handlerefcart(val) { - this.refcartSelection = val + this.refcartSelection = val; }, async confirm() { - console.log(this.itemdata, this.multipleSelection) + console.log(this.itemdata, this.multipleSelection); if (!this.targetTableId) { this.$message({ - message: '请选择目标台桌!', - type: 'warning' - }) + message: "请选择目标台桌!", + type: "warning", + }); return false; } + // 判断全选增加课桌费 + var tzf = [] + try { + let one = this.itemdata.old.list.every((i, index) => i.info.length == this.multipleSelection[index].length) + let tow = this.itemdata.list.every((icon) => icon.length == this.refcartSelection.length) + if (one && tow) { + tzf = [999] + } + } catch (error) { } + // 数据处理 增加cartId方便判断 if (this.refcartSelection.length) { this.refcartSelection.forEach((i) => { - i.cartId = i.id - }) + i.cartId = i.id; + }); } - let cartIds = [...this.multipleSelection, [...this.refcartSelection]] + let cartIds = [...this.multipleSelection, [...this.refcartSelection]]; console.log(cartIds) await placeswitch({ masterId: this.masterId, - orderId: this.itemdata.orderId,//当前台桌订单id 可选 - cartIds: this.isFull ? '' : cartIds.flatMap(subArray => subArray.map(item => item.cartId)),//转单的购物车商品 并桌时可不传 可选 - isFull: this.isFull,//并台会将全部购物车商品转入,默认为false 可选 + orderId: this.itemdata.orderId, //当前台桌订单id 可选 + cartIds: this.isFull ? "" : [...cartIds.flatMap((subArray) => subArray.map((item) => item.cartId)),...tzf] , //转单的购物车商品 并桌时可不传 可选 + isFull: this.isFull, //并台会将全部购物车商品转入,默认为false 可选 currentTableId: this.currentTableId, targetTableId: this.targetTableId, - - }) + }); this.$forceUpdate(); this.$emit("transfertoPinpin"); this.show = false; - }, 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.filter((i) => i.tableId != currentTableId && i.status == 'using')//台桌列表 + console.log(item, masterId, currentTableId, originTableList); + this.itemdata = item; + this.masterId = masterId; //取餐码 + this.currentTableId = currentTableId; //当前桌台id + this.originTableList = originTableList.filter( + (i) => i.tableId != currentTableId && i.status == "using" + ); //台桌列表 try { this.$refs.refcart.clearSelection(); this.$refs.reftransfertoPinpin.forEach((a) => { a.clearSelection(); - }) + }); } catch (error) { } + this.multipleSelection = [] + this.refcartSelection = [] + this.targetTableId = '' this.show = true; }, returnTableColor(key) { @@ -157,7 +172,7 @@ export default { return item ? item.type : ""; }, changeTable(item, index) { - console.log(item, index) + console.log(item, index); }, searchInput(e) { console.log(e); @@ -179,7 +194,6 @@ export default { margin: 20px 10px; .boxspan {} - } .buttonbox { @@ -188,4 +202,4 @@ export default { text-align: right; } } - \ No newline at end of file + diff --git a/src/views/tool/Instead/index.vue b/src/views/tool/Instead/index.vue index 212bea4..908fcc6 100644 --- a/src/views/tool/Instead/index.vue +++ b/src/views/tool/Instead/index.vue @@ -2,18 +2,32 @@