<template>
  <div class="assets-list-header-con">
    <m-nav-bar title="我的仓库" background="transparent" light />
    <div class="search-con">
      <div class="search flex-default">
        <m-icon icon="icon-search3" :size="16" />
        <m-input
          class="search-input"
          placeholder="请输入商品名称或商品通证标识"
          v-model="searchKey"
          @confirm="handleSearch"
        />
      </div>
    </div>
    <div class="tabs-con">
      <!-- <m-tabs v-model="tabIndex" :tabs="tabList" background="transparent" /> -->
    </div>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: [String, Number],
      default: 0,
    },
    tabList: {
      type: Array,
      default: () => [],
    },
  },
  watch: {
    tabIndex(val) {
      this.$emit("input", val);
    },
    value(val) {
      this.tabIndex = val;
    },
  },
  data() {
    return {
      tabIndex: 0,
      searchKey: "",
    };
  },
  mounted() {
    this.tabIndex = this.value;
  },
  methods: {
    handleSearch() {
      this.$emit("search", this.searchKey);
    },
  },
};
</script>

<style lang="less">
.assets-list-header-con {
  width: 100%;
  background: url("~@/assets/img/order-detail-bg.png");
  background-size: 100% auto;
  > .search-con {
    margin-top: 18px;
    margin-bottom: 30px;
    padding: 0 16px;
    > .search {
      padding: 0 14px;
      width: 100%;
      height: 30px;
      background: rgba(216, 216, 216, 0.4);
      border-radius: 15px;
    }
    .search-input {
      flex: 1;
      margin-left: 8px;
      font-size: 14px;
      color: rgba(255, 255, 255, 0.8);
      &::-webkit-input-placeholder {
        color: rgba(255, 255, 255, 0.8);
      }
    }
  }
  > .tabs-con {
    border-radius: 20px 20px 0 0;
    background: #ffffff;
    padding-top: 15px;
    .m-tabs {
      border-bottom: none;
    }
    .van-tabs__line {
      background: linear-gradient(90deg, #2C66F5 0%, rgba(44, 102, 245, 0.6) 100%);
      height: 3px;
      border-radius: 2px;
      width: 42px;
    }
    .van-tab > .van-tab__text {
      color: #666666;
    }
    .van-tab--active > .van-tab__text {
      color: #140603;
      font-weight: bold;
      font-size: 16px;
    }
    .van-tabs__wrap {
      height: 32px;
    }
  }
}
</style>
