<!--packageF/wxFriendExtend/workWxFriendExtend/workWxFriendExtend.wxml-->


<view class="deposit-wrap size-con" style="--bgColor: {{details.bg_color}};">

  <view class="floating-window" wx:if="{{details.poster_list.length>0}}">
    <swiper class="swiperContainer" circular="{{true}}" vertical="{{true}}" autoplay="{{true}}" interval="{{3000}}">
      <swiper-item class="swiperItem" wx:for="{{details.poster_list}}" wx:key="uid">
        <view class="wrapper">
          <view class="image">
            <image mode="widthFix" src="{{item.has_one_member.avatar_image}}"></image>
          </view>
          <text class="text">{{item.has_one_member.nickname}}生成了海报</text>
        </view>
      </swiper-item>
    </swiper>
  </view>

  <view class="activity-info">
    <view class="info">
      <view class="activity-name text-overHide">{{details.name}}</view>
      <!-- 活动未开始 -->
      <view class="count-down" wx:if="{{details.state==1}}">

        <view>距离活动开始还有</view>
        <van-count-down use-slot time="{{ (details.start_time*1000)-currentTime }}" format="DD 天 HH 时 mm 分 ss 秒"
          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>
      </view>
      <!-- 活动进行中 -->
      <view class="count-down active" wx:if="{{details.state==2 && details.end_time!=-1}}">
        <view>距离活动结束还剩</view>
        <van-count-down use-slot time="{{ (details.end_time*1000)-currentTime }}" format="DD 天 HH 时 mm 分 ss 秒"
          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>
      </view>
      <!-- 活动结束 -->
      <view class="end" wx:if="{{details.state==3}}">活动已结束</view>
    </view>

  </view>


  <!-- 活动进度 -->
  <view class="invite-box container-box">
    <view class="panel-title-box">
      <view class="panel-title-decoration">
        <view class="panel-title-decoration-item"></view>
        <view class="panel-title-decoration-item"></view>
      </view>
      <view class="panel-title-text">邀请进度</view>
      <view class="panel-title-decoration">
        <view class="panel-title-decoration-item-right"></view>
        <view class="panel-title-decoration-item-right"></view>
      </view>
    </view>


    <view class="progress-box">
      <view class="progress-bar-container">
        <view class="progress-bar-current" style="width: {{tool.progress(progressRules,details.step)}};"></view>
        <view class="progress-bar-overall"></view>
      </view>
      <view class="progress-items">
        <view class="progress-item" wx:for="{{progressRules}}">
          <view class="btn" data-item="{{item.step_reward}}" bindtap="setStepReward"
            wx:if="{{item.step_reward && item.step_reward.exist_reward==1}}">查看奖品</view>
          <view style="height: 44rpx;width:110rpx;" wx:else></view>
          <i class="iconfont icon-kehuqunzu"></i>
          <view class="people">{{ item['step_people'] ? item['step_people'] : 0 }}人</view>
        </view>
      </view>

    </view>



    <!-- 进度条 -->
    <!-- <yz-progress wx:if="{{actData.status == 0 && (actData.activity_start <= currentTime) && (currentTime<= actData.activity_end )}}" steps="{{steps}}" stepsList="{{ladderList}}"></yz-progress> -->

    <view class="list-items">
      <view class="list-item {{item.step_level === details.step ? 'active' : ''}}" wx:for="{{ruleLadder}}" wx:key="id">
        <view class="icon">
        </view>
        <view class="content">
          <view class="diff-tip" wx:if="{{item.step_level == details.step}}">
            <view class="current-ladder">当前梯队</view>
            <view style="margin-left: 14rpx;color: #808080;font-size: 24rpx;" wx:if="{{details.next_step}}">
              再邀请{{details.next_step.step_people-details.invite_count}}人可进入下一梯队
            </view>
          </view>
          <view class="stage" wx:if="{{item.step_level!=0}}">
            <text>邀请达到</text>
            <text class="red-text">{{item.step_people}}</text>
            <text>人，即可获得奖励</text>
          </view>
          <view class="stage" wx:else>
            <text>邀请</text>
            <text class="red-text">{{item.step_people}}</text>人以下，无奖励
          </view>
        </view>
        <view class="icon" data-item="{{item.step_reward}}" bindtap="setStepReward"
          wx:if="{{item.step_reward.exist_reward==1}}">
          <i class="iconfont icon-qt_icon_record"></i>
        </view>
        <view class="icon" wx:else></view>

      </view>
    </view>
  </view>


  <!-- 活动说明 -->
  <view class="activity-des container-box">
    <div class="panel-title-box">
      <div class="panel-title-decoration">
        <div class="panel-title-decoration-item"></div>
        <div class="panel-title-decoration-item"></div>
      </div>
      <view class="panel-title-text">活动介绍</view>
      <div class="panel-title-decoration">
        <div class="panel-title-decoration-item-right"></div>
        <div class="panel-title-decoration-item-right"></div>
      </div>
    </div>

    <mp-html class="description" content="{{details.desc_text}}" wx:if="{{details.desc_text}}"></mp-html>
    <view class="des-empty" wx:else>暂无说明</view>
  </view>


  <!-- 参与纪录 -->
  <view class="activity-record container-box">
    <div class="panel-title-box">
      <div class="panel-title-decoration">
        <div class="panel-title-decoration-item"></div>
        <div class="panel-title-decoration-item"></div>
      </div>
      <view class="panel-title-text">生成记录</view>
      <div class="panel-title-decoration">
        <div class="panel-title-decoration-item-right"></div>
        <div class="panel-title-decoration-item-right"></div>
      </div>
    </div>
    <block wx:if="{{details.poster_list.length>0}}">
      <view class="record-list">
        <view class="record-item" wx:for="{{details.poster_list}}" wx:key="uid">
          <view class="timer">{{item.created_at}}</view>
          <image class="avatar" src="{{item.has_one_member.avatar_image}}"></image>
          <view class="name text-overHide">{{item.has_one_member.nickname}}</view>
          <view class="desc">生成了海报</view>
        </view>
      </view>
      <!-- <view class="more red-text" catchtap="loadMore">
      查看更多
      <van-icon name="arrow-down" style="margin-left: 10rpx;" />
    </view> -->
    </block>

    <block wx:if="{{details.poster_list.length==0}}">
      <view class="rec-empty">---暂无记录---</view>
    </block>
  </view>

