<style>
  .packagePrice .resource-content {
    min-width: 1200px;
    margin-top: 30px;
    font-size: 12px;
  }

  .packagePrice .resource-content>div {
    display: inline-block;
  }

  .packagePrice .resource-baseinfo {
    float: left;
    height: auto;
    width: 550px;
    margin-left: 30px;
  }

  .packagePrice .resource-imginfo {
    float: left;
    width: 550px;
    margin-top: 60px;
  }

  .packagePrice .resource-imginfo>div {
    margin-bottom: 20px;
  }

  .packagePrice .resource-lititle {
    display: block;
    border-left: 4px solid #e95252;
    padding-left: 10px;
  }

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

  .packagePrice .resource-baseinfo>div {
    margin-top: 60px;
  }

  .packagePrice .priceDate {
    width: 500px;
    background-color: #fff;
    border: 1px solid #d1d1d1;
  }

  .packagePrice .noticeInfo div {
    margin-bottom: 10px;
    margin: 0 120px 10px 80px;
  }

  .packagePrice .subPrice {
    margin: 0 20px 0 70px;
  }

  .packagePrice .inventoryCommon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
  }

  .packagePrice .price-manage {
    margin: 20px 0 25px 0;
  }

  .packagePrice .day {
    width: 1000px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
  }

  .packagePrice .yearSelect,
  .monthSelect {
    float: left;
    width: 168px;
    height: 30px;
  }

  .packagePrice .priceDate td.checked>label {
    border-color: red;
    line-height: 28px;
    box-sizing: border-box;
    border-radius: 15px;
  }

  .packagePrice .triangle_border_up {
    width: 0;
    height: 0;
    border-width: 0 123px 30px;
    border-style: solid;
    opacity: 0.75;
    border-color: transparent transparent rgba(233, 82, 82, 1);
    /*透明 透明  灰*/
  }

  .packagePrice #calendar {
    width: 500px;
    height: 400px;
    margin: 0 auto;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 3px 1px -2px rgba(0, 0, 0, 0.1),
      0 1px 5px 0 rgba(0, 0, 0, 0.12);
  }

  .packagePrice .month ul {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
  }

  .packagePrice .year-month {
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
  }

  .packagePrice .year-month>input {
    width: 100px;
    float: left;
  }

  .packagePrice .arrow {
    padding: 10px;
    font-style: normal;
    cursor: pointer;
  }

  .packagePrice .monthminus {
    position: absolute;
    left: 15px;
    top: 15px;
  }

  .packagePrice .monthadd {
    position: absolute;
    right: 21px;
    top: 16px;
  }

  .packagePrice .month ul li {
    font-size: 12px;
    position: relative;
    text-transform: uppercase;
    float: left;
    letter-spacing: 3px;
  }

  .packagePrice .month ul li>input {
    padding-left: 10px;
    text-align: center;
    margin: 20px 10px 20px;
  }

  .packagePrice .weekdays {
    margin: 0;
    padding: 10px 0;
    background-color: #f9f9f9;
    display: flex;
    flex-wrap: wrap;
    color: #999999;
    justify-content: space-around;
  }

  .packagePrice .weekdays li {
    display: inline-block;
    width: 13.6%;
    text-align: center;
  }

  .packagePrice .days {
    width: 500px;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
  }

  .packagePrice .days li {
    list-style-type: none;
    display: inline-block;
    width: 14.2%;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
    padding-top: 10px;
    font-size: 1rem;
    color: #000;
  }

  .packagePrice .spanCheck {
    cursor: pointer;
  }

  .packagePrice .days li .active {
    padding: 6px 10px;
    border-radius: 50%;
    background: #00b8ec;
    color: #fff;
  }

  .packagePrice .days li span {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 1px solid #fff;
    border-radius: 17px;
    line-height: 30px;
  }

  .packagePrice .days li .other-month {
    padding: 5px;
    display: inline-block;
    width: auto;
    height: 30px;
    line-height: 20px;
    color: gainsboro;
  }

  .packagePrice .checked span {
    border-color: green !important;
  }

  .packagePrice .currentInput {
    width: 120px;
    height: 30px;
    border-radius: 17px;
    outline: none;
    border: none;
    margin-top: 20px;
    border: 1px solid #dcdfe6;
  }

  .packagePrice .detailInfo {
    display: none;
    position: absolute;
    left: -85px;
    top: 50px;
    z-index: 999;
  }

  .packagePrice .packagePrice {
    min-width: 1200px;
  }

  .packagePrice .popContent {
    width: 245px;
    height: 145px;
    background-color: #e95252;
    text-align: left;
    color: #fff;
    font-size: 12px;
  }

  .packagePrice .popContent div {
    width: 100%;
  }

  .packagePrice .popList label:first-child {
    display: inline-block;
    width: 40%;
    margin: 10px 0 0 10px;
    text-align: left;
  }

  .packagePrice .popList label:last-child {
    display: inline-block;
    width: 40%;
    margin: 10px 10px 0 0;
    text-align: right;
  }

  .packagePrice .class-a {
    background-color: #e95252;
    color: #fff;
  }

  .packagePrice .delButton {
    position: relative;
    top: -50px;
    background-color: #1bc594;
    color: #fff;
  }

  .packagePrice .el-form-item {
    display: inline-block;
  }

  .packagePrice .el-form-item__label {
    width: 80px;
  }

  .packagePrice .resDiv {
    width: 700px;
  }

  .packagePrice .el-textarea__inner {
    resize: none;
    font-family: "微软雅黑";
  }

  .packagePrice input::-webkit-outer-spin-button,
  .packagePrice input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
  }

  .packagePrice .el-form-item__error {
    left: 80px;
  }

  .packagePrice .s {
    display: block !important;
  }

  .packagePrice .el-form-item__content {
    width: 315px;
  }

  .packagePrice .RemarkDiv .el-form-item__content {
    width: 400px;
  }

  .packagePrice .class-a {
    background-color: #e95252;
    color: #fff;
  }

  .packagePrice .ckAll {
    margin: 25px 20px 0 0;
  }

  .HT_supplier {
    margin: 10px 0 10px 10px;
  }

