<!--pages/signIn/index.wxml-->
<page-wrap id="Page" wx:if="{{showPage}}">

<custom-page head-bg-image="{{activity.themePic}}" bind:sizes="handlePageSizes">
    <topbar slot="head" title="签到中心" back-color="{{mainColor}}" title-color="{{mainColor}}" />
    <!-- 页面主体 -->
    <view slot="body" class="sign-scroll-body">
        <view class="sign-info-extra" style="color: {{mainColor}};">
            <view class="coupon_num_box">
                <view class="my_coupon_title">签到优惠券</view>
                <view class="_num_arear">
                    <text class="_num">{{notUseNum}}</text>
                    <text class="_unit">张</text>
                    <view class="_btn" style="border-color: {{mainColor}};" wx:if="{{notUseNum > 0}}">
                    <jumpmallapp>去使用</jumpmallapp>
                    </view>
                </view>
                <view class="_look_btn" catchtap="toRecordDetailPage">明细 | 查看</view>
            </view> 
        </view>
        <!-- 签到卡片 -->
        <view class="sign-card-box" style="border-color: {{thirdColor}};">
            <view class="sign-item-box">
                <view class="_left">
                    <view class="_item" wx:for="{{signInNodes}}" wx:key="index" >
                        <image class="_figure {{item.isSignIn == -1 || item.isSignIn == 1 ? '_signed': ''}}" src="{{item.figure}}" mode="aspectFill" />
                        <image wx:if="{{item.isSignIn == -1}}" class="_lose_sign_in" src="/images/signIn/losesign.png" />
                        <image wx:if="{{item.isSignIn == 1}}" class="_finish_sign_in" src="/images/signIn/finishsign.png" />
                    </view>
                </view>
                <view class="_right">
                    <view class="_item">
                        <image class="_figure {{lastSignInNode.isSignIn == -1 || lastSignInNode.isSignIn == 1 ? '_signed':''}}" src="{{lastSignInNode.figure}}" mode="aspectFill" />
                        <image wx:if="{{lastSignInNode.isSignIn == -1}}" class="_lose_sign_in" src="/images/signIn/losesign.png" />
                        <image wx:if="{{lastSignInNode.isSignIn == 1}}" class="_finish_sign_in" src="/images/signIn/finishsign.png" />
                    </view>
                </view>
            </view>
            
            <block wx:if="{{todayIsSigned}}">
                <view class="_sign_in_btn" style="background-color:{{thirdColor}};">今日已签到</view>
            </block>
            <block wx:else>
                <view class="_sign_in_btn" style="{{backGroundStyle}}" catchtap="tapSignIn">
                    签到领好礼
                    <button wx:if="{{!isLogin}}" class="phone-button" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" />
                </view>
            </block>

        </view>

        <!-- 签到任务列表 -->
        <view wx:if="{{showTaskCard}}" class="sign-task-box">
            <view class="_task_title">做任务领优惠券</view>
            <view class="_task_list">
                <!-- 签到项 -->
                <view wx:for="{{activity.taskAwardList}}" wx:key="index" class="_task_item">
                <view  class="_task_item_left">
                    <view class="_ico">
                        <image src="{{item.figure}}" mode="aspectFill" />
                    </view>
                    <view class="_info">
                            <view class="_title">{{item.taskTitle}}</view>
                            <view class="_des">{{item.taskSubtitle}}</view>
                    </view>
                </view>
                <view class="_task_item_right">
                    <view style="color:#999;" class="_btn" wx:if="{{item.isComplete == 1}}">
                        已完成
                    </view>
                    <view style="color: {{mainColor}};" class="_btn" wx:else>
                        未完成
                    </view>
                </view>
                </view>
            </view>
        </view>

        <!-- 活动说明 -->
        <view class="activity-des">
            <view class="_title">活动说明</view>
            <view class="_des">
                <text user-select>{{activity.activityDesc}}</text>
            </view>
        </view>
    </view>
</custom-page>

<!-- 签到成功弹窗 -->
<view class="dlg" wx:if="{{showSignInSuccessDlg}}">
    <view class="sign-pop-body">
        <view class="_body">
           <view class="gift_wrap">
                <jumpmallapp>
                    <view class="coupon_node">
                        <view class="_node_left">
                            <view class="_coupont_title">{{hitResult.couponTitle}}</view>
                            <view class="_coupon_sub_title">{{hitResult.formatLeastCostStr}}</view>
                            <view class="_coupon_times"></view>
                        </view>
                        <view class="flex-column">
                            <view wx:if="{{hitResult.couponType=='D'}}" class="_node_right _zk {{hitResult._classSmallStyle}}">
                                <view class="_num">{{hitResult.formatDiscount}}</view>
                                <view class="_zhe">折</view>
                            </view>
                            <view wx:if="{{hitResult.couponType=='C'}}" class="_node_right _cash {{hitResult._classSmallStyle}}">
                                <view class="_unit">¥</view>
                                <view class="_num">{{hitResult.formatReduceCost}}</view>
                            </view>
                            <view class="_coupon_use_text">立即使用</view>
                        </view>
                        <image wx:if="{{hitResult.couponType=='D'}}" class="_bg" src="https://dy.shpr.top/welfareGo/discount.png" />
                        <image wx:if="{{hitResult.couponType=='C'}}" class="_bg" src="https://dy.shpr.top/welfareGo/cash.png" />
                    </view>
                </jumpmallapp>
           </view>
           <view class="award_des" style="color:{{secColor}};">恭喜您签到成功</view>

           <view class="_btn" style="{{backGroundStyle}}">
            <jumpmallapp>去使用</jumpmallapp>
           </view>

        </view>
        
        <image class="_layer_bg" src="{{activity.popBgPic}}" />
    </view>
    
    <view class="_layer" catchtap="closeDlg" >
        <image class="_close" src="/images/signIn/close.png" />
    </view>
</view>

</page-wrap>