search.ttml 5.94 KB
<!--search.wxml-->

<import src="../brandStore/categoryProductListFilter.ttml"/>
<!-- <import src="../../vendors/zanui/actionsheet/index.ttml"/> -->

<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 tt:for="{{hotKeyword['data']}}" tt: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 tt:for="{{searchHistory}}" tt: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 tt:for="{{fuzzySearch['data']}}" tt: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 tt: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 tt:elif="{{isChangedQuery}}">
          <view class='emptyClass'>
           <text class="suggestionText">
            没有找到相关商品,为您推荐“{{suggestion_query}}”的搜索结果或者试试
           </text>
              <block tt:for="{{terms_suggestion}}" tt:key="unique">
                 <text tt:if="{{suggestion_query != item}}" class="suggestionCell" bindtap="hotKeywordItemTapped"data-keyword="{{item}}">{{item}}</text> 
              </block>
            
          </view>
          <view class="productListContainerForEmpty">
            <block tt:for="{{list.data}}" tt:key="{{index}}">
                <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
            </block>
          </view>
        </block>
        <block tt:elif="{{list.data.length < 20 && terms_suggestion.length > 0}}">
          <view class='emptyClass'>
            <text class="suggestionText">
            相关商品太少了,试试
           </text>
            <block tt:for="{{terms_suggestion}}" tt:key="unique">
                 <text tt:if="{{suggestion_query != item}}" class="suggestionCell" bindtap="hotKeywordItemTapped"data-keyword="{{item}}">{{item}}</text> 
              </block>
          </view>
          <view class="productListContainerForEmpty">
              <block tt:for="{{list.data}}" tt:key="{{index}}">
                  <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
              </block>
          </view>
        </block>
        <block tt:else>
          <view class="productListContainer">
              <block tt:for="{{list.data}}" tt:key="{{index}}">
                  <productListCell item="{{item}}" page-name="searchResult" page-param="{{keyword}}"></productListCell>
              </block>
          </view>
        </block>

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

        <loading tt: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>
  <template is="zan-actionsheet" data="{{...actionsheet}}" />
  <snapshootShare id="snapshootShare" isShow="{{isShowSnapshoot}}" sourceType="list_union" shareData="{{snapshootShareData}}" bind:hiddenSheet="hiddenSheet"></snapshootShare>   -->