<!--packageC/redPacket/personRed/personRed.wxml-->
<view class="person-red">
    <view class="record-box">
        <view class="record-btn" bindtap="goPersonList">个人记录</view>
    </view>
    <view class="text-img">
        <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/personRed/txt.png"  mode="widthFix"></image>
    </view>
    <view class="grant-gift">
        <view class="grant-btn" catchtap="goPersonRedIssue"  wx:if="{{show_button}}">发红包</view>
    </view>
    
    <view class="gift-list" wx:if="{{redpack_list.length > 0}}">
        <view class="gift-item" wx:for="{{redpack_list}}" wx:key="item.id">
            <view style="display:flex;">
                <image class="left-img" src="{{item.thumb}}" mode="aspectFit"></image>
                <view class="right-box">
                    <view class="gift-title">{{item.title}}</view>
                    <view class="user-info">
                        <image class="avatar" src="{{item.member ? item.member.avatar_image : ''}}"></image>
                        <text class="nickname">发放人: {{item.member ? item.member.nickname : ''}}</text>
                    </view>
                    <view class="end-time">
                        红包截止时间: 
                        <view>{{item.created_at}} - {{item.valid_time_date}}</view>
                    </view>
                </view>
            </view>
            <view class="btn-box">
                <block wx:for="{{item.buttons}}" wx:for-item="btn" wx:for-index="ind" wx:key="ind">
                    <view class="grab-btn" wx:if="{{btn.status == 1}}" catchtap="receiveGift" data-redpack="{{item}}" >{{btn.name ? btn.name : '抢红包'}}</view>
                    <view wx:if="{{btn.status != 1 && ind === 0}}" class="received">已领取</view>
                    <view wx:if="{{btn.status != 1 && ind === 1}}" class="receiv-record" bindtap="goPersonRedRecord" data-rid="{{item.id}}">领取记录 </view>
                </block>
            </view>
        </view>
       
        <block>
            <view class="more" wx:if="{{!finished}}" bindtap="getMoreData">显示更多<van-icon name="arrow-down" /></view>
            <view class="more" wx:else style="color:#000">没有更多</view>
        </block>
    </view>
    <van-empty  wx:else image="default" description="暂无红包~"></van-empty>
</view>

<van-popup 
    class="giftPopup" 
    show="{{ showGiftPopup }}" 
    bind:close="closePopup" 
    custom-style="width: 700rpx; height: 670rpx;background: transparent;overflow: visible;" 
    closeable close-icon="close" close-icon-position="bottom"
>
    <view class="red-gift">
        <view class="gift-bitle"><text class="nickname">{{redpack_name}}</text> 发出的红包</view>
        <image src="{{redpack_img}}" class="gift-img"></image>
        <view class="btn-receive" bindtap="openGift">立即拆开</view>
    </view>
</van-popup>

<van-popup class="succeedPopup" show="{{showSuccessPopup}}" custom-style="width: 100%; height: 670rpx;background: transparent;overflow: visible;" >
    <view class="received-gift">
        <view class="succeed-tip">您已成功领取 <text class="name">{{receivedSucceed.nickname}}</text>的红包可到{{customBalance}}里查看</view>
        <view class="amount">￥{{receivedSucceed.amount}}</view>
        <view class="btn-confirm" catchtap="confirm">确认</view>
    </view>
</van-popup>

<van-popup show="{{showRejectPopup}}" custom-style="width: 80%;"  round>
    <view class="reject-tip">
        <view class="tip">
            <van-icon class="info-o" name="info-o" />
            <text>{{rejectMess}}</text>
        </view>
        <view class="btn-min-confirm" bindtap="hideRejectPopup">确认</view>
    </view>
</van-popup>
