<style>
.domestucRestaurantInfo .resourceImgAdd {
  width: 620px;
  margin: auto;
}

.domestucRestaurantInfo .clearfix:after {
  content: "\0020";
  display: block;
  height: 0;
  clear: both;
}

.domestucRestaurantInfo .resource-content {
  width: 100%;
  margin-top: 30px;
  font-size: 12px;
  min-width: 1200px;
}

.domestucRestaurantInfo .resource-baseinfo {
  float: left;
  height: auto;
  width: 600px;
  margin: 0 0 20px 30px;
}

.domestucRestaurantInfo .resource-imginfo {
  float: left;
  width: 510px;
  margin-top: 35px;
}

.domestucRestaurantInfo .resource-lititle {
  display: block;
  border-left: 4px solid #e95252;
  padding-left: 10px;
  margin-bottom: 20px;
}

.domestucRestaurantInfo .resource-baseinfo span {
  display: inline-block;
}

.domestucRestaurantInfo .resource-name {
  width: 300px;
  height: 34px;
  background: rgba(255, 255, 255, 1);
  outline: none;
  border: 1px solid #d6d6d6;
  padding-left: 10px;
}

.domestucRestaurantInfo .common-lefttit {
  width: 80px;
  text-align: right;
  margin: 0 7px 0 8px;
  display: inline-block;
}

.domestucRestaurantInfo .resource-net {
  position: relative;
}

.domestucRestaurantInfo .resource-http {
  position: absolute;
  color: #999999;
  width: 70px !important;
  background-color: #f5f7fa;
  border-right: 1px solid #d1d1d1;
  height: 32px;
  top: 5px;
  left: 1px;
  text-align: center;
  line-height: 32px;
  text-align: center;
}

.domestucRestaurantInfo .R1 {
  width: 300px;
  padding: 0 15px 0 80px;
  transition: all 0.3s ease-in-out;
}

.domestucRestaurantInfo .areaInput {
  width: 300px;
  padding-right: 120px;
}

.domestucRestaurantInfo .areaInput:focus {
  border: 1px solid #e95252;
}

.domestucRestaurantInfo .map-icon {
  position: absolute;
  right: 1px;
  top: 1px;
  line-height: 32px;
  text-align: center;
  border-left: 1px solid #cccccc;
  border-top-right-radius: 17px;
  border-bottom-right-radius: 17px;
  padding-right: 15px;
  padding-left: 10px;
  cursor: pointer;
  display: inline-block;
  height: 32px;
  background-color: #f5f7fa;
}

.domestucRestaurantInfo .map-icon i {
  margin: 0 5px;
  position: relative;
  top: 1px;
}

.domestucRestaurantInfo .save-Btn {
  width: 90px;
  height: 30px;
  background: rgba(233, 82, 82, 1);
  border-radius: 15px;
  color: #fff;
  outline: none;
  cursor: pointer;
  margin-right: 20px;
}

.domestucRestaurantInfo .cancel-Btn,
.save-Btn:hover {
  opacity: 0.8;
}

.domestucRestaurantInfo .cancel-Btn {
  width: 90px;
  height: 30px;
  background: rgba(255, 255, 255, 1);
  border-radius: 15px;
  color: #e95252;
  outline: none;
  cursor: pointer;
  border: 1px solid #e95252;
}

.domestucRestaurantInfo .re-img {
  width: 140px;
  height: 93px;
  border-radius: 10px;
  float: left;
  margin: 0 30px 50px 0;
  position: relative;
}

.domestucRestaurantInfo .re-img:first-child {
  margin-left: 0;
}

.domestucRestaurantInfo .resource-imglist {
  width: 100%;
  height: auto;
  margin-top: 20px;
}

.domestucRestaurantInfo .resource-imglist img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

.domestucRestaurantInfo .add-img {
  margin-top: 20px;
}

.domestucRestaurantInfo .reimg-add {
  width: 140px;
  height: 93px;
  background: rgba(236, 236, 236, 1);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  z-index: 999;
}

.domestucRestaurantInfo .ad-one {
  display: none;
  background: rgba(0, 0, 0, 0.4);
  width: 100%;
  height: 100%;
  border-radius: 10px;
  position: absolute;
  top: 0;
}

.domestucRestaurantInfo .bigAdd {
  font-size: 50px;
  color: #d1d1d1;
  position: relative;
  left: 45px;
  top: 10px;
}

.domestucRestaurantInfo .imgzhe {
  display: none;
  background: rgba(0, 0, 0, 0.4);
  width: 100%;
  height: 100%;
  border-radius: 10px;
  position: absolute;
  text-align: center;
  line-height: 93px;
  top: 0;

}
.domestucRestaurantInfo .imgtag{
 height: 40px;
 color: #000;
} 
.domestucRestaurantInfo .reimg-add:hover .ad-one {
  display: block;
}

.domestucRestaurantInfo .re-img:hover .imgzhe {
  display: block;
}

.domestucRestaurantInfo .ad-one div {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  line-height: 32px;
  text-align: center;
  background: gray;
  color: #fff;
}

.domestucRestaurantInfo .ad-one div:hover {
  background-color: #fff;
  color: #e95252;
}

.domestucRestaurantInfo .re-upload {
  position: absolute;
  top: 30px;
  left: 30px;
  z-index: 999;
}

.domestucRestaurantInfo .re-find {
  position: absolute;
  top: 30px;
  right: 30px;
  z-index: 999;
}

.domestucRestaurantInfo .search-imgicon {
  padding-right: 20px;
  margin-left: -40px;
}

.domestucRestaurantInfo .resAddImg {
  width: 520px;
  padding-right: 45px;
}

.domestucRestaurantInfo .addimgContent {
  height: 290px;
  overflow: auto;
  margin: 30px 0 30px 25px;
  width: 545px;
}

.domestucRestaurantInfo .addimgDiv {
  width: 160px;
  height: 155px;
  float: left;
  margin: 0 20px 15px 0;
  overflow: hidden;
}

.domestucRestaurantInfo .addimgContent div:first-child {
  margin-left: 0;
}

.addimgContent div:nth-child(3n) {
  margin-right: 0;
}

.domestucRestaurantInfo .itemImgdiv {
  width: 160px;
  height: 106px;
  position: relative;
}

.domestucRestaurantInfo .itemImgdiv img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

.domestucRestaurantInfo .imgseclet {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 10px;
  position: absolute;
  top: 0;
  text-align: center;
  line-height: 106px;
  color: #e95252;
}

.icon-dagouyouquan {
  font-size: 25px;
}

.domestucRestaurantInfo .test-1::-webkit-scrollbar {
  width: 0px;
  height: 0px;
  background-color: #f5f5f5;
}

.domestucRestaurantInfo .test-1::-webkit-scrollbar-track {
  background-color: #f5f5f5;
}

.domestucRestaurantInfo .test-1::-webkit-scrollbar-thumb {
  border-radius: 20px;
  background-color: #aaa;
  margin-bottom: 24px;
}

