<!--packageH/deposit_group/activity_index/activity_index.wxml-->
<view class="deposit-wrap size-con" style="--bgColor: {{backgroundRGB[0]}}, {{backgroundRGB[1]}}, {{backgroundRGB[2]}};">
<!-- 头部轮播栏 -->
  <view class="floating-window" wx:if="{{actData.activity_order.length > 0}}">
		<swiper class="swiperContainer" circular="{{true}}" vertical="{{true}}" autoplay="{{true}}" interval="{{3000}}">
			<swiper-item class="swiperItem" wx:for="{{actData.activity_order}}" wx:key="index">
				<view class="wrapper">
					<view class="image">
						<image mode="widthFix" src="{{item.member.avatar}}"></image>
					</view>
					<text class="text">{{ item.member.nickname }}支付了定金</text>
				</view>
			</swiper-item>
		</swiper>
	</view>

  <view class="activity-info">
    <view class="info">
      <view class="info-bg"></view>
      <view class="activity-name">{{actData.activity_name}}</view>
      <!-- 活动未开始 -->
      <view class="count-down not-start" wx:if="{{actData.status == 0 && (currentTime < actData.activity_start)}}" >
        <view>距离活动开始还有</view>
        <van-count-down use-slot time="{{ activity_start }}"
          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:elif="{{actData.status === 0 && (actData.activity_end > currentTime)}}">
        <view>距离活动结束还剩</view>
        <van-count-down use-slot time="{{ activity_end }}"
        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:else>活动已结束</view>
    </view>
    <!-- 商品信息 -->
    <view class="com-info" bindtap="getGoodDetail">
      <image src="{{actData.bind_goods.thumb_src}}" class="com-left-img"></image>
      <view class="com-right-box">
        <view class="com-title">{{actData.bind_goods.title}}</view>
        <view class="com-opt"  wx:if="{{actData.bind_goods.has_option == 1}}" >
           规格：{{actData.goods_option.title}}
        </view>
        <view class="com-price">￥{{actData.bind_goods.price}}</view>
        <view class="com-deposit">
          <text>定金： ￥{{actData.deposit * goods_count}}</text>
          <view class="num">
            <view class="reduce-goods" catchtap="changeGoodCount" data-num="-1">-</view>
            <view class="good-num" >{{goods_count}}</view>
            <view class="add-goods" catchtap="changeGoodCount" data-num="1">+</view>
          </view>
        </view>
      </view>
    </view>
  </view>

  <!-- 活动规则 -->
  <view class="activity-rule container-box">
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <view class="title">活动规则</view>
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <!-- 进度条 -->
    <yz-progress wx:if="{{actData.status == 0 && (actData.activity_start <= currentTime) && (currentTime<= actData.activity_end )}}" steps="{{steps}}" stepsList="{{ladderList}}"></yz-progress>

    <block>
      <view class="rule-condition {{steps === index ? 'act-state' : ''}}" wx:for="{{ladderList}}" wx:key="index">
        <view class="diff-tip" wx:if="{{steps === index && index !== ladderList.length - 1}}">
          <view class="current-ladder">当前梯队</view>
          <view style="line-height: 24px;" wx:if="{{actData.ladder_type === 0}}">
            还差<text>{{ladderList[index + 1].deal_num - actData.order_count}}</text>人可以进入下一梯队
          </view>
          <view style="line-height: 24px;" wx:else>
            还差<text>{{ladderList[index + 1].sale_num - actData.sale_count}}</text>件可以进入下一梯队
          </view>
        </view>
        <view class="stage">
          <text>{{(actData.ladder_type === 0)?'支付':'销售'}}</text>达到
          <text class="red-text">{{(actData.ladder_type === 0)?item.deal_num:item.sale_num}}</text>
          <text>{{actData.ladder_type === 0 ? '人':'件'}}</text>
          <text wx:if="{{index === 0}}">以下</text>，价格<text class="red-text">￥{{item.deal_price}}</text>
        </view>
      </view>
    </block>
  </view>

  <!-- 活动说明 -->
  <view class="activity-des container-box">
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <view class="title">活动说明</view>
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <rich-text class="description" nodes="{{richNode}}" wx:if="{{actData.activity_explain}}"></rich-text>
    <view class="des-empty" wx:else>暂无说明</view>
  </view>

  <!-- 参与纪录 -->
  <view class="activity-record container-box">
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <view class="title">参与纪录</view>
    <div class="panel-title-decoration">
      <div class="panel-title-decoration-item"></div>
      <div class="panel-title-decoration-item"></div>
    </div>
    <block wx:if="{{recordList.length > 0}}">
      <view class="record-list">
      <view class="record-item" wx:for="{{recordList}}" wx:key="index">
        <view class="rank">{{actData.activity_order_count - index}}</view>
        <image class="avatar" src="{{item.member.avatar}}"></image>
        <view class="name">{{item.member.nickname}}</view>
        <view class="timer">{{item.created_at}}</view>
      </view>
    </view>
    <view class="more red-text" catchtap="loadMore" wx:if="{{isMore}}">
      查看更多
      <van-icon name="arrow-down" style="margin-left: 10rpx;" />
    </view>
    </block>

    <block wx:else>
      <view class="rec-empty">---暂无记录---</view>
    </block>
  </view>

	<!-- 悬浮按钮 -->
	<view class="float-nav">
    <view class="nav-bonus" bindtap="openShareShow" wx:if="{{actData.commission > 0}}">
      <view class="bonus-img">
        <view class="bouns-text red-text">￥{{actData.commission}}</view>
      </view>
    </view>
    <view class="nav-icon nav-share" bindtap="openShareShow" wx:else></view>
    <view class="nav-icon nav-order" bindtap="gotoOrder"></view>
    <view class="nav-icon nav-rank" bindtap="gotoRankList" wx:if="{{actData.ranking_list == 1}}"></view>
  </view>

  <!-- 弹起分析面板 -->
  <van-share-sheet
    class="yz-share-sheet"
    title="{{shareText}}"
    show="{{ shareShow }}"
    options="{{options}}"
    bind:share="share"
    bind:close="onCloseShare"
    bind:select="onSelectShare"
  >
  </van-share-sheet>

  <!-- 海报 -->
  <yz-share-poster isshow="{{posterShow}}" activityid="{{activity_id}}" ></yz-share-poster>

  <!-- 商品详情 -->
  <yz-goods-detail
    show="{{goodsPopupShow}}"
    bind:addCart="goodsDetailCartAdd"
    goodsInfo="{{goodsInfo}}"
    OrderNum="{{goods_count}}"
  ></yz-goods-detail>

