<template>
  <div>
    <div class="header">
      <div class="header_top">
        <Button
          type="primary"
          class="header_btn"
          ghost
          @click="handleShow"
          :icon="is_show ? 'ios-arrow-dropup' : 'ios-arrow-dropdown'"
        >
          <div style="margin-right: 0.6rem">
            {{ is_show ? "收起" : "展开" }}
          </div></Button
        >
        <div style="margin-right: 1rem; color: #66a9f0">王小伟</div>
      </div>
      <div class="header_middle">
        <b-dropdown size="sm" text="Large" class="m-2" :disabled="is_use">
          <b-dropdown-item-button>Action</b-dropdown-item-button>
          <b-dropdown-item-button>Another action</b-dropdown-item-button>
          <b-dropdown-item-button>Something else here</b-dropdown-item-button>
        </b-dropdown>
        <b-dropdown size="sm" text="Large" class="m-2" :disabled="is_use">
          <b-dropdown-item-button>Action</b-dropdown-item-button>
          <b-dropdown-item-button>Another action</b-dropdown-item-button>
          <b-dropdown-item-button>Something else here</b-dropdown-item-button>
        </b-dropdown>
        <b-dropdown size="sm" text="Large" class="m-2" :disabled="is_use">
          <b-dropdown-item-button>Action</b-dropdown-item-button>
          <b-dropdown-item-button>Another action</b-dropdown-item-button>
          <b-dropdown-item-button>Something else here</b-dropdown-item-button>
        </b-dropdown>
      </div>
      <div class="header_middle1 ot">
        <div class="ft">58 &nbsp;</div>
        <div class="ft">12 &nbsp;</div>
        <div class="ft">12 &nbsp;</div>
      </div>
      <div class="header_footer">
        <div style="margin-left: 1rem">已完成56/10</div>
        <div style="margin-right: 1.4rem">已完成10%</div>
      </div>
    </div>
    <div class="bdy">
      <div style="font-size: 1.3rem; font-weight: bold">销售单号</div>
      <div>
        <Select
          v-model="selected"
          style="
            margin-top: 1rem;
            height: 3.4rem;
            width: 100%;
            font-size: 1.5rem;
            border-radius: 0.6rem;
            background: #fff;
            border: 0.1rem solid;
          "
          filterable
          clearable
          placeholder="请选择"
        >
         <Option v-for="(item,index) in options" :key="index" :label="item.text" :value="item.value"/>
        </Select>
      </div>
      <div class="bdy_btn">
        <Button
          type="primary"
          class="header_btn"
          style="margin-right: 3rem; height: 2.6rem"
          @click="handleReturn"
        >
          返回</Button
        >
        <Button
          type="primary"
          class="header_btn"
          style="margin-left: 3rem; height: 2.6rem"
          @click="handelGoSure"
        >
          确认</Button
        >
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data () {
    return {
      is_show: true,
      is_use: false,
      selected: '',
      options: []
    }
  },
  created () {
    const data = {
      url: 'http://121.36.142.167:7774/jbl/api/module-data/exe_sale_order_b/page',
      post:{"direction":"DESC","property":"id","fromClientType":"pc","number":0,"sorts":[],"rules":[],"size":15,"specialConditions":[],"dynamicFormCode":"exe_sale_order_b","developmentSystemId":null,"debugFlag":false}
    }
    this.axios.post('/api/testdwy', { ...data }).then(res => {
      this.options = res.data.content
      this.options.forEach(v => {
        v.value = v.no
        v.text = v.no
      })
    })
  },
  methods: {
    handelGoSure () {
      if (!this.selected) {
        return this.$Message.warning('请先选择销售单号！')
      }
      this.$router.push({ path: '/cms/Package/detail', query: { id: this.selected } })
    },
    handleReturn () {
      this.$router.push('/cms/home')
    },
    handleShow () {
      this.is_show = !this.is_show
      console.log(document.getElementsByClassName('header'))
      if (this.is_show) {
        document.getElementsByClassName('header')[0].style = 'height:7rem;overflow:hidden;transition:all .4s;'
        setTimeout(() => {
          document.getElementsByClassName('header')[0].style = 'overflow:none;'
          this.is_use = false
        }, 400)
      } else {
        this.is_use = true
        document.getElementsByClassName('header')[0].style = 'height:2.7rem;overflow:hidden;transition:all .4s;'
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.header {
  width: 94%;
  height: 7rem;
  // overflow: hidden;
  // transition: all 0.4s;
  position: relative;
  top: 0.5rem;
  left: 3%;
  box-shadow: 0.16rem 0.1rem 0.1rem 0.1rem #9d9b9b;
  border-radius: 1rem;
  padding: 0.4rem 0.7rem 0 1rem;
  background: #fff;
}
.header_btn {
  border-radius: 1rem;
  padding: 0.1rem;
  width: 5rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.header_top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ot {
  position: relative;
  top: -1.3rem;
}
.header_middle1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  .ft {
    font-size: 1.5rem;
    width: 5rem;
    text-align: center;
  }
}
.header_middle {
  position: relative;
  top: -0.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
/deep/ .btn-group > .btn,
.btn-group-vertical > .btn {
  background: #ffffff;
  color: #2c3e50;
  outline: none;
  border: none;
  margin: 0;
  z-index: 3;
}
.header_footer {
  position: relative;
  top: -1.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  div {
    font-size: 0.5rem;
    color: rgb(244, 136, 42);
  }
}
.bdy {
  padding: 1rem;
  position: relative;
  width: 94%;

  top: 3rem;
  height: 14rem;
  border-radius: 1rem;
  left: 3%;
  box-shadow: 0.16rem 0.1rem 0.1rem 0.1rem #9d9b9b;
  background: #fff;
}
.bdy_btn {
  margin-top: 3rem;

  display: flex;
  justify-content: center;
  align-items: center;
}
/deep/ .ivu-select-selection{
  height: 100%;
  border:none;
}
/deep/.ivu-select-input{
  height: 3.4rem;
  font-size:1.5rem
}
</style>