.domestucRestaurantInfo .test-1:hover::-webkit-scrollbar {
  width: 4px;
  height: 4px;
  background-color: #f5f5f5;
}

.domestucRestaurantInfo .addimg-btnlist {
  text-align: center;
}

.domestucRestaurantInfo .addimg-select {
  font-size: 14px;
  color: #999999;
  float: right;
  margin-bottom: 10px;
  position: relative;
  bottom: 20px;
}

.domestucRestaurantInfo .re-delte {
  width: 32px;
  height: 32px;
  background: gray;
  border-radius: 50%;
  text-align: center;
  line-height: 32px;
  display: inline-block;
  color: #fff;
  cursor: pointer;
}

.domestucRestaurantInfo .re-delte:hover {
  color: #e95252;
  background: #fff;
}

.domestucRestaurantInfo .imgDescription {
  font-size: 12px;
  margin-top: 12px;
  color: #333333;
  width: 100%;
  line-height: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.domestucRestaurantInfo .el-upload-dragger {
  border: none;
}

.domestucRestaurantInfo .res-span span:last-child {
  display: inline;
}

.domestucRestaurantInfo .resourcerightTop span {
  display: inline-block;
}

.domestucRestaurantInfo .sheshi {
  margin-bottom: 20px;
}

.domestucRestaurantInfo .dialog-footer {
  padding-bottom: 30px;
}

.domestucRestaurantInfo .btn-list {
  margin: 20px 0 40px 30px;
}

.domestucRestaurantInfo .input-with-select .el-input-group__prepend {
  background-color: #fff;
}

.domestucRestaurantInfo .el-textarea__inner {
  resize: none;
  height: 120px;
  font-family: "微软雅黑";
}

.domestucRestaurantInfo .R1:focus {
  border: 1px solid #e95252;
}

.domestucRestaurantInfo .el-form-item__label {
  width: 96px;
  font-size: 12px;
}

.domestucRestaurantInfo .el-form-item__error {
  left: 100px;
}

.domestucRestaurantInfo .hotelDay {
  margin-left: 10px;
}

.domestucRestaurantInfo .searchImgIcon {
  cursor: pointer;
}

.domestucRestaurantInfo .el-dialog--center .el-dialog__body {
  padding: 25px 25px 0;
}

.domestucRestaurantInfo .addressInput .el-input-group__append {
  border-top-right-radius: 17px;
  border-bottom-right-radius: 17px;
}

.domestucRestaurantInfo ::-webkit-input-placeholder {
  color: #d1d1d1;
}

.domestucRestaurantInfo :-moz-placeholder {
  color: #d1d1d1;
}

.domestucRestaurantInfo ::-moz-placeholder {
  color: #d1d1d1;
}

.domestucRestaurantInfo :-ms-input-placeholder {
  color: #d1d1d1;
}

.domestucRestaurantInfo .el-switch.is-checked .el-switch__core {
  border-color: #4bca81;
  background-color: #4bca81;
}

.domestucRestaurantInfo .orderAdd {
  position: relative;
  width: 340px;
}

.domestucRestaurantInfo .minus:hover {
  background-color: #cccccc;
  cursor: pointer;
}

.domestucRestaurantInfo .footabs {
  width: 300px;
  min-height: 34px;
  border: 1px solid #d1d1d1;
  margin-left: 10px;
  display: inline-block;
  background-color: #fff;
  padding: 5px 10px;
  display: flex;
  flex-wrap: wrap;
}

.domestucRestaurantInfo .foodtips {
  display: inline-block;
  padding: 3px 5px;
  background-color: #efefef;
  margin: 3px;
  position: relative;
}

.domestucRestaurantInfo .toolOne {
  margin: 0 0 28px 38px;
  display: flex;
}

.domestucRestaurantInfo .foodTipsDiv {
  max-width: 200px;
  display: inline;
}

.domestucRestaurantInfo .wInput {
  border: none;
  height: 30px;
}

.domestucRestaurantInfo .wInput .el-input__inner {
  border: none !important;
  height: 28px;
  padding: 0;
  border-radius: 0;
  margin-top: 2px;
}

.domestucRestaurantInfo .delTips {
  position: absolute;
  right: -5px;
  top: -5px;
  cursor: pointer;
  color: #999;
  font-size: 14px;
}

.domestucRestaurantInfo .delTips:hover {
  color: #e95252;
}

.domestucRestaurantInfo .fanyong {
  font-size: 12px;
  color: #666666;
  margin-right: 10px;
}

.domestucRestaurantInfo .footabs .el-tag {
  margin: 0 5px 5px 0;
}

.domestucRestaurantInfo .footabs .el-input__inner {
  height: 30px;
  position: relative;
}

.domestucRestaurantInfo .button-new-tag {
  height: 30px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}

.domestucRestaurantInfo .input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}

.domestucRestaurantInfo .toolSpan {
  margin-top: 5px;
}

.domestucRestaurantInfo .RabateDiv {
  margin-left: 6px;
}

.domestucRestaurantInfo .RebateCount {
  height: 34px;
  float: left;
}

.domestucRestaurantInfo .leftPnum {
  float: left;
  width: 50px;
  background-color: #f5f7fa;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-right: 1px solid #cccccc;
  position: absolute;
  left: 1px;
  top: 1px;
}

.domestucRestaurantInfo .fanNum {
  float: left;
  width: 50px;
  background-color: #f5f7fa;
  height: 32px;
  line-height: 32px;
  text-align: center;
  border-right: 1px solid #cccccc;
  position: absolute;
  left: 1px;
  top: 1px;
}

.domestucRestaurantInfo .toolInput {
  height: 34px;
  padding-left: 5px;
  border: none;
}

.domestucRestaurantInfo .inpuOne {
  width: 130px;
  padding-left: 55px;
  border: 1px solid #d1d1d1;
  border-right: none;
}

.domestucRestaurantInfo .reOne,
.domestucRestaurantInfo .reTwo,
.domestucRestaurantInfo .dayNum {
  position: relative;
}

.domestucRestaurantInfo .tiqianDay {
  position: absolute;
  left: 1px;
  top: 1px;
  width: 30px;
  height: 32px;
  background-color: #f5f7fa;
  z-index: 999;
  width: 100px;
  text-align: center;
  line-height: 32px;
  border-right: 1px solid #d1d1d1;
}

.domestucRestaurantInfo .dayNum {
  width: 300px;
  padding: 0 45px 0 110px;
  border: 1px solid #d1d1d1;
  height: 34px;
}

.domestucRestaurantInfo .inpuTwo {
  width: 170px;
  padding: 0 45px 0 55px;
  border: 1px solid #d1d1d1;
}

.domestucRestaurantInfo .fanbili {
  margin-top: 8px;
}

.domestucRestaurantInfo .percentCon {
  float: right;
  width: 40px;
  height: 32px;
  text-align: center;
  background-color: #f5f7fa;
  border-left: 1px solid #cccccc;
  line-height: 32px;
  position: absolute;
  right: 1px;
  top: 1px;
}