</style>
<template>
  <div class="flexOne packagePrice">
    <div class="resource-content clearfix">
      <div class="resource-baseinfo">
        <div>
          <div class="priceDate" id="DayAll">
            <div class="month">
              <ul>
                <li>
                  <i class="arrow monthminus" @click="currentYear-=1,getDateString(),initCalendar(dateString)">❮</i>
                  <input type="text" v-model="currentYear" class="currentInput"
                    @input="getDateString(),initCalendar(dateString)" />{{$t('pub.year')}}
                  <i class="arrow monthadd" @click="currentYear+=1,getDateString(),initCalendar(dateString)">❯</i>
                </li>
                <li>
                  <i class="arrow monthminus" @click="pickPre(currentYear,currentMonth)">❮</i>
                  <input type="text" v-model="currentMonth" class="currentInput"
                    @input="getDateString(),initCalendar(dateString)" />{{$t('pub.month')}}
                  <i class="arrow monthadd" @click="pickNext(currentYear,currentMonth)">❯</i>
                </li>
                <li>
                  <div class="ckAll">
                    <el-checkbox class="checkBox" v-model='isCheckAll' @change="checkAll">{{$t('system.table_chekAll')}}
                    </el-checkbox>
                  </div>
                </li>
              </ul>
            </div>
            <!-- 星期 -->
            <ul class="weekdays">
              <li>{{$t('hotel.hotel_Monday')}}</li>
              <li>{{$t('hotel.hotel_Tuesday')}}</li>
              <li>{{$t('hotel.hotel_Wednesday')}}</li>
              <li>{{$t('hotel.hotel_Thursday')}}</li>
              <li>{{$t('hotel.hotel_Friday')}}</li>
              <li>{{$t('hotel.hotel_Saturday')}}</li>
              <li>{{$t('hotel.hotel_Sunday')}}</li>
            </ul>
            <!-- 日期 -->
            <ul class="days">
              <li class="liList" :class="{'checked':dayobject.checkState==$calendarUtils.checkState.checked}"
                v-for="(dayobject,index) in days" :key="dayobject.subCode" @mouseover="disBoard(dayobject,index)"
                @mouseout="disNoneBoard()">
                <span v-if="dayobject.day.getMonth()+1 != currentMonth"
                  class="other-month">{{ dayobject.day.getDate()}}</span>
                <span class="spanCheck" @click="clickedDay(dayobject)"
                  v-else-if="updateDay==-1 || dayobject.day.getDate()==updateDay" :class="dayobject.class">
                  {{dayobject.day.getDate()}}
                </span>
                <span class="other-month" v-else>
                  {{dayobject.day.getDate()}}
                </span>
                <div class="detailInfo" :class="{s:index==num}">
                  <div class="triangle_border_up"></div>
                  <div class="popContent">
                    <div class="popList">
                      <label>{{$t('hotel.hotel_cost')}}：{{dayobject.CostPrice}}</label>
                      <label>{{$t('hotel.hotel_B2BPrice')}}：{{dayobject.B2BPrice}}</label>
                    </div>
                    <div class="popList">
                      <label>{{$t('hotel.hotel_SalesPrice')}}：{{dayobject.SalesPrice}}</label>
                      <label>{{$t('hotel.hotel_B2CPrice')}}：{{dayobject.B2CPrice}}</label>
                    </div>
                    <div class="popList">
                      <label>{{$t('scen.sc_dj')}}：{{dayobject.MinPrice}}</label>
                      <label>{{$t('scen.sc_gj')}}：{{dayobject.MaxPrice}}</label>
                    </div>
                    <div class="HT_supplier" v-if="IsSelfBook">
                      <label>{{$t('hotel.hotel_Supplier')}}：{{dayobject.SupplierName}}</label>
                    </div>
                  </div>
                  <input type="button" class="hollowFixedBtn delButton" @click="isdelete(dayobject.ID)"
                    :value="$t('system.table_delete')" />
                  <button class="hollowFixedBtn delButton"
                    @click="updateInfo(dayobject.ID,dayobject.date,index)">{{$t('system.table_edit')}}
                  </button>
                </div>
              </li>
            </ul>
          </div>
        </div>
      </div>
      <div class="resource-imginfo">
        <el-form :model="addMsg" :rules="rules" ref="addMsg">
          <div class="resDiv" style="margin:0 0 20px 42px">
            <span>
              <em style="margin-right:10px;">{{$t('pub.date')}}</em>
              <el-date-picker class="w150" v-model='addMsg.StartDate' type="date"
                :picker-options="pickerBeginDateBefore" value-format="yyyy-MM-dd" placeholder="">
              </el-date-picker>
              <el-date-picker class="w150" v-model='addMsg.EndDate' type="date" value-format="yyyy-MM-dd"
                :picker-options="pickerBeginDateAfter" placeholder="">
              </el-date-picker>
            </span>
          </div>
          <div class="resDiv">
            <!--prop="CostPrice"-->
            <el-form-item :label="$t('hotel.hotel_CostPrice')">
              <el-input type="text" class="w210" v-model="addMsg.CostPrice"
                @keyup.native="checkPrice(addMsg,'CostPrice')"></el-input>
            </el-form-item>
            <el-form-item :label="$t('hotel.hotel_SalesPrice')">
              <el-input type="text" class="w210" v-model="addMsg.SalesPrice"
                @keyup.native="checkPrice(addMsg,'SalesPrice')"></el-input>
            </el-form-item>
          </div>
          <div class="resDiv">
            <el-form-item :label="$t('scen.sc_dj')">
              <el-input type="text" class="w210" v-model="addMsg.MinPrice"
                @keyup.native="checkPrice(addMsg,'MinPrice')"></el-input>
            </el-form-item>
            <el-form-item :label="$t('scen.sc_gj')">
              <el-input type="text" class="w210" v-model="addMsg.MaxPrice"
                @keyup.native="checkPrice(addMsg,'MaxPrice')"></el-input>
            </el-form-item>
          </div>
          <div class="resDiv">
            <el-form-item :label="$t('hotel.hotel_B2BPrice')">
              <el-input type="text" class="w210" v-model="addMsg.B2BPrice"
                @keyup.native="checkPrice(addMsg,'B2BPrice')"></el-input>
            </el-form-item>
            <el-form-item :label="$t('hotel.hotel_B2CPrice')">
              <el-input type="text" class="w210" v-model="addMsg.B2CPrice"
                @keyup.native="checkPrice(addMsg,'B2CPrice')"></el-input>
            </el-form-item>
          </div>

          <div class="resDiv">
            <el-form-item :label="$t('hotel.hotel_Currency')">
              <el-select :placeholder="$t('objFill.qingxuanzhebz')" filterable class='multiple_input w210'
                @change="getCurrentRate(addMsg.CurrencyId)" v-model="addMsg.CurrencyId">
                <el-option :label="$t('pub.unlimitedSel')" :value='SelectDefaultValue'></el-option>
                <el-option v-for="item in allCurrencyList" :key="item.ID" :label="item.Name" :value="item.ID">
                </el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label="$t('hotel.hotel_CurrentRate')" prop="Fax">
              <el-input class="w210" v-model='addMsg.CurrentRate' @keyup.native="checkRate(addMsg,'CurrentRate')">
              </el-input>
            </el-form-item>
          </div>
          <div class="resDiv">
            <el-form-item :label="$t('hotel.hotel_Supplier')" v-if="IsSelfBook">
              <el-select v-model="addMsg.Supplier" class="w210" filterable :placeholder="$t('hotel.hotel_inputholder')">
                <el-option :label='$t("hotel.hotel_inputholder")' :value='defaultSelect'></el-option>
                <el-option v-for="item in SupplierList" :key="item.ID" :label="item.Name" :value="item.ID"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div class="resDiv RemarkDiv">
            <el-form-item :label="$t('hotel.hotel_remark')" prop="Remark">
              <el-input type="textarea" class="w300" v-model="addMsg.Remark"></el-input>
            </el-form-item>
          </div>
        </el-form>
        <div class="noticeInfo">
          <div>{{$t('hotel.hotel_attention')}}：</div>
          <!-- <div>1.{{$t('ground.meicznclygysj')}}。</div> -->
          <div>1.{{$t('ground.tjsjfgyq')}}</div>
        </div>
        <button type="success" class="subPrice" :class="{'comDisableBtn':isDisable==true,'normalBtn':isDisable==false}"
          :disabled='isDisable' @click="submitForm('addMsg')">{{comBtnText}}
        </button>
        <button type="success" class="hollowFixedBtn" @click="goBack"
          v-if="updateDay=='-1'">{{$t('pub.returnBack')}}</button>
        <button type="success" class="hollowFixedBtn" @click="resetForm('addMsg')"
          v-else>{{$t('pub.cancelBtn')}}</button>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      var SupperValidate = (rule, value, callback) => {
        if (value === 0) {
          let tips = this.$t('ground.qingxuanzegys')
          callback(new Error(tips));
        } else {
          callback();
        }
      };
      return {
        SupplierList: "",
        serviceNum: "",
        yearInput: "", //输入框年
        monthInput: "", //输入框月
        DiningId: "",
        DateList: [],
        DateArr: [],
        currentDay: 1,
        currentMonth: 1,
        currentYear: 1970,
        currentWeek: 1,
        days: [],
        nowDate: "",
        isCheckAll: false,
        IsSelfBook: "",
        //提交报价中
        comBtnText: this.$t('ground.tijiaobaojia'),
        isDisable: false,
        dateString: "2016-01-02",
        num: -1,
        Did: "",
        Mid: "",
        defaultSelect: 0,
        updateDay: -1,
        //下拉框默认值
        SelectDefaultValue: 0,
        allCurrencyList: [], //所有币种
        addMsg: {
          ID: 0,
          DiningId: "",
          MealId: "",
          Supplier: 0,
          CostPrice: "",
          B2BPrice: "",
          B2CPrice: "",
          SalesPrice: "",
          DateList: "",
          Remark: "",
          CurrencyId: 0,
          CurrentRate: 0,
          StartDate: '',
          EndDate: '',
          MinPrice: 0,
          MaxPrice: 0,
        },
        rules: {
          //表单必填验证
          CostPrice: [{
              required: true,
              message: this.$t('ground.qingshurcbj'),
              trigger: "change"
            },
            {
              pattern: this.$commonUtils.Regex.el_Isdecimal,
              message: this.$t('ground.qingshurlwxs')
            }
          ],
          B2BPrice: [{
              required: true,
              message: this.$t('ground.qingshurnbjg'),
              trigger: "change"
            },
            {
              pattern: this.$commonUtils.Regex.el_Isdecimal,
              message: this.$t('ground.qingshurlwxs')
            }
          ],
          B2CPrice: [{
              required: true,
              message: `${this.$t('pub.pleaseImport')}B2B${this.$t('objFill.jiage')}`,
              trigger: "change"
            },
            {
              pattern: this.$commonUtils.Regex.el_Isdecimal,
              message: this.$t('ground.qingshurlwxs')
            }
          ],
          SalesPrice: [{
              required: true,
              message: this.$t('ground.qingshuruB2Bjg'),
              trigger: "change"
            },
            {
              pattern: this.$commonUtils.Regex.el_Isdecimal,
              message: this.$t('ground.qingshurlwxs')
            }
          ],
          Supplier: [{
            required: this.IsSelfBook,
            validator: SupperValidate,
            trigger: "change"
          }]
        },
        pickerBeginDateBefore: {
          disabledDate: time => {
            let endTime = new Date(this.addMsg.EndDate);
            return endTime.getTime() < time.getTime();
          }
        },
        pickerBeginDateAfter: {
          disabledDate: time => {
            let startTime = new Date(this.addMsg.StartDate);
            return startTime.getTime() >= time.getTime();
          }
        }
      };
    },
    created: function () {},
    methods: {
      initDataTable() {
        //初始化列表数据
        let msg = {
          DiningId: this.Did,
          MealId: this.Mid,
          Date: this.nowDate
        };
        this.apipost(
          "price_post_GetList",
          msg,
          res => {
            if (res.data.resultCode == 1) {
              var tableinfo = res.data.data;
              this.days.forEach(dayItem => {
                var d = dayItem.day;
                var myDate = this.$calendarUtils.formatDate(
                  d.getFullYear(),
                  d.getMonth() + 1,
                  d.getDate()
                );
                for (var j = 0; j < tableinfo.length; j++) {
                  if (tableinfo[j].Date == myDate) {
                    dayItem.CostPrice = tableinfo[j].CostPrice;
                    dayItem.B2BPrice = tableinfo[j].B2BPrice;
                    dayItem.B2CPrice = tableinfo[j].B2CPrice;
                    dayItem.SalesPrice = tableinfo[j].SalesPrice;
                    dayItem.MinPrice = tableinfo[j].MinPrice;
                    dayItem.MaxPrice = tableinfo[j].MaxPrice;
                    dayItem.checkState = this.$calendarUtils.checkState.hasValue;
                    dayItem.SupplierName = tableinfo[j].SupplierName;
                    dayItem.ID = tableinfo[j].ID;
                    dayItem.class = "class-a";
                    dayItem.date = tableinfo[j].Date;
                  }
                }
              });
            }
          },
          null
        );
      },
      initSupplier() {
        let msg = {
          Type: 2
        };
        this.apipost(
          "supplier_post_GetAllList",
          msg,
          response => {
            if (response.data.resultCode == 1) {
              this.SupplierList = response.data.data;
            }
          },
          null
        );
      },
      hotelOfferSet() {
        //提交酒店报价
        this.addMsg.DateList = this.DateArr;
        this.addMsg.DiningId = this.Did;
        this.addMsg.MealId = this.Mid;
        if (this.addMsg.DateList == "" && (this.addMsg.StartDate == "" || this.addMsg.EndDate == "")) {
          this.Error(this.$t('ground.qingxuanzeriq'));
          return;
        }
        this.isDisable = true;
        this.comBtnText = this.$t('ground.zhengzaitijiao');
        this.apipost(
          "price_post_Set",
          this.addMsg,
          res => {
            this.isDisable = false;
            this.comBtnText = this.$t('ground.tijiaobaojia')
            if (res.data.resultCode == 1) {
              this.initDataTable();
              this.addMsg = {};
              this.Success(this.$t('tips.saveYes'));
              this.DateArr.length = 0;
              this.addMsg.ID = 0;
              this.resetForm("addMsg");
            } else {
              this.Error(res.data.message);
            }
          },
          null
        );
      },
      isdelete(ID) {
        this.$confirm(this.$t('tips.shifoushanchu'), this.$t('tips.tips'), {
            confirmButtonText: this.$t('pub.sureBtn'),
            cancelButtonText: this.$t('pub.cancelBtn'),
            type: "warning"
          })
          .then(() => {
            this.$message({
              type: "success",
              message: this.$t('tips.shanchuchenggong')
            });
            let msg = {
              ID: ID
            };
            this.apipost(
              "price_post_Remove",
              msg,
              res => {
                if (res.data.resultCode == 1) {
                  this.Success(this.$t('tips.shanchuchenggong'));
                  this.initDataTable();
                  this.initCalendar();
                } else {
                  this.Error(res.data.message);
                }
              },
              null
            );
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: this.$t('ground.yiquxsc')
            });
          });
      },
      updateInfo(ID, date, index) {
        let msg = {
          ID: ID
        };
        this.addMsg.ID = ID;
        let formatDate = date.split("-");
        this.setCheck(index);
        this.updateDay = formatDate[formatDate.length - 1];
        this.apipost("price_post_Get", msg, res => {
          if (res.data.resultCode == 1) {
            this.addMsg = res.data.data;
            this.DateArr = [date];
          }
        });
      },
      getDateString: function () {
        this.dateString = this.formatDate(this.currentYear, this.currentMonth, 1);
      },
      initCalendar: function (cur) {
        var newDays = this.$calendarUtils.createCalendar(cur);
        this.currentDay = newDays.CurrentDay;
        this.currentYear = newDays.CurrentYear;
        this.currentMonth = newDays.CurrentMonth;
        this.currentWeek = newDays.CurrentWeek;
        this.days.length = 0;
        var dateArray = newDays.DayArray;
        for (var i = 0; i < dateArray.length; i++) {
          var d = dateArray[i].day;
          var dayobject = {};
          dayobject.day = d;
          if (d.getMonth() + 1 == this.currentMonth) {
            dayobject.checkState = this.$calendarUtils.checkState.noChecked;
          }
          this.days.push(dayobject);
        }
      },
      pickPre: function (year, month) {
        var d = new Date(this.formatDate(year, month, 1));
        d.setDate(0);
        this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1";
        this.initCalendar(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1));
        this.initDataTable();
      },
      pickNext: function (year, month) {
        var d = new Date(this.formatDate(year, month, 1));
        d.setDate(35);
        this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1";
        this.initCalendar(this.formatDate(d.getFullYear(), d.getMonth() + 1, 1));
        this.initDataTable();
      },
      //鼠标移入显示详情看板
      disBoard(item, index) {
        if (item.checkState == this.$calendarUtils.checkState.hasValue) {
          this.num = index;
        }
      },
      //鼠标移出隐藏详情看板
      disNoneBoard() {
        this.num = -1;
      },
      //日历修改设置
      setCheck(index) {
        this.$calendarUtils.daySetCheck(this.days, index);
      },
      //点击选取日历日期
      clickedDay(item) {
        this.$calendarUtils.dayClick(item, this.DateArr);
      },
      // 返回 类似 2016-01-02 格式的字符串
      formatDate: function (year, month, day) {
        var y = year;
        var m = month;
        if (m < 10) m = "0" + m;
        var d = day;
        if (d < 10) d = "0" + d;
        return y + "-" + m + "-" + d;
      },
      //日历全选
      checkAll() {
        this.DateArr = this.$calendarUtils.checkAll(this.days, this.isCheckAll);
      },
      submitForm(addMsg) {
        //提交创建、修改表单
        let that = this;
        that.$refs[addMsg].validate(valid => {
          if (valid) {
            that.hotelOfferSet();
          } else {
            return false;
          }
        });
      },
      goBack() {
        window.history.back(-1);
      },
      //弹出框取消 初始化谈框内表单
      resetForm(formName) {
        this.$refs[formName].resetFields();
        this.updateDay = -1;
        this.$calendarUtils.resetChekState(this.days);
      },
      //设置供应商是否显示
      setSuplier() {
        var msg = {
          ID: this.DiningId
        };
        this.apipost("dining_post_Get", msg, res => {
          if (res.data.resultCode == 1) {
            this.IsSelfBook = res.data.data.IsSelfBook;
          }
        });
      },
      //获取所有币种
      getAllCurrency() {
        this.apipost(
          "financeinfo_post_GetList", {},
          res => {
            if (res.data.resultCode == 1) {
              this.allCurrencyList = res.data.data;
            }
          },
          err => {}
        );
      },
      //获取当前下拉选中币种汇率
      getCurrentRate(currencyId) {
        this.addMsg.CurrentRate = 1.0;
        this.allCurrencyList.forEach(x => {
          if (x.ID == currencyId) {
            this.addMsg.CurrentRate = x.Rate;
          }
        });
      },
    },
    mounted() {
      var d = new Date();
      this.nowDate =
        d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
      this.yearInput = d.getFullYear();
      this.monthInput = d.getMonth() + 1;
      this.Mid = this.$route.query.MealId;
      this.Did = this.$route.query.DiningId;
      this.DiningId = this.$route.query.DiningId;
      this.initCalendar();
      this.initDataTable();
      this.initSupplier();
      this.setSuplier();
      this.getAllCurrency();
    }
  };

</script>
