<wxs module="g_filter" src="g_filter.wxs"></wxs>

<view class="container">
		<!-- 搜索框 -->
		<view class="search-bar">
		  <form bindsubmit="submitSearch">
				<view class="pdh20 pdv10 flex ai_c jc_sb">
					<view class="input-box">
						<input class="input-search" name="word" placeholder="请输入商品关键字" bindconfirm="submitSearch" bindinput="getInput" bindfocus="inputFocus" value="{{keyword}}"/>
						<text class="iconfont icon-guan" hidden="{{hiddenClear}}" catchtap="clearInput"></text>
					</view>
					<button class="btn" formType="submit" hover-class="none">搜索</button>
				</view>
		  </form>
		</view>
		
		
		<view wx:if="{{openSearchModal}}">
		  <view class="pd20">
				<view class="" wx:if="{{searchRecord.length != 0}}">
				  <view class="flex jc_sb ai_c">
						<text class="fs28 bold">历史搜索</text>
						<text class="iconfont icon-shanchu c-6" bindtap="clearSearchRecord" wx:if="{{searchRecord.length != 0}}"></text>
					</view>
				  <block wx:if="{{searchRecord.length>0}}">
				    <view class="hot-row flex flex-wrap" wx:key="{{index}}">
				      <view class="hot-item history ellipsis-1" bindtap="searchHotWord" data-word="{{item}}" wx:for="{{searchRecord}}" wx:key="{{index}}">{{item}}</view>
				    </view>
				  </block>
					<view wx:else class="fs24">暂无历史搜索记录</view>
				</view>
				
		    <view class="" wx:if="{{hotWords.length>0}}">
		      <view class="fs28 bold">热门搜索</view>
		      <block wx:if="{{hotWords.length>0}}">
		        <view class="hot-row" wx:for="{{hotWords}}" wx:key="{{index}}">
		          <view bindtap="searchHotWord" class="hot-item" data-word="{{item}}" wx:for="{{item}}" wx:key="{{index}}">{{item}}</view>
		        </view>
		      </block>
		    </view>
		  </view>
		</view>
		
		
		
		<block wx:if="{{!openSearchModal}}">
		
		<view class="nav flex">
		  <navigator class="nav-item f1" >
              <picker bindchange="bind_pk_sort"  value="{{index}}" range="{{more_sort_arr}}" range-key="name">
                  <text  wx:if="{{tabname=='on_time'}}">新品</text>
                  <text wx:elif="{{tabname=='comment_count'}}">评论</text>
                  <text wx:else>综合</text>
              </picker>
              <view class="arrow_down"></view>
		  </navigator>


		  <navigator bindtap="changeTab" class="nav-item f1" data-href="sales_sum" data-ad="{{adname}}">销量
              <view>
                  <view class="arrow_up {{tabname=='sales_sum' && adname=='asc'?'on':''  }}  "></view>
                  <view class="arrow_down  {{tabname=='sales_sum' && adname=='desc'?'on':''  }} "></view>
              </view>
		  </navigator>
		  <navigator bindtap="changeTab" class="nav-item f1" data-href="final_price" data-ad="{{adname}}">价格
              <view>
                  <view class="arrow_up {{tabname=='final_price' && adname=='asc'?'on':''  }}  "></view>
                  <view class="arrow_down  {{tabname=='final_price' && adname=='desc'?'on':''  }} "></view>
              </view>
		  </navigator>
		  <navigator bindtap="openFilterModal" class="nav-item f1">筛选<view class="ico-filter">
		              <image class="wh100" src="{{url}}/miniapp/images/xx.png"></image>
		          </view>
		  </navigator>
		  <!-- <navigator bindtap="openSearchModal" class="nav-item nav-search">
		    <image class="wh100 search-img" src="{{url}}/miniapp/images/search.png"></image>
		  </navigator> -->
		</view>
	
	
	
  <view class="choice_list">
    <navigator class="choice_item flex ai-center" url="{{g_filter.get_goods_url(item)}}" wx:for="{{requestData}}" wx:key="{{index}}">
      <view class="img-wrap">
        <image src="{{item.original_img}}" lazy-load="true" binderror="bind_bnerr" data-errorimg="requestData[{{index}}].original_img"></image>
      </view>
      <view class="item-cont">
        <view class="title ellipsis-2">{{item.goods_name}}</view>
        <!-- 判断是否有活动价，小程序没有有团购和拼单 -->
        <block wx:if="{{(item.prom_price>0 || item.prom_integral) && item.prom_id>0 && item.prom_type!=3 && item.prom_type!=5 && item.prom_type!=7 && item.prom_type!=10}}">
          <!-- 活动价 -->
          <view class="price">
			  <text wx:if="{{item.prom_integral}}">{{item.prom_integral}}积分</text>
			  <text wx:if="{{item.prom_integral && item.prom_price}}">+</text>
			  <text wx:if="{{item.prom_price}}">￥{{item.prom_price}}</text>
		  </view>
          <view class="comment flex jc_sb">