.domestucRestaurantInfo .dayLi {
  left: 90px;
}

.domestucRestaurantInfo .el-dialog--center .el-dialog__body {
  padding: 15px 25px 0 !important;
}

.domestucRestaurantInfo .mapList {
  width: 850px !important;
  /* height: 510px !important; */
}

.domestucRestaurantInfo .addAddress .el-input__inner {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border: 1px solid #d1d1d1 !important;
}

.domestucRestaurantInfo .el-input-group__append {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.domestucRestaurantInfo .FoodRecommendList {
  min-height: 50px;
}
.FoodRecommendGroup {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.FoodRecommendList .el-input,
.FoodRecommendList .el-input__inner {
  width: 200px;
  margin-right: 20px;
}
.FoodRecommendList .FoodName,
.FoodRecommendList .sort {
  font-size: 12px;
  color: #606266;
  border: none;
  background-color: transparent;
}
</style>
<template>
  <div class="flexOne domestucRestaurantInfo">
    <div class="resource-content clearfix">
      <el-form :model="addMsg" :rules="rules" ref="addMsg">
        <div class="resource-baseinfo">
          <span class="resource-lititle">{{ $t("hotel.hotel_baseinfo") }}</span>
          <el-form-item :label="$t('ground.cantdwmc')" prop="Name">
            <el-input
              type="text"
              v-model="addMsg.Name"
              maxlength="100"
              class="w300"
            ></el-input>
          </el-form-item>
          <el-form-item :label="$t('ground.cantzsmc')" prop="RealName">
            <el-input
              type="text"
              v-model="addMsg.RealName"
              maxlength="100"
              class="w300"
            ></el-input>
          </el-form-item>
          <el-form-item :label="$t('hotel.hotel_website')">
            <div>
              <span class="resource-net">
                <span class="resource-http">https://</span>
                <input
                  type="text"
                  v-model="addMsg.URL"
                  maxlength="100"
                  class="resource-name R1"
                />
              </span>
            </div>
          </el-form-item>
           <el-form-item label="是否上架" prop="IsShelves">
             <el-radio v-model="addMsg.IsShelves" :label="0">上架</el-radio>
             <el-radio v-model="addMsg.IsShelves" :label="1">下架</el-radio>
          </el-form-item>
          <!-- <el-form-item :label="$t('system.table_country')">
            <el-select
              :placeholder="$t('visaT.qxzguojia')"
              filterable
              v-model="addMsg.Country"
              class="multiple_input w300"
              @change="
                GetSubAreaList(addMsg.Country, 1),
                  (addMsg.Province = 0),
                  (addMsg.City = 0),
                  (addMsg.District = 0)
              "
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="childItem in CountryList"
                :key="childItem.ID"
                :label="childItem.Name"
                :value="childItem.ID"
              >
              </el-option>
            </el-select>
          </el-form-item> -->
          <el-form-item :label="$t('hotel.hotel_province')">
            <el-select
              :placeholder="$t('pub.pleaseSel')"
              filterable
              class="multiple_input w300"
              v-model="addMsg.Province"
              @change="
                GetSubAreaList(addMsg.Province, 2),
                  (addMsg.City = 0),
                  (addMsg.District = 0)
              "
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="childItem in ProvinceList"
                :key="childItem.ID"
                :label="childItem.Name"
                :value="childItem.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('hotel.hotel_city')">
            <el-select
              :placeholder="$t('pub.pleaseSel')"
              filterable
              class="multiple_input w300"
              v-model="addMsg.City"
              @change="GetSubAreaList(addMsg.City, 3), (addMsg.District = 0)"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="childItem in CityList"
                :key="childItem.ID"
                :label="childItem.Name"
                :value="childItem.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="区">
            <el-select
              v-model="addMsg.District"
              class="w300"
              @change="getArea"
              filterable
              :placeholder="$t('hotel.hotel_area')"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="item in district"
                :key="item.ID"
                :label="item.Name"
                :value="item.ID"
              ></el-option>
            </el-select>
          </el-form-item>

          <el-form-item :label="$t('hotel.hotel_detailinfo')" prop="Address">
            <el-input
              :placeholder="$t('fnc.qsrneirong')"
              class="w300 addAddress"
              v-model="addMsg.Address"
            >
              <el-button
                slot="append"
                @click="selectAddress = true"
                icon="iconfont icon-img_dw"
              ></el-button>
            </el-input>
          </el-form-item>
          <div class="toolOne">
            <span class="fanbili">地理位置</span>
            <div class="RabateDiv clearfix">
              <div class="RebateCount reOne">
                <div class="leftPnum">经度</div>
                <input type="text" class="toolInput inpuOne" v-model="addMsg.Lng" maxlength="20">
              </div>
              <div class="RebateCount reTwo">
                <div class="fanNum">纬度</div>
                <input type="text" class="toolInput inpuTwo" v-model="addMsg.Lat" maxlength="20">
              </div>
            </div>
          </div>
          <!-- 营业时间 -->
          <el-form-item :label="$t('restaurant.res_ContactNumber')" prop="Tel">
            <el-input
              type="text"
              maxlength="20"
              v-model="addMsg.Tel"
              class="w300"
            ></el-input>
          </el-form-item>
          <el-form-item :label="$t('hotel.hotel_fax')" prop="Fax">
            <el-input
              type="text"
              maxlength="20"
              v-model="addMsg.Fax"
              class="w300"
            ></el-input>
          </el-form-item>
          <el-form-item
            :label="$t('restaurant.res_parkDetail')"
            prop="ParkInfo"
          >
            <el-input
              type="text"
              maxlength="100"
              v-model="addMsg.ParkInfo"
              class="w300"
            ></el-input>
          </el-form-item>
           <span class="resource-lititle">开放时间 
               <el-tooltip
              class="item"
              effect="dark"
              content="添加开放时间"
              placement="top-end"
            >
              <el-button
                type="primary"
                icon="el-icon-plus"
                circle
                style="margin-left: 10px"
                @click="addOpenTime"
              ></el-button>
            </el-tooltip>
           </span>
          <div v-for="(item,index) in addMsg.OpeningHoursList" :key="index">
              <template v-if="index!=0">
                   <el-form-item label="操作" prop="StartDay">
                   <el-tooltip
                   class="item"
                   effect="dark"
                   content="删除开放时间"
                   placement="top-end"
                  >
                <el-button
                  type="danger"
                  icon="el-icon-delete"
                  circle
                  size="small"
                  
                  @click="delOpenTime(index)"
                  ></el-button>
                  </el-tooltip>
               </el-form-item>
              </template>
              <template>
                 <el-form-item label="营业开始时间" prop="OpeningHours">
                    <el-time-select
                        v-model="item.StartTime"
                        :picker-options="{
                        start: '00:00',
                        step: '00:15',
                        end: '23:45',
                        maxTime:item.EndTime
                        }"
                        placeholder="选择时间">
                    </el-time-select>
                </el-form-item>
                <el-form-item label="营业结束时间" prop="OpeningHours">
                    <el-time-select
                        v-model="item.EndTime"
                        :picker-options="{
                        start: '00:00',
                        step: '00:15',
                        end: '23:45',
                        minTime:item.StartTime
                        }"
                        placeholder="选择时间">
                     </el-time-select>
                 </el-form-item>
              </template>
              <template>
                 <el-form-item label="营业开始周" prop="OpeningHours">
                    <el-select
                    v-model="item.BusinessStartWeek"
                    filterable
                    allow-create
                    placeholder="请选择"
                    >
                    <el-option label="不限" :value="0"></el-option>  
                    <el-option
                    v-for="item in weekEnumList"
                    :key="item.ID"
                    :label="item.Name"
                    :value="item.ID"
                    >
                    </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="营业结束周" prop="OpeningHours">
                    <el-select
                    v-model="item.BusinessEndWeek"
                    filterable
                    allow-create
                    placeholder="请选择"
                    >
                    <el-option label="不限" :value="0"></el-option>  
                    <el-option
                    v-for="item in weekEnumList"
                    :key="item.ID"
                    :label="item.Name"
                    :value="item.ID"
                    >
                    </el-option>
                    </el-select>
                 </el-form-item>
              </template>
              
          </div>
          <span class="resource-lititle sheshi">{{
            $t("restaurant.res_detailInformation")
          }}</span>
          <el-form-item :label="$t('restaurant.res_salePlatform')">
            <el-select
              v-model="openplatString"
              class="multiple_input w300"
              multiple
              :placeholder="$t('pub.pleaseSel')"
            >
              <el-option
                v-for="item in openplatform"
                :key="item.ID"
                :label="item.Name"
                :value="item.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item
            :label="$t('restaurant.res_bookCapacity')"
            prop="SupportCount"
          >
            <el-input-number
              v-model="addMsg.SupportCount"
              class="w300"
              :min="0"
            ></el-input-number>
          </el-form-item>
          <div class="RabateDiv clearfix">
            <div class="RebateCount reTwo dayLi">
              <div class="tiqianDay">
                {{ $t("restaurant.res_advanceDays") }}
              </div>
              <input
                type="text"
                class="dayNum"
                v-model="addMsg.DieLine"
                maxlength="10"
                onkeyup="value=value.replace(/[^\d]/g,'')"
              />
              <div class="percentCon">{{ $t("hotel.hotel_day") }}</div>
            </div>
          </div>
          <el-form-item :label="$t('ground.shifouyuyue')">
            <el-switch
              v-model="addMsg.AppointmentStyle"
              :active-value="inActive"
              :inactive-value="notInActive"
            ></el-switch>
          </el-form-item>
          <el-form-item :label="$t('ground.zhifufangshi')">
            <el-select
              v-model="addMsg.PayStyle"
              class="multiple_input w300"
              :placeholder="$t('pub.pleaseSel')"
              :disabled="IsHaveAuth == 1 ? false : true"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="item in PayList"
                :key="item.Id"
                :label="item.Name"
                :value="item.Id"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('ground.cantingleixing')">
            <el-select
              v-model="addMsg.DiningType"
              class="multiple_input w300"
              :placeholder="$t('pub.pleaseSel')"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="item in DiningTypeList"
                :key="item.ID"
                :label="item.Name"
                :value="item.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!-- <el-form-item label="美食分类" prop="FoodType">
            <el-cascader
                 style="width:300px"
                 v-model="addMsg.FoodType"
                 :show-all-levels='false'
                 :options="FoodTypeList"
                 :props="{ 
                   checkStrictly: true,
                   label:'Name',
                   value:'ID',
                   children:'ChildrenList',
                   emitPath:false
                  }"
                 clearable>
                </el-cascader>
          </el-form-item> -->

           <el-form-item label="美食分类" prop="FoodType">
            <el-select v-model="addMsg.FoodType" class='w300' :placeholder="$t('pub.pleaseSel')">
              <el-option v-for="item in FoodTypeList" :key="item.ID" :label="item.Name" :value="item.ID">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item :label="$t('Operation.Op_price')">
            <el-select
              v-model="addMsg.DiningPriceType"
              class="multiple_input w300"
              :placeholder="$t('pub.pleaseSel')"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="item in DiningPriceTypeList"
                :key="item.ID"
                :label="item.Name"
                :value="item.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="均价" prop="AveragePrice">
            <el-input v-model="addMsg.AveragePrice" type="number" step="0.01" class="multiple_input w300"></el-input>
          </el-form-item>
          <el-form-item :label="$t('ground.hezuofangshi')">
            <el-select
              v-model="addMsg.CooperationType"
              class="multiple_input w300"
              :placeholder="$t('pub.pleaseSel')"
            >
              <el-option
                :label="$t('pub.unlimitedSel')"
                :value="SelectDefaultValue"
              ></el-option>
              <el-option
                v-for="item in CooperationTypeList"
                :key="item.ID"
                :label="item.Name"
                :value="item.ID"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </div>
        <div class="resource-imginfo">
          <div class="resourcerightTop">
            <!-- <div class="toolOne">
              <span class="fanbili">{{
                $t("restaurant.res_commissionColumn")
              }}</span>
              <div class="RabateDiv clearfix">
                <div class="RebateCount reOne">
                  <div class="leftPnum">
                    {{ $t("admin.admin_personNumber") }}>
                  </div>
                  <input
                    type="text"
                    class="toolInput inpuOne"
                    v-model="addMsg.RebateCount"
                    onkeyup="value=value.replace(/[^\d]/g,'')"
                    maxlength="20"
                  />
                </div>
                <div class="RebateCount reTwo">
                  <div class="fanNum">{{ $t("restaurant.res_return") }}</div>
                  <input
                    type="text"
                    class="toolInput inpuTwo"
                    v-model="addMsg.RebateRatio"
                    onkeyup="value=value.replace(/[^\d]/g,'')"
                    maxlength="20"
                  />
                  <div class="percentCon">%</div>
                </div>
              </div>
            </div> -->

            <div class="toolOne">
              <span class="toolSpan">{{ $t("scen.sc_fdTag") }}</span>
              <div class="footabs">
                <el-tag
                  :key="tag"
                  v-for="tag in tipsList"
                  closable
                  :disable-transitions="false"
                  @close="handleClose(tag)"
                  >{{ tag }}
                </el-tag>
                <el-input
                  class="input-new-tag"
                  v-if="inputVisible"
                  v-model="inputValue"
                  ref="saveTagInput"
                  size="small"
                  @keyup.enter.native="handleInputConfirm"
                  @blur="handleInputConfirm"
                >
                </el-input>
                <el-button
                  v-else
                  class="button-new-tag"
                  size="small"
                  @click="showInput"
                  >+ {{ $t("pub.addBtn") }}
                </el-button>
              </div>
            </div>
            <div class="toolOne">
              <span class="toolSpan">{{ $t("scen.sc_dlTag") }}</span>
              <div class="footabs">
                <el-tag
                  :key="tag"
                  v-for="tag in Geographic"
                  closable
                  :disable-transitions="false"
                  @close="handleClose2(tag)"
                  >{{ tag }}
                </el-tag>
                <el-input
                  class="input-new-tag"
                  v-if="inputVisible2"
                  v-model="inputValue2"
                  ref="saveTagInput"
                  size="small"
                  @keyup.enter.native="handleInputConfirm2"
                  @blur="handleInputConfirm2"
                >
                </el-input>
                <el-button
                  v-else
                  class="button-new-tag"
                  size="small"
                  @click="showInput2"
                  >+ {{ $t("pub.addBtn") }}
                </el-button>
              </div>
            </div>
            <el-form-item :label="$t('restaurant.res_special')">
              <el-input
                type="textarea"
                class="w300"
                v-model="addMsg.Feature"
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('Operation.Op_Warmprompt')" prop="About">
              <el-input
                type="textarea"
                maxlength="1000"
                v-model="addMsg.About"
                class="w300"
              ></el-input>
            </el-form-item>

            <el-form-item
              :label="$t('restaurant.res_bookInformation')"
              prop="BookingInfo"
            >
              <el-input
                type="textarea"
                maxlength="1000"
                v-model="addMsg.BookingInfo"
                class="w300"
              ></el-input>
            </el-form-item>
            <!-- <el-form-item :label="$t('restaurant.res_WhetherToConfirm')">
              <el-switch
                v-model="addMsg.Sure"
                active-value="1"
                inactive-value="0"
              ></el-switch>
            </el-form-item> -->
            <!-- <el-form-item>
              <el-switch
                v-model="isBook"
                active-color="#13ce66"
                inactive-color="#ff4949"
                :active-text="$t('hotel.hotel_Supplier')"
                :inactive-text="$t('ground.ziding')"
              ></el-switch>
            </el-form-item> -->
            <el-form-item>
              <el-switch
                v-model="isRecommend"
                active-color="#13ce66"
                inactive-color="#ff4949"
                :active-text="$t('visaT.Recommend')"
                :inactive-text="$t('ground.butuijian')"
              ></el-switch>
            </el-form-item>
          </div>
          <!-- 推荐菜品 -->
          <span class="resource-lititle" style="margin-top: 20px"
            >推荐菜品
            <el-tooltip
              class="item"
              effect="dark"
              content="添加菜品"
              placement="top-end"
            >
              <el-button
                icon="el-icon-plus"
                circle
                style="margin-left: 10px"
                @click="addFood"
              ></el-button>
            </el-tooltip>
          </span>
          <div class="FoodRecommendList">
            <div
              v-for="(item, index) in addMsg.FoodRecommendList"
              :key="item.id"
              class="FoodRecommendGroup"
            >
              <el-input v-model="item.FoodName" label=""
                ><div slot="prepend" class="FoodName">食物名称</div></el-input
              >
              <el-input type="number" v-model="item.Sort" label=""
                ><div slot="prepend" class="sort">排序</div></el-input
              >
              <el-tooltip
                class="item"
                effect="dark"
                content="删除菜品"
                placement="top-end"
              >
                <el-button
                  type="danger"
                  icon="el-icon-delete"
                  circle
                  size="small"
                  @click="delFood(index)"
                ></el-button>
              </el-tooltip>
            </div>
            <span
              v-if="addMsg.FoodRecommendList.length === 0"
              style="color: #606266"
              >暂无推荐菜品</span
            >
          </div>
          <span class="resource-lititle">{{
            $t("hotel.hotel_imgintroduce")
          }}</span>
          <div class="resource-list">
            <div class="resource-imglist clearfix">
              <div
                class="re-img"
                v-for="(item, index) in DiningImageArray"
                :key="index"
              >
                <img v-if="!item" src="../../assets/img/bg_c3@3x.png" />
                <img :src="item.ShowPath" :onerror="defaultImg" />
                 <div class="imgtag resTypeList">
                  <el-input v-model="item.TagName" 
                    ><div slot="prepend">标签</div></el-input>
                 </div>
                
                
                <div class="imgzhe">
                  <div class="re-delte">
                    <i
                      @click.stop="showImg(item.ShowPath)"
                      class="iconfont icon-img_cz"
                    ></i>
                  </div>
                  <div class="re-delte" @click="delImg(index)">
                    <i class="iconfont icon-xingzhuang"></i>
                  </div>

                  <div
                    class="re-delte"
                    @click.stop="ExchangeImg(index, 0)"
                    v-if="index != 0 && item.ShowPath"
                  >
                    <i class="iconfont icon-zuoyi"></i>
                  </div>
                  <div
                    class="re-delte"
                    @click.stop="ExchangeImg(index, 1)"
                    v-if="index != DiningImageArray.length - 1 && item.ShowPath"
                  >
                    <i class="iconfont icon-youyi"></i>
                  </div>
                  <!-- <el-tooltip class="item" effect="dark" content="添加标签" placement="top">
                    <div
                    class="re-delte"
                    @click.stop="addTag(index)"
                  >
                    <i class="iconfont el-icon-circle-plus"></i>
                  </div>
                  </el-tooltip> -->
                  
                </div>
              </div>
            </div>
            <div class="add-img">
              <div class="reimg-add">
                <i class="iconfont icon-img_haha bigAdd"></i>
                <div class="ad-one">
                  <div class="re-upload">
                    <el-upload
                      :http-request="UploadImage"
                      :multiple="true"
                      accept="image/jpeg,image/gif,image/png,image/bmp"
                      :show-file-list="false"
                      action=""
                    >
                      <i class="iconfont icon-img_bdsc"></i>
                    </el-upload>
                  </div>
                  <div class="re-find" @click="addImgOpen">
                    <i class="iconfont icon-img_cz"></i>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <!-- <div class="add-img">
                 <el-button type="primary" @click="isShowHotelImg=true" icon="el-icon-plus" circle></el-button>
          </div> -->
        </div>
      </el-form>
    </div>
    <el-dialog
      custom-class="resourceImgAdd"
      :title="$t('pub.addImg')"
      center
      :visible.sync="addimg"
    >
      <DMCchooseImg
        @closeImg="closeDMCchooseImg"
        ref="DMCchooseImg1"
        @headCallBack="getDMCimg"
        v-bind:imgType="2"
      ></DMCchooseImg>
    </el-dialog>
    <el-dialog
      custom-class="mapList"
      :title="$t('hotel.hotel_mapLocation')"
      center
      :visible.sync="selectAddress"
    >
      <!-- <googleMap
        @refList="googleMap"
        v-on:headCallBack="headCall"
        v-bind:address="addMsg.Address"
      ></googleMap> -->
       <tencentMap @map-submit="mapEvent" :address="addMsg.Address"></tencentMap>
    </el-dialog>

    <div class="btn-list">
      <span class="common-lefttit"></span>
      <button class="save-Btn" @click="submitForm('addMsg')">
        {{ $t("pub.saveBtn") }}
      </button>
      <button class="cancel-Btn" @click="goUrl('domesticRestaurantList')">
        {{ $t("pub.cancelBtn") }}
      </button>
    </div>
    <viewer
      :images="images"
      :options="imageOptions"
      @inited="inited"
      class="viewer"
      ref="viewer"
    >
      <img v-for="src in images" :src="src" :key="src" />
    </viewer>
    <!-- <el-dialog title="餐厅图片" :visible.sync="isShowHotelImg" width="1240px">
      <comImgList :saveObj="DiningImageArray"></comImgList>
    </el-dialog> -->
    <!-- <el-dialog :visible.sync="showaddTag" width="400px" title="添加图片标签" center>
      <div style="margin-bottom:10px">
        <el-input v-model="tagName"
        ><div slot="prepend">图片标签</div></el-input>
      </div>
      <div slot="footer">
        <el-button size="small" text-type="primary" @click="showaddTag=false">取消</el-button>
        <el-button size="small" type="primary" @click="saveTag">确认</el-button>
      </div>
    </el-dialog> -->
  </div>
