<template>
  <div class="h100">
    <van-popup
    v-model="moreSearchShow"
    class="goodsHighSearch"
    position="right"
    :style="{ width: '75%',height: '100%', overflow: 'hidden' }"
    >
      <div style="height: 40px">
      </div>
      <div class="search-info">
        <div class="search-name">商品编号</div>
        <div class="search-input-layout">
          <input v-model="moreSearchInfo.goodsCode" type="text" placeholder="请输入商品编号" class="search-input" >
        </div>
      </div>
      <div class="search-info">
        <div class="search-name">商品名称</div>
        <div class="search-input-layout">
          <input v-model="moreSearchInfo.goodsName" type="text" placeholder="请输入商品名称" class="search-input" >
        </div>
      </div>
      <div class="search-info">
        <div class="search-name">商品规格</div>
        <div class="search-input-layout">
          <input v-model="moreSearchInfo.goodsSpec" type="text" placeholder="请输入商品规格" class="search-input" >
        </div>
      </div>
      <div class="search-info">
        <div class="search-name">生产企业</div>
        <div class="search-input-layout">
          <input v-model="moreSearchInfo.manufacturer" type="text" placeholder="请输入生产企业" class="search-input" >
        </div>
      </div>
      <div class="action-bottom">
        <van-button type="default" @click="onCleanClick">重置</van-button>
        <van-button type="info" class="submit" @click="onSearchClick">查询</van-button>
      </div>
    </van-popup>
  </div>
</template>

<script>
export default {
  name: 'GoodsHighSearch',
  data () {
    return {
      moreSearchShow: false,
      moreSearchInfo: {
        goodsCode: '', // 商品编号
        goodsName: '', // 商品名称
        goodsSpec: '', // 商品规格
        manufacturer: '', // 生产企业
      }
    }
  },
  props: {
    value: {
      type: Boolean,
      default: false
    }
  },
  watch: {
    value (val) {
      this.moreSearchShow = val
    },
    moreSearchShow (val) {
      this.$emit('input', val)
    }
  },
  methods: {
    onSearchClick() {
      this.moreSearchShow = false
      this.$emit('onsearch', this.moreSearchInfo)
    },
    onCleanClick() {
      this.moreSearchInfo = {
        goodsCode: '', // 商品编号
        goodsName: '', // 商品名称
        goodsSpec: '', // 商品规格
        manufacturer: '' // 生产企业
      }
      console.log(this.moreSearchInfo)
      this.moreSearchShow = false
      this.$emit('onsearch', this.moreSearchInfo)
    },
  }
}
</script>

<style lang="scss" scoped>
.goodsHighSearch{
  .search-info {
    padding: 15px 15px 0;
    .search-name {
      font-size: 16px;
      font-weight: bold;
    }
    .search-input-layout {
      background-color:#eeeeee;
      border-radius: 2px;
      height:40px;
      padding: 5px;
      margin-top: 10px;
      font-size: 14PX;
      .search-input {
        background-color:#eeeeee;
        width: 100%;
        height: 100%;
        border: none;
      }
    }
  }
  .action-bottom {
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;

    button {
      flex: 1;
    }
  }
}
  
</style>
