<wxs module="filter" src="../../../utils/filter.wxs"></wxs>
<view class="pdb80">
	<!-- 图片 -->
	<view><image src="{{imghost + (details.lburl ? details.lburl:'miniapp/images/default_g_img.gif')}}" class="img" mode="widthFix"/></view>

	 <!-- 未买 -->    
    <block wx:if="{{index==0}}">
	  <view wx:if="{{is_not_start}}" class="fs26 exp_title">活动开始时间：{{filter.format_time(details.startime,1)}}</view>
	  <view wx:else class="fs26 exp_title">活动结束时间：{{filter.format_time(details.endtime,1)}}</view>
	 </block>
	 <!-- 已买 -->
     <block wx:else>
       <view wx:if="{{details.lbtype==1}}"class="fs26 exp_title">兑换结束时间：{{filter.format_time(details.expdate,1)}}</view>
	 </block>

	

	<!-- 描述-->
	<view class="desc-container">
		<!-- 标题 -->
		<view class="mgb10 ellipsis-2 lh taj">{{details.lbtitle}}</view>
		<!-- 价格 -->
		<view class="flex jc_sb ai-center pdb10">
			<view class="flex ai-center">
				<view class="c-red fs36">
					<block wx:if="{{details.lbprice>0 && details.lbintegral>0 }}">
						<text class="rmb">{{filter.toFix(details.lbprice,2)}}</text>/{{details.lbintegral}}积分
					</block>
					<block wx:elif="{{details.lbprice>0 || details.lbintegral>0 }}">
						<block wx:if="{{details.lbprice>0}}" >
					    	<text class="rmb">{{filter.toFix(details.lbprice,2)}}</text>
						</block>
						<block wx:if="{{details.lbintegral>0}}" >
						    {{details.lbintegral}}积分
				    	</block>
					</block>

				</view>
				<view class="fs22 c-a4 line-through mgl10">{{is_retail_price?'零售价：':''}}{{filter.toFix(details.oldprice,2)}}</view>
			</view>
			<view class="fs24 c-a4" wx:if="{{!is_not_start}}">已售{{details.salenum+details.virtualsales}}件</view>
		</view>
		<!-- 时间 -->
		<!-- <view class="date">活动结束日期 {{filter.format_time(details.endtime)}}</view> -->
	</view>


	<!-- 领券和兑换商品 -->
	<!-- 单品 -->
	<view class="goods-container" wx:if="{{details.lbtype==1}}">
		<view class="pd20 bold bdb">可到线下门店兑换以下单品</view>
		<view wx:if="{{index==1 && details.codetype==1}}" class="">
			<view class="flex pd20 jc_sb">
				<view style="width: 35%">单品名称</view>
				<view style="width: 25%;text-align: center">总数量</view>
				<view style="width: 25%;text-align: center">剩余数量</view>
				<view style="width: 15%;"></view>
			</view>
			<view class="flex pd20 jc_sb" wx:for="{{list}}">
				<view style="width: 35%">{{item.goods_name}}</view>
				<view style="width: 25%;text-align:center" class="c-a4">x{{item.goods_num}}</view>
				<view style="width: 25%;text-align:center" class="c-a4">x{{item.alsonum}}</view>
				<view bindtap="show_hxm" data-index="{{index}}" style="width: 15%;text-align: center" wx:if="{{item.alsonum>0}}" >
					<text class="ling_btn">使用</text>
				</view>
				<view style="width: 15%;text-align: center" wx:else >
					<text class="ling_btn c_a">已领</text>
				</view>
			</view>
		</view>

		<view wx:else class="">
			<view class="flex pd20 jc_sb">
				<view>单品名称</view>
				<view>数量</view>
			</view>
			<view class="flex pd20 jc_sb" wx:for="{{list}}">
				<view>{{item.goods_name}}</view>
				<view class="c-a4">x{{item.goods_num}}</view>
			</view>
		</view>
	</view>

	<view wx:if="{{details.lbtype==2}}" class="flex" style="flex-wrap: wrap;">
		<block wx:for="{{list}}" wx:for-index="f_idx">		
			<block wx:for="{{item.goods_num-0}}" wx:for-item="nitem" wx:for-index="idx">
				<view class="lb_quan" style="background-image: url({{imghost}}/miniapp/images/yhq_{{index%2+1}}.png)">
					 <view class="flex fs28 fir_view">
						 <view>满{{item.condition?item.condition:'0.00'}}使用</view>
						 <view wx:if="{{item.type==6}}" class="fs8" style="text-align: center; padding-right: 40rpx; font-size: 35rpx">包邮</view>
						 <view wx:else class="fs8" style="text-align: center; width: 140rpx">￥{{filter.toFix(item.money,2)}}</view>
					 </view>
					
				
					  <view style="font-size: 16rpx; text-align: center"> {{index==0?'活动结束日期':'截至时间'}}：
					  
					   <block wx:if="{{item.endtype<1}}">
						  <block wx:if="{{item.use_end_time}}">
							  {{filter.format_time(item.use_end_time,1)}}
						  </block>
						  <block wx:else>
							  不限
						  </block>
					   </block>	  
					   
						<block wx:else>	
							<block wx:if="{{item.days>0}}">
								  有效期{{item.days}}天
							</block>
							<block wx:else>
								不限
							</block>
						
						</block>						  
					  </view>
					
						 
				</view>
		    </block>
		</block>
	</view>

	<view style="height: 20rpx"></view>
	<!-- 按钮 -->
	<view class="btn-container" wx:if="{{details.lbtype==1 && showBtn}}">
		<block wx:if="{{index == 0}}">
			<block wx:if="{{is_not_start}}">
				<view class="btn gray">活动还未开始</view>
			</block>
			<block wx:else>
			    <view wx:if="{{details.lbintegral>0}}" bindtap="GetBuyIntegral" class="btn red">立即兑换</view>
			    <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice"  class="btn pink">立即购买</view>
			</block>
		</block>

		<block wx:else>
			<view wx:if="{{details.isget}}"  data-type="1" class="btn" style="background-color:#aaa;color: #fff">
				已领取{{list[0].freebh}}
		    </view>
			<view wx:elif="{{details.codetype!=1}}" bindtap="show_hxm" data-type="1" class="btn red">立即使用</view>
		</block>
	</view>

	<view class="btn-container" wx:if="{{details.lbtype==2 && showBtn}}">
		<block wx:if="{{index == 0}}">
			<block wx:if="{{is_not_start}}">
				<view class="btn gray">活动还未开始</view>
			</block>
			<block wx:else>
			   <view wx:if="{{details.lbintegral>0}}" bindtap="GetBuyIntegral" class="btn red">立即兑换</view>
			   <view wx:if="{{details.lbprice>0}}" bindtap="GetBuyPrice"  class="btn pink">立即购买</view>
			</block>

		</block>
		<block wx:else>
		   <view wx:if="{{details.isget}}"  data-type="1" class="btn" style="background-color:#aaa;color: #fff">已领取</view>
		   <view wx:else bindtap="show_get_quan" data-type="1" class="btn red">一键领取优惠券→</view>
		</block>
	</view>

</view>

<!-- 引入提示组件 -->
<warn id="warn"></warn>
<my_confirm id="my_confirm"></my_confirm>
<qrcode id="qrcode" ></qrcode>

