<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
<wxs module="g_filter" src="g_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">
		<!-- 标题 -->
		<scroll-view class="title" scroll-x="true">
			<!-- <block> -->
				<view wx:for="{{tab}}" class="title-item {{currentIndex == index ? 'active':''}}" data-index="{{index}}" bindtap="clickTab">{{item}}</view>
			<!-- </block> -->
		</scroll-view>
		<!-- 促销页标题 -->
		<view class="subTab-title flex" wx:if="{{currentIndex == 2}}">
			<block wx:for="{{tab2}}">
				<view class="subTab-titleItem {{currentIndex2 == index ? 'active':''}}" data-index="{{index}}" bindtap="clickTab2">{{item}}</view>
			</block>
		</view>
		<!-- 列表项 -->
		<scroll-view
		 class="list {{currentIndex == 2?'active1':''}} {{(currentIndex == 3 || currentIndex == 4 || currentIndex == 5 || currentIndex == 6)?'active2':''}}"
		 scroll-y="true"
		 bindscrolltolower="refresh"
		 scroll-anchoring
		 >
		   
		   <block wx:for="{{list}}">
	
			<!-- 拼单和秒杀 -->
			<block wx:if="{{currentIndex == 0 || currentIndex == 1}}">
				<view class class="list-item" bindtap="go_goods" data-index="{{index}}">
					<view class="img-container">
						<image src="{{url+item.original_img}}" style="width: 100%; height: 100%;"
						  binderror="bind_bnerr2"  lazy-load="true" 
						  data-errorimg="list[{{index}}].original_img"></image>
						
					</view>
					<view class="details">
						<view class="fs28 name ellipsis-2">{{item.title}}</view>
						<view>
							<!-- 点击秒杀时显示 -->
							<view class="flex ai-center pdtb8" wx:if="{{currentIndex == 0}}">
								<view class="progress-container">
									<progress class="progress" percent="{{100*(item.goods_num-item.buy_num)/item.goods_num}}" border-radius="6" stroke-width="14" activeColor="#FE6867" backgroundColor="#ccc"></progress>
									<text class="percent fs20">剩余{{g_filter.toFix(100*(item.goods_num-item.buy_num)/item.goods_num,2) }}%</text>
								</view>
								<view class="fs22 gray">已抢{{item.buy_num}}件</view>
							</view>
							<!-- 点击拼单时显示 -->
							<view class="flex pdtb6" wx:if="{{currentIndex == 1}}">
								<view class="group-num">已拼{{item.buy_num}}份</view>
								<view class="group-type">{{item.ct_num}}人团</view>
							</view>
							<!-- 公共项 -->
							<view class="fs22 red">剩余:
								<text class='tui-conutdown-box'> {{item.djs.day}}</text>天
								<text class='tui-conutdown-box'>{{item.djs.hou}}</text>时
								<text class='tui-conutdown-box'>{{item.djs.min}}</text>分
								<text class='tui-conutdown-box tui-countdown-bg'>{{item.djs.sec}}</text>秒							
							</view>
						</view>
						<view class="red flex ai-center">
							<view>￥{{item.price}}</view>
							<view class="retail">零售价：￥{{item.market_price}}</view>
						</view>
						<view catchtap="share_good" data-index="{{index}}" class="t-r fs28"><text class="btn-share">分享</text></view>
					</view>
				</view>
			</block>
			
			<!-- 促销 - 订单促销 -->
			<block wx:if="{{currentIndex == 2}}">
				<view class="subTab-container">
					<view class="subTab-list">
						<view class="subTab-item">
							<view class="bdr-b">
								<view class="flex">
									<view wx:if="{{currentIndex2==1 && item.type==0}}" class="badge">折</view>
									<view wx:if="{{currentIndex2==1 && item.type==1}}" class="badge">减</view>
									<view wx:if="{{currentIndex2==1}}" class="badge">配</view>
									<view wx:if="{{currentIndex2==2}}" class="badge">惠</view>																	
									<view wx:if="{{currentIndex2==1}}" class="ellipsis-1">{{item.main_goods_name}}</view>
									<view wx:else class="ellipsis-1">{{item.name}}</view>
								</view>
								<view class="pdv10 fs28">促销时间：{{g_filter.format_time(item.start_time,1)}} 到 {{g_filter.format_time(item.end_time,1)}}</view>
							</view>
							<view class="flex-space-between" wx:if="{{currentIndex2 == 0}}">
								<view class="fs28">
									<view class="pdv10">需购买金额：￥{{g_filter.toFix(item.money,2)}}</view>
									<view wx:if="{{item.type==0}}">折扣：{{item.expression}}(%)</view>
									<view wx:if="{{item.type==1}}">优惠金额：{{g_filter.toFix(item.expression,2)}}</view>
								</view>
								<view bindtap="share_index" data-index="{{index}}"  class="btn-container"><text class="btn-share">分享</text></view>
							</view>
							<view class="flex-equality pdt20" wx:else>
								<view bindtap="showPopup" data-index="{{index}}" class="btn-container" ><text class="btn-share">活动详情</text></view>
								
								<view wx:if="{{currentIndex2==1}}" bindtap="share_good" data-index="{{index}}" class="btn-container"><text class="btn-share w164">分享</text></view>
								<view wx:else bindtap="share_index" data-index="{{index}}" class="btn-container"><text class="btn-share w164">分享</text></view>
							</view>
						</view>
					</view>
				</view>
			</block>
						
			<!-- 专享礼包 -->
			<block wx:if="{{currentIndex == 3}}">
				<view class class="list-item" bindtap="go_libao" data-index="{{index}}">
					<view class="img-container">
						<image src="{{url+item.lbUrl}}" style="width: 100%; height: 100%;"
						  binderror="bind_bnerr2"  lazy-load="true" 
						  data-errorimg="list[{{index}}].lbUrl"></image>						
					</view>
					<view class="details">
						<view class="ellipsis-2 fs28 name">{{item.giftTitle}}</view>
						<view class="pdt14 red">							
							<tex wx:if="{{item.payMoney}}">￥{{g_filter.toFix(item.payMoney,2)}}</tex> 
							<text wx:if="{{item.payMoney && item.payIntegral}}">/</text> 
							<text wx:if="{{item.payIntegral}}">{{item.payIntegral}}积分</text>						
						</view>
						<view class="fs22 line-through gray">零售价：￥{{item.giftPosPrice}}</view>
						<!-- <view class="fs22">已售：<text class="red">3</text></view> -->
						<view catchtap="share_index" data-index="{{index}}" class="t-r fs28"><view class="btn-share">分享</view></view>
					</view>
				</view>
			</block>
			
			<!-- 预售 -->
			<block wx:if="{{currentIndex == 4}}">
				<view class="kill-item">
				    <navigator class="kill-pic rel" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">
				        <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}"
				            data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image>
				    </navigator>
				    <view class="kill-cont">
				        <navigator class="goods-name ellipsis-2"
				                   url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator>
				        <view class="flex-vertical xc-strip-frame">
				        <view class="xc-strip-blank rel">
				
				        <view class="flex-vertical rel total">
				           <view class="t-c abs xc-fill" style="width:{{215*(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)}}rpx;background:#e4374d;"></view>
				           <text class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}%</text>
				        </view>
				       
				        </view>
				        <view class=" ml10 fs20">库存还剩{{item.presell_sumqty-item.buy_goodnum}}件</view>
				       </view>
				
				
				        <view class="goods-num">
				            <view>
						    <view class="{{type==1?'xc-wc':'blue_c'}}"></view>
				                <view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" >
				                <view class="fs28" style="line-height: 16px;">￥{{item.presell_price}}</view>
				                <text>{{item.price}}</text> 
				                <span class="underline fs20">零售价￥{{item.market_price}}</span></view>
				                
				            </view>
				            <view class="btn-share fs26" catchtap="share_index" data-index="{{index}}">分享</view>
				        </view>
				    </view>
				</view>
			</block>
			
			<!-- 团购 -->
			<block wx:if="{{currentIndex == 5}}">
				<view class="list-item" bindtap="go_goods" data-index="{{index}}">
					<view class="img-container">
						<image class="img-block" src="{{url + item.original_img}}" data-val="{{item.original_img}}"
							   data-errorimg="list[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image>
					</view>
					<view class="mgl20 flex fdc f1 jc_sb">
						<view>
							<view class="fs30">{{item.title}}</view>
							<view class="flex ai_c">
								<view class="fs26 tag">{{item.rebate}}折</view>
								<view class="rmb c-red fs30">{{item.price}}</view>
								<view class="rmb del fs24 c-7b pdl10">{{item.market_price}}</view>
							</view>
						</view>
						<view class="flex jc_sb ai-center c-7b pdt20">
							<view class="fs24">
								<view>已售{{item.buy_num+item.virtual_num}}件</view>
								<view class=""><text class="iconfont icon-shizhong fs24"></text>{{item.djs.day}}天{{item.djs.hou}}时{{item.djs.min}}分{{item.djs.sec}}秒</view>
							</view>
							<view class="btn" catchtap="share_good" data-index="{{index}}">分享</view>
						</view>
					</view>
				</view>
			</block>
			
			<!-- 组合购 -->
			<block wx:if="{{currentIndex == 6}}">
				<view class="kill-item">
				    <navigator class="kill-pic rel zhbuy" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}" hover-class="none">
				        <image class="wh100" src="{{url+item.img_url}}" data-val="{{item.img_url}}"
				            data-errorimg="list[{{index}}].img_url" binderror="bind_bnerr2" lazy-load="true"></image>
				    </navigator>
				    <view class="kill-cont">
				        <navigator class="goods-name" url="/packageB/pages/zuhegou/index/index?id={{item.id}}&title={{item.name}}"  hover-class="none" style="height: auto !important;">
								{{item.name}}
								<view class="goods-num zhbuy">
								    <!-- <view> -->
											<view>组合数量: {{item.zhbuyqty}}</view>
											<view>活动时间: {{filters.format_time(item.start_time) + '至' + filters.format_time(item.end_time)}}</view>
											<view class="flex jc_sb ai-center pdt10">
												<view class="fs40 flex xc-buttom-money {{type==1?'xc-wc':'blue_c'}}" >
													<view class="fs28" style="line-height: 16px;">￥</view>
													<text>{{item.zhprice}}</text> 
												</view>
												<view class="btn-share" catchtap="share_index" data-index="{{index}}">分享</view>
											</view>
								        
								        
								    <!-- </view> -->
								</view>
					  </navigator>
				  </view>
				</view>
			</block>
			
			<!-- 幸运购 -->
			<block wx:if="{{currentIndex == 7}}">
				<view class="list-item luckygo" wx:if="{{item.status == 1}}" bindtap="{{item.actLen == 0 ? '':'go'}}" data-url="/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id={{item.goods_id}}&prom_type=9&group_id={{item.id}}">
					<view class="flex ai-center">
						<view class="img-container">
							<image class="img-block" src="{{url + item.original_img}}" data-val="{{item.original_img}}"
							data-errorimg="list[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true" mode="heightFix"></image></view>
						<view class="pdl20 flex fdc jc_sb f1">
							
							<view class="ellipsis-2 name fs28" data-content="{{item.group_num}}人团">{{item.title}}</view>
							<view>
								<view class="flex ai-center">
									<text class="rmb c-red">{{filters.price(item.group_price)}}</text>
									<view class="del fs22 c-a pdl10">零售价:<text class="rmb">{{item.market_price}}</text></view>
								</view>
								<view class="flex jc_sb">
									<progress class="pdr20 f1 progress" percent="{{filters.percent(item.num, item.group_num)}}" activeColor="#FF6768" backgroundColor="#d0d0d0" border-radius="12" stroke-width="12" data-content="{{item.num}}人已参团"></progress>
									<!-- <view class="btn fs26 {{item.actLen == 0 ? 'gray':''}}" wx:if="{{item.actLen == 0}}">已抢光</view> -->
									<view class="btn-share fs26" catchtap="share_index" data-index="{{index}}">分享</view>
								</view>
							</view>
							
						</view>
					</view>
					<view class="fs24 pdt10 c-7b">*<text class="c-red">{{item.group_num}}</text>人成团，<text class="c-red">{{item.group_win}}</text>人得商品，<text class="c-red">{{item.group_num - item.group_win}}</text>人全额退款并得<text class="c-red">惊喜礼品</text>！</view>
				</view>
			</block>
			
			</block><!--for的闭合 -->			
			<view style="height: 1rpx;"></view>			
			<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 class="tabbar flex" wx:if="{{currentIndex == 0 || currentIndex == 1}}" bindtap="clickTab3">
		<view class="tabbar-item {{currentIndex3 == 0?'active':''}}" data-index="0">
			<text class="iconfont icon-hot"></text>火热进行
		</view>
		<view class="tabbar-item {{currentIndex3 == 1?'active':''}}" data-index="1">
			<text class="iconfont icon-clock"></text>即将开始
		</view>
	</view>
	
	<!-- 弹出层 -->
	<view class="popup-container" hidden="{{hiddenPopup}}">
		<view class="popup">
			<view class="popup-content {{currentIndex2 == 2?'active':''}}">
				<view class="popup-title dash-b">活动详情</view>
				<!-- 搭配促销 -->
				<block wx:if="{{currentIndex2 == 1}}">
					<view class="pdv20 dash-b fs28" bindtap="go_coll_good" data-gid="{{hui_active.main_goods_id}}">
						<view class="popup-title2">必买商品</view>
						<view class="popup-title3">商品编号：{{hui_active.ginfo.goods_sn}}</view>
						<view class="popup-title3">商品名称：{{hui_active.main_goods_name}}</view>
						<view class="popup-title3">手店价：<text class="red">￥{{g_filter.toFix(hui_active.ginfo.shop_price,2)}}</text></view>
					</view>
					<view class="pdv20">
						<view class="popup-title2 fs28">搭配商品</view>
						<view class="fs28">
							<view class="flex t-c bold pdv10">
								<view class="w25">序号</view>
								<view class="w25">商品信息</view>
								<view class="w25">手店价</view>
								<view class="w25">搭配价</view>
							</view>
							<view class="popup-list t-c">
								<block wx:for="{{list2}}">							
								   <view class="flex ai-center pdb10" bindtap="go_coll_good" data-gid="{{item.goods_id}}">
										<view class="w25">{{index+1}}</view>
										<view class="w25 ellipsis-2">{{item.goods_name}}</view>
										<view class="w25">￥{{g_filter.toFix(item.shop_price,2)}}</view>
										<view class="w25 red">￥{{g_filter.toFix(item.price,2)}}</view>
									</view>
								</block>
								
							</view>
						</view>
					</view>
				</block>
				
				<!-- 优惠促销 -->
				<block wx:if="{{currentIndex2 == 2}}">
					<view class="pdv20 dash-b">
						<view class="popup-title2 fs28">参与对象</view>
						<view class="flex ai-center t-c fs28 pdv20">
							<view class="w50">
								<radio wx:if="{{hui_active.good_object==0}}" checked="true" disabled/>
								<radio wx:else  disabled/>
								全部商品
							</view>
							<view class="w50">		
								<radio wx:if="{{hui_active.good_object==1}}" checked="true" disabled/>
								<radio wx:else disabled/>
								指定商品
							</view>
						</view>
						<view class="fs28">
							<view class="flex t-c bold pdv10">
								<view class="w25">序号</view>
								<view class="w25">商品信息</view>
								<view class="w25">手店价</view>
								<view class="w25">操作</view>
							</view>
							<view class="t-c">								
								<block wx:for="{{list2}}">								
									<view class="flex ai-center pdb10"  bindtap="go_coll_good" data-gid="{{item.goods_id}}">
										<view class="w25">{{index+1}}</view>
										<view class="w25 ellipsis-2">{{item.goods_name}}</view>
										<view class="w25">￥{{item.shop_price}}</view>
										<view  catchtap="share_good2" data-index="{{index}}" class="w25"><text class="btn-share">分享</text></view>
									</view>								
								</block>								
							</view>
						</view>
					</view>
					<view class="pdv20">
						<view class="popup-title2 fs28">活动详情</view>
						<view class="fs28">						
							<block wx:for="{{prom_goods}}">							
								<view class="pdv10">需购买：{{item.condition}}  
								     <text wx:if="{{item.prom_type==0}}">元</text>
									 <text wx:else>件</text>
								</view>
								<view class="pdl20">
									<view class="flex pdb20">
										<view class="w50" wx:if="{{item.money}}"><radio checked="true" disabled/>减现金 <text class="red">{{item.money}}</text></view>
										<view class="w50" wx:if="{{item.sale}}"><radio checked="true" disabled/>打折 <text class="red">{{item.sale}}折</text></view>
									</view>
									<view class="flex pdb20">
										<view class="w50"><radio wx:if="{{item.past}}" checked="true" disabled/><radio wx:else disabled/>包邮</view>
										<view class="w50">
											<block wx:if="{{item.intValue}}">
											  <radio checked="true" disabled/>积分 <text class="red">{{item.intValue}}</text>
											</block>  
											<block wx:else>
											  <radio disabled/>积分
											</block>  
										</view>
									</view>
									<view class="pdb20"><radio wx:if="{{item.couponId}}" checked="true" disabled/> <radio wx:else disabled/>优惠券</view>
									<view class="pdb20"><radio wx:if="{{item.gift_id}}" checked="true" disabled/> <radio wx:else disabled/>赠品</view>
									<view><radio wx:if="{{item.lb_id}}" checked="true" disabled/> <radio wx:else disabled/>礼包</view>
								</view>							
							</block>
							
						</view>
					</view>
				</block>
			</view>
			<view class="popup-btn t-c"><text class="iconfont icon-close" bindtap="closePopup"></text></view>
		</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>
