修复每周菜谱自动计价功能bug
This commit is contained in:
parent
d61517cf46
commit
147dbe0e15
@ -36,8 +36,8 @@
|
|||||||
<el-table-column type="selection" width="55" align="center"/>
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="id" align="center" prop="id" v-if="false"/>
|
<el-table-column label="id" align="center" prop="id" v-if="false"/>
|
||||||
<el-table-column label="星期几" align="center" prop="weekday" width="80px"/>
|
<el-table-column label="星期几" align="center" prop="weekday" width="80px"/>
|
||||||
<el-table-column label="类型" align="center" prop="dinnerType" width="80px"/>
|
<el-table-column label="类型" align="center" prop="dinnerType" width="80px"/>
|
||||||
<el-table-column label="菜品列表" align="center" prop="foods" width="500px">
|
<el-table-column label="菜品列表" align="center" prop="foods" width="500px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.foods"
|
<el-select v-model="scope.row.foods"
|
||||||
@change="changeFoods(scope.row)"
|
@change="changeFoods(scope.row)"
|
||||||
@ -248,11 +248,18 @@
|
|||||||
},
|
},
|
||||||
// 根据菜单选择的变化,计算总价
|
// 根据菜单选择的变化,计算总价
|
||||||
changeFoods(row) {
|
changeFoods(row) {
|
||||||
|
console.log("row-->", row);
|
||||||
|
console.log("foodList-->", this.foodList)
|
||||||
let ret = 0;
|
let ret = 0;
|
||||||
for(let i =0 ; i < row.foods.length; i++) {
|
for (let i = 0; i < row.foods.length; i++) {
|
||||||
ret += this.foodList[i].price;
|
let foodPrice = row.foods[i];
|
||||||
|
this.foodList.forEach(item => {
|
||||||
|
if (item.foodId === foodPrice) {
|
||||||
|
ret += item.price;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.weekMenuList[row.id -1 ].price = ret;
|
this.weekMenuList[row.id - 1].price = ret;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 控制合并列
|
// 控制合并列
|
||||||
|
Loading…
x
Reference in New Issue
Block a user