<!--packageE/solitaire/solitaire.wxml-->


<view class="container">
	<view class="floating-window">
		<swiper class="swiperContainer" circular="{{true}}" vertical="{{true}}" autoplay="{{true}}" interval="{{3000}}">
			<swiper-item class="swiperItem" wx:for="{{buyerListDataLimit}}" wx:key="index">
				<view class="wrapper">
					<view class="image">
						<image mode="widthFix" src="{{item.has_one_member.avatar_image}}"></image>
					</view>
					<view class="text"><text>{{ item.nickname }}完成接龙，购买了{{ item.title_list[0] }}</text></view>
				</view>
			</swiper-item>	
			<swiper-item class="swiperItem" ></swiper-item>
		</swiper>
	</view>

	<view class="countdown">
		<block wx:if="{{activity_data.state==0&&(activity_data.end_time>currentTime)}}">
			<view>距离活动结束还剩</view> 
			<van-count-down use-slot time="{{ (activity_data.end_time-currentTime)*1000 }}" bind:change="onChangeTime">
				<view class="bottom_time">
					<text class="radius-box">{{ timeData.days }}</text>
					<text class="text">天</text>
					<text class="radius-box">{{ timeData.hours }}</text>
					<text class="text">:</text>
					<text class="radius-box">{{ timeData.minutes }}</text>
					<text class="text">:</text>
					<text class="radius-box">{{ timeData.seconds }}</text>
				</view>
			</van-count-down>
		</block>
		<block wx:elif="{{activity_data.state==0&&(activity_data.start_time>currentTime)}}">
			<view>距离活动开始还剩</view> 
			<van-count-down use-slot time="{{ (activity_data.start_time-currentTime)*1000 }}" bind:change="onChangeTime">
				<view class="bottom_time">
					<text class="radius-box">{{ timeData.days }}</text>
					<text class="text">天</text>
					<text class="radius-box">{{ timeData.hours }}</text>
					<text class="text">:</text>
					<text class="radius-box">{{ timeData.minutes }}</text>
					<text class="text">:</text>
					<text class="radius-box">{{ timeData.seconds }}</text>
				</view>
			</van-count-down>
		</block>
		<block wx:elif="{{networkLoading==true}}">
			<view>活动已结束</view> 
		</block>
	</view>
	<view class="notice">
		<view class="notice-title">{{activity_data.activity_name}}</view>
		<view class="notice-award">
			<view class="notice-award-child" wx:for="{{activity_data.rule_list}}" wx:key="index" >{{item}}</view>
		</view>
		<view class="notice-content">
			 <rich-text nodes="{{activity_data.desc}}"></rich-text>
		</view>
	</view>

	<view class="goods-list">
		<view class="good-child" wx:for="{{goods_list}}" wx:key="id">
			<view class="good-img" data-item="{{item}}" catchtap="openGoodsDetail">
				<image src="{{item.thumb}}" ></image>
			</view>
			<view class="good-info">
				<view class="good-title" data-item="{{item}}" catchtap="openGoodsDetail">{{item.title}}</view>
				<view class="goods-purchased" wx:if="{{item.count > 0}}"  data-item="{{item}}" catchtap="openGoodsDetail">
					<view class="buyer-imgs">
						<image
							src="{{img}}"
							wx:for="{{item.avatar_arr}}"
							wx:key="index"
							wx:for-item="img"
						></image>
					</view>
					{{item.count}}人已购买
				</view>
				<view class="good-buy">
					<view class="good-price" data-item="{{item}}" catchtap="openGoodsDetail">
						<!-- {{ $i18n.t('money') }} -->
						{{language['money']}}
						<view class="price">{{item.price}}</view>
						<text wx:if="{{item.has_option==1}}">起</text> 
					</view>
					<view class="select"  wx:if="{{item.has_option==0}}">
						<icon catchtap="reduceCartNum" wx:if="{{goodsCartsTotal[item.id] && goodsCartsTotal[item.id].total>0}}" data-cartid="{{goodsCartsTotal[item.id].id}}" data-item="{{item}}" class="iconfont icon-life-game-sign"></icon>
						<input bindblur="updateCartNum" data-cartid="{{goodsCartsTotal[item.id].id}}" data-item="{{item}}" wx:if="{{goodsCartsTotal[item.id] && goodsCartsTotal[item.id].total>0}}" type="number" value="{{goodsCartsTotal[item.id].total}}" style="width:50rpx;text-align:center;" />
						<icon catchtap="addCartNum" data-item="{{item}}" data-cartid="{{goodsCartsTotal[item.id].id}}" confirm-type="done" class="iconfont icon-life-game-plus"></icon>
					</view>
					<view class="select" wx:if="{{item.has_option==1}}" catchtap="openSpecs" data-item="{{item}}">
						<view class="option-text-btn">选规格<text class="num" wx:if="{{goodsCartsTotal[item.id]}}">{{ goodsCartsTotal[item.id].total }}</text></view>
					</view>
				</view>
			</view>
		</view>
	</view>


    <view class="buy-log">
        <view class="buy-log-title">
			<view class="decoration left-decoration">
				<view class="line"></view>
				<view class="circle-o"></view>
				<view class="circle"></view>
			</view>
			<view class="title">他们都在买</view>
			<view class="decoration right-decoration">
				<view class="circle"></view>
				<view class="circle-o"></view>
				<view class="line"></view>
			</view>
        </view>

        <view class="log-list">
			<view class="list" wx:for="{{buyerListData}}" wx:key="index">
				<view class="index">{{ item.pay_sort  }}.</view>
				<image src="{{item.has_one_member.avatar}}" class="avatar"></image>
				<view class="order-info">
					<view>{{item.has_one_member.nickname}}</view>
					<view>{{item.title_list[0]}}</view>
				</view>
				<view class="order-time">
					<view>{{tools.parsetDate(item.pay_time,'date')}}</view>
					<view>{{tools.parsetDate(item.pay_time,'time')}}</view>
				</view>
			</view>
        </view>
    </view>


	<!-- 底部购物车 -->
	<view class="bottom-car">
		<view class="car-box" wx:if="{{activity_data.state==0&&!end_time}}">
			<view class="car-num" bindtap="openCartListPopup">
				
				<view class="car-num-box">
					<icon class="iconfont icon-all_buycar"></icon>
					<view class="carnum-style">{{ cartsNum }}</view>
				</view>
				<view class="small-price">
					{{language['money']}}
				</view>
				{{cartsTotal}}
			</view>
			<view class="car-add" bindtap="checkGoods">接龙购买</view>
		</view>
		<view wx:if="{{activity_data.state==0&&end_time}}" class="car-box endstyle">活动未开始</view>
		<view wx:if="{{activity_data.state!=0}}" class="car-box endstyle">活动已结束</view>
	</view>
	<!-- 悬浮按钮 -->
	<view class="float-nav">
		<view class="nav-child" bindtap="openShareShow"><icon class="iconfont icon-zb_all_share"></icon>分享</view>
		<view class="nav-child" bindtap="gotoOrder"><icon class="iconfont icon-fontclass-shangpindingdan"></icon>订单</view>
	</view>
