index.wxml 5.4 KB

1
  1. <view class="search-page data-v-482e85b8"><view class="custom-navbar data-v-482e85b8" style="{{'padding-top:'+(statusBarHeight+'px')+';'}}"><view class="navbar-content data-v-482e85b8"><view data-event-opts="{{[['tap',[['goBack',['$event']]]]]}}" class="back-button data-v-482e85b8" bindtap="__e"><text class="back-icon data-v-482e85b8">←</text></view><view class="search-input-container data-v-482e85b8"><view class="search-icon data-v-482e85b8"><text class="icon data-v-482e85b8">🔍</text></view><input class="search-input data-v-482e85b8" placeholder="搜索商品名称" focus="{{true}}" confirm-type="search" data-event-opts="{{[['input',[['__set_model',['','searchKeyword','$event',[]]],['onSearchInput',['$event']]]],['confirm',[['performSearch',['$event']]]]]}}" value="{{searchKeyword}}" bindinput="__e" bindconfirm="__e"/></view><view data-event-opts="{{[['tap',[['performSearch',['$event']]]]]}}" class="search-button data-v-482e85b8" bindtap="__e"><text class="search-text data-v-482e85b8">搜索</text></view></view></view><block wx:if="{{$root.g0}}"><view class="search-history data-v-482e85b8"><view class="history-header data-v-482e85b8"><text class="history-title data-v-482e85b8">历史记录</text><view data-event-opts="{{[['tap',[['clearHistory',['$event']]]]]}}" class="clear-history data-v-482e85b8" bindtap="__e"><text class="clear-icon data-v-482e85b8">🗑</text></view></view><view class="history-tags data-v-482e85b8"><block wx:for="{{searchHistory}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['searchFromHistory',['$0'],[[['searchHistory','',index]]]]]]]}}" class="history-tag data-v-482e85b8" bindtap="__e"><text class="tag-text data-v-482e85b8">{{item}}</text></view></block></view></view></block><block wx:if="{{!searchKeyword}}"><view class="hot-search data-v-482e85b8"><view class="hot-header data-v-482e85b8"><text class="hot-title data-v-482e85b8">热门搜索</text></view><block wx:if="{{$root.g1===0}}"><view class="no-data data-v-482e85b8" style="padding:60rpx;text-align:center;color:#999;"><text class="data-v-482e85b8">暂无热门搜索数据</text></view></block><block wx:else><view class="hot-list data-v-482e85b8"><block wx:for="{{hotSearchList}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['searchFromHot',['$0'],[[['hotSearchList','',index]]]]]]]}}" class="hot-item data-v-482e85b8" bindtap="__e"><view class="{{['hot-rank','data-v-482e85b8',index===0?'rank-first':index===1?'rank-second':index===2?'rank-third':'rank-normal']}}"><text class="rank-number data-v-482e85b8">{{index+1}}</text></view><text class="hot-text data-v-482e85b8">{{item}}</text></view></block></view></block></view></block><block wx:if="{{$root.g2}}"><view class="search-suggestions data-v-482e85b8"><block wx:for="{{searchSuggestions}}" wx:for-item="suggestion" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['selectSuggestion',['$0'],[[['searchSuggestions','',index]]]]]]]}}" class="suggestion-item data-v-482e85b8" bindtap="__e"><text class="suggestion-icon data-v-482e85b8">🔍</text><text class="suggestion-text data-v-482e85b8">{{suggestion}}</text></view></block></view></block><block wx:if="{{hasSearched}}"><view class="search-results data-v-482e85b8"><view class="result-stats data-v-482e85b8"><text class="stats-text data-v-482e85b8">找到<text class="stats-count data-v-482e85b8">{{$root.g3}}</text>个相关商品</text></view><view class="filter-bar data-v-482e85b8"><block wx:for="{{$root.l0}}" wx:for-item="filter" wx:for-index="index" wx:key="index"><view data-event-opts="{{[['tap',[['changeFilter',['$0'],[[['filterOptions','',index,'value']]]]]]]}}" class="{{['filter-item','data-v-482e85b8',(currentFilter===filter.$orig.value)?'active':'']}}" bindtap="__e"><text class="filter-text data-v-482e85b8">{{filter.$orig.label}}</text><block wx:if="{{filter.$orig.sortable}}"><text class="sort-arrow data-v-482e85b8">{{filter.m0}}</text></block></view></block></view><block wx:if="{{$root.g4>0}}"><view class="product-list data-v-482e85b8"><block wx:for="{{$root.l1}}" wx:for-item="product" wx:for-index="__i0__" wx:key="id"><view data-event-opts="{{[['tap',[['goToProductDetail',['$0'],[[['searchResults','id',product.$orig.id]]]]]]]}}" class="product-item data-v-482e85b8" bindtap="__e"><image class="product-image data-v-482e85b8" src="{{product.$orig.imageUrl}}" mode="aspectFill"></image><view class="product-info data-v-482e85b8"><text class="product-name data-v-482e85b8">{{product.m1}}</text><view class="product-meta data-v-482e85b8"><text class="product-category data-v-482e85b8">{{product.$orig.categoryName}}</text><text class="product-sales data-v-482e85b8">{{"销量: "+product.$orig.sales}}</text></view><view class="product-stock data-v-482e85b8"><text class="{{['stock-text','data-v-482e85b8',(product.$orig.stock<10)?'low-stock':'']}}">{{'库存: '+product.$orig.stock+''}}</text></view></view></view></block></view></block><block wx:else><view class="no-results data-v-482e85b8"><view class="no-results-icon data-v-482e85b8">😔</view><text class="no-results-text data-v-482e85b8">未找到相关商品</text><text class="no-results-tip data-v-482e85b8">试试搜索其他关键词</text></view></block></view></block><block wx:if="{{loading}}"><view class="loading-container data-v-482e85b8"><view class="loading-spinner data-v-482e85b8"></view><text class="loading-text data-v-482e85b8">搜索中...</text></view></block></view>