
<template>
  <div class="business">
    <Head :headText="headText"></Head>
    <div class="count-top-right">
      <date-temp :types="1"  @pickerVal="pickerVal"></date-temp>
    </div>
    <el-calendar class="doBusinessContainer" :first-day-of-week="7">
      <template slot="dateCell" slot-scope="{date, data}">
        <div class="time-duration">
          <el-time-picker
            is-range
            v-model="value1"
            size="mini"
            range-separator="-"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            placeholder="选择时间范围"
            format="hh:mm"
            @change="setHours"
          ></el-time-picker>
        </div>
        <div class="dataJoin">{{ data.day.split('-').slice(2).join('')}}</div>
      </template>
    </el-calendar>
  </div>
</template>
<script>
import Head from "../main/index";
import DateTemp from "../evaluate/dateTemp";
import {queryHours,updateHours} from '@/api/doBusiness/business.js'
export default {
  data() {
    return {
      headText: "营业时间调整",
      value1: [new Date(), new Date()],
      date:""
    };
  },
  components: {
    Head,
    DateTemp
  },
  methods: {
    pickerVal(val) {
      console.log(val);
      this.date = val
    },
    getHours(){
      let params = {
        postParams:{
          criteria:{
            projectId:'Pj4419000005',
            date:'201902'
          }
        }
      }
      queryHours(params).then(res=>{
        console.log(res)
      })
    },
    setHours(){
      let params = {
        postParams:{
          projectId:'Pj4419000005',
          date:'201902',
          openTime:'080000',
          endTime:'220000'
        }
      }
      updateHours(params).then(res=>{
        console.log(res)
      })
    }
  },
  mounted(){
    this.getHours()
  }
};
</script>
<style lang="scss" scoped>
.count-top-right {
  width: 148px;
  padding: 16px;
}
.doBusinessContainer {
  margin-top: 20px;
  background: #fff;
  .time-duration {
    .el-input__inner {
      width: 134px;
      padding: 0;
      border: none;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: rgba(100, 108, 115, 1);
      line-height: 24px;
      padding: 1px 12px;
      height: 24px;
      background: rgba(245, 246, 247, 1);
      border-radius: 12px;
      margin-right: 17px;
    }
    .el-range-editor .el-range-input {
      border: none;
      background: rgba(245, 246, 247, 1);
    }
  }
  .dataJoin {
    height: 22px;
    font-size: 16px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(31, 36, 41, 1);
    line-height: 22px;
  }
}
</style>
<style lang="scss">
.business {
  .el-calendar-table thead th {
    text-align: right;
    height: 20px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(100, 106, 115, 1);
    line-height: 20px;
    padding-right: 15px;
  }
  .el-calendar__header {
    display: none;
  }
  .el-range-editor--mini .el-range-input {
    background: #f5f6f7;
  }
  .el-calendar-table .el-calendar-day {
    display: flex;
  }
}
</style>