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

<import src="../goodsList/categoryProductListFilter.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='hotHistorySeparator' hidden="{{(searchHistory.length > 0) ? false : true}}"></view>
    <view class="searchHistoryContainer" hidden="{{(searchHistory.length > 0 && status == 0) ? false : true}}">
        <text class="hotKeyword">最近搜索</text>
        <image class='deleteButton' bindtap='clearSearchHistory' src='./images/rubbish-ic@2x.png'></image>
        <view class="hotKeywordItemContainer">
            <block wx:for="{{searchHistory}}" wx:key="{{index}}">
                <view class="hotKeywordItem" bindtap="hotKeywordItemTapped" data-keyword="{{item}}">
                    <text class="hotKeywordTitle">{{item}}</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">
        <FilterComponent id='filterComponent' isResetFilter="{{resetFilter}}" bind:updateProductList="updateProductList" bind:jumpToFilterPage="jumpToFilterPage"></FilterComponent>
        </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'>
           <text class="suggestionText">
            没有找到相关商品,为您推荐“{{suggestion_query}}”的搜索结果或者试试
           </text>
              <block wx:for="{{terms_suggestion}}" wx:key="unique">
                 <text wx:if="{{suggestion_query != item}}" class="suggestionCell" bindtap="hotKeywordItemTapped"data-keyword="{{item}}">{{item}}</text> 
              </block>
            
          </view>
          <view class="productListContainerForEmpty">
            <block wx:for="{{list.data}}" wx:key="{{index}}">
                <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
            </block>
          </view>
        </block>
        <block wx:elif="{{list.data.length < 20 && terms_suggestion.length > 0}}">
          <view class='emptyClass'>
            <text class="suggestionText">
            相关商品太少了,试试
           </text>
            <block wx:for="{{terms_suggestion}}" wx:key="unique">
                 <text wx:if="{{suggestion_query != item}}" class="suggestionCell" bindtap="hotKeywordItemTapped"data-keyword="{{item}}">{{item}}</text> 
              </block>
          </view>
          <view class="productListContainerForEmpty">
              <block wx:for="{{list.data}}" wx:key="{{index}}">
                  <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
              </block>
          </view>
        </block>
        <block wx:else>
          <view class="productListContainer">
              <block wx:for="{{list.data}}" wx:key="{{index}}">
                  <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
              </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>
 <quickNavigation id="quickNavigation" isShowIndicator="{{isShowIndicator}}" isShowMenu="{{true}}" bind:backToTop="backToTop" isUnionShare="{{status==2 && keyword && isUnionShare}}" bind:unionShare="unionShare"></quickNavigation>