<!-- 客服弹框 -->
  <yz-kefu-pop showKefu="{{showKefu}}" serviceInfo="{{serviceInfo}}"></yz-kefu-pop>


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

  <!-- 协议签订 -->
  <van-popup
    class="agr-popup"
    show="{{showAgrPopup}}"
    round="{{true}}"
    bind:close="closeAgreementPopup"
    closeable="{{true}}"
    custom-style="width: 80%;"
  >
    <block wx:if="{{contractId}}">
      <view class="agr-title">定金合同</view>
      <view class="contract">
        <view class="contract-text"> 为了保障您的合法权益，参加活动交付定金前需签订本活动电子合同！</view>
        <view class="contract-text red-text">电子合同和纸质合同一样具备同等法律效力！</view>
        <view class="contract-text" style="font-weight: 700;">
          点击下方去签合同跳转合同页面签订电子合同，签订完成后再次点击进入活动页面即可支付定金，参加我们的活动！
        </view>
      </view>
      <view class="btn-agreed"  catchtap="gotoSignPage">去签合同</view>
    </block>
    <block wx:else>
      <view class="agr-title">定金协议</view>
      <view class="agr-content">{{actData.agreement_content}}</view>
      <view class="btn-agreed"  catchtap="agreement">我已阅读并确认</view>
    </block>

  </van-popup>

</view>

<yz-custom-foot
  showReserve="{{true}}"
  bind:buyNow = "buyNow"
  cservice="{{cservice}}"
  isNocar="{{actData.status != 0 || actData.activity_end < currentTime || currentTime < actData.activity_start}}"
></yz-custom-foot>

