菜谱编辑新增时价格修改
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 class="dialog-left">
 | 
			
		||||
                    <div>已选菜品数量:{{dishesList.length}}</div>
 | 
			
		||||
| 
						 | 
				
			
			@ -655,7 +655,6 @@ export default {
 | 
			
		|||
                    this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
 | 
			
		||||
                }
 | 
			
		||||
            }) 
 | 
			
		||||
            console.log(this.dishesTypeList) 
 | 
			
		||||
            this.choseDishesType(this.dishesTypeList[0])
 | 
			
		||||
            this.getDishesPage()
 | 
			
		||||
            this.openDishes=true
 | 
			
		||||
| 
						 | 
				
			
			@ -686,14 +685,15 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        //点击左侧待选菜品
 | 
			
		||||
        chosenDishes(obj){
 | 
			
		||||
            console.log(obj) 
 | 
			
		||||
            obj.salePrice=0;
 | 
			
		||||
            obj.supplyNum=999;
 | 
			
		||||
            obj.restrictNum=999;
 | 
			
		||||
            //判断是否为新菜品类型
 | 
			
		||||
            let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
 | 
			
		||||
            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=>{
 | 
			
		||||
                    if(obj.dishesId==item.dishesId){
 | 
			
		||||
| 
						 | 
				
			
			@ -719,7 +719,6 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        //选中菜品类型-更新右侧表格数据
 | 
			
		||||
        choseDishesType(item){
 | 
			
		||||
            console.log(item)
 | 
			
		||||
            this.dishesType = item.typeId;
 | 
			
		||||
            this.dishesTableList = []
 | 
			
		||||
            this.dishesList.forEach(dish=>{
 | 
			
		||||
| 
						 | 
				
			
			@ -727,7 +726,6 @@ export default {
 | 
			
		|||
                    this.dishesTableList.push(dish)
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
            console.log(this.dishesTableList)
 | 
			
		||||
        },
 | 
			
		||||
        //弹窗右侧表格删除菜谱
 | 
			
		||||
        handleDelDishes(item){
 | 
			
		||||
| 
						 | 
				
			
			@ -756,16 +754,13 @@ export default {
 | 
			
		|||
                })
 | 
			
		||||
            }).catch(() => {}); 
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
        // 提交按钮
 | 
			
		||||
        confirmSubmit(){
 | 
			
		||||
            this.$refs["baseInfo"].validate(valid => {
 | 
			
		||||
                if (valid) {
 | 
			
		||||
                    console.log(this.baseInfo)
 | 
			
		||||
                    let param = this.baseInfo
 | 
			
		||||
                    if(this.baseInfo.recipeType==1){ 
 | 
			
		||||
                        console.log(this.dateRangeList)
 | 
			
		||||
                        param.recipeDateList = this.dateRangeList
 | 
			
		||||
                        param.recipeDateList = this.dateRangeList;
 | 
			
		||||
                    }
 | 
			
		||||
                    if(this.baseInfo.recipeType==2){ 
 | 
			
		||||
                        param.recipeDateList = [{
 | 
			
		||||
| 
						 | 
				
			
			@ -774,16 +769,27 @@ export default {
 | 
			
		|||
                        }]
 | 
			
		||||
                    }
 | 
			
		||||
                    if(this.baseInfo.recipeType==3){
 | 
			
		||||
                        console.log(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) => {  
 | 
			
		||||
                        this.jumpList() 
 | 
			
		||||
                    });
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //日期
 | 
			
		||||
        formatDate(date) {
 | 
			
		||||
            // 格式化为 YYYY-MM-DD
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -497,7 +497,11 @@ export default {
 | 
			
		|||
                    for (let i = 0; i < response.length; i++) {
 | 
			
		||||
                        this.detailList.forEach(item=>{
 | 
			
		||||
                            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=>{
 | 
			
		||||
                            if(item.mealtimeType==response[i].mealtimeType){
 | 
			
		||||
                                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=>{
 | 
			
		||||
                            if(item.mealtimeType==response[i].mealtimeType){
 | 
			
		||||
                                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)
 | 
			
		||||
                                })
 | 
			
		||||
                            }
 | 
			
		||||
                        }) 
 | 
			
		||||
                    } 
 | 
			
		||||
| 
						 | 
				
			
			@ -783,7 +795,6 @@ export default {
 | 
			
		|||
                    this.dishesTypeList.push({typeId:dish.typeId,typeName:dish.typeName})
 | 
			
		||||
                }
 | 
			
		||||
            }) 
 | 
			
		||||
            console.log(this.dishesTypeList) 
 | 
			
		||||
            this.choseDishesType(this.dishesTypeList[0])
 | 
			
		||||
            this.getDishesPage()
 | 
			
		||||
            this.openDishes=true
 | 
			
		||||
| 
						 | 
				
			
			@ -814,14 +825,15 @@ export default {
 | 
			
		|||
        },
 | 
			
		||||
        //点击左侧待选菜品
 | 
			
		||||
        chosenDishes(obj){
 | 
			
		||||
            console.log(obj) 
 | 
			
		||||
            obj.salePrice=0;
 | 
			
		||||
            obj.supplyNum=999;
 | 
			
		||||
            obj.restrictNum=999;
 | 
			
		||||
            //判断是否为新菜品类型
 | 
			
		||||
            let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
 | 
			
		||||
            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=>{
 | 
			
		||||
                    if(obj.dishesId==item.dishesId){
 | 
			
		||||
| 
						 | 
				
			
			@ -888,10 +900,9 @@ export default {
 | 
			
		|||
        confirmSubmit(){
 | 
			
		||||
            this.$refs["baseInfo"].validate(valid => {
 | 
			
		||||
                if (valid) { 
 | 
			
		||||
                    console.log(this.baseInfo)
 | 
			
		||||
                    
 | 
			
		||||
                    let param = this.baseInfo
 | 
			
		||||
                    if(this.baseInfo.recipeType==1){
 | 
			
		||||
                        console.log(this.dateRangeList)
 | 
			
		||||
                        param.recipeDateList = this.dateRangeList
 | 
			
		||||
                    }
 | 
			
		||||
                    if(this.baseInfo.recipeType==2){ 
 | 
			
		||||
| 
						 | 
				
			
			@ -904,7 +915,14 @@ export default {
 | 
			
		|||
                        console.log(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) => {  
 | 
			
		||||
                        this.jumpList() 
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue