<template>
  <!-- 搜索框 -->
  <view class="search-wrapper">
    <view class="index-search">
      <view class="index-cont-search t-c">
        <text class="search-icon iconfont icon-search"></text>
        <text class="search-text">
          <input type="text" :placeholder="tips" v-model="searchValue">
        </text>
        <button class="search-text-bu" @click="onSearch">搜索</button>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    props: {
      tips: {
        type: String,
        default: '请输入店铺/标的名称关键字'
      }
    },
    data() {
      return {
        searchValue: ''
      }
    },

    methods: {
      onClick() {
        this.$emit('event')
      },

      onSearch() {
        this.$navTo('pages/search/index', { searchValue: this.searchValue })
      }

    }
  }
</script>

<style lang="scss" scoped>
  .search-wrapper {
    background: #1c223b;
    padding: 0rpx 0rpx 0rpx 0rpx;
    position: fixed;
    top: 20rpx;
    left: 19rpx;
    width: 95%;
    border-radius: 50rpx;
  }

  .index-search {
    border-bottom: 0;
    background: #fff;
    border-radius: 50rpx;
    overflow: hidden;
    font-size: 28rpx;
    color: #6d6d6d;
    box-sizing: border-box;
    height: 74rpx;
    line-height: 74rpx;

    .index-cont-search {
      width: 100%;
      font-size: 28rpx;
      background: #f7f7f7;
      display: flex;
      justify-content: center;
      align-items: center;

      .search-icon {
        font-size: 34rpx;
        margin-left: 50rpx;
      }

      .search-text {
        text-align: left;
        float: left;
        margin-left: 20rpx;
        width: 100%;

        input {
          font-size: 24rpx;
        }
      }
      .search-text-bu {
        margin-right: 20rpx;
        color: #ffffff;
        background-color: #1c223b;
        font-size: 20rpx;
        width: 120rpx;
        height: 50rpx;
        text-align: center;
        border-radius: 50rpx;
      }
    }
  }
</style>
