代课下单

This commit is contained in:
魏啾
2024-12-10 11:36:32 +08:00
parent f16d81d9bd
commit 25761ba734
2 changed files with 15 additions and 21 deletions

View File

@@ -7,7 +7,7 @@
<h4 class="boxspan">本组菜品{{ item.count }}{{ item.number || 1 }}</h4> <h4 class="boxspan">本组菜品{{ item.count }}{{ item.number || 1 }}</h4>
<el-alert v-if="item.alertshow" title="错误:请按照规定选择套餐" type="warning" :closable="false"></el-alert> <el-alert v-if="item.alertshow" title="错误:请按照规定选择套餐" type="warning" :closable="false"></el-alert>
</div> </div>
<el-table ref="dialogpackagetable" :data="item.goods" tooltip-effect="dark" style="width: 100%" <el-table ref="refdialogpackagetable" :data="item.goods" tooltip-effect="dark" style="width: 100%"
@selection-change="handleSelectionChange($event, index)"> @selection-change="handleSelectionChange($event, index)">
<el-table-column type="selection" width="55"> <el-table-column type="selection" width="55">
</el-table-column> </el-table-column>
@@ -44,26 +44,23 @@ export default {
}; };
}, },
methods: { methods: {
toggleSelection(rows) { toggleSelection() {
if (rows) { this.$refs.refdialogpackagetable.forEach((a) => {
rows.forEach(row => { a.clearSelection();
this.$refs.dialogpackagetable.toggleRowSelection(row); })
});
} else {
this.$refs.dialogpackagetable.clearSelection();
}
}, },
handleSelectionChange(val, index) { handleSelectionChange(val, index) {
try { try {
this.listdata.proGroupVo.forEach((a, i) => { this.listdata.proGroupVo.forEach((a, i) => {
this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || [] this.multipleSelection[index] = i === index ? val : this.multipleSelection[index] || []
}) })
this.disabledshow = !this.listdata.proGroupVo.every((element, num) => element.number <= this.multipleSelection[num].length); this.disabledshow = !this.listdata.proGroupVo.every((element, num) => element.number == this.multipleSelection[num].length);
} catch (error) { } } catch (error) { }
this.$set(this.listdata.proGroupVo, index, { ...this.listdata.proGroupVo[index], alertshow: this.listdata.proGroupVo[index].number >= this.multipleSelection[index].length ? true : false });
this.$set(this.listdata.proGroupVo, index, { ...this.listdata.proGroupVo[index], alertshow: this.listdata.proGroupVo[index].number != this.multipleSelection[index].length ? true : false });
}, },
confirm() { confirm() {
console.log(listdata.proGroupVo)
this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection); this.$emit("dialogpackageconfirm", this.listdata, this.multipleSelection);
this.show = false; this.show = false;
@@ -71,11 +68,10 @@ export default {
open(item) { open(item) {
this.listdata = item this.listdata = item
try { try {
this.$refs.dialogpackagetable.clearSelection(); this.$refs.refdialogpackagetable.forEach((a) => {
a.clearSelection();
} catch (error) { })
} catch (error) { }
}
this.multipleSelection = [] this.multipleSelection = []
this.disabledshow = true this.disabledshow = true
console.log(this.listdata, this.multipleSelection); console.log(this.listdata, this.multipleSelection);

View File

@@ -1902,9 +1902,7 @@ export default {
}, },
//套餐下单 //套餐下单
async dialogpackageconfirm(item, multipleSelection) { async dialogpackageconfirm(item, multipleSelection) {
console.log(item) this.goodsClick(item, 1, true, multipleSelection.flatMap(subArray => subArray.map(item => item.proId)))
console.log(multipleSelection)
this.goodsClick(item, 1, true, multipleSelection)
}, },
//挂账人支付确认 //挂账人支付确认
guazhangPayConfirm(guazhangren, price) { guazhangPayConfirm(guazhangren, price) {
@@ -3613,7 +3611,7 @@ export default {
} }
}, },
//根据右侧商品单规格多规格做不同处理 //根据右侧商品单规格多规格做不同处理
async goodsClick(item, number = 0, isConfirm = false, multipleSelection='') { async goodsClick(item, number = 0, isConfirm = false, multipleSelection = '') {
// if (!this.table) { // if (!this.table) {
// return this.$message.error("暂不支持无桌台下单,请先选择桌台"); // return this.$message.error("暂不支持无桌台下单,请先选择桌台");