<scroll-view class="container" style="height: 100%;">
  <view class="search-header">
    <view class="input-box">
      <van-icon name="search"/>
      <input name="input" class="keywrod" focus="true" value="{{keyword}}" confirm-type="search" bindinput="inputChange" bindfocus="inputFocus" bindconfirm="onKeywordConfirm" placeholder="{{defaultKeyword.keyword}}" />
      <van-icon class="del" wx:if="{{keyword}}" bindtap="clearKeyword" name="cross" />
    </view>
    <view class="right" bindtap="closeSearch">取消</view>
  </view>
  <view class="no-search" wx:if="{{ !searchStatus}}">
    <view class="search-keywords search-history" wx:if="{{!keyword  && historyKeyword.length}}">
      <view class="h">
        <text class="title">历史记录</text>
        <van-icon bindtap="clearHistory" name="delete" class="icon"/>
      </view>
      <view class="b">
        <view class="item" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{historyKeyword}}" wx:key="keyword" hover-class="navigator-hover">{{item.keyword}}</view>
      </view>
    </view>
    <view class="search-keywords search-hot" wx:if="{{!keyword && hotKeyword.length}}">
      <view class="h">
        <text class="title">热门搜索</text>
      </view>
      <view class="b">
        <view class="item {{item.is_hot === 1 ? 'active' : ''}}" hover-class="navigator-hover" bindtap="onKeywordTap" data-keyword="{{item.keyword}}" wx:for="{{hotKeyword}}" wx:key="id">{{item.keyword}}</view>
      </view>
    </view>
    <view class="shelper-list" wx:if="{{keyword}}">
      <view class="item" hover-class="navigator-hover" wx:for="{{helpKeyword}}" wx:key="id" bindtap="onKeywordTap" data-keyword="{{item}}">{{item}}</view>
    </view>
  </view>

  <view class="search-result" wx:if="{{ searchStatus && goodsList.length}}">
    <view class="sort">
      <view class="sort-box">
        <view class="item {{currentSortType == 'default' ? 'active' : ''}}" bindtap="openSortFilter" id="defaultSort">
          <text class="txt">综合</text>
        </view>
        <view class="item {{currentSortType == 'price' ? 'active' : ''}}" bindtap="openSortFilter" id="priceSort">
          <text class="txt">价格</text>
          <van-icon name="arrow-up" wx:if="{{ currentSortType == 'price' && currentSortOrder == 'asc' }}" />
          <van-icon name="arrow-down" wx:elif="{{ currentSortType == 'price' && currentSortOrder == 'desc'}}" />
        </view>
        <view class="item {{currentSortType == 'category' ? 'active' : ''}}" bindtap="openSortFilter" id="categoryFilter">
          <text class="txt">分类</text>
        </view>
      </view>
      <view class="sort-box-category" wx-if="{{categoryFilter}}">
        <view class="item {{item.checked ? 'active' : ''}}" wx:for="{{filterCategory}}" wx:key="id" data-category-index="{{index}}" bindtap="selectCategory">{{item.name}}</view>
      </view>
    </view>
    <view class="cate-item">
      <view class="b">
        <navigator class="item {{(iindex + 1) % 2 == 0 ? 'item-b' : ''}}" url="/pages/goods/goods?id={{iitem.id}}" wx:for="{{goodsList}}" wx:key="id" wx:for-item="iitem" wx:for-index="iindex">
          <image class="img" src="{{iitem.picUrl}}" background-size="cover"></image>
          <text class="name">{{iitem.name}}</text>
          <text class="price">￥{{iitem.retailPrice}}</text>
        </navigator>
      </view>
    </view>
  </view>

  <view class="search-result-empty" wx:if="{{!goodsList.length && searchStatus}}">
    <text class="text">您寻找的商品还未上架</text>
  </view>
</scroll-view>