菜谱编辑新增时价格修改
This commit is contained in:
parent
5cdf323d5c
commit
194e4a3b02
|
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<el-dialog title="选择菜品" :visible.sync="openDishes" width="90%" append-to-body>
|
<el-dialog title="选择菜品" :visible.sync="openDishes" width="90%" append-to-body >
|
||||||
<div style="width: 100%;height:620px;display: flex;align-items: center;color: #000;">
|
<div style="width: 100%;height:620px;display: flex;align-items: center;color: #000;">
|
||||||
<div class="dialog-left">
|
<div class="dialog-left">
|
||||||
<div>已选菜品数量:{{dishesList.length}}</div>
|
<div>已选菜品数量:{{dishesList.length}}</div>
|
||||||
|
|
@ -654,8 +654,7 @@ export default {
|
||||||
if(index==-1){
|
if(index==-1){
|
||||||
this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
|
this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(this.dishesTypeList)
|
|
||||||
this.choseDishesType(this.dishesTypeList[0])
|
this.choseDishesType(this.dishesTypeList[0])
|
||||||
this.getDishesPage()
|
this.getDishesPage()
|
||||||
this.openDishes=true
|
this.openDishes=true
|
||||||
|
|
@ -686,14 +685,15 @@ export default {
|
||||||
},
|
},
|
||||||
//点击左侧待选菜品
|
//点击左侧待选菜品
|
||||||
chosenDishes(obj){
|
chosenDishes(obj){
|
||||||
console.log(obj)
|
|
||||||
obj.salePrice=0;
|
|
||||||
obj.supplyNum=999;
|
|
||||||
obj.restrictNum=999;
|
|
||||||
//判断是否为新菜品类型
|
//判断是否为新菜品类型
|
||||||
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
||||||
if(index==-1){
|
if(index==-1){
|
||||||
this.dishesList.push(obj)
|
let dish = Object.assign({}, obj)
|
||||||
|
this.$set(dish,'price',Number(dish.price/100))
|
||||||
|
this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
|
||||||
|
this.$set(dish,'supplyNum',dish.supplyNum||99999)
|
||||||
|
this.$set(dish,'restrictNum',dish.restrictNum||99999)
|
||||||
|
this.dishesList.push(dish)
|
||||||
//反显选中样式
|
//反显选中样式
|
||||||
this.dishesPageList.forEach(item=>{
|
this.dishesPageList.forEach(item=>{
|
||||||
if(obj.dishesId==item.dishesId){
|
if(obj.dishesId==item.dishesId){
|
||||||
|
|
@ -719,7 +719,6 @@ export default {
|
||||||
},
|
},
|
||||||
//选中菜品类型-更新右侧表格数据
|
//选中菜品类型-更新右侧表格数据
|
||||||
choseDishesType(item){
|
choseDishesType(item){
|
||||||
console.log(item)
|
|
||||||
this.dishesType = item.typeId;
|
this.dishesType = item.typeId;
|
||||||
this.dishesTableList = []
|
this.dishesTableList = []
|
||||||
this.dishesList.forEach(dish=>{
|
this.dishesList.forEach(dish=>{
|
||||||
|
|
@ -727,7 +726,6 @@ export default {
|
||||||
this.dishesTableList.push(dish)
|
this.dishesTableList.push(dish)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(this.dishesTableList)
|
|
||||||
},
|
},
|
||||||
//弹窗右侧表格删除菜谱
|
//弹窗右侧表格删除菜谱
|
||||||
handleDelDishes(item){
|
handleDelDishes(item){
|
||||||
|
|
@ -756,16 +754,13 @@ export default {
|
||||||
})
|
})
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交按钮
|
// 提交按钮
|
||||||
confirmSubmit(){
|
confirmSubmit(){
|
||||||
this.$refs["baseInfo"].validate(valid => {
|
this.$refs["baseInfo"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(this.baseInfo)
|
|
||||||
let param = this.baseInfo
|
let param = this.baseInfo
|
||||||
if(this.baseInfo.recipeType==1){
|
if(this.baseInfo.recipeType==1){
|
||||||
console.log(this.dateRangeList)
|
param.recipeDateList = this.dateRangeList;
|
||||||
param.recipeDateList = this.dateRangeList
|
|
||||||
}
|
}
|
||||||
if(this.baseInfo.recipeType==2){
|
if(this.baseInfo.recipeType==2){
|
||||||
param.recipeDateList = [{
|
param.recipeDateList = [{
|
||||||
|
|
@ -774,16 +769,27 @@ export default {
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
if(this.baseInfo.recipeType==3){
|
if(this.baseInfo.recipeType==3){
|
||||||
console.log(this.weekDateList)
|
|
||||||
param.recipeDateList = this.weekDateList
|
param.recipeDateList = this.weekDateList
|
||||||
}
|
}
|
||||||
console.log(param)
|
param.recipeDateList.forEach(item=>{
|
||||||
|
item.detailList.forEach(subItem=>{
|
||||||
|
subItem.dishesList.forEach(dishItem=>{
|
||||||
|
dishItem.price = Number(dishItem.price*100)
|
||||||
|
dishItem.salePrice = Number(dishItem.salePrice*100)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
addMenuRecipeApi(param).then((response) => {
|
addMenuRecipeApi(param).then((response) => {
|
||||||
this.jumpList()
|
this.jumpList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//日期
|
//日期
|
||||||
formatDate(date) {
|
formatDate(date) {
|
||||||
// 格式化为 YYYY-MM-DD
|
// 格式化为 YYYY-MM-DD
|
||||||
|
|
|
||||||
|
|
@ -430,7 +430,7 @@ export default {
|
||||||
this.baseInfo = JSON.parse(this.$route.query.pageJson)
|
this.baseInfo = JSON.parse(this.$route.query.pageJson)
|
||||||
this.baseInfo.recipeType = this.baseInfo.recipeType+''
|
this.baseInfo.recipeType = this.baseInfo.recipeType+''
|
||||||
this.initEditDetail()
|
this.initEditDetail()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//菜谱编辑
|
//菜谱编辑
|
||||||
|
|
@ -497,7 +497,11 @@ export default {
|
||||||
for (let i = 0; i < response.length; i++) {
|
for (let i = 0; i < response.length; i++) {
|
||||||
this.detailList.forEach(item=>{
|
this.detailList.forEach(item=>{
|
||||||
if(item.mealtimeType==response[i].mealtimeType){
|
if(item.mealtimeType==response[i].mealtimeType){
|
||||||
item.dishesList = response[i].dishesList
|
item.dishesList = response[i].dishesList;
|
||||||
|
item.dishesList.forEach(dish=>{
|
||||||
|
this.$set(dish,'price',Number(dish.price/100))
|
||||||
|
this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -517,6 +521,10 @@ export default {
|
||||||
this.detailList.forEach(item=>{
|
this.detailList.forEach(item=>{
|
||||||
if(item.mealtimeType==response[i].mealtimeType){
|
if(item.mealtimeType==response[i].mealtimeType){
|
||||||
item.dishesList = response[i].dishesList
|
item.dishesList = response[i].dishesList
|
||||||
|
item.dishesList.forEach(dish=>{
|
||||||
|
this.$set(dish,'price',Number(dish.price/100))
|
||||||
|
this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -536,6 +544,10 @@ export default {
|
||||||
this.detailList.forEach(item=>{
|
this.detailList.forEach(item=>{
|
||||||
if(item.mealtimeType==response[i].mealtimeType){
|
if(item.mealtimeType==response[i].mealtimeType){
|
||||||
item.dishesList = response[i].dishesList
|
item.dishesList = response[i].dishesList
|
||||||
|
item.dishesList.forEach(dish=>{
|
||||||
|
this.$set(dish,'price',Number(dish.price/100))
|
||||||
|
this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -782,8 +794,7 @@ export default {
|
||||||
if(index==-1){
|
if(index==-1){
|
||||||
this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
|
this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
console.log(this.dishesTypeList)
|
|
||||||
this.choseDishesType(this.dishesTypeList[0])
|
this.choseDishesType(this.dishesTypeList[0])
|
||||||
this.getDishesPage()
|
this.getDishesPage()
|
||||||
this.openDishes=true
|
this.openDishes=true
|
||||||
|
|
@ -814,14 +825,15 @@ export default {
|
||||||
},
|
},
|
||||||
//点击左侧待选菜品
|
//点击左侧待选菜品
|
||||||
chosenDishes(obj){
|
chosenDishes(obj){
|
||||||
console.log(obj)
|
|
||||||
obj.salePrice=0;
|
|
||||||
obj.supplyNum=999;
|
|
||||||
obj.restrictNum=999;
|
|
||||||
//判断是否为新菜品类型
|
//判断是否为新菜品类型
|
||||||
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
|
||||||
if(index==-1){
|
if(index==-1){
|
||||||
this.dishesList.push(obj)
|
let dish = Object.assign({}, obj)
|
||||||
|
this.$set(dish,'price',Number(dish.price/100))
|
||||||
|
this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
|
||||||
|
this.$set(dish,'supplyNum',dish.supplyNum||99999)
|
||||||
|
this.$set(dish,'restrictNum',dish.restrictNum||99999)
|
||||||
|
this.dishesList.push(dish)
|
||||||
//反显选中样式
|
//反显选中样式
|
||||||
this.dishesPageList.forEach(item=>{
|
this.dishesPageList.forEach(item=>{
|
||||||
if(obj.dishesId==item.dishesId){
|
if(obj.dishesId==item.dishesId){
|
||||||
|
|
@ -888,10 +900,9 @@ export default {
|
||||||
confirmSubmit(){
|
confirmSubmit(){
|
||||||
this.$refs["baseInfo"].validate(valid => {
|
this.$refs["baseInfo"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(this.baseInfo)
|
|
||||||
let param = this.baseInfo
|
let param = this.baseInfo
|
||||||
if(this.baseInfo.recipeType==1){
|
if(this.baseInfo.recipeType==1){
|
||||||
console.log(this.dateRangeList)
|
|
||||||
param.recipeDateList = this.dateRangeList
|
param.recipeDateList = this.dateRangeList
|
||||||
}
|
}
|
||||||
if(this.baseInfo.recipeType==2){
|
if(this.baseInfo.recipeType==2){
|
||||||
|
|
@ -904,7 +915,14 @@ export default {
|
||||||
console.log(this.weekDateList)
|
console.log(this.weekDateList)
|
||||||
param.recipeDateList = this.weekDateList
|
param.recipeDateList = this.weekDateList
|
||||||
}
|
}
|
||||||
console.log(param)
|
param.recipeDateList.forEach(item=>{
|
||||||
|
item.detailList.forEach(subItem=>{
|
||||||
|
subItem.dishesList.forEach(dishItem=>{
|
||||||
|
dishItem.price = Number(dishItem.price*100)
|
||||||
|
dishItem.salePrice = Number(dishItem.salePrice*100)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
addMenuRecipeApi(param).then((response) => {
|
addMenuRecipeApi(param).then((response) => {
|
||||||
this.jumpList()
|
this.jumpList()
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue