<template id="MenuEdit">
    <div style="padding: 10px;background: #E5EBF6;min-height: 830px;">
        <div style="background: #FFF;padding: 10px;border-radius: 10px;margin-bottom: 20px;">
            <el-form :model="baseInfo" ref="baseInfo" :rules="baseRules" size="medium" :inline="true" label-width="80px">
                <el-form-item label="菜谱名称" prop="recipeName">
                    <el-input v-model="baseInfo.recipeName" placeholder="请输入菜谱名称" maxlength="20" clearable style="width: 300px"/>
                </el-form-item>
                <el-form-item label="所属区域" prop="areaId">
                    <el-cascader v-model="baseInfo.areaId"
                        :options="treeAreaOptions" :filterable="true" style="width: 300px" :show-all-levels="false" disabled
                        :props="{  
                        emitPath: false,// 若设置 false，则只返回该节点的值，只返回最后选择的id
                        checkStrictly: false,//来设置父子节点取消选中关联，从而达到选择任意一级选项的目的
                        value:'id',label:'label'
                        }" @change="handleAreaChange">
                    </el-cascader>
                </el-form-item>
                <el-form-item label="所属食堂" prop="canteenId">
                    <el-select v-model="baseInfo.canteenId" placeholder="请选择所属食堂" style="width: 300px;" @change="handleCanteenChange" disabled>
                        <el-option v-for="item in canteenOptions"
                            :key="item.canteenId"
                            :label="item.canteenName"
                            :value="item.canteenId"
                        ></el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item label="所属档口" prop="stallId">
                    <el-select v-model="baseInfo.stallId" placeholder="请选择所属档口" style="width: 300px;" disabled>
                        <el-option v-for="item in stallOptions"
                            :key="item.stallId"
                            :label="item.stallName"
                            :value="item.stallId"
                        ></el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item label="菜谱类型" prop="recipeType">
                    <el-select v-model="baseInfo.recipeType" placeholder="请选择菜谱类型" style="width: 300px;" clearable @change="changeRecipeType" disabled>
                        <el-option label="指定日期" value="1"></el-option>
                        <el-option label="每日循环" value="2"></el-option>
                        <el-option label="每周循环" value="3"></el-option>
                    </el-select> 
                </el-form-item>
                <!-- <el-form-item label="用户范围" prop="effId">
                    <el-select v-model="baseInfo.effId" placeholder="请选择用户范围" style="width: 300px;" clearable>
                        <el-option v-for="item in effOptions"
                            :key="item.effId"
                            :label="item.effName"
                            :value="item.effId"
                        ></el-option>
                    </el-select> 
                </el-form-item> -->
                <el-row class="mb8" v-if="baseInfo.recipeType==1">
                    <el-form-item label="日期范围">
                        <el-date-picker
                            v-model="dateRange"
                            type="daterange"
                            align="right"
                            unlink-panels
                            range-separator="至"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            @change="changeDateRange"
                            format="yyyy-MM-dd"
                            :picker-options="pickerOptions" >
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item>
                        <el-button plain size="small" type="primary" @click="openCopyOtherMenu('date')">复制其他日期菜谱</el-button>
                        <el-button plain size="small" type="primary" @click="openCopyDateMenu">复制本菜谱到指定日期</el-button>
                        <el-button plain size="small" type="danger" @click="clearDateMenu">清空当天菜谱</el-button>
                    </el-form-item>
                </el-row>
                <el-row class="mb8" v-if="baseInfo.recipeType==1">
                        <el-col :span="1">
                            <span style="font-weight: bold;color: #606266;font-size: 14px;">日期</span>
                        </el-col>
                        <el-col :span="23">
                            <el-radio-group v-model="dateRangeRadio" @change="choseDateRadio">
                                <el-radio :label="item.applyDate" v-for="(item,index) in dateRangeList" :key="index" style="font-size: 14px;margin-bottom: 10px;">{{ item.applyDateStr }}</el-radio>
                            </el-radio-group>
                        </el-col>
                </el-row>
                <el-row class="mb8" v-if="baseInfo.recipeType==3">
                    <el-button plain v-for="(item,index) in weekDateList" :key="index" style="margin: 0;" :class="weekId==item.applyWeek?'primary':''" @click="choseWeekDate(item,index)">{{ item.weekStr }}</el-button>
                    <el-form-item style="margin-left: 50px;">
                        <el-button plain size="small" type="primary" @click="openCopyOtherMenu('week')">复制其他日期菜谱</el-button>
                        <el-button plain size="small" type="primary" @click="openCopyWeekMenu">复制本菜谱到指定日期</el-button>
                        <el-button plain size="small" type="danger" @click="clearWeekMenu">清空当天菜谱</el-button>
                    </el-form-item>
                </el-row> 
            </el-form>
        </div> 
        <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;display: flex;" v-if="baseInfo.recipeType">
            <el-card class="dishes-card" v-for="item in detailList" :key="item.mealtimeType">
                <div slot="header">
                    <span>{{item.mealtimeName}}</span> 
                </div>
                <div class="body-card">
                    <div v-for="dish in item.dishesList" :key="dish.dishesId" style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
                        <span>{{dish.dishesName}}</span>
                        <i class="el-icon-delete" style="color: red;cursor: pointer;" @click="deleteDishes(item,dish)"></i>
                    </div>
                </div>
                <div class="bottom-card">
                    <el-button type="primary" @click="addDishes(item)" v-if="item.dishesList.length==0">新增</el-button>
                    <el-button plain type="primary" v-if="item.dishesList.length>0" @click="editDishes(item)">修改</el-button>
                    <el-button plain type="danger" v-if="item.dishesList.length>0" @click="clearDishes(item)">清空</el-button>
                </div>
            </el-card> 
        </div>
        <div style="width: 100%;height: 80px;padding: 10px;background: #FFF;border-radius: 10px;display: flex;align-items: center;justify-content: center;">
            <el-button type="primary" @click="confirmSubmit" :loading="loading">提 交</el-button>
            <el-button @click="jumpList">返 回</el-button>
        </div>
        
        <!-- 选择菜品 -->
        <el-dialog title="选择菜品" :visible.sync="openDishes" width="90%" append-to-body :close-on-click-modal="false">
            <div style="width: 100%;height:620px;display: flex;align-items: center;color: #000;">   
                <div class="dialog-left">
                    <div>已选菜品数量：{{dishesList.length}}</div>
                    <div>
                        <div style="font-weight: bold;margin: 10px 0;">计价方式</div>
                        <el-select v-model="queryDish.salesMode" style="width: 100%;" @change="getDishesPage">
                            <el-option label="按份" value="1" />
                            <el-option label="称重" value="2" />
                        </el-select>  
                    </div>
                    <div>
                        <div style="font-weight: bold;margin: 10px 0;">菜品分类</div>
                        <el-cascader v-model="queryDish.typeId"
                            :options="typeOptions" :filterable="true" style="width: 100%;" :show-all-levels="false"
                            :props="{ 
                                emitPath: false,// 若设置 false，则只返回该节点的值，只返回最后选择的id
                                checkStrictly: false,//来设置父子节点取消选中关联，从而达到选择任意一级选项的目的
                                value:'dishesTypeId',label:'dishesTypeName'
                            }" clearable @change="getDishesPage">
                        </el-cascader>
                        <!-- <el-select v-model="queryDish.typeId" style="width: 100%;" clearable @change="getDishesPage">
                            <el-option v-for="item in typeOptions"
                                :key="item.typeId"
                                :label="item.dishesTypeName"
                                :value="item.typeId" 
                            ></el-option>
                        </el-select> -->
                    </div>
                    <div>
                        <div style="font-weight: bold;margin: 10px 0;">菜品名称</div>
                        <el-input  v-model="queryDish.dishesName" placeholder="请输入菜品名称" maxlength="30" clearable @input="getDishesPage"/>
                    </div>
                    <div style="margin-top: 20px;">
                        <el-card style="width: 100%;height: 380px;">
                            <div slot="header">
                                <span>菜品</span> 
                            </div>
                            <div style="width: 100%;height: 320px;overflow-y: auto;">
                                <div v-for="item in dishesPageList" :key="item.dishesId" class="dish-name" @click="chosenDishes(item)">
                                    <!-- <span v-if="item.sizeType==1">【标准】</span>
                                    <span v-if="item.sizeType==2">【大小份】</span> -->
                                    <span>【{{ item.dishesTypeName }}】</span>
                                    <span>{{ item.dishesName }}</span>
                                    <i class="el-icon-check" v-if="item.isChecked"></i>
                                </div>
                                 
                            </div>
                        </el-card> 
                    </div>
                </div>
                <div class="dialog-center">
                    <div class="dialog-center-header">菜品分类</div>
                    <div v-for="(item,index) in dishesTypeList" :key="index" style="width: 100%;text-align: center;margin: 10px 0;display: flex;align-items: center;justify-content: center;">
                        <el-button plain :class="dishesType==item.typeId?'primary':''" style="width: 70%;" @click="choseDishesType(item)">{{ item.dishesTypeName }}</el-button>
                        <i class="el-icon-delete" style="color: red;cursor: pointer;margin-left: 10px;font-size: 18px;" @click="clearDishTab(item)"></i>
                    </div> 
                </div>
                <div class="dialog-right">
                    <el-table :data="dishesTableList" height="620">
                        <!-- <el-table-column label="菜品编号" align="center" prop="dishesNum" /> -->
                        <el-table-column label="菜品名称" align="center" prop="dishesName" />
                        <el-table-column label="所属食堂" align="center" prop="canteenName" />
                        <el-table-column label="菜品类别" align="center" prop="dishesTypeName"></el-table-column>
                        <el-table-column label="当餐售价" align="center" prop="price">
                            <template slot-scope="scope">
                                <el-input  v-model="scope.row.price" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.price=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
                            </template>
                        </el-table-column>
                        <el-table-column label="当餐优惠价" align="center" prop="salePrice">
                            <template slot-scope="scope">
                                <el-input  v-model="scope.row.salePrice" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)" @input="(v)=>(scope.row.salePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
                            </template>
                        </el-table-column>
                        <el-table-column label="最大供应量" align="center" prop="supplyNum">
                            <template slot-scope="scope">
                                <el-input  v-model="scope.row.supplyNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.supplyNum=v.replace(/[^\d]/g,''))"/>
                            </template>
                        </el-table-column>
                        <el-table-column label="每人限购数" align="center" prop="limitNum">
                            <template slot-scope="scope">
                                <el-input  v-model="scope.row.limitNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.limitNum=v.replace(/[^\d]/g,''))"/>
                            </template>
                        </el-table-column>
                        <!-- <el-table-column label="移动端推荐" align="center" prop="recommendFlag">
                            <template slot-scope="scope">
                                <el-switch v-model="scope.row.recommendFlag"
                                    active-text="是" inactive-text="否"
                                    :active-value="1" :inactive-value="2">
                                </el-switch>
                            </template>
                        </el-table-column> -->
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button size="mini" type="text" style="color: red;"
                                @click="handleDelDishes(scope.row)" 
                                >删除</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </div>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="openDishes=false">确 定</el-button>
                <el-button @click="openDishes=false">取 消</el-button>
            </div>
        </el-dialog>
        <!-- 复制其他日期菜谱 -->
        <el-dialog title="选择要复制的菜谱" :visible.sync="openCopyMenu" width="80%" append-to-body :close-on-click-modal="false">
            <el-form :model="dialogQueryParams" ref="dialogQueryParams" size="mini" :inline="true" label-width="80px">
                <el-form-item label="所属区域" prop="areaId">
                    <el-cascader v-model="dialogQueryParams.areaId"
                        :options="treeAreaOptions" :filterable="true" style="width: 100%;" :show-all-levels="false" disabled
                        :props="{  
                        emitPath: false,// 若设置 false，则只返回该节点的值，只返回最后选择的id
                        checkStrictly: false,//来设置父子节点取消选中关联，从而达到选择任意一级选项的目的
                        value:'id',label:'label'
                        }" clearable @change="handleAreaChange2">
                    </el-cascader>
                </el-form-item>
                <el-form-item label="所属食堂" prop="canteenId">
                    <el-select v-model="dialogQueryParams.canteenId" clearable placeholder="请选择所属食堂" disabled style="width: 100%;" @change="handleCanteenChange2">
                        <el-option v-for="item in canteenOptions2"
                            :key="item.canteenId"
                            :label="item.canteenName"
                            :value="item.canteenId"
                        ></el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item label="所属档口" prop="stallId">
                    <el-select v-model="dialogQueryParams.stallId" clearable placeholder="请选择所属档口" style="width: 100%;" @change="handleStallChange2">
                        <el-option v-for="item in stallOptions2"
                            :key="item.stallId"
                            :label="item.stallName"
                            :value="item.stallId"
                        ></el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item label="菜谱" prop="recipeId">
                    <el-select v-model="dialogQueryParams.recipeId" clearable placeholder="请选择菜谱" style="width: 100%;" @change="handleRecipeChange2">
                        <el-option v-for="item in recipeOptions"
                            :key="item.recipeId"
                            :label="item.recipeName"
                            :value="item.recipeId"
                        ></el-option>
                    </el-select> 
                </el-form-item>
                <el-form-item label="日期" prop="applyDate" v-if="dialogQueryParams.recipeType==1">
                    <el-date-picker
                        v-model="dialogQueryParams.applyDate"
                        type="date"
                        align="right" value-format="yyyy-MM-dd"
                        format="yyyy-MM-dd" @change="changQueryDate"
                        :picker-options="pickerOptions2" >
                    </el-date-picker> 
                </el-form-item>
                <el-form-item label="日期" prop="applyWeek" v-if="dialogQueryParams.recipeType==3">
                    <el-select v-model="dialogQueryParams.applyWeek" clearable placeholder="请选择星期" style="width: 100%;" @change="changQueryWeek">
                        <el-option  label="星期一" :value="1"></el-option>
                        <el-option  label="星期二" :value="2"></el-option>
                        <el-option  label="星期三" :value="3"></el-option>
                        <el-option  label="星期四" :value="4"></el-option>
                        <el-option  label="星期五" :value="5"></el-option>
                        <el-option  label="星期六" :value="6"></el-option>
                        <el-option  label="星期日" :value="7"></el-option>
                    </el-select> 
                </el-form-item> 
            </el-form>
            <div style="width: 100%;height: 500px;padding: 10px;border-radius: 10px;margin-bottom: 10px;display: flex;">
                <div style="width: 20%;height: 100%;margin-right: 10px;" v-for="item in dialogDetailList" :key="item.mealtimeType">
                    <el-card style="width: 100%;height: 88%;position: relative;">
                        <div slot="header">
                            <span style="font-weight: 600;">{{item.mealtimeName}}</span> 
                        </div>
                        <div class="body-card">
                            <div v-for="dish in item.dishesList" :key="dish.dishesId" style="width: 100%;display: flex;justify-content: space-between;align-items: center;">
                                <span>{{dish.dishesName}}</span>
                            </div>
                        </div>
                    </el-card> 
                    <div style="width: 100%;height: 12%;display: flex;align-items: center;justify-content: center;">
                         <el-button type="primary" @click="confirmCopyMealTypeMenu(item)">复制餐次</el-button>
                    </div>
                </div> 
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="confirmCopyMenu">确 定</el-button>
                <el-button @click="openCopyMenu=false">取 消</el-button>
            </div>
        </el-dialog>
        <!-- 复制本菜谱到指定日期-日期 -->
        <el-dialog title="选择要复制的日期" :visible.sync="openCopyDate" width="30%" append-to-body :close-on-click-modal="false">
            <div style="width: 100%;padding: 10px;border-bottom: 1px solid #ccc;margin-bottom: 10px;">
                {{currentMonth}}
            </div> 
            <div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;">
                <div v-for="(item,index) in currentWeekList" :key="index" style="width: 14%;text-align: center;">{{item}}</div>
            </div>
            <!--  :class="currentDaysList.findIndex(v=>v==item)>-1 ? 'dateTable2' : 'dateTable'" -->
            <div style="width: 100%;display: flex;align-items: center;margin-bottom: 10px;flex-wrap: wrap;">
                <div v-for="(item,index) in monthDaysList" :key="index" 
                class="dateTable" :style="{color:currentDaysList.findIndex(v=>v==item)>-1?'#000':'#9a9da3'}"
                :class="checkDateList.findIndex(v=>v==item)>-1 ? 'bgBlue' : ''"
                @click="choseCopyDate(item)"
                >{{item}}</div> 
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="copyDateMenu">确 定</el-button>
                <el-button @click="openCopyDate=false">取 消</el-button>
            </div>
        </el-dialog>
        <!-- 复制本菜谱到指定日期-星期 -->
        <el-dialog title="选择要复制的日期" :visible.sync="openCopyWeek" width="50%" append-to-body :close-on-click-modal="false">
            <el-checkbox-group v-model="checkWeekList">
                <el-checkbox :label="1">星期一</el-checkbox>
                <el-checkbox :label="2">星期二</el-checkbox>
                <el-checkbox :label="3">星期三</el-checkbox>
                <el-checkbox :label="4">星期四</el-checkbox>
                <el-checkbox :label="5">星期五</el-checkbox>
                <el-checkbox :label="6">星期六</el-checkbox>
                <el-checkbox :label="7">星期日</el-checkbox>
            </el-checkbox-group>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="copyWeekMenu">确 定</el-button>
                <el-button @click="openCopyWeek=false">取 消</el-button>
            </div>
        </el-dialog>
        
    </div>
