search.wxml 4.05 KB
<!--search.wxml-->

<import src="../goodsList/categoryProductListFilter.wxml"/>
<import src="../goodsList/productListCell.wxml"/>

<view class="sContainer">
    <view class="searchContainer">
        <view class="search">
            <image class="serachIcon" src="../index/images/home_search@2x.png"></image>
            <input class="serachInput" value="{{keyword}}" placeholder="潮流单品搜一下" bindinput="inputChanged" bindfocus="focusChanged" bindconfirm="inputConfirmed" placeholder-class="placeholder" auto-focus/>
        </view>
        <text class="cancelButton" bindtap="cancelSearch">取消</text>
    </view>


    <view class="hotKeywordContainer" hidden="{{status == 0 ? false : true}}">
        <text class="hotKeyword">热门搜索</text>
        <view class="hotKeywordItemContainer">
            <block wx:for="{{hotKeyword['data']}}" wx:key="{{index}}">
                <view class="hotKeywordItem" bindtap="hotKeywordItemTapped" data-keyword="{{item.content}}">
                    <text class="hotKeywordTitle">{{item.content}}</text>          
                </view>
            </block>
        </view>
    </view>

    <view class="fuzzySearchContainer" style="height:{{windowHeight-44}}px;" hidden="{{status == 1 ? false : true}}">
        <block wx:for="{{fuzzySearch['data']}}" wx:key="{{index}}">
            <view class="fuzzySearchItem" bindtap="fuzzySearchItemTapped" data-keyword="{{item.keyword}}">
                <text class="fuzzySearchTitle" style="max-width:{{0.6*windowWidth}}px">{{item.keyword}}</text>
                <view class="fuzzySearchRight">
                    <text class="fuzzySearchCount" style="max-width:{{0.3*windowWidth}}px">{{item.count + ' items'}}</text>
                    <image class="fuzzySearchArrow" src="./images/arrow@2x.png"></image>
                </view>
                
            </view>
        </block>
    </view>

    <view hidden="{{status == 2 ? false : true}}">
        <view class="fixedFilter">
            <template is="categoryProductListFilter" data="{{filter, filterGenderItem, genderFilter}}"/>
        </view>
        <block wx:if="{{list.data.length == 0}}">
           <view class='noContentClass' style='height:{{windowHeight}}px;'>
             <image class='nosearch-ic' src="images/nosearch-ic@3x.png"></image>
             <view class='noContent'>未搜索到任何相关商品</view>
           </view>
        </block>
        <block wx:elif="{{isChangedQuery}}">
          <view class='emptyClass'>
            <image class='nosearch-ic' src="images/nosearch-ic@3x.png"></image>
            <view class='noContent'>没有找到相关商品,为您推荐“{{suggestion_query}}”的搜索结果或者试试</view>
            <view class="suggestionView">
              <block wx:for="{{terms_suggestion}}" wx:key="unique">
                 <view wx:if="{{suggestion_query != item}}" class="suggestionCell" bindtap="hotKeywordItemTapped"data-keyword="{{item}}">{{item}}</view> 
              </block>
            </view>
          </view>
          <view class="productListContainerForEmpty">
            <block wx:for="{{list.data}}" wx:key="{{index}}">
                <template is="productListCell" data="{{listWidth, listHeight, listImageWidth, listImageHeight, listImageTop, listMarginHorizontal, item}}"/>
            </block>
          </view>
        </block>
        <block wx:else>
          <view class="productListContainer">
              <block wx:for="{{list.data}}" wx:key="{{index}}">
                  <template is="productListCell" data="{{listWidth, listHeight, listImageWidth, listImageHeight, listImageTop, listMarginHorizontal, item}}"/>
              </block>
          </view>
        </block>

        <view class="loadMore" wx:if="{{list.data.length > 0 && list.isLoading && !list.endReached}}">
            <text class="loadText">加载中...</text>
        </view>
        <view class="loadMore" wx:if="{{list.endReached}}">
            <text class="loadText">没有更多了</text>
        </view>

        <loading wx:if="{{list.currentPage == 0 && list.isLoading}}">加载中</loading>
    </view>
</view>