<wxs module="g_filter" src="g_filter.wxs"></wxs>
<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
<view class="container">
	<!-- 搜索框 -->
	<view class="search-container">
		<view class="input-container"><input bindinput="set_search_value" class="search" type="text" placeholder="请输入您想查找的商品信息"/></view>
		<view bindtap="search_data" class="btn-search">搜索</view>
	</view>
	<!-- 列表 -->
	<view class="list-container">
		<!-- 标题 -->
		<view class="title">
			<view class="title-item f1 {{isSale?'c-red':''}}" bindtap="sale_sort">销量</view>
			
			<block wx:if="{{orderField=='money'}}">
		    	<view class="title-item f1 {{isPrice?'c-red':''}}" bindtap="sort1">价格<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view>
			</block>
			<block wx:else>
			    <view class="title-item f1 {{isPrice?'c-red':''}}" bindtap="sort1">价格<text class="iconfont icon-shang"></text></view>
			</block>
			
			<!-- <block wx:if="{{orderField=='commission'}}">
			   <view class="title-item" bindtap="sort2">佣金<text class="iconfont {{orderType=='asc'?'icon-shang':'icon-xia'}}"></text></view>
			</block>  
			<block wx:else> 
			   <view class="title-item" bindtap="sort2">佣金<text class="iconfont icon-xia"></text></view>
			</block> --> 
			
			<view class="title-item f1 {{isNew?'c-red':''}}" bindtap='new_sort'>最新</view>
		</view>
		<!-- 列表项 -->
		<scroll-view
		 class="list"
		 scroll-y="true"
		 bindscrolltolower="refresh"
		 scroll-anchoring
		 >	
		<block wx:for="{{list}}">
			<!-- <view class class="list-item" bindtap="go_goods" data-index="{{index}}"> -->
			<view class class="list-item" bindtap="goto" data-index="{{index}}" data-url="{{'/packageH/pages/goodsInfo/goodsInfo?goods_id=' + item.id}}">
				<view class="img-container">
					 <image src="{{url+item.imgUrl}}" style="width: 100%; height: 100%;"
					   binderror="bind_bnerr2"  lazy-load="true" 
					   data-errorimg="list[{{index}}].imgUrl" mode="aspectFit"></image>					
				</view>
				<view class="details">
					<view class="ellipsis-2 fs28 name">{{item.serviceName}}</view>	
					<view class="fs26 pdt10">有效天数：{{item.validDays}}</view>				
					<view class="flex ai-center pdt14 jc_sb">												
					   <view class="red fs26">￥{{item.money}}</view>
						 <view class="gray fs24">已售：<text class="red">{{item.sales_sum}}</text></view>
					   <!-- <view class="txt_line">￥{{item.market_price}}</view> -->
					</view>	
										
					<view class="t-r">
					<!-- 如果有等级卡的话 -->
					<!-- <block wx:if="{{g_filter.is_has_rank(rank_switch,item)}}"> -->											   
						 <!-- 当会员是等级卡的时候,且卡有钱的时候 -->
						 <!-- <block wx:if="{{card_field  && item[card_field]>0}}"> -->
							 <!-- <text class="plus_show">card_name</text>￥{{item[card_field]}} -->							
							 <!-- <view class="card_bg ellipsis-1 flex ai-center">
							   <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
							   <text class="card_name">{{card_name}}</text>
							 </view>
							 <view class="fs28">￥{{filters.toFix(item[card_field],2)}}</view>							 
							 
						 </block> -->
						 <!-- 当会员不是等级卡的时候,且卡有钱的时候 -->
						 <!-- <block wx:if="{{!card_field && g_filter.get_card_price(item,card_list,0)>0}}">						    
							 <view class="card_bg ellipsis-1 flex ai-center">
						       <image src="{{url}}/miniapp/images/plus/dj_icon.png"></image>
						       <text class="card_name">{{g_filter.get_card_price(item,card_list,1)}}</text>
						     </view>
							 <view class="fs28">￥{{g_filter.get_card_price(item,card_list,0)}}</view>	
						 							
						 </block>							 
					</block>	   	
					</view> -->
							
						<!-- <view class="flex jc_sb fs24 pdt14">
							<view class="gray">已售：<text class="red">{{item.sales_sum}}</text></view>
							<view class="gray">分成金额：						 
										<text wx:if="{{!pattern}}" class="red">￥{{item.commission}}</text>						 
									<text wx:else class="red">￥{{item.fir_rate+item.sec_rate+item.thi_rate}}</text> 	 						
							</view>
						</view> -->
						<view catchtap="share_good" data-index="{{index}}"  class="t-r fs28 pdt14">
							<view class="btn-share">分享</view>
						</view>
					</view>
				</view>
				</view>
			</block>						
			<nodata wx:if="{{list.length==0}}" nodataContainer="nodata">暂无数据</nodata>
			<view wx:if="{{is_no_more}}" class="no-more t-c">- 已全部加载 -</view>
		</scroll-view>
	</view>
</view>

<!--二维码显示页面-->
<canvas canvas-id='share' style='width:750rpx;height:1217rpx;' wx:if='{{!canvasHidden}}'></canvas>
<!-- 分享控件，底部弹出 -->
<share_button id="share_button" bind:cancel="cancel" bind:share_img="saveImageToPhotosAlbum"  wx:if="{{!share_hidden}}"></share_button>