</template>
  
<script> 
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { mealTimeListApi,getmkteffectiveApi,getDishesByTypePageApi,editMenuRecipeApi,getPageRecipeListAllApi,getMenuRecipeDetailApi,getMenuRecipeTemplateDetailApi } from "@/api/dish/menu"; 
import { menuDishesTypeAllListApi } from "@/api/dish/dish";

export default {
    name: "menuEdit",
    dicts: [],
    data() {
      return {
        loading:false,
        baseInfo: { 
            recipeName:undefined,
            recipeType:undefined,
            areaId:undefined,
            canteenId:undefined,
            stallId:undefined,
            effId:undefined,
        },
        // 表单校验
        baseRules: {
            recipeName: [
                { required: true, message: "菜谱名称不能为空", trigger: "blur" }
            ],
            areaId: [
                { required: true, message: "所属区域不能为空", trigger: "change" }
            ],
            canteenId: [
                { required: true, message: "所属食堂不能为空", trigger: "change" }
            ],
            stallId: [
                { required: true, message: "所属档口不能为空", trigger: "change" }
            ],
            recipeType: [
                { required: true, message: "菜谱类型不能为空", trigger: "change" }
            ]
        },
        mealTimeList:[],
        treeAreaOptions:[],
        canteenOptions:[],
        stallOptions:[],
        effOptions:[],
        dateRange:[new Date(),new Date().setDate(new Date().getDate() + 6)],
        dateRangeRadio:"",
        dateRangeList:[],
        dateRangeIndex:0,
        pickerOptions: {
            shortcuts: [{
                text: '最近一周',
                onClick(picker) {
                const start = new Date();
                const end = new Date();
                end.setTime(start.getTime() + 3600 * 1000 * 24 * 6);
                picker.$emit('pick', [start, end]);
                }
            }, {
                text: '最近一个月',
                onClick(picker) {
                const start = new Date();
                const end = new Date();
                end.setTime(start.getTime() + 3600 * 1000 * 24 * 30);
                picker.$emit('pick', [start, end]);
                }
            }],
            disabledDate(v) {
                return v.getTime() < (new Date().getTime() - 86400000) ||v.getTime() > (new Date().getTime() + 3600 * 1000 * 24 * 30);//  - 86400000是否包括当天
            }
        },
        pickerOptions2: {
            disabledDate(v) {
                return v.getTime() > (new Date().getTime()+ 3600 * 1000 * 24 * 7);//  - 86400000是否包括当天
            }
        },
        recipeDateList:[
            // {   //指定日期-1
            //     applyDate:"2025-03-14",
            //     detailList:[
            //         {
            //             mealtimeType:"1",
            //             mealtimeName:"早餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"2",
            //             mealtimeName:"午餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"3",
            //             mealtimeName:"下午茶",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"4",
            //             mealtimeName:"晚餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"5",
            //             mealtimeName:"夜宵",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //     ],  
            // },
            // {   //指定日期-1
            //     applyDate:"2025-03-15",
            //     detailList:[
            //         {
            //             mealtimeType:"1",
            //             mealtimeName:"早餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"2",
            //             mealtimeName:"午餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"3",
            //             mealtimeName:"下午茶",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"4",
            //             mealtimeName:"晚餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"5",
            //             mealtimeName:"夜宵",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //     ],  
            // },
            // {   //每日循环-2
            //     anyone:"repeat",
            //     detailList:[
            //         {
            //             mealtimeType:"1",
            //             mealtimeName:"早餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"2",
            //             mealtimeName:"午餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"3",
            //             mealtimeName:"下午茶",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"4",
            //             mealtimeName:"晚餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"5",
            //             mealtimeName:"夜宵",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //     ],  
            // },
            // {   //每周循环-3
            //     applyWeek:"1",//周一
            //     detailList:[
            //         {
            //             mealtimeType:"1",
            //             mealtimeName:"早餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"2",
            //             mealtimeName:"午餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"3",
            //             mealtimeName:"下午茶",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"4",
            //             mealtimeName:"晚餐",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //         {
            //             mealtimeType:"5",
            //             mealtimeName:"夜宵",
            //             dishesList:[{dishesId:"385767644524974080",dishesName:"农场山芋"}]
            //         },
            //     ],  
            // }, 
        ],
        weekDateList:[],
        weekId:'1',
        detailList:[],
        openDishes:false,
        // 查询菜品
        queryDish:{
            salesMode:null,
            typeId:null,
            dishesName:''
        },
        typeOptions:[],
        //弹窗左侧待选菜品
        dishesPageList:[],
        //弹窗中间待选菜品
        dishesTypeList:[{dishesTypeName:"全部",typeId:"-1"}],
        dishesType:"",
        //弹窗右侧已选菜品
        dishesTableList:[],
        dishesList:[],
        noDishes:true,
        openCopyDate:false,//日期复制弹窗
        currentMonth:"",//日期复制弹窗-年月
        monthDaysList:[],//日期复制弹窗-近14天日期
        currentDaysList:[],//日期复制弹窗-近7天日期
        checkDateList:"",//日期复制弹窗-选择复制的日期
        currentWeekList:[],//日期复制弹窗-星期
        openCopyWeek:false,//星期复制弹窗 
        checkWeekList:[],//星期复制弹窗-选择复制的星期
        openCopyMenu:false,
        canteenOptions2:[],
        stallOptions2:[],
        recipeOptions:[],
        copyType:'',
        dialogQueryParams:{
            areaId:null,
            canteenId:null,
            stallId:null,
            recipeId:null,
            recipeType:null,
            applyDate:null,
            applyWeek:null
        },
        dialogDetailList:[
            {
                mealtimeType:"1",
                mealtimeName:"早餐",
                dishesList:[]
            },
            {
                mealtimeType:"2",
                mealtimeName:"午餐",
                dishesList:[]
            },
            {
                mealtimeType:"3",
                mealtimeName:"下午茶",
                dishesList:[]
            },
            {
                mealtimeType:"4",
                mealtimeName:"晚餐",
                dishesList:[]
            },
            {
                mealtimeType:"5",
                mealtimeName:"夜宵",
                dishesList:[]
            }
        ]
      };
    },
    created() {
        this.getAreaTreeData()
        // this.getmkteffective() 
        this.getMealTimeList() 
        //获取菜品类型
        this.getTypeData()  
        if(this.$route.query.pageJson){
            console.log(JSON.parse(this.$route.query.pageJson))
            this.$set(this,"baseInfo",JSON.parse(this.$route.query.pageJson)) 
            this.$set(this.baseInfo,"recipeType",this.baseInfo.recipeType+'')
            this.$set(this.baseInfo,"areaId",this.baseInfo.areaId||null) 
            this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId||null) 
            this.$set(this.baseInfo,"stallId",this.baseInfo.stallId||null) 
            this.initEditDetail() 
        }
    },
    watch: {
        '$route'(newVal) {
            if(newVal.query.pageJson) {
                this.$set(this,"baseInfo",JSON.parse(newVal.query.pageJson))
                console.log(this.baseInfo)
                this.$set(this.baseInfo,"recipeType",this.baseInfo.recipeType+'')
                this.$set(this.baseInfo,"areaId",this.baseInfo.areaId||null) 
                this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId||null) 
                this.$set(this.baseInfo,"stallId",this.baseInfo.stallId||null) 
                this.initEditDetail()  
            }
        }
    },
    methods: {
        //  注意事项：
        //  1.后台交互需要构建的数据为日期（星期）数组嵌套餐次数组再嵌套菜品数组的三层结构数组对象；
        //  2.页面展示的为空白数组detailList,编辑菜品弹窗操作数组detailList
        //菜谱编辑
        initEditDetail(){ 
            if(this.baseInfo.recipeType==1){//指定日期 
                let length = this.baseInfo.applyDateList.length
                if(length>0){
                    this.dateRange[0] = this.baseInfo.applyDateList[0]
                    this.dateRange[1] = this.baseInfo.applyDateList[length-1]
                    this.dateRangeList = this.getDateRange(this.dateRange[0],this.dateRange[1])
                    this.dateRangeIndex = 0
                    this.dateRangeRadio = this.dateRange[0];
                    this.detailList = this.dateRangeList[0].detailList;
                    this.getRecipeDetailByDate()
                }else{
                    this.dateRange=[new Date(),new Date().setDate(new Date().getDate() + 6)] 
                    this.dateRangeList = this.getDateRange(this.dateRange[0],this.dateRange[1]) 
                    this.dateRangeIndex = 0
                    this.dateRangeRadio = this.formatDate(this.dateRange[0]); 
                    this.detailList = this.dateRangeList[0].detailList; 
                    this.getRecipeDetailByDate()
                }
            }
            if(this.baseInfo.recipeType==2){//每日循环
                this.detailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ]
                this.getRecipeDetailByRepeat()
            }
            //-----每周重复类型----
            if(this.baseInfo.recipeType==3){//每周重复
                this.weekDateList = this.getWeekDates()
                this.weekId = '1';
                this.detailList = this.weekDateList[0].detailList;
                this.getRecipeDetailByWeek()
            }
        },
        // 获取指定日期菜谱计划菜品详情
        getRecipeDetailByDate(){
            let param = {
                "applyDate": this.dateRangeRadio,
                "recipeId": this.baseInfo.recipeId
            }
            getMenuRecipeDetailApi(param).then((response) => {
                // console.log(response)
                if(response.data.length>0){
                    for (let i = 0; i < response.data.length; i++) {
                        this.detailList.forEach(item=>{
                            if(item.mealtimeType==response.data[i].mealtimeType){
                                item.dishesList = response.data[i].dishesList;
                                item.dishesList.forEach(dish=>{
                                    this.$set(dish,'price',Number(dish.price/100))
                                    this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
                                })
                            }
                        }) 
                    } 
                }
            });
        },
        //每日循环(每周循环)-获取菜谱详情
        getRecipeDetailByRepeat(){
            let param = {
                "anyone": "repeat",
                "recipeId": this.baseInfo.recipeId
            }
            getMenuRecipeTemplateDetailApi(param).then((response) => {
                // console.log(response)
                if(response.data.length>0){
                    for (let i = 0; i < response.data.length; i++) {
                        this.detailList.forEach(item=>{
                            if(item.mealtimeType==response.data[i].mealtimeType){
                                item.dishesList = response.data[i].dishesList
                                item.dishesList.forEach(dish=>{
                                    this.$set(dish,'price',Number(dish.price/100))
                                    this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
                                })
                            }
                        }) 
                    } 
                }
            });
        },
        //每周循环-获取菜谱详情
        getRecipeDetailByWeek(){
            let param = {
                "applyWeek": this.weekId,
                "recipeId": this.baseInfo.recipeId
            }
            getMenuRecipeTemplateDetailApi(param).then((response) => {
                // console.log(response)
                if(response.data.length>0){
                    for (let i = 0; i < response.data.length; i++) {
                        this.detailList.forEach(item=>{
                            if(item.mealtimeType==response.data[i].mealtimeType){
                                item.dishesList = response.data[i].dishesList
                                item.dishesList.forEach(dish=>{
                                    this.$set(dish,'price',Number(dish.price/100))
                                    this.$set(dish,'salePrice',Number(dish.salePrice/100)||0)
                                })
                            }
                        }) 
                    } 
                }
            });
        },
        //餐次数据
        getMealTimeList() { 
            // mealTimeListApi({}).then(response => {
            //     this.mealTimeList=response
            // }); 
            this.mealTimeList= [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                    }
            ]
        },
        // 返回列表页
        jumpList() {
            const obj = { path: "/canteen/dish/menuDetail" };
            this.$tab.closeOpenPage(obj);
            this.$router.replace({ path: "/canteen/dish/menu" }); // 要打开的页面 
        },
        //区域树
        getAreaTreeData() {
            systemAreaTreeApi({}).then((response) => {
                this.treeAreaOptions = response.data;
                if(this.treeAreaOptions.length>0){ 
                    this.handleAreaChange()
                }
            });
        },
        getFirstChild(node) {
            if (!node.children || node.children.length === 0) {
                return node; // 没有子节点或子节点为空，返回当前节点
            } else {
                return this.getFirstChild(node.children[0]); // 递归调用最后一个子节点
            }
        },
        //选中区域-查询食堂
        handleAreaChange(e){ 
            let param= {
                areaId:this.baseInfo.areaId,canteenType: 1
            }
            getCanteenByAreaApi(param).then((response) => {
                this.canteenOptions=response.rows||[]
                if(this.canteenOptions.length>0){
                    // this.baseInfo.canteenId = this.canteenOptions[0].canteenId;
                    this.handleCanteenChange()
                }
            });
        },
        //选中食堂-查询档口
        handleCanteenChange(e){
            let param= {
                canteenId:this.baseInfo.canteenId
            }
            getStallByCanteenApi(param).then((response) => {
                this.stallOptions=response.rows||[]
                // if(this.stallOptions.length>0){
                //     this.baseInfo.stallId = this.stallOptions[0].stallId;
                // }
            });
        },
        //用户范围
        // getmkteffective() {
        //     let param = {object:{},page:{size:-1}}
        //     getmkteffectiveApi({"content":JSON.stringify(param)}).then((response) => {
        //         this.effOptions = response.data.records; 
        //     });
        // },
        
        //-------切换菜谱类型---------
        changeRecipeType(e){ 
            if(this.baseInfo.recipeType==1){//日期范围  
                this.dateRangeList = this.getDateRange(this.dateRange[0],this.dateRange[1]) 
                this.dateRangeIndex = 0
                this.dateRangeRadio = this.formatDate(this.dateRange[0])
                this.detailList = this.dateRangeList[0].detailList
            }
            //-----每日重复类型----
            if(this.baseInfo.recipeType==2){//每日重复
                this.detailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ]
                this.getRecipeDetailByRepeat()
            }
            //-----每周重复类型----
            if(this.baseInfo.recipeType==3){//每周重复
                this.weekDateList = this.getWeekDates()
                this.weekId = '1';
                this.detailList = this.weekDateList[0].detailList;
                this.getRecipeDetailByWeek()
            }
        },
        //-----指定日期类型----
        //选择日期范围
        changeDateRange(e){ 
            this.dateRangeList = this.getDateRange(this.formatDate(e[0]),this.formatDate(e[1]))
            this.dateRangeIndex = 0
            this.dateRangeRadio = this.formatDate(e[0])
            this.detailList = this.dateRangeList[0].detailList;
            this.getRecipeDetailByDate()
        },
        //获取两日期间所有日期-构建每日菜谱数据
        getDateRange(startDate, endDate) {
            let start = new Date(startDate);
            let end = new Date(endDate) 
            let dateArray = []; 
            while (start <= end) { 
                //周几
				var days = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
				var dayOfWeek = start.getDay();
                let obj = {
                    applyDate:this.formatDate(start),
                    applyDateStr:this.formatDate(start)+" "+days[dayOfWeek],
                    detailList:[
                        {
                            mealtimeType:"1",
                            mealtimeName:"早餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"2",
                            mealtimeName:"午餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"3",
                            mealtimeName:"下午茶",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"4",
                            mealtimeName:"晚餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"5",
                            mealtimeName:"夜宵",
                            dishesList:[]
                        }
                    ]
                }
                dateArray.push(obj); // 转换为 YYYY-MM-DD 格式
                start.setDate(start.getDate() + 1); // 日期加 1 
            } 
            return dateArray; 
        },
        //切换日期菜谱
        choseDateRadio(e){
            let index = this.dateRangeList.findIndex(v=>v.applyDate==this.dateRangeRadio)
            this.dateRangeIndex = index
            this.detailList = this.dateRangeList[index].detailList;
            this.dateRangeList[index].editStatus=true
            let hasDishes = false
            this.detailList.forEach(item=>{
                if(item.dishesList.length>0){
                    hasDishes=true
                }
            }) 
            if(!hasDishes){
                this.getRecipeDetailByDate()
            }
            
        },
        // ----每周重复-----
        getWeekDates() {
			let weekDates = []; 
			for (let i = 0; i < 7; i++) { 
				//周几
				var days = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六','星期日']; 
				//对象
				let obj = {
                    applyWeek:i+1,
                    weekStr:days[i],
                    detailList:[
                        {
                            mealtimeType:"1",
                            mealtimeName:"早餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"2",
                            mealtimeName:"午餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"3",
                            mealtimeName:"下午茶",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"4",
                            mealtimeName:"晚餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"5",
                            mealtimeName:"夜宵",
                            dishesList:[]
                        }
                    ]
				}
				weekDates.push(obj);  
			} 
			return weekDates;
		},
        choseWeekDate(item,index){
            this.weekId = item.applyWeek;
            this.detailList = this.weekDateList[index].detailList;
            this.weekDateList[index].editStatus=true
            let hasDishes2 = false
            this.detailList.forEach(item=>{
                if(item.dishesList.length>0){
                    hasDishes2=true
                }
            })
            console.log(this.detailList) 
            if(!hasDishes2){
                this.getRecipeDetailByWeek()
            }
        },

        
        /** 查询新增页面-菜品类型下拉 */
        getTypeData() {
            menuDishesTypeAllListApi({}).then((response) => {
                this.typeOptions = response.data; 
            });
        },
        //新增菜品
        addDishes(item){ 
            this.dishesList=item.dishesList; 
            this.dishesTypeList=[{dishesTypeName:"全部",typeId:"-1"}]
            this.dishesTableList=[]
            this.getDishesPage()
            this.openDishes=true
        },
        //修改菜品
        editDishes(item){
            this.dishesList=item.dishesList; 
            this.dishesTypeList=[{dishesTypeName:"全部",typeId:"-1"}]
            this.dishesList.forEach(dish=>{
                let index = this.dishesTypeList.findIndex(v=>v.typeId==dish.typeId)
                if(index==-1){
                    this.dishesTypeList.push({typeId:dish.typeId,dishesTypeName:dish.dishesTypeName})
                }
            }) 
            this.choseDishesType(this.dishesTypeList[0])
            this.getDishesPage()
            this.openDishes=true
        },
        //清空
        clearDishes(item){
            console.log(item)
            console.log(this.detailList) 
            this.detailList.forEach(mealType=>{
                if(mealType.mealtimeType==item.mealtimeType){
                    mealType.dishesList=[]
                }
            })
        },
        //获取左侧待选菜品
        getDishesPage(){
            let param = {
                "areaId":this.baseInfo.areaId,
                "canteenId":this.baseInfo.canteenId,
                "stallId":this.baseInfo.stallId,
                "salesMode":this.queryDish.salesMode,
                "typeIds":[this.queryDish.typeId],
                "dishesName":this.queryDish.dishesName, 
                "pageNum":1,
                "pageSize":100
            }
            getDishesByTypePageApi(param).then((response) => {
                // console.log(response)
                this.dishesPageList = response.rows;
                for(let i =0 ;i < this.dishesList.length ;i++){
                    this.dishesPageList.forEach(item=>{
                        if(item.dishesId==this.dishesList[i].dishesId){
                            item.isChecked=true
                        }
                    })
                }
            });
        },
        //点击左侧待选菜品
        chosenDishes(obj){
            //判断是否为新菜品类型
            let index = this.dishesList.findIndex(v=>v.dishesId==obj.dishesId)
            if(index==-1){//新-加入
                let dish = Object.assign({}, obj)  
                this.$set(dish,'salePrice',Number(dish.price/100)||Number(dish.price/100))
                this.$set(dish,'price',Number(dish.price/100)) 
                this.$set(dish,'supplyNum',dish.supplyNum||99999)
                this.$set(dish,'limitNum',dish.limitNum||99999) 
                this.dishesList.push(dish)
                //反显选中样式
                this.dishesPageList.forEach(item=>{
                    if(obj.dishesId==item.dishesId){
                        item.isChecked = true;
                    }
                })
                //判断是否为新菜品类型
                let typeIndex = this.dishesTypeList.findIndex(v=>v.typeId==obj.typeId)
                if(typeIndex==-1){
                    this.dishesTypeList.push({typeId:obj.typeId,dishesTypeName:obj.dishesTypeName})
                }
            }else{
                this.dishesList.splice(index,1)
                //反显选中样式
                this.dishesPageList.forEach(item=>{
                    if(obj.dishesId==item.dishesId){
                        item.isChecked = null;
                    }
                })
            }
            //选中类型
            this.choseDishesType(obj)
        },
        //选中菜品类型-更新右侧表格数据
        choseDishesType(item){
            this.dishesType = item.typeId;
            this.dishesTableList = []
            if(this.dishesType==-1){
                this.dishesList.forEach(dish=>{ 
                    this.dishesTableList.push(dish) 
                })
            }else{
                this.dishesList.forEach(dish=>{
                    if(dish.typeId==item.typeId){
                        this.dishesTableList.push(dish)
                    }
                })
                if(this.dishesTableList.length==0){//单个菜品分类中无菜品时，删除该分类
                    let typeIndex = this.dishesTypeList.findIndex(v=>v.typeId==item.typeId)
                    if(typeIndex>-1){
                        this.dishesTypeList.splice(typeIndex,1)
                    }
                }
            }
        },
        //弹窗中间-清空菜品类别
        clearDishTab(item){
            this.$modal.confirm('是否确认清空该类别？').then(()=>{
                if(item.typeId==-1){
                    for (let i = this.dishesList.length - 1; i >= 0; i--) { 
                        this.dishesList.splice(i, 1); 
                    }
                    this.dishesType = -1
                    this.dishesTypeList=[{dishesTypeName:"全部",typeId:"-1"}]
                    this.dishesTableList = [] 
                    this.dishesPageList.forEach(dish=>{ 
                        dish.isChecked = null; 
                    })
                }else{
                    for (let i = this.dishesList.length - 1; i >= 0; i--) {
                        if (this.dishesList[i].typeId == item.typeId) {
                            this.dishesList.splice(i, 1);
                        }
                    } 
                    this.dishesPageList.forEach(dish=>{
                        if(dish.typeId==item.typeId){
                            dish.isChecked = null;
                        }
                    })
                    let typeIndex = this.dishesTypeList.findIndex(v=>v.typeId==item.typeId)
                    if(typeIndex>-1){
                        this.dishesTypeList.splice(typeIndex,1)
                    }
                    this.choseDishesType(this.dishesTypeList[0])
                } 
            }).catch(() => {});  
        },
        //弹窗右侧表格删除菜谱
        handleDelDishes(item){
            this.$modal.confirm('是否确认删除？').then(()=>{
                let index = this.dishesList.findIndex(v=>v.dishesId==item.dishesId) 
                if(index>-1){
                    this.dishesList.splice(index,1)
                    let index2 = this.dishesTableList.findIndex(v=>v.dishesId==item.dishesId) 
                    this.dishesTableList.splice(index2,1)
                    this.dishesPageList.forEach(dish=>{
                        if(dish.dishesId==item.dishesId){
                            dish.isChecked = null;
                        }
                    })
                    if(this.dishesTableList.length==0){//单个菜品分类中无菜品时，删除该分类
                        let typeIndex = this.dishesTypeList.findIndex(v=>v.typeId==item.typeId)
                        if(typeIndex>-1){
                            this.dishesTypeList.splice(typeIndex,1)
                        }
                    }
                }
            }).catch(() => {}); 
        },
        //外部餐次列表删除菜谱
        deleteDishes(type,dish){
            this.$modal.confirm('是否确认删除？').then(()=>{
                let index = type.dishesList.findIndex(v=>v.dishesId==dish.dishesId)
                this.detailList.forEach(item=>{
                    if(item.mealtimeType==type.mealtimeType){
                        item.dishesList.splice(index,1) 
                    }
                }) 
            }).catch(() => {}); 
        },
        // 提交按钮
        confirmSubmit(){
            this.$refs["baseInfo"].validate(valid => {
                if (valid) {  
                    setTimeout(()=>{
                        let param = this.baseInfo
                        if(this.baseInfo.recipeType==1){
                            param.recipeDateList = [] 
                            this.dateRangeList.forEach(item=>{
                                let index = item.detailList.findIndex(subItem=>subItem.dishesList.length>0)
                                if(index>-1){
                                    param.recipeDateList.push(item)
                                }else{
                                    if(item.editStatus){
                                        param.recipeDateList.push(item)
                                    } 
                                } 
                            })
                        }
                        if(this.baseInfo.recipeType==2){ 
                            param.recipeDateList = [{
                                anyone:"repeat",
                                detailList:this.detailList
                            }]
                        }
                        if(this.baseInfo.recipeType==3){
                            param.recipeDateList = []
                            this.weekDateList.forEach(item=>{
                                let index = item.detailList.findIndex(subItem=>subItem.dishesList.length>0)
                                if(index>-1){
                                    param.recipeDateList.push(item)
                                }else{
                                    if(item.editStatus){
                                        param.recipeDateList.push(item)
                                    } 
                                }
                                
                            })
                        }
                        this.noDishes = true;
                        param.recipeDateList.forEach(item=>{
                            item.detailList.forEach(subItem=>{
                                if(subItem.dishesList.length>0){
                                    this.noDishes=false
                                    subItem.dishesList.forEach(dishItem=>{
                                        dishItem.price = Number(dishItem.price)
                                        dishItem.salePrice =  Number(dishItem.salePrice)
                                    })
                                }
                            })
                        })
                        console.log(param)
                        if(this.noDishes){
                            this.$modal.msgError("请选中菜品！");
                        }else{
                            this.loading=true
                            editMenuRecipeApi(param).then((response) => {  
                                this.loading=false
                                this.jumpList() 
                            }).catch(() => {
                                this.loading=false;

                            }); 
                        }
                    },500)
                }
            });
        },

        
        // 注意事项：
        // 由于日期（星期）数据为：
        //  日期（星期）数组嵌套餐次数组再嵌套菜品数组的三层结构数组对象
        //  不可直接赋值或者浅拷贝外层数组，只能浅拷贝第三层数
        //  下面代码一些赋值数组不可更改不然回出现操作bug
        
        // 复制其他日期菜谱
        //区域下拉联动
        handleAreaChange2(e){ 
            let param= {
                areaId:this.dialogQueryParams.areaId,canteenType: 1
            }
            getCanteenByAreaApi(param).then((response) => {
                this.canteenOptions2=response.rows||[]
                this.dialogQueryParams.canteenId = null; 
                this.dialogQueryParams.stallId = null;
                this.stallOptions2 = []
                this.dialogQueryParams.recipeId = null;
                this.recipeOptions = []
                this.dialogQueryParams.recipeType = null;
                this.dialogQueryParams.applyDate = null;
                this.dialogQueryParams.applyWeek = null;
                this.dialogDetailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ]
            });
        },
        //食堂下拉联动
        handleCanteenChange2(e){
            let param= {
                canteenId:this.dialogQueryParams.canteenId
            }
            getStallByCanteenApi(param).then((response) => {
                this.stallOptions2=response.rows||[]
                if(this.stallOptions2.length>0){
                    this.dialogQueryParams.stallId = this.stallOptions2[0].stallId;
                    this.dialogQueryParams.recipeId = null;
                    this.recipeOptions = []
                    this.dialogQueryParams.recipeType = null;
                    this.dialogQueryParams.applyDate = null;
                    this.dialogQueryParams.applyWeek = null; 
                    this.dialogDetailList = [
                        {
                            mealtimeType:"1",
                            mealtimeName:"早餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"2",
                            mealtimeName:"午餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"3",
                            mealtimeName:"下午茶",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"4",
                            mealtimeName:"晚餐",
                            dishesList:[]
                        },
                        {
                            mealtimeType:"5",
                            mealtimeName:"夜宵",
                            dishesList:[]
                        }
                    ]
                    this.handleStallChange2()
                }
            });
        },
        //档口下拉联动
        handleStallChange2(e){
            let param= {
                areaId:this.dialogQueryParams.areaId,
                canteenId:this.dialogQueryParams.canteenId,
                stallId:this.dialogQueryParams.stallId,
            }
            getPageRecipeListAllApi(param).then((response) => {
                this.recipeOptions = response.rows||[]
                this.dialogQueryParams.recipeId = null
                this.dialogQueryParams.recipeType = null;
                this.dialogQueryParams.applyDate = null;
                this.dialogQueryParams.applyWeek = null;
                this.dialogDetailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ]
            });
        },
        //菜谱选择联动
        handleRecipeChange2(e){ 
            let index = this.recipeOptions.findIndex(v=>v.recipeId==this.dialogQueryParams.recipeId)
            let currentItem = this.recipeOptions[index]
            this.dialogQueryParams.recipeType = currentItem.recipeType
            // console.log(currentItem)
            this.dialogDetailList = [
                {
                    mealtimeType:"1",
                    mealtimeName:"早餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"2",
                    mealtimeName:"午餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"3",
                    mealtimeName:"下午茶",
                    dishesList:[]
                },
                {
                    mealtimeType:"4",
                    mealtimeName:"晚餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"5",
                    mealtimeName:"夜宵",
                    dishesList:[]
                }
            ]
            if(currentItem.recipeType==1){//日期
                this.dialogQueryParams.applyDate = currentItem.applyDateList[0]||null;
                // this.pickerOptions2 = {
                //     disabledDate(date) { 
                //         const year = date.getFullYear();
                //         const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
                //         const day = String(date.getDate()).padStart(2, '0');
                //         let str = `${year}-${month}-${day}`;
                //         return currentItem.applyDateList.findIndex(v=>v==str)==-1
                //     }
                // }
                let param = {
                    "applyDate": this.dialogQueryParams.applyDate,
                    "recipeId": this.dialogQueryParams.recipeId
                }
                getMenuRecipeDetailApi(param).then((response) => {
                    if(response.data.length>0){
                        for (let i = 0; i < response.data.length; i++) {
                            this.dialogDetailList.forEach(item=>{
                                if(item.mealtimeType==response.data[i].mealtimeType){
                                    response.data[i].dishesList.forEach(dish=>{
                                        this.$set(dish,'salePrice',Number(dish.price/100)||Number(dish.price/100))
                                        this.$set(dish,'price',Number(dish.price/100))
                                    }); 
                                    item.dishesList = response.data[i].dishesList;
                                }
                            }) 
                        }  
                    }else{
                        this.dialogDetailList = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[]
                            }
                        ]
                    }
                });
            }
            if(currentItem.recipeType==2){//每日
                let param = {
                    "anyone": "repeat",
                    "recipeId": this.dialogQueryParams.recipeId
                }
                getMenuRecipeTemplateDetailApi(param).then((response) => {
                    if(response.data.length>0){
                        for (let i = 0; i < response.data.length; i++) {
                            this.dialogDetailList.forEach(item=>{
                                if(item.mealtimeType==response.data[i].mealtimeType){
                                    item.dishesList = response.data[i].dishesList;
                                }
                            }) 
                        }  
                    }else{
                        this.dialogDetailList = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[]
                            }
                        ]
                    }
                });
            }
            if(currentItem.recipeType==3){//星期 
                this.$set(this.dialogQueryParams,"applyWeek",Number(1))
                let param = {
                    "applyWeek": this.dialogQueryParams.applyWeek,
                    "recipeId": this.dialogQueryParams.recipeId
                }
                getMenuRecipeTemplateDetailApi(param).then((response) => {
                    if(response.data.length>0){
                        for (let i = 0; i < response.data.length; i++) {
                            this.dialogDetailList.forEach(item=>{
                                if(item.mealtimeType==response.data[i].mealtimeType){
                                    item.dishesList = response.data[i].dishesList;
                                }
                            }) 
                        }  
                    }else{
                        this.dialogDetailList = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[]
                            }
                        ]
                    }
                });
            } 
        },
        //日期选择联动
        changQueryDate(e){
            this.dialogDetailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ]
            if(this.dialogQueryParams.applyDate){
                let param = {
                    "applyDate": this.dialogQueryParams.applyDate,
                    "recipeId": this.dialogQueryParams.recipeId
                }
                getMenuRecipeDetailApi(param).then((response) => {
                    if(response.data.length>0){
                        for (let i = 0; i < response.data.length; i++) {
                            this.dialogDetailList.forEach(item=>{
                                if(item.mealtimeType==response.data[i].mealtimeType){
                                    item.dishesList = response.data[i].dishesList;
                                }
                            }) 
                        }  
                    }else{
                        this.dialogDetailList = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[]
                            }
                        ]
                    }
                });
            }
        },
        //星期选择联动
        changQueryWeek(e){
            this.dialogDetailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
            ]
            if(this.dialogQueryParams.applyWeek){
                let param = {
                    "applyWeek": this.dialogQueryParams.applyWeek,
                    "recipeId": this.dialogQueryParams.recipeId
                }
                getMenuRecipeTemplateDetailApi(param).then((response) => {
                    if(response.data.length>0){
                        for (let i = 0;i < response.data.length;i++) {
                            console.log(this.dialogDetailList)
                            this.dialogDetailList.forEach(item=>{
                                if(item.mealtimeType==response.data[i].mealtimeType){
                                    item.dishesList = response.data[i].dishesList;
                                }
                            }) 
                        }  
                    }else{
                        this.dialogDetailList = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[]
                            }
                        ]
                    }
                });
            }
        },
        //打开弹窗
        openCopyOtherMenu(type){
            this.copyType = type
            this.dialogQueryParams={
                areaId:null,
                canteenId:null,
                stallId:null,
                recipeId:null,
                recipeType:null,
                applyDate:null,
                applyWeek:null,
            }
            this.dialogQueryParams.areaId = this.baseInfo.areaId;
            this.handleAreaChange2()
            setTimeout(()=>{
                this.dialogQueryParams.canteenId = this.baseInfo.canteenId;
                this.handleCanteenChange2()
            },200) 
            setTimeout(()=>{
                this.dialogQueryParams.stallId = this.baseInfo.stallId;
            },400)
            this.$set(this.dialogQueryParams,"applyWeek",1)
            this.dialogDetailList = [
                {
                    mealtimeType:"1",
                    mealtimeName:"早餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"2",
                    mealtimeName:"午餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"3",
                    mealtimeName:"下午茶",
                    dishesList:[]
                },
                {
                    mealtimeType:"4",
                    mealtimeName:"晚餐",
                    dishesList:[]
                },
                {
                    mealtimeType:"5",
                    mealtimeName:"夜宵",
                    dishesList:[]
                }
            ]

            this.openCopyMenu = true
        },
        //确认复制其他日期菜谱
        confirmCopyMenu(){
            this.$modal.confirm('当前日期会被覆盖！确定复制？').then(() => {
                this.detailList=[]
                this.detailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[...this.dialogDetailList[0].dishesList]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[...this.dialogDetailList[1].dishesList]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[...this.dialogDetailList[2].dishesList]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[...this.dialogDetailList[3].dishesList]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[...this.dialogDetailList[4].dishesList]
                    }
                ];
                this.detailList.forEach(item=>{
                    item.dishesList.forEach(sub=>{
                        sub.price = (Number(sub.price)/100).toFixed(2)
                        sub.salePrice = (Number(sub.salePrice)/100).toFixed(2)
                    })
                })
                if(this.copyType=='date'){
                    this.dateRangeList[this.dateRangeIndex].detailList = this.detailList;
                }
                if(this.copyType=='week'){
                    let index = this.weekDateList.findIndex(v=>v.applyWeek==this.weekId)
                    this.weekDateList[index].detailList = this.detailList;
                }
                this.$modal.msgSuccess("复制成功");
                this.openCopyMenu = false
            }).catch(() => {});
        },
        //确认复制其他日期菜谱-单个餐次
        confirmCopyMealTypeMenu(item){
            console.log(item)
            console.log(this.dialogDetailList)
            console.log(this.detailList)
            this.$modal.confirm('当前日期会被覆盖！确定复制？').then(() => {
                item.dishesList.forEach(sub=>{
                        sub.price = (Number(sub.price)/100).toFixed(2)
                        sub.salePrice = (Number(sub.salePrice)/100).toFixed(2)
                })
                let index = this.detailList.findIndex(v=>v.mealtimeType==item.mealtimeType)
                this.detailList[index].dishesList = item.dishesList;
                if(this.copyType=='date'){
                    this.dateRangeList[this.dateRangeIndex].detailList = this.detailList;
                }
                if(this.copyType=='week'){
                    let index = this.weekDateList.findIndex(v=>v.applyWeek==this.weekId)
                    this.weekDateList[index].detailList = this.detailList;
                }
                this.$modal.msgSuccess("复制成功");
                this.openCopyMenu = false
            }).catch(() => {});
        },
        // ------日期--------
        //清空当天菜谱-日期
        clearDateMenu(){
            this.$modal.confirm('是否确认清空当天菜谱？').then(() => {
                this.dateRangeList[this.dateRangeIndex].detailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ];
                this.detailList = this.dateRangeList[this.dateRangeIndex].detailList; 
                this.$modal.msgSuccess("清空成功");
            }).catch(() => {});
            
        },
        //打开日期复制弹框
        openCopyDateMenu(){
            this.currentMonth = ""
            this.checkDateList = []
            this.monthDaysList = []
            this.currentDaysList = []
            this.currentWeekList = []     
            this.getRecentMonthDates();
            this.openCopyDate = true
        },
        //选择要复制的日期
        choseCopyDate(item){
            let index = this.currentDaysList.findIndex(v=>v==item)
            if(index>-1){
                this.checkDateList.push(item) 
            }
        },
        //确认复制菜品
        copyDateMenu(){
            // console.log(this.detailList)
            // console.log(this.checkDateList)
            // console.log(this.dateRangeList)
            if(this.checkDateList.length==0){
                this.$modal.msgError("请先选择要复制的日期");
            }else{
                this.$modal.confirm('所选日期数据会被覆盖！确定复制？').then(() => {
                    this.checkDateList.forEach(item=>{
                        let index = this.dateRangeList.findIndex(v=>v.applyDate.indexOf(item)>-1)
                        if(index>-1){
                            const arr = [
                                {
                                    mealtimeType:"1",
                                    mealtimeName:"早餐",
                                    dishesList:[...this.detailList[0].dishesList]
                                },
                                {
                                    mealtimeType:"2",
                                    mealtimeName:"午餐",
                                    dishesList:[...this.detailList[1].dishesList]
                                },
                                {
                                    mealtimeType:"3",
                                    mealtimeName:"下午茶",
                                    dishesList:[...this.detailList[2].dishesList]
                                },
                                {
                                    mealtimeType:"4",
                                    mealtimeName:"晚餐",
                                    dishesList:[...this.detailList[3].dishesList]
                                },
                                {
                                    mealtimeType:"5",
                                    mealtimeName:"夜宵",
                                    dishesList:[...this.detailList[4].dishesList]
                                }
                            ];
                            this.dateRangeList[index].detailList = JSON.parse(JSON.stringify(arr)) 
                        }
                    });
                    this.$modal.msgSuccess("复制成功");
                    this.openCopyDate = false
                }).catch(() => {});
            }
        },
        // ------ 星期 -------
        //清空当天菜谱-星期
        clearWeekMenu(){
            let index = this.weekDateList.findIndex(v=>v.applyWeek==this.weekId)
            this.$modal.confirm('所选日期数据会被清空！确定清空？').then(() => {
                this.weekDateList[index].detailList = [
                    {
                        mealtimeType:"1",
                        mealtimeName:"早餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"2",
                        mealtimeName:"午餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"3",
                        mealtimeName:"下午茶",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"4",
                        mealtimeName:"晚餐",
                        dishesList:[]
                    },
                    {
                        mealtimeType:"5",
                        mealtimeName:"夜宵",
                        dishesList:[]
                    }
                ];
                this.detailList = this.weekDateList[index].detailList;
                this.$modal.msgSuccess("清空成功");
            }).catch(() => {}); 
        },
        //打开星期复制弹框
        openCopyWeekMenu(){
            this.checkWeekList = []
            this.openCopyWeek = true
        },
        //确认复制菜品
        copyWeekMenu(){
            if(this.checkWeekList.length==0){
                this.$modal.msgError("请先选择要复制的日期");
            }else{
                this.$modal.confirm('所选日期数据会被覆盖！确定复制？').then(() => { 
                    this.checkWeekList.forEach(item=>{
                        let index = this.weekDateList.findIndex(v=>v.applyWeek==item)
                        const arr = [
                            {
                                mealtimeType:"1",
                                mealtimeName:"早餐",
                                dishesList:[...this.detailList[0].dishesList]
                            },
                            {
                                mealtimeType:"2",
                                mealtimeName:"午餐",
                                dishesList:[...this.detailList[1].dishesList]
                            },
                            {
                                mealtimeType:"3",
                                mealtimeName:"下午茶",
                                dishesList:[...this.detailList[2].dishesList]
                            },
                            {
                                mealtimeType:"4",
                                mealtimeName:"晚餐",
                                dishesList:[...this.detailList[3].dishesList]
                            },
                            {
                                mealtimeType:"5",
                                mealtimeName:"夜宵",
                                dishesList:[...this.detailList[4].dishesList]
                            }
                        ];
                        this.weekDateList[index].detailList = JSON.parse(JSON.stringify(arr))
                    })
                    this.$modal.msgSuccess("复制成功");
                    this.openCopyWeek = false
                }).catch(() => {});
            }
        },
 
        // 获取日期弹窗数据
        getRecentMonthDates() {
			let startDate = new Date(new Date(this.dateRangeList[0].applyDate).getTime()-2*24*60*60*1000); // 获取当前日期
			let currentDate = new Date(new Date(this.dateRangeList[0].applyDate).getTime()); // 获取当前日期
			let monthDates = []; 
            let currentDates = [];
            let month = new Date().getMonth() + 1; // 月份是从0开始计数的，所以要+1
            let year = new Date().getFullYear();
            this.currentMonth = `${year}年${month < 10 ? '0' + month : month}月`; 
            let dateLength = this.dateRangeList.length
			for (let i = 0; i < (dateLength+7); i++) {
				let day = startDate.getDate();
				let month = startDate.getMonth() + 1; // 月份是从0开始计数的，所以要+1 
				//日期
				let formattedDate = `${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
                //星期几
				var days = ['日', '一', '二', '三', '四', '五', '六'];
				var dayOfWeek = startDate.getDay();
                if(i<7){
                    this.currentWeekList.push(days[dayOfWeek])
                }
				monthDates.push(formattedDate); 
				startDate.setDate(startDate.getDate() + 1); // 获取前一天的日期
			}
            let arr = this.dateRangeRadio.split("-") 
            let str = arr[1]+'-'+arr[2]
            for (let i = 0; i < dateLength; i++) {
				let day = currentDate.getDate();
				let month = currentDate.getMonth() + 1; // 月份是从0开始计数的，所以要+1 
				//日期
				let formattedDate = `${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
                if(formattedDate!=str){
                    currentDates.push(formattedDate);
                }
                currentDate.setDate(currentDate.getDate() + 1); // 获取前一天的日期
			}
            this.monthDaysList = monthDates
            this.currentDaysList = currentDates 
		},
        //日期
        formatDate(date) {
            // 格式化为 YYYY-MM-DD
            const year = date.getFullYear();
            const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始
            const day = String(date.getDate()).padStart(2, '0');
            return `${year}-${month}-${day}`;
        },
        //price salePrice
        patternValue(row){ 
            if(row.price&&row.salePrice){
                console.log(111)
                setTimeout(()=>{
                    if(Number(row.salePrice)>=(Number(row.price))){ 
                        row.salePrice = Number(row.price) 
                    }
                },200)
            }
        }
    }
};
</script>
<style scoped>
    .dishes-card{
        width: 20%;
        height: 100%;
        margin-right: 15px;
        position: relative;
    }
    .body-card{
        width: 96%;
        margin: 10px auto;
        display: flex;
        flex-direction: column;
        height: 300px;
        overflow-y: auto;
    }

    .bottom-card{
        width: 100%;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        bottom: 0;
    }


    .dialog-left{
        width: 20%;
        height: 100%;
    }
    .dish-name{
        width: 100%;
        height: 32px;
        display: flex;
        align-items: center;
        cursor: pointer;
    }
    .dish-name:hover{ 
        background-color:rgba(0, 0, 0, 0.1);
        color: #4b80fd;
    } 

    .dialog-center{
        width: 10%;
        height: 100%;
        /* background: #4b80fd; */
        border: 1px solid #ccc;
        border-radius: 5px;
        margin: 0 1%;
    }
    .dialog-center-header{
        width: 100%;display: flex;align-items: center;justify-content: center;height: 60px;font-weight: bold;border-bottom: 1px solid #ccc;
    }
    .dialog-right{
        width: 70%;
        height: 100%;
    }
    .primary{
        background: #1890ff!important;
        color: #fff!important;
    }
    .dateTable{
        width: 14%;
        height: 40px;
        color: #9a9da3;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid #e6ebf5;
    }
    .dateTable2{
        width: 14%;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        color:#000;
        border: 1px solid #e6ebf5;
        cursor: pointer;
    }
    .bgBlue{
        width: 14%;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #0c6ccc;
        color:#fff !important;
        border: 1px solid #fff;
        cursor: pointer;
    }
</style>




  