</template>
<script>
import DMCchooseImg from "../commonPage/DMCchooseImg.vue";
// import googleMap from "../commonPage/googleMap.vue";
// import comImgList from "../commonPage/comImgList.vue";
import tencentMap from "../commonPage/tencentMap.vue";
export default {
  data() {
    return {
      imageOptions: {
        navbar: false,
        title: false,
      },
      //是否有权限操作支付方式
      IsHaveAuth: 0,
      images: [],
      selectAddress: false,
      addimg: false,
      //图片选取数组
      imglistArry: [],
      imgKeyword: "",

      openplatform: "",
      totalimg: "",
      selecnum: 0,
      ID: "",
      tipsList: [],
      tipsItem: "",
      Geographic: [],
      GeoItem: "",
      value1: "true",
      value2: "false",
      defaultImg: 'this.src="' + require("../../assets/img/bg_z1@2x.png") + '"',
      openplatString: "",
      OpenPlatformStrings: "",
      inputVisible: false,
      inputValue: "",
      inputVisible2: false,
      inputValue2: "",
      isBook: true,
      isRecommend: true,
      //下拉框默认值
      SelectDefaultValue: 0,
      //国家列表
      CountryList: [],
      //省份列表
      ProvinceList: [],
      //城市列表
      CityList: [],
      //区域
      district: [],
      //上传的文件数组
      DiningImageArray: [],
      //删除的图片文件数组
      DeleteImageArray: [],
      inActive: 1, //已选中
      notInActive: 0, //未选中
      DiningTypeList: [],
      DiningPriceTypeList: [],
      CooperationTypeList: [],
      //付款方式
      PayList: [],
      addMsg: {
        ID: 0,
        Name: "",
        URL: "",
        FoodTag: "",
        DiningType: 0,
        DiningPriceType: 0,
        CooperationType: 0,
        GeographicTag: "",
        //   OpeningHours: "",
        OpeningHoursList: [
          { StartTime: "", EndTime: "",BusinessStartWeek:0,BusinessEndWeek:0 },
        ],
        Tel: "",
        ParkInfo: "",
        Feature: "",
        About: "",
        BookingInfo: "",
        RealName: "",
        Sure: "",
        RebateCount: "",
        RebateRatio: "",
        OpenPlatform: "",
        SupportCount: "0",
        DieLine: "",
        QCountry: "",
        QProvince: "",
        QCity: "",
        District: 5572,
        Address: "",
        Lng: "",
        Lat: "",
        PicPath: "",
        IsSelfBook: "",
        Fax: "",
        Country: 2,
        Province: 261,
        City: 5571,
        DiningImageList: [], //现在的图片
        DeleteImageList: [], //要删除的图片
        IsRecommend: 0, //是否推荐 0:否,1:是
        //是否预约
        AppointmentStyle: 0,
        //支付方式
        PayStyle: 0,
        FoodType: 0, //美食分类
        FoodRecommendList: [{ FoodName: "", Sort: 0 }], //推荐菜品
        IsShelves:0,
      },
      rules: {
        //表单必填验证
        Name: [
          {
            required: true,
            message: this.$t("ground.qingtianxiemc"),
            trigger: "change",
          },
        ],
        RealName: [
          {
            required: true,
            message: this.$t("ground.qingtxzsxm"),
            trigger: "change",
          },
        ],
        Address: [
          {
            required: true,
            message: this.$t("ground.qingxuanzedz"),
            trigger: "change",
          },
        ],
        Descriptions: [
          {
            required: true,
            message: this.$t("ground.qingshuruwzms"),
            trigger: "change",
          },
        ],

        DieLine: [
          {
            pattern: this.$commonUtils.Regex.el_isInteger,
            message: this.$t("ground.qingshuruzqdsz"),
          },
        ],
        RebateCount: [
          {
            pattern: this.$commonUtils.Regex.el_isInteger,
            message: this.$t("ground.qingshuruzqdsz"),
          },
        ],
        RebateRatio: [
          {
            pattern: this.$commonUtils.Regex.el_isInteger,
            message: this.$t("ground.qingshuruzqdsz"),
          },
        ],
        SupportCount: [
          {
            required: true,
            message: this.$t("ground.qingtxkydrs"),
            trigger: "change",
          },
        ],
        FoodType: [
          {
            required: true,
            message: '请选择分类',
            trigger: "change",
          },
        ],
      },
      FoodTypeList: [],
      weekEnumList: [], //周一到周日枚举
      startDay: "", //开始日
      endDay: "", //结束日
      showaddTag:false,
      tagName:"",
      tagIndex:0,
      FoodTypeProps:{
          label:'Name',
          value:"ID",
          lazy: true,
          lazyLoad (node, resolve) {
            const { level } = node;
            setTimeout(() => {
              const nodes = Array.from({ length: level + 1 })
                .map(item => ({
                  value: ++id,
                  label: `选项${id}`,
                  leaf: level >= 2
                }));

              resolve(nodes);
            }, 1000);
          }
        }
    };
  },
  components: {
    // googleMap: googleMap,
    DMCchooseImg: DMCchooseImg,
    // comImgList,
    tencentMap
  },
  methods: {
      //得到地图信息
      mapEvent(e) {
        this.addMsg.Lat = e.lat;
        this.addMsg.Lng = e.long;
        this.selectAddress = false;
      },
    //上传餐厅图片
    UploadImage(file) {
      let newArr = [];
      newArr.push(file.file);
      let fileName = file.file.name;
      var path = "/Upload/DMC/";
      this.UploadSelfFileT(path, newArr, (x) => {
        //统一图片处理
        var obj = this.$DMCUtils.DMCImageObj();
        var str = x.data.FilePath;
        var imgUrl = this.domainManager().ViittoFileUrl + x.data.FilePath;
        obj.Path = str;
        obj.ShowPath = imgUrl;
        obj.TagName="";
        this.DiningImageArray.push(obj);
      });
    },
    //更新餐厅图片
    updatePic() {
      if (this.ID > 0) {
        var postMsg = {
          ID: this.ID,
          HotelImageList: this.HotelImageArray, //新增修改
          DeleteImageList: this.DeleteImageArray, //删除的图片
        };
        this.apipost("dining_Post_UpateDinnerPic", postMsg, (res) => {}, null);
      }
    },
    //删除图片
    delImg(index) {
      //更新图片
      var item = this.DiningImageArray[index];
      this.DeleteImageArray.push(item);
      this.DiningImageArray.splice(index, 1);
      //this.updatePic();
    },
    addImgOpen() {
      this.addimg = true;
      this.initimgList();
    },
    inited(viewer) {
      this.$viewer = viewer;
    },
    showImg: function (src) {
      let srcArr = src.split("?");
      src = srcArr[0];
      let isExsit = false;
      this.images.forEach((x) => {
        if (x === src) isExsit = true;
      });
      if (!isExsit) {
        this.images.push(src);
      } else {
        this.$viewer.view(this.images.indexOf(src));
      }
      this.$viewer.show();
    },
    saveResource() {
      //保存餐厅信息
      if (this.isBook) {
        this.addMsg.IsSelfBook = 1;
      } else {
        this.addMsg.IsSelfBook = 0;
      }
      if (this.isRecommend) {
        this.addMsg.IsRecommend = 1;
      } else {
        this.addMsg.IsRecommend = 0;
      }
      this.addMsg.OpenPlatform = this.openplatString.toString();
      if (this.ID != "undefined") {
        this.addMsg.ID = this.ID;
      }
      let picPathArr = [];
      this.DiningImageArray.forEach((x) => {
        picPathArr.push(x.Path);
      });
      this.addMsg.PicPath = picPathArr.join(",");
      this.addMsg.FoodTag = this.tipsList.join(",");
      this.addMsg.GeographicTag = this.Geographic.join(",");
      this.addMsg.DiningImageList = this.DiningImageArray;
      this.addMsg.DeleteImageList = this.DeleteImageArray;
      if(this.startDay==""){
        this.startDay=0
      }
      if(this.endDay==""){
        this.endDay=0
      }
      this.addMsg.BusinessWeek=this.startDay+'-'+this.endDay;
      this.apipost(
        "appletsdining_post_AppletsSet",
        this.addMsg,
        (res) => {
          //修改添加接口
          if (res.data.resultCode == 1) {
            this.tips(this.$t("tips.baocunchenggong"), "success");
            this.goUrl("domesticRestaurantList");
          } else {
            this.tips(res.data.message, "error");
          }
        },
        null
      );
    },
    init() {
      var msg = {};
      this.apipost("hotel_post_GetPlatform", msg, (res) => {
        //获取开放平台
        this.openplatform = res.data.data;
      });
    },
    initimgList() {
      //初始化弹窗图片列表
      var keyWord = this.imgKeyword;
      this.imglistArry = [];
      let msg = {
        Name: keyWord,
        Type: 4,
      };
      this.apipost(
        "hotel_post_GetPicList",
        msg,
        (res) => {
          if (res.data.resultCode == 1) {
            this.imglistArry = res.data.data;
            this.totalimg = this.imglistArry.length;
          }
        },
        null
      );
    },
    selectImg(index) {
      //选取弹窗图片
      this.imglistArry[index].isShow = !this.imglistArry[index].isShow;
      let num = 0;
      this.imglistArry.forEach((x) => {
        if (x.isShow == true) {
          num++;
        }
        this.selecnum = num;
      });
    },
    initHotelData() {
      //获取信息
      var msg = {
        ID: this.ID,
      };
      this.apipost(
        "appletsdining_post_Get",
        msg,
        (res) => {
          if (res.data.resultCode == 1) {
            this.addMsg = res.data.data;
            this.addMsg.FoodType=parseInt(res.data.data.FoodType)
            if (this.addMsg.OpeningHoursList.length === 0) {
              let obj={
                StartTime: "",
                EndTime: "",
                BusinessStartWeek:0,
                BusinessEndWeek:0
              }
              this.addMsg.OpeningHoursList.push(obj)
            }
            // if (this.addMsg.Country > 0) {
            //   this.GetSubAreaList(this.addMsg.Country, 1);
            // }
            if (this.addMsg.Province > 0) {
              this.GetSubAreaList(this.addMsg.Province, 2);
            }
            if (this.addMsg.City > 0) {
              this.GetSubAreaList(this.addMsg.City, 3);
            }
            if (this.addMsg.OpenPlatform != null) {
              if (this.addMsg.OpenPlatform != "") {
                this.OpenPlatformStrings = this.addMsg.OpenPlatform.split(",");
                this.OpenPlatformStrings.forEach((x) => {
                  this.openplatString.push(Number(x));
                });
              }
            }
            if (res.data.data.FoodTag != "") {
              this.tipsList = res.data.data.FoodTag.split(",");
            }
            if (res.data.data.GeographicTag != "") {
              this.Geographic = res.data.data.GeographicTag.split(",");
            }
            this.addMsg.Sure = res.data.data.Sure.toString();
            this.isBook = this.addMsg.IsSelfBook;
            this.isRecommend = this.addMsg.IsRecommend;
            res.data.data.DiningPicList.forEach((x) => {
              if (x != "") {
                var obj = this.$DMCUtils.DMCImageObj();
                obj.ID = x.ID;
                obj.Path = x.Path;
                obj.PicID = x.Pic;
                obj.ShowPath =
                  this.domainManager().ViittoFileUrl +
                  x.Path +
                  "?x-oss-process=image/resize,l_140";
                obj.TagName=x.TagName
                this.DiningImageArray.push(obj);
              }
            });
          } else {
            this.tips(res.data.message, "error");
          }
          this.startDay=parseInt(res.data.data.BusinessWeek.slice(0,1))
          this.endDay=parseInt(res.data.data.BusinessWeek.slice(-1))
        },
        null
      );
    },
    goUrl(path) {
      this.$router.push({
        path: path,
        // query: {
        //   cache: this.$route.query.cache,
        // },
      });
    },
    closeDMCchooseImg() {
      this.addimg = false;
    },
    submitForm(addMsg) {
      //提交创建、修改表单
      let that = this;
      that.$refs[addMsg].validate((valid) => {
        if (valid) {
          that.saveResource();
        } else {
          return false;
        }
      });
    },
    checkImgList() {
      this.imglistArry.forEach((x) => {
        if (x.isShow == true) {
          this.imgArray.push(x.Path);
          let arr = x.Path.split(".com");
          this.PicPathArray.push(arr[1]);
        }
        x.isShow = false;
        this.selecnum = 0;
      });
      this.addimg = false;
    },
    resetImg() {
      this.imglistArry.forEach((x) => {
        if (x.isShow == true) {
          x.isShow = false;
        }
        this.selecnum = 0;
      });
    },
    tips(msg, type) {
      this.$message({
        message: msg,
        duration: 2000,
        type: type,
      });
    },
    getItemList(type) {
      if (type == 1) {
        this.tipsList.push(this.tipsItem);
        this.tipsItem = "";
      } else {
        this.Geographic.push(this.GeoItem);
        this.GeoItem = "";
      }
    },
    handleClose(tag) {
      this.tipsList.splice(this.tipsList.indexOf(tag), 1);
    },

    showInput() {
      this.inputVisible = true;
      this.$nextTick((_) => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        this.tipsList.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = "";
    },
    handleClose2(tag) {
      this.Geographic.splice(this.Geographic.indexOf(tag), 1);
    },

    showInput2() {
      this.inputVisible2 = true;
      this.$nextTick((_) => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm2() {
      let inputValue = this.inputValue2;
      if (inputValue) {
        this.Geographic.push(inputValue);
      }
      this.inputVisible2 = false;
      this.inputValue2 = "";
    },
    googleMap() {
      this.selectAddress = false;
    },
    headCall(msg) {
      this.addMsg.Lng = msg.lng;
      this.addMsg.Lat = msg.lat;
    },
    //获取国家
    // GetCounrty() {
    //   this.apipost(
    //     "dict_post_Destination_GetCountry",
    //     {},
    //     (res) => {
    //       this.CountryList = res.data.data;
    //     },
    //     (err) => {}
    //   );
    // },
    //获取省份和城市
    GetSubAreaList(ID, type) {
      let msg = {
        Id: ID,
      };
      // if (this.addMsg.Country != 0) {
        this.apipost(
          "dict_post_Destination_GetChildList",
          msg,
          (res) => {
            if (type == 1) {
              this.ProvinceList = res.data.data;
              this.CityList = [];
              this.district = [];
            } else if (type == 2) {
              this.CityList = res.data.data;
              this.district = [];
            } else if (type == 3) {
              this.district = res.data.data;
            }
          },
          (err) => {}
        );
      // }
    },
    getDMCimg(imgArr) {
      imgArr.forEach((imgItem) => {
        var obj = this.$DMCUtils.DMCImageObj();
        obj.ID = 0;
        obj.Path = "/" + this.$commonUtils.removeDomain(imgItem.Path);
        obj.PicID = imgItem.ID;
        obj.ShowPath = imgItem.Path + "?x-oss-process=image/resize,l_140";
        this.DiningImageArray.push(obj);
      });
    },
    //获取支付方式列表
    GetPayList() {
      this.apipost(
        "dmc_post_Get_GetPayStyleList",
        {},
        (res) => {
          if (res.data.resultCode == 1) {
            this.PayList = res.data.data;
          }
        },
        (err) => {}
      );
    },
    //获取餐厅类型列表
    GetDiningTypeList() {
      this.apipost(
        "dining_get_GetDiningType",
        {},
        (res) => {
          if (res.data.resultCode == 1) {
            this.DiningTypeList = res.data.data;
          }
        },
        (err) => {}
      );
    },
    //获取餐厅价格列表
    GetDiningPriceTypeList() {
      this.apipost(
        "dining_get_GetDiningPriceType",
        {},
        (res) => {
          if (res.data.resultCode == 1) {
            this.DiningPriceTypeList = res.data.data;
          }
        },
        (err) => {}
      );
    },
    //获取合作方式列表
    GetCooperationTypeList() {
      this.apipost(
        "dining_get_GetCooperationType",
        {},
        (res) => {
          if (res.data.resultCode == 1) {
            this.CooperationTypeList = res.data.data;
          }
        },
        (err) => {}
      );
    },
    //图片左移右移
    ExchangeImg(index, IsMove) {
      var imgItem = this.DiningImageArray[index];
      //左移
      if (IsMove == 0) {
        var upItem = this.DiningImageArray[index - 1];
        this.$set(this.DiningImageArray, index - 1, imgItem);
        this.$set(this.DiningImageArray, index, upItem);
      } else {
        //右移动
        var downItem = this.DiningImageArray[index + 1];
        this.$set(this.DiningImageArray, index + 1, imgItem);
        this.$set(this.DiningImageArray, index, downItem);
      }
    },
    getArea() {
      this.$forceUpdate();
    },
    //获取美食下拉列表
    getFoodTypeList(id) {
      this.apipost(
        "foodtype_post_GetDropDownFoodType",
        { ParentID: id,ClassType:0 },
        (res) => {
          if (res.data.resultCode == 1) {
            let newData= this.getTreeData(res.data.data,'ChildrenList')
            this.FoodTypeList = newData;
          }
        },
        (err) => {}
      );
    },
     //递归景区类型列表级联菜单
      getTreeData(data,childrenField){
                // 循环遍历json数据
                for(var i=0;i<data.length;i++){
                    if(data[i][childrenField]===undefined||data[i][childrenField].length===0){
                        // children若为空数组，则将children设为undefined
                        data[i][childrenField]=undefined;
                    }else {
                        // children若不为空数组，则继续 递归调用 本方法
                        this.getTreeData(data[i][childrenField],childrenField);
                    }
                }
                return data;
      },
    //添加推荐菜品
    addFood() {
      let obj = {
        FoodName: "",
        Sort: 0,
      };
      this.addMsg.FoodRecommendList.push(obj);
    },
    //删除推荐菜品
    delFood(index) {
      this.addMsg.FoodRecommendList.splice(index, 1);
    },
    //获取周长枚举
    getweekenum() {
      this.apipost(
        "appletsdining_Post_GetBusinessWeekEnumType",
        {},
        (res) => {
          if (res.data.resultCode == 1) {
            this.weekEnumList = res.data.data;
          }
        },
        (err) => {}
      );
    },
    //新增营业时间
    addOpenTime(){
         let obj={
            StartTime:"",
            EndTime:"",
            BusinessStartWeek:0,
            BusinessEndWeek:0
        }
        this.addMsg.OpeningHoursList.push(obj);
    },
    //删除营业时间
    delOpenTime(index){
        this.addMsg.OpeningHoursList.splice(index,1);
    },
  },
  mounted() {
    let userInfo = this.getLocalStorage();
    //有权限操作的部门
    if (
      userInfo.RB_Department_Id == 240 ||
      userInfo.RB_Department_Id == 1 ||
      userInfo.RB_Department_Id == 3 ||
      userInfo.RB_Branch_id == 49
    ) {
      this.IsHaveAuth = 1;
    }
    this.GetPayList();
    this.GetDiningTypeList();
    this.GetDiningPriceTypeList();
    this.GetCooperationTypeList();
    this.qMsg = this.$route.query.qMsg;
    this.ID = this.$route.query.id;
    this.init(); //开放平台
    // this.GetCounrty();
    if (typeof this.ID != "undefined") {
      this.initHotelData();
    }
    this.getFoodTypeList(0);
    this.getweekenum();
    this.GetSubAreaList(2,1)
     if(this.addMsg.Province>0){
        this.GetSubAreaList(this.addMsg.Province, 2, 1);
      }
      if(this.addMsg.City>0){
        this.GetSubAreaList(this.addMsg.City, 3, 1);
      }
  },
};
</script>