</view>

<footer wx:if="{{details}}" auto_poster="{{details.auto_poster}}" staff_data="{{details.staff_data}}"
  activity_id="{{activity_id}}" isset_poster="{{details.isset_poster}}" chat_data="{{details.chat_data}}"></footer>

<!-- 悬浮按钮 -->
<view class="float-nav">
  <view class="nav-icon nav-share" bindtap="gotoReward"></view>
</view>


<van-popup show="{{ rewardFlag }}" custom-style="background:transparent;">
  <view style="height:650rpx;">
    <view class="rewardWrapper">
      <view class="rewardTextTitle">奖励内容</view>

      <view class="rewardTextContent">
        <view class="rewardTextItem">
          {{basic_info.point || '积分'}}：<text class="red">+{{stepReward.point ? stepReward.point : 0}}</text>
        </view>
        <view class="rewardTextItem">
          {{basic_info.balance || '余额'}}：<text class="red">+{{stepReward.balance ? stepReward.balance : 0}}</text>
        </view>
        <view class="rewardTextItem">
          {{basic_info.love || '爱心值'}}：<text class="red">+{{stepReward.love ? stepReward.love : 0}}</text>
        </view>
        <view class="rewardTextItem">
          {{basic_info.integral || '消费积分'}}：<text class="red">+{{stepReward.integral ? stepReward.integral : 0}}</text>
        </view>
        <view class="rewardTextItem" wx:if="{{stepReward.coupon && stepReward.coupon.length}}">
          优惠卷：
          <view>
            <view wx:for="{{stepReward.coupon}}">
              {{item.name}}<text class="red">+{{item.reward_num}}张</text>
            </view>
          </view>

        </view>
        <view class="rewardTextItem" wx:if="{{stepReward.member_level}}">
          会员等级：<text class="red">升级至 {{stepReward.member_level.level_name}}</text>
        </view>
      </view>
      <icon bindtap="setRewardFlag" class="close iconfont icon-close11"></icon>

    </view>
  </view>
</van-popup>





<wxs module="tool">
  function progress(arr, level) {
    var index = 0;
    for (var i = 0; i < arr.length; i++) {
      if (arr[i].step_level == level) {
        index = i;
      }
    }
    if (arr.length == 3) {
      if (index == 0) return '14%';
      if (index == 1) return '50%';
      if (index == 2) return '100%';
    } else if (arr.length == 2) {
      if (index == 0) return '14%';
      if (index == 1) return '100%';
    }
    return '0%';
  }


  module.exports.progress = progress;


</wxs>