<wxs module="filters" src="../../../utils/filter.wxs"></wxs>
<wxs module="g_filter" src="g_filter.wxs"></wxs>
<wxs src="checkin.wxs" module="myUtil"></wxs>

<com_top_nav title="签到领积分"></com_top_nav>

<view class="checkin-container">
	<view class="rule-container flex">
		<view class="rule" bindtap="showRules">规则</view>
		<view class="points" bindtap="goto" data-url="/packageD/pages/user/integral/integral">
			<image class="coin" src="https://mshop-lib.yolipai.net/template/mobile/new/static/images/integral/coins.png"></image>我的积分
		</view>
	</view>
	<view class="list flex" wx:if="{{res}}">
		<view class="list-item active}}">
			<view class="circle">+{{res.cday1}}</view>
			<view class="fs26">{{res.sday2}}</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 0,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.daynum}}</view>
			<view class="fs26">今日</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 1,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.tdayc1}}</view>
			<view class="fs26">明日</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 2,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.tdayc2}}</view>
			<view class="fs26">{{myUtil.setDate(year, res.sday3, 2)}}日</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 3,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.tdayc3}}</view>
			<view class="fs26">{{myUtil.setDate(year, res.sday3, 3)}}日</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 4,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.tdayc4}}</view>
			<view class="fs26">{{myUtil.setDate(year, res.sday3, 4)}}日</view>
		</view>
		<view class="list-item {{myUtil.setDate_is_act(year, res.sday3, 5,res.qddaylist)? 'active':''}}">
			<view class="circle">+{{res.tdayc5}}</view>
			<view class="fs26">{{myUtil.setDate(year, res.sday3, 5)}}日</view>
		</view>
	</view>
	<view wx:else style="height: 100rpx;"></view>

	<view class="btn-container" wx:if="{{res}}">
		<view class="btn {{cking?'gray':''}}" bindtap="checkInToday" wx:if="{{isLogin}}">
			<text class="iconfont icon-rili"></text>{{!myUtil.setDate_is_act(year, res.sday3, 0,res.qddaylist) ? '立即签到':'今日已签到'}}
		</view>
		<view class="btn" bindtap="isLogin" wx:else>
			<text class="iconfont icon-rili"></text>签到请登录
		</view>
		<view class="btn  {{cking?'gray':''}}" wx:if="{{res.curbqdaynum}}" bindtap="reCheckIn"><text class="iconfont icon-buqian"></text>补签(-{{res.getBQIntegral}}分)</view>
	</view>


	<!-- <view class="current">
		<view class="f-vc">当前连续签到：<text class="days fs34">{{res.getlxnum}}</text> 天</view>
		<view class="f-vc">当前积分：<text class="fs34">{{integral}}</text></view>
	</view> -->
	<!-- <view class="goleft iconfont icon-jianzuo" bindtap="prevMonth">a</view> -->

	<view class="calendar-container">
		<view class="calendar-wrapper">
			<view class="calendar-title">
				<view>{{year}}年{{month}}月</view>
				<!-- 有补签，才要补签卡 -->
				<view wx:if="{{res.getkbqnum}}" class="fs24" style="color:#999;font-weight:bold">补签卡：{{res.getkbqnum}}</view>
			</view>
			<view class="calendar">
				<!-- <view class="selectDate"> -->
				<!-- <view class="goleft iconfont icon-jianzuo" bindtap="prevMonth">a</view> -->
				<!-- <view class="date-wrap">
			  {{year}}年{{month}}月
			 </view> -->
				<!-- <view class="goright iconfont icon-jianzuo" bindtap="nextMonth">b</view> -->
				<!-- </view> -->
				<view class="week">
					<view wx:for="{{weekArr}}" wx:for-index="index" wx:for-item="item" wx:key="key" style="height:{{param-17}}px;line-height:{{param-17}}px;flex:1;">{{item}}</view>
				</view>

				<view class="date">
					<block wx:for="{{dateArr}}" wx:for-index="index" wx:for-item="item" wx:key="key">
						<!-- <view style="{{index ==0?'margin-left:calc(100%/7 * ' + firstDay + ');':''}}width:calc(100%/7);line-height:80rpx;" class="{{index+1==day?'today':''}} {{index+1==day&&isClock?'clockOn':''}}" ><view class="day">{{item}}</view></view> -->
						<view style="width:calc(100% / 7) ; line-height: 80rpx;{{index ==0?'margin-left:calc(100%/7 * 0);':''}}" class="{{item.isCheckIn ? 'active':''}} {{res.curbqdaynum&&item.isBq ? 'bq':''}}" bindtap="clickDay" data-day="{{item.num}}">
							<view class="day">{{item.num}}</view>
						</view>
					</block>
				</view>

			</view>
		</view>

	</view>

	<view class="jfbuy-container">

		<block wx:if="{{ad_data}}">
			<swiper class="swiper" style="height: {{max_sw_height}}rpx;" circular="true" autoplay="true" indicator-dots="true" interval="2500">
				<block wx:for="{{ad_data}}">
					<navigator url="{{item.ad_weapplink}}" wx:if="{{g_filter.has_char(item.ad_weapplink,'plugin')>=0}}">
						<swiper-item class="swiper-item">
							<image src="{{item.ad_code}}" data-index="{{index}}" mode="widthFix" bindload="imageLoad" class="slide-image" lazy-load="true" />
						</swiper-item>
					</navigator>

					<view data-url="{{item.ad_weapplink}}" wx:else bindtap="go_url">
						<swiper-item class="swiper-item">
							<image src="{{item.ad_code}}" class="slide-image" mode="widthFix" bindload="imageLoad" lazy-load="true" />
						</swiper-item>
					</view>
				</block>
			</swiper>
		</block>
		<block wx:else>
			<view class="jfbuy flex">

				<image class="jfbuy-img" src="https://mshop-lib.yolipai.net/template/mobile/new/static/images/integral/liwu.png"></image>
				<view class="right">
					<view>
						<view class="t1">小积分大作为</view>
						<view class="t2">积分抵用现金，积少成多</view>
					</view>
					<view class="t-c">
						<view class="btn-buy" bindtap="goto" data-url="/packageA/pages/jfbuy/jfbuy">去购物 Go!</view>
					</view>
				</view>
			</view>

		</block>
	</view>

	<view class="popup-container" wx:if="{{isShowRules}}">
		<view class="popup-wrapper">
			<view class="popup">
				<view class="popup-title">签到规则</view>
				<view class="popup-content">{{res.qdrules}}</view>
			</view>
			<view class="popup-close">
				<text class="btn-close" bindtap="showRules">X</text>
			</view>
		</view>
	</view>

	<view bindtap="back_to" wx:if="{{show_no_integral}}">
       <view class="cover-layer"></view>
	   <view class="pop_up_no">
            <view class="title" style="position:relative">
				提示
				<image class="close_img" src="{{imgUrl}}/miniapp/images/close.png"></image>
			</view>
            <view class="content">
                 <image style="width:270rpx; height:270rpx; margin:20rpx 0"
						src="{{imgUrl}}/miniapp/images/fenxiao.png"></image>
				 <view style="margin-top:10rpx">商家暂时未开启积分签到，敬请期待哦！ </view>
			</view>
	   </view>
	</view>


</view>