<style>
.priceUpdate .resource-content {
  min-width: 1200px;
  margin-top: 30px;
  font-size: 12px;
}
.priceUpdate .resource-content > div {
  display: inline-block;
}
.priceUpdate .resource-baseinfo {
  float: left;
  height: auto;
  width: 550px;
  margin-left: 30px;
}
.priceUpdate .resource-imginfo {
  float: left;
  width: 550px;
  margin-top: 60px;
}
.priceUpdate .resource-imginfo > div {
  margin-bottom: 20px;
}
.priceUpdate .resource-lititle {
  display: block;
  border-left: 4px solid #e95252;
  padding-left: 10px;
}
.priceUpdate .resource-baseinfo span {
  display: inline-block;
}
.priceUpdate .resource-baseinfo > div {
  margin-bottom: 20px;
}
.clearfix:after {
  content: "\0020";
  display: block;
  height: 0;
  clear: both;
}
.priceUpdate .priceDate {
  width: 500px;
  background-color: #fff;
  border: 1px solid #d1d1d1;
}
.priceUpdate .noticeInfo div {
  margin-bottom: 10px;
  margin: 0 120px 10px 80px;
}
.priceUpdate .subPrice {
  margin: 0 20px 0 70px;
}
.priceUpdate .inventory-div > div {
  float: left;
  margin: 10px 30px 30px 0;
}
.priceUpdate .inventoryCommon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.priceUpdate .inOne {
  background-color: #e95252;
}
.priceUpdate .inTwo {
  background-color: #f58f0c;
}
.priceUpdate .inThree {
  background-color: #1bc594;
}
.priceUpdate .inFour {
  background-color: #1b63c5;
}
.priceUpdate .price-manage {
  margin: 20px 0 25px 0;
}
.priceUpdate .day {
  width: 1000px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.priceUpdate .yearSelect,
.monthSelect {
  float: left;
  width: 168px;
  height: 30px;
}
.priceUpdate .priceDate td.checked > label {
  border-color: red;
  line-height: 28px;
  box-sizing: border-box;
  border-radius: 15px;
}
.priceUpdate .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); /*透明 透明  灰*/
}
.priceUpdate #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);
}
.priceUpdate .month ul {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
}
.priceUpdate .year-month {
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
}
.priceUpdate .year-month > input {
  width: 100px;
  float: left;
}
.priceUpdate .arrow {
  padding: 10px;
  font-style: normal;
  cursor: pointer;
}
.priceUpdate .monthminus {
  position: absolute;
  left: 15px;
  top: 15px;
}
.priceUpdate .monthadd {
  position: absolute;
  right: 21px;
  top: 16px;
}
.priceUpdate .month ul li {
  font-size: 12px;
  position: relative;
  text-transform: uppercase;
  float: left;
  letter-spacing: 3px;
}
.priceUpdate .month ul li > input {
  padding-left: 10px;
  text-align: center;
  margin: 20px 10px 20px;
}
.priceUpdate .weekdays {
  margin: 0;
  padding: 10px 0;
  background-color: #f9f9f9;
  display: flex;
  flex-wrap: wrap;
  color: #999999;
  justify-content: space-around;
}
.priceUpdate .weekdays li {
  display: inline-block;
  width: 13.6%;
  text-align: center;
}
.priceUpdate .days {
  width: 500px;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
}
.priceUpdate .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;
}
.priceUpdate .spanCheck {
  cursor: pointer;
}
.priceUpdate .days li .active {
  padding: 6px 10px;
  border-radius: 50%;
  background: #00b8ec;
  color: #fff;
}
.priceUpdate .days li span {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 1px solid #fff;
  border-radius: 17px;
  line-height: 30px;
}
.priceUpdate .days li .other-month {
  display: inline-block;
  width: 30px;
  height: 30px;
  line-height: 30px;
  color: gainsboro;
}
.priceUpdate .checked span {
  border-color: green !important;
}
.priceUpdate .currentInput {
  width: 120px;
  height: 30px;
  border-radius: 17px;
  outline: none;
  border: none;
  margin-top: 20px;
  border: 1px solid #dcdfe6;
}
.priceUpdate .detailInfo {
  display: none;
  position: absolute;
  left: -85px;
  top: 50px;
  z-index: 999;
}
.priceUpdate .priceUpdate {
  min-width: 1200px;
}
.priceUpdate .popContent {
  width: 245px;
  height: 145px;
  background-color: #e95252;
  text-align: left;
  color: #fff;
  font-size: 12px;
}
.priceUpdate .popContent div {
  width: 100%;
}
.priceUpdate .popList label:first-child {
  display: inline-block;
  width: 40%;
  margin: 10px 0 0 10px;
  text-align: left;
}
.priceUpdate .popList label:last-child {
  display: inline-block;
  width: 40%;
  margin: 10px 10px 0 0;
  text-align: right;
}
.priceUpdate .class-a {
  background-color: #e95252;
  color: #fff;
}
.priceUpdate .class-b {
  background-color: #f58f0c;
  color: #fff;
}
.priceUpdate .class-c {
  background-color: #1bc594;
  color: #fff;
}
.priceUpdate .class-d {
  background-color: #1b63c5;
  color: #fff;
}

