代客下单增加课座费

This commit is contained in:
wwz 2024-12-17 10:29:00 +08:00
parent 3828987560
commit 9f72777317
2 changed files with 893 additions and 354 deletions

View File

@ -1,14 +1,18 @@
<template> <template>
<div class="select_desk"> <div class="select_desk">
<el-dialog title="请选择商品" :visible.sync="show"> <el-dialog title="请选择商品" :visible.sync="show">
<div style="padding: 10px 0;display: flex;justify-content: space-between;align-items: center;"> <div style="
padding: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
">
<el-checkbox v-model="isFull">并桌</el-checkbox> <el-checkbox v-model="isFull">并桌</el-checkbox>
<el-select v-model="targetTableId" placeholder="请选择目标台桌"> <el-select v-model="targetTableId" placeholder="请选择目标台桌">
<el-option v-for="item in originTableList" :key="item.tableId" :label="item.name" <el-option v-for="item in originTableList" :key="item.tableId" :label="item.name"
:value="item.tableId" @click="changeTable(item, index)"> :value="item.tableId" @click="changeTable(item, index)">
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
<div v-if="!isFull"> <div v-if="!isFull">
<div v-if="itemdata.list.length > 0"> <div v-if="itemdata.list.length > 0">
@ -53,7 +57,6 @@
{{ (scope.row.salePrice * scope.row.number).toFixed(2) }} {{ (scope.row.salePrice * scope.row.number).toFixed(2) }}
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
@ -64,7 +67,6 @@
<el-button @click="toggleSelection">取消</el-button> <el-button @click="toggleSelection">取消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -74,16 +76,17 @@ import { forEach } from "lodash";
export default { export default {
data() { data() {
return { return {
selectalllist: [],
show: false, show: false,
itemdata: {}, itemdata: {},
list: [], list: [],
masterId: '', masterId: "",
currentTableId: '', currentTableId: "",
targetTableId: '', targetTableId: "",
originTableList: [],// originTableList: [], //
multipleSelection: [], multipleSelection: [],
refcartSelection: [], refcartSelection: [],
isFull: false isFull: false,
}; };
}, },
methods: { methods: {
@ -92,64 +95,76 @@ export default {
this.$refs.refcart.clearSelection(); this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => { this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection(); a.clearSelection();
}) });
} catch (error) { } catch (error) { }
}
}, },
handleSelectionChange(val, index) { handleSelectionChange(val, index) {
try { try {
this.itemdata.old.list.forEach((a, i) => { 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) { } } catch (error) { }
}, },
handlerefcart(val) { handlerefcart(val) {
this.refcartSelection = 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) {
this.$message({ this.$message({
message: '请选择目标台桌!', message: "请选择目标台桌!",
type: 'warning' type: "warning",
}) });
return false; 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) { if (this.refcartSelection.length) {
this.refcartSelection.forEach((i) => { 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) 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 ? '' : cartIds.flatMap(subArray => subArray.map(item => item.cartId)),// cartIds: this.isFull ? "" : [...cartIds.flatMap((subArray) => subArray.map((item) => item.cartId)),...tzf] , //
isFull: this.isFull,//false isFull: this.isFull, //false
currentTableId: this.currentTableId, currentTableId: this.currentTableId,
targetTableId: this.targetTableId, targetTableId: this.targetTableId,
});
})
this.$forceUpdate(); this.$forceUpdate();
this.$emit("transfertoPinpin"); this.$emit("transfertoPinpin");
this.show = false; this.show = false;
}, },
open(item, masterId, currentTableId, originTableList) { open(item, masterId, currentTableId, originTableList) {
// ,id // ,id
console.log(item, masterId, currentTableId, originTableList) 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.filter((i) => i.tableId != currentTableId && i.status == 'using')// this.originTableList = originTableList.filter(
(i) => i.tableId != currentTableId && i.status == "using"
); //
try { try {
this.$refs.refcart.clearSelection(); this.$refs.refcart.clearSelection();
this.$refs.reftransfertoPinpin.forEach((a) => { this.$refs.reftransfertoPinpin.forEach((a) => {
a.clearSelection(); a.clearSelection();
}) });
} catch (error) { } } catch (error) { }
this.multipleSelection = []
this.refcartSelection = []
this.targetTableId = ''
this.show = true; this.show = true;
}, },
returnTableColor(key) { returnTableColor(key) {
@ -157,7 +172,7 @@ export default {
return item ? item.type : ""; return item ? item.type : "";
}, },
changeTable(item, index) { changeTable(item, index) {
console.log(item, index) console.log(item, index);
}, },
searchInput(e) { searchInput(e) {
console.log(e); console.log(e);
@ -179,7 +194,6 @@ export default {
margin: 20px 10px; margin: 20px 10px;
.boxspan {} .boxspan {}
} }
.buttonbox { .buttonbox {
@ -188,4 +202,4 @@ export default {
text-align: right; text-align: right;
} }
} }
</style> </style>

File diff suppressed because it is too large Load Diff