</view>



<block wx:if="{{specsShow}}">
	<yz-specs goodsInfo="{{hand_goods_obj}}" cartList="{{carList}}" popupSpecs="{{specsShow}}" bind:closeSpecsPopup="close_yz_specs_popup"></yz-specs>
</block>

<yz-goodsPopup show="{{goodsPopupShow}}" bind:addCart="goodsDetailCartAdd" goodsInfo="{{hand_goods_obj}}" ></yz-goodsPopup>
<solitaire-qrcode isshow="{{posterShow}}" activityid="{{activity_id}}" ></solitaire-qrcode>
<yz-cartList show="{{cartListShow}}" cardata="{{carList}}" bind:cartInputBlur="cartListInputBlur" bind:addCart="cartListAdd" bind:reduceCart="cartListReduce" bind:popupcartListbtn="close_yz_cartList_popup">
	<view class="bottom-car" slot="button">
		<view class="car-box">
			<view class="car-num" bindtap="openCartListPopup">
				<view class="car-num-box">
					<icon class="iconfont icon-all_buycar"></icon>
					<view class="carnum-style">{{ cartsNum }}</view>
				</view>
				<view class="small-price">
					{{language['money']}}
				</view>
				{{cartsTotal}}
			</view>
			<view class="car-add" bindtap="checkGoods">接龙购买</view>
		</view>
		
	</view>
</yz-cartList>

<van-share-sheet show="{{ shareShow }}" bind:select="onSelectShare" options="{{ shareOptions }}" bind:close="onCloseShare" />


<van-popup show="{{showChoose}}" round close-on-click-overlay="true" custom-style="width: 600rpx;border-radius: 30rpx;">
	<view class="wrapper">
		<view class="block">
			<view class="choose-title">
				您的购物车配送方式有冲突，请选择其中一种配送方式~
			</view>

			<view class="choose-content">
				<van-radio-group value="{{radioChoose}}" bind:change="typeChange">
					<view wx:for="{{dispatch_types}}" wx:for-item="item" wx:for-index="idx" wx:key="idx" style="padding: 20rpx 0;">
						<van-radio name="{{idx}}" checked-color="#ff4949">
							<view class="radio-title">{{item.name}}({{item.member_carts.length}}件)</view>
						</van-radio>
						<view class="radio-list ul">
							<view class="radio-item li" wx:for="{{item.member_carts}}" wx:for-item="goods" wx:for-index="i" wx:key="{{i}}">
								<view class="p">{{goods.title}}</view>
								<view class="p" wx:if="{{goods.option_title}}" style="font-size: 12px;color: #666666;">规格：{{goods.option_title}}</view>
							</view>
						</view>
					</view>
				</van-radio-group>
			</view>

			<view class="buttons">
				<view class="button-item">
					<view class="button-content" catchtap="closeChoose">返回</view>
				</view>
				<view class="button-item">
					<view class="button-content red" catchtap="submitGoods">去结算</view>
				</view>
			</view>
		</view>
	</view>
</van-popup>


<wxs module="tools">

	var parsetDate=function(ns,type){
		var date = getDate((ns*1000));
		if(type=='date'){
			return formatTime(date).slice(0,10);
		}else {
			return formatTime(date).slice(10);
		}
		
	}

	function formatTime(date) {
		var year = date.getFullYear()
		var month = date.getMonth() + 1
		var day = date.getDate()
		var hour = date.getHours()
		var minute = date.getMinutes()
		var second = date.getSeconds()
		return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
	}
	function formatNumber(n) {
		n = n.toString()
		return n[1] ? n : '0' + n
	}

	module.exports={
		parsetDate:parsetDate
	}

</wxs>










