<!--packageH/newDraw/newDrawIndex/newDrawIndex.wxml-->
<wxs src="../../../utils/timeTranslate.wxs" module="timeTranslate"></wxs>
<view id="new_draw"
  style="background-image:url('https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/newdraw_bg.png')">
  <view class="top-main">
    <view class="award-life  flex-column-stlye" bindtap='gotoWinnersList' data-num="{{info.current_round}}">
      <icon class="icon-fontclass-dashang iconfont"></icon>
      <view class="text-color-box">中奖名单</view>
    </view>
    <view class="text-img">
      <image class="text-img-src" mode="heightFix" src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/text-img.png" alt="" />
    </view>
    <view class="share-sheet ">
      <view class="sheet-chilid flex-column-stlye" bindtap="onClickShowShare">
        <icon class="icon-share iconfont"></icon>
        分享
      </view>
      <view class="sheet-chilid flex-column-stlye" wx:if="{{info.is_complaint == 1}}" bindtap="gotoLotteryComplaint">
        <icon class="icon-fontclass-tousu iconfont"></icon>
        投诉
      </view>
    </view>
  </view>
  <!-- main -->
  <view class="main">
    <view class="active-time" wx:if="{{info.start_time}}">活动时间：{{ timeTranslate.timestampToTime(info.start_time) }} -
      {{ timeTranslate.timestampToTime(info.end_time) }}</view>
    <view class="active-introduce">
      <view class="active-big-title">{{ info.activity_name }}</view>
      <view class="ul">
        <view class="li">共{{ info.turn_num }}轮</view>
        <view class="li">每轮{{ info.limit_num }}次机会</view>
        <view class="li">参加次数达到{{ info.max_num }}次自动开奖</view>
        <view class="li" wx:if="{{info.is_share}}">邀请1位好友参与可获得1次参与机会，限获得{{ info.share_num }}次</view>
      </view>
      <view class="active-rounds">
        当前第<em>{{ info.current_round }}</em>轮，<em>{{ info.activity_num }}</em> 人可参与
      </view>
      <view class="active-num">
        剩余次数：<em>{{ info.member_num }}次</em>
      </view>
      <view class="lottery-btn {{!addBtn_status ? 'dont' : ''}}" bindtap="addActivity">{{ btn_text }}</view>
      <view class="add-member">
        <image wx:for="{{info.participants}}" class="member-info" src="{{item}}" />
      </view>
      <view class="schedule">
        <view class="progress-text">进度</view>
        <view class="progress">
          <progress percent="{{percent}}" show-info color="#ffb700" active stroke-width="3" />
        </view>
      </view>
    </view>
    <!--  -->
    <view class="template-box">
      <view class="template-box-title">奖品</view>
      <view class="template-box-main">
        <view class="reward-good flex-column-stlye" catchtap="getGoodsDetails" data-id="{{info.goods_id}}">
          <image src="{{info.goods_thumb}}" alt="" class="good-img" />
          <view class="good-title">{{ info.goods_title }}</view>
        </view>
      </view>
    </view>
    <!--  -->
    <view class="template-box">
      <view class="template-box-title">抽奖规则</view>
      <view class="template-box-main">{{ info.rule }}</view>
    </view>
    <!--  -->
    <view class="template-box">
      <view class="template-box-title">活动介绍</view>
      <view class="template-box-main">
        <rich-text nodes="{{info.explain}}" class="msg-text"></rich-text>
      </view>
    </view>
  </view>
  <!-- 右侧悬浮按钮 -->
  <view class="fiexd-btn-right">
    <view class="btn-child" bindtap="getComment">
      <icon class="iconfont icon-fontclass-pinglun1"></icon>
      {{ info.comment_num }}
    </view>
    <view class="btn-child" bindtap="getCollection"
      style=" color: {{info.is_collection == 1 ? '#f14e4e' : '#939393' }}">
      <icon class="iconfont icon-fontclass-pingfen"></icon>
      {{ info.collection_num }}
    </view>
  </view>
  <!-- 底部按钮 -->
  <view class="nav-bottom ">
    <view class="nav-b-chlid" bindtap="gotoLuckyDraw" data-tag="activity">
      <icon class="iconfont icon-fontclass-dashang"></icon>
      更多抽奖
    </view>
    <view class="nav-b-chlid" bindtap="gotoMydraw">
      <icon class="iconfont icon-fontclass-wode"></icon>
      我的抽奖
    </view>
  </view>
  <!-- 评论弹窗 -->
  <van-popup show="{{ showcomment}}" position="bottom" custom-style="height: 80%" closeable round
    bind:close='closeComment'>
    <view class="comment-box flex-column-stlye">
      <view class="comment-titel">{{ commentlist.length }}条评论</view>
      <view class="comment-list">
        <view class="comment-child" wx:for="{{commentlist}}">
          <image src="{{item.avatar}}" alt="" class="member-img" />
          <view class="comment-child-right flex-column-stlye">
            <view class="member-name">{{ item.nickname }}</view>
            <view class="comment-text">{{ item.content }}</view>
            <view class="comment-time">{{ item.created_at }}</view>
          </view>
        </view>
        <view wx:if="{{total_page != 0 && isLoadMore && page < total_page}}" bindtap="getMoreData">点击加载更多...</view>
      </view>
      <view class="send-box">
        <input type="text" value="{{comment_input}}" bindinput='bindinputComment' id="send-input" placeholder="留下你精彩的评论吧~" />
        <view class="send-btn" bindtap="sendComment" style=" color:{{ comment_input ? '#f14e4e' : '#999'}}">发送</view>
      </view>
    </view>
  </van-popup>
  <van-popup show="{{showInfo}}" class="award-information" position="bottom" custom-style="height: 80%">
    <van-nav-bar title="参与抽奖" right-text="返回" bind:click-right="onClickRight" />
    <view class="add-num">
      <view class="add-num-name flex-column-stlye">
        <view class="name1">参与次数</view>
        <view class="name2">
          您最多可参与{{ activityInfo.activity_num > activityInfo.surplus_num ? activityInfo.surplus_num : activityInfo.activity_num }}次
        </view>
      </view>
      <view class="add-num-tepper">
        <van-stepper value="{{addNum}}" theme="round" button-size="22" disable-input bind:change="onChangeaddNum"
          max="{{activityInfo.activity_num > activityInfo.surplus_num ? activityInfo.surplus_num : activityInfo.activity_num}}" />
      </view>
    </view>
    <van-cell-group wx:if="{{activityInfo.type == 2 && activityInfo.need_address == 1}}">
      <van-field value="{{ tel }}" label="手机号" placeholder="请输入手机号" border="{{ false }}"
        bind:change="onChangeTel" />
    </van-cell-group>
    <view class="address-box" wx:else>
      <view class="address-title">收货地址</view>
      <view class="addr" bindtap="getAddress" wx:if="{{Object.keys(activityInfo.address).length != 0}}">
        <icon class="fa fa-map-marker"></icon>
        <view class="address-info">
          <view class="address-namenick">收货人:{{ activityInfo.address.username }} {{ activityInfo.address.mobile }}
          </view>
          <view class="address-shipping">
            {{ activityInfo.address.province }} {{ activityInfo.address.city }} {{ activityInfo.address.district }}
            {{ activityInfo.address.street || "" }} {{ activityInfo.address.address }}
          </view>
        </view>
        <icon class="fa fa-angle-right"></icon>
      </view>
    </view>
    <view class="confirm-address-btn" bindtap="joinActivity">确定</view>
  </van-popup>

  <van-share-sheet show="{{ showShare }}" title="立即分享给好友" options="{{ options }}" bind:select="onSelectShare"
    bind:close="onCloseShare" />
  <!-- 海报弹窗 -->
  <!-- <van-popup show="{{showposter}}" position="center" custom-style="background-color: transparent;" bind:close="onClosePoster">
    <image src="{{poster_url}}" alt="" style="width: 16rem;" mode='widthFix'/>
  </van-popup> -->
  <draw-qrcode isshow="{{showposter}}" activeid="{{activeid}}" ></draw-qrcode>
  <yz_addressList show="{{showAddress}}" bind:confirm="confirmSelectAddress"></yz_addressList>

  <yz-goodsPopup show="{{goodsPopupShow}}" goodsInfo="{{hand_goods_obj}}" addCartBtn='{{false}}'></yz-goodsPopup>
</view>