.packagePrice .class-e {
  background-color: #e95252;
  color: #fff;
}
.priceUpdate .delButton {
  position: relative;
  top: -50px;
  background-color: #1bc594;
  color: #fff;
}
.priceUpdate .el-form-item {
  display: inline-block;
}
.priceUpdate .el-form-item__label {
  width: 80px;
}
.priceUpdate .resDiv {
  width: 700px;
}
.priceUpdate .el-textarea__inner {
  resize: none;
  font-family: "微软雅黑";
}
.priceUpdate input::-webkit-outer-spin-button,
.priceUpdate input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0;
}
.priceUpdate .el-form-item__error {
  left: 80px;
}
.priceUpdate .s {
  display: block !important;
}
.priceUpdate .el-form-item__content {
  width: 315px;
}
.priceUpdate .RemarkDiv .el-form-item__content {
  width: 400px;
}
.priceUpdate .ckAll {
  margin: 25px 20px 0 0;
}
.priceUpdate .ckStyle {
  cursor: pointer;
}
.HS_supplier {
  margin: 10px 0 10px 10px;
}
</style>
<template>
  <div class="flexOne priceUpdate">
    <div class="resource-content clearfix">
      <div class="resource-baseinfo">
        <span class="resource-lititle price-manage">{{$t('hotel.hotel_productManage')}}</span>
        <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)" />年
                  <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)" />月
                  <i class="arrow monthadd" @click="pickNext(currentYear,currentMonth)">❯</i>
                </li>
                <li>
                  <div class="ckAll">
                    <el-checkbox class="checkBox" v-model='isCheckAll' @change="checkAll">全选</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="ckStyle" @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 :class="{'class-a': dayobject.checkState==$calendarUtils.checkState.hasValue}">
                  {{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_Inventory')}}:{{dayobject.kucun}}</label>
                      <label>{{$t('hotel.hotel_B2CPrice')}}:{{dayobject.B2CPrice}}</label>
                    </div>
                    <div class="HS_supplier">
                      <label>{{$t('hotel.hotel_Supplier')}}:{{dayobject.SupplierName}}</label>
                    </div>
                  </div>
                  <input type="button" class="hollowFixedBtn delButton" @click="isdelete(dayobject.ID)" value="删除" />
                  <button class="hollowFixedBtn delButton" @click="updateInfo(dayobject.ID,dayobject.date,index)">修改</button>
                </div>
              </li>
            </ul>
          </div>
        </div>
        <div class="inventory-div clearfix">
          <div>
            <span class="inventoryCommon inOne"></span>
            <span>{{$t('hotel.hotel_Inventory')}}<10</span>
          </div>
          <div>
            <span class="inventoryCommon inTwo"></span>
            <span>10-100</span>
          </div>
          <div>
            <span class="inventoryCommon inThree"></span>
            <span>100-500</span>
          </div>
          <div>
            <span class="inventoryCommon inFour"></span>
            <span>500-1000</span>
          </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">
            <el-form-item :label="$t('hotel.hotel_CostPrice')" prop="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_Inventory')" prop="Inventory">
              <el-input type="text" class="w210" v-model="addMsg.Inventory" @keyup.native="checkPrice(addMsg,'Inventory')"></el-input>
            </el-form-item>
          </div>
          <div class="resDiv">
            <el-form-item :label="$t('hotel.hotel_B2BPrice')" prop="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')" prop="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_SalesPrice')" prop="SalesPrice">
              <el-input type="text" class="w210" v-model="addMsg.SalesPrice" @keyup.native="checkPrice(addMsg,'SalesPrice')"></el-input>
            </el-form-item>
            <el-form-item :label="$t('hotel.hotel_Supplier')" v-if="IsSelfBook==1" prop="Supplier">
              <el-select v-model="addMsg.Supplier" class="w210" filterable clearable :placeholder="$t('hotel.hotel_inputholder')">
                <el-option label='不限' value=''></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">
            <el-form-item label="币种">
              <el-select placeholder="请选币种" 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="汇率" prop="Fax">
              <el-input class="w210" v-model='addMsg.CurrentRate' @keyup.native="checkRate(addMsg,'CurrentRate')"></el-input>
            </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('hotel.hotel_attentionOne')}}</div>
          <div>2.{{$t('hotel.hotel_attentionTwo')}}</div>
        </div>
        <button type="success" class="subPrice" :class="{'comDisableBtn':isDisable==true,'normalBtn':isDisable==false}"
          :disabled='isDisable' @click="isDeleteNote=true,submitForm('addMsg')">{{comBtnText}}</button>
        <button type="success" class="hollowFixedBtn" @click="goBack" v-if="updateDay=='-1'">返回</button>
        <button type="success" class="hollowFixedBtn" @click="resetForm('addMsg')" v-else>取消</button>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      //供应商
      SupplierList: [],
      productname: "",
      serviceNum: "",
      yearInput: "", //输入框年
      monthInput: "", //输入框月
      ID: "",
      HotelID: "",
      DateList: [],
      DateArr: [],
      currentDay: 1,
      currentMonth: 1,
      currentYear: 1970,
      currentWeek: 1,
      days: [],
      nowDate: "",
      dateString: "2016-01-02",
      num: -1,
      updateDay: -1,
      IsSelfBook: 0,
      Country:0,
      //提交报价中
      comBtnText: "提交报价",
      isDisable: false,
      //选中状态
      isCheckAll: false,
      //选择的币种
      SelectDefaultValue: 0,
      //所有币种
      allCurrencyList: [],
      addMsg: {
        Hotel: "",
        Product: "",
        Supplier: "",
        Inventory: "",
        B2BPrice: "",
        B2CPrice: "",
        SalesPrice: "",
        DMCPrice: 0,
        DateList: "",
        Remark: "",
        CostPrice: "",
        CurrencyId: 0,
        CurrentRate: 0,
        StartDate: "",
        EndDate: ""
      },
      rules: {
        //表单必填验证
        CostPrice: [
          {
            required: true,
            message: "请输入成本价",
            trigger: "change"
          },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: "请输入两位小数"
          }
        ],
        Inventory: [
          {
            required: true,
            message: "请输入库存",
            trigger: "change"
          },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: "请输入正确的数字"
          }
        ],
        B2BPrice: [
          {
            required: true,
            message: "请输入B2B价格",
            trigger: "change"
          },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: "请输入两位小数"
          }
        ],
        B2CPrice: [
          {
            required: true,
            message: "请输入B2C价格",
            trigger: "change"
          },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: "请输入两位小数"
          }
        ],
        SalesPrice: [
          {
            required: true,
            message: "请输入内部价格",
            trigger: "change"
          },
          {
            pattern: this.$commonUtils.Regex.el_Isdecimal,
            message: "请输入两位小数"
          }
        ],
        Supplier: [
          {
            required: true,
            message: "请输选择供应商"
          }
        ]
      },
      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();
        }
      }
    };
  },

  methods: {
    //初始化列表数据
    initDataTable() {
      let msg = {
        Product: this.ID,
        Date: this.nowDate
      };
      this.apipost(
        "dict_post_HotelOffer_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].DateStr == myDate) {
                  dayItem.CostPrice = tableinfo[j].CostPrice;
                  dayItem.B2BPrice = tableinfo[j].B2BPrice;
                  dayItem.B2CPrice = tableinfo[j].B2CPrice;
                  dayItem.kucun = tableinfo[j].Inventory;
                  dayItem.SupplierName = tableinfo[j].SupplierName;
                  dayItem.ID = tableinfo[j].ID;
                  dayItem.date = tableinfo[j].Date;
                  dayItem.checkState = this.$calendarUtils.checkState.hasValue;
                  if (dayItem.kucun >= 0 && dayItem.kucun < 10) {
                    dayItem.class = "class-a";
                  } else if (dayItem.kucun >= 10 && dayItem.kucun < 100) {
                    dayItem.class = "class-b";
                  } else if (dayItem.kucun >= 100 && dayItem.kucun < 500) {
                    dayItem.class = "class-c";
                  } else if (dayItem.kucun >= 500) {
                    dayItem.class = "class-d";
                  }
                }
              }
            });
          }
        },
        null
      );
    },
    initSupplier() {
      let msg = {
        Type: 1
      }; //HK新增查询条件
      this.apipost(
        "supplier_post_GetAllList",
        msg,
        response => {
          if (response.data.resultCode == 1) {
            this.SupplierList = response.data.data;
          }
        },
        null
      );
    },
    //提交酒店报价
    hotelOfferSet() {
      this.addMsg.Hotel = this.HotelID;
      this.addMsg.Product = this.ID;
      this.addMsg.DateList = this.DateArr;
      if (
        this.addMsg.DateList == "" &&
        (this.addMsg.StartDate == "" || this.addMsg.EndDate == "")
      ) {
        this.Error("请选择日期");
        return;
      }
      this.isDisable = true;
      this.comBtnText = "正在提交";
      this.apipost(
        "dict_post_HotelOffer_Set",
        this.addMsg,
        res => {
          this.isDisable = false;
          this.comBtnText = "提交报价";
          if (res.data.resultCode == 1) {
            this.initDataTable();
            this.addMsg = {};
            this.Success("保存成功!");
            this.DateArr = [];
            this.resetForm("addMsg");
          } else {
            this.Error(res.data.message);
          }
        },
        null
      );
    },
    isdelete(ID) {
      var that = this;
      that.Confirm("是否删除?", function() {
        that.apipost(
          "dict_post_HotelOffer_Remove",
          {
            Id: ID
          },
          res => {
            if (res.data.resultCode == 1) {
              that.initDataTable();
              that.initCalendar();
              that.Success("删除成功!");
            }
          }
        );
      });
    },
    updateInfo(ID, date, index) {
      let msg = {
        Id: ID
      };
      this.addMsg.ID = ID;
      let parameterDate = date.split("-");
      this.setCheck(index);
      this.updateDay = parameterDate[parameterDate.length - 1];
      this.apipost("dict_post_HotelOffer_Get", msg, res => {
        if (res.data.resultCode == 1) {
          this.addMsg = res.data.data;
          this.DateArr = [date];
        }
      });
    },
    getDateString: function() {
      this.dateString = this.$calendarUtils.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.$calendarUtils.formatDate(year, month, 1));
      d.setDate(0);
      this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1";
      this.initCalendar(
        this.$calendarUtils.formatDate(d.getFullYear(), d.getMonth() + 1, 1)
      );
      this.initDataTable();
    },
    //点击右箭头切换年月
    pickNext: function(year, month) {
      var d = new Date(this.$calendarUtils.formatDate(year, month, 1));
      d.setDate(35);
      this.nowDate = d.getFullYear() + "-" + (d.getMonth() + 1) + "-1";
      this.initCalendar(
        this.$calendarUtils.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);
    },
    //日历全选
    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;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.updateDay = -1;
      this.$calendarUtils.resetChekState(this.days);
    },
    goBack() {
      window.history.back(-1);
    },
    //设置供应商是否显示
    // setSuplier() {
    //   var msg = {
    //     hotelID: this.HotelID
    //   };
    //   this.apipost("hotel_post_GetAll", 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.allCurrencyList.forEach(x => {
        if (x.ID == currencyId) {
          this.addMsg.CurrentRate = x.Rate;
        }
      });
    }
  },
  mounted() {
    this.getAllCurrency();
    var d = new Date();
    var vYear = d.getFullYear();
    var vMonth = d.getMonth() + 1;
    var vDate = d.getDate();
    this.nowDate = vYear + "-" + vMonth + "-" + vDate;
    this.yearInput = vYear;
    this.monthInput = vMonth;
    this.ID = this.$route.query.id;
    this.HotelID = this.$route.query.HotelID;
    this.IsSelfBook = this.$route.query.IsSelfBook;
    this.Country = this.$route.query.Country;
    this.initSupplier();
    // this.setSuplier();
    this.initCalendar();
    this.initDataTable();
  }
};
</script>