search.ttml
5.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--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>