<!--            <view class="word-line xc-ash">￥{{item.market_price}}</view>-->
            <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
          </view>
        </block>
        <block wx:else>
          <!-- 商品价格,先判断下是后又等级价-->
          <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}">
            <!-- 当会员是等级卡的时候 -->
            <block wx:if="{{card_field}}">
              <!-- 等级价>0 -->
              <block wx:if="{{item[card_field]>0}}">
                <view class="flex ai_center">
                  <view class="price">￥{{item[card_field]}}</view>
                  <view class="card_bg flex ai-center">
											<image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
											<!-- <view class="card_name ellipsis-1">{{card_name}}</view> -->
											<text class="ellipsis-1">{{card_name}}</text>
                  </view>
                </view>
                <view class="comment flex jc_sb">
                  <view wx:if="{{is_retail_price}}" class="word-line xc-ash no_line_x">￥{{item.market_price}}</view>
                  <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
                </view>
              </block>
              <block wx:else>
                <view class="price">￥{{item.shop_price}}</view>
                <view class="comment flex jc_sb">
                  <view  wx:if="{{is_retail_price}}"  class="word-line xc-ash no_line_x">￥{{item.market_price}}</view>
                  <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
                </view>
              </block>
            </block>
            <block wx:else>
              <block wx:if="{{g_filter.get_card_price(item,card_list,0) && is_no_plus}}">
                <view class="flex ai-center">
                  <view class="price">￥{{item.shop_price}}</view>
                  <view  wx:if="{{is_retail_price}}"  class="word-line xc-ash mk_price no_line_x">￥{{item.market_price}}</view>
                </view>
                <view class="comment flex jc_sb">
                  <view class="flex ai_center">
                    <view class="">￥{{g_filter.get_card_price(item,card_list,0)}}</view>
                    <view class="card_bg flex">
											<view class="flex ai-center">
												<image src="{{url}}/miniapp/images/plus/dj_icon.png" class=""></image>
												<text class="ellipsis-1">{{g_filter.get_card_price(item,card_list,1)}}</text>
											</view>
                    </view>
                  </view>
                  <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
                </view>
              </block>
              <block wx:else>
                <view class="price">￥{{item.shop_price}}</view>
                <view class="comment flex jc_sb">
                  <view  wx:if="{{is_retail_price}}"  class="word-line xc-ash no_line_x">￥{{item.market_price}}</view>
                  <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
                </view>
              </block>
            </block>
          </block>
          <block wx:else>
            <view class="price">￥{{item.shop_price}}</view>
            <view class="comment flex jc_sb">
              <view  wx:if="{{is_retail_price}}"  class="word-line xc-ash no_line_x">￥{{item.market_price}}</view>
              <view>评论{{item.comment_count}} 已售{{item.sales_sum}}</view>
            </view>
          </block>
        </block>
      </view>
    </navigator>
    <!-- 有商品列表的时候，要有分享攻击 -->
    <share_box id="share"></share_box>
  </view>
		<!-- 无数据提示 -->
		<view class="no-data" wx:if="{{!requestData||requestData.length==0}}">
		  <image class="cart-image" src="{{url}}/miniapp/images/cart-null.png"></image>
		  <view class="no-data-title">没有相关的数据</view>
		  <navigator bindtap="go_url" class="lookat"  data-url="/pages/index/index/index"> 去逛逛 </navigator>
		</view>
	
	</block>
</view>

<include src="../../../../pages/goods/com_screen" />