菜品原料克数限制

This commit is contained in:
zzyuan 2025-05-14 18:20:43 +08:00
parent b18c592947
commit 96f40250f6
1 changed files with 26 additions and 16 deletions

View File

@ -1661,6 +1661,7 @@
}
})
}else{
//littleWeight largeWeight baseForm.littleWeight baseForm.largeWeight
param.littlePrice = Number(param.littlePrice)*100;
param.largePrice = Number(param.largePrice)*100;
param.littleMaterialCost = Number(param.littleMaterialCost)*100;
@ -1682,22 +1683,31 @@
}
})
}
// console.log(param.materialList)
if (this.title === "新增") {
addMenuDishesApi(param).then(response => {
this.openDish = false;
this.$modal.msgSuccess("新增成功");
this.getList();
});
this.btnLoading=false;
} else {
editMenuDishesApi(param).then(response => {
this.openDish = false;
this.$modal.msgSuccess("修改成功");
this.getList();
});
this.btnLoading=false;
}
let sumWeight = 0
param.materialList.forEach(item=>{
sumWeight = item.weight+sumWeight;
})
if(sumWeight>param.weight){
this.btnLoading=false
sumWeight=0
this.$modal.msgError("组成成分总克数不可大于菜品份量");
return false
}
if (this.title === "新增") {
addMenuDishesApi(param).then(response => {
this.openDish = false;
this.$modal.msgSuccess("新增成功");
this.getList();
});
this.btnLoading=false;
} else {
editMenuDishesApi(param).then(response => {
this.openDish = false;
this.$modal.msgSuccess("修改成功");
this.getList();
});
this.btnLoading=false;
}
}
}
})