<!--pages/spellDetail/index.wxml-->
<navbar back home text="{{barTitle}}" background='#fff'></navbar>
<view style="height:{{navigationBarHeight}} "></view>
<view class='container' >
   <!-- 拼团产品详情 -->
  <view class='detail'>
    <view class='detail-top'>
      <view class='detail-top01'>
        <image src='{{data.coverImg}}' mode="aspectFill"></image>
      </view>
      <view class='detail-top02'>
        <view class='title'>{{data.title}}</view>
        <view class='des'>{{data.subTitle}}</view>
      </view>
      <view class='detail-top03'>
        <view class='detail-p-price'>{{data.salePrice}}</view>
        <view class='detail-p-name'>「拼团价」￥</view>
      </view>
    </view>
    <view class='detail-bottom' wx:if="{{isMyself==true}}">
      <view class='b-price'>{{data.salePrice}}</view>
      <view class='b-unit'>￥</view>
      <view class='b-name'>实付款</view>
    </view>
    <image class="frImg" wx:if="{{data.status == 10}}" src="{{orangeImg}}" mode="aspectFill" lazy-load="true"><text>{{data.statustext}}</text></image>
    <image class="frImg" wx:if="{{data.status == 11}}" src="{{blueImg}}" mode="aspectFill" lazy-load="true"><text>{{data.statustext}}</text></image>
    <image class="frImg" wx:if="{{data.status != 11&&data.status != 10}}" src="{{grayImg}}" mode="aspectFill" lazy-load="true"><text>{{data.statustext}}</text></image>
    
  </view>

  <!-- 拼团状态-拼团中，拼团成功 -->
  <view class='status' wx:if="{{isMyself==true}}" style='margin-top:30rpx;'>
    <view class='status-center' style='{{"width:"+(120*data.userList.length>634?634:120*data.userList.length)+"rpx;"+"margin:0 auto;"}}'>
      <view class='status-lists'>
        <view class='tuanzhang touxiangitems' wx:for="{{data.userList}}" wx:key="{{index}}+','">
          <view class='touxiang' wx:if='{{item.avatarUrl}}'>
            <image src='{{item.avatarUrl}}'></image>
          </view>
          <view class='tuan-icon' wx:if='{{index==0}}'>
            <image src='{{tuanzhang}}'></image>
          </view> 
          <view class='no-touxiang' wx:if='{{!item.avatarUrl}}'>
            ?
          </view>
        </view>
      </view>
      <!-- <view class='need' >还差 <text class='needNum'>{{data.remainPeople}}人</text>拼团成功，赶快邀人！</view> -->
    </view>
    <view class='status-top' wx:if='{{data.status==10}}' style="width:332rpx;margin:0 auto;">
      <view class='p-text'>结束</view>
      <view class='p-time'>{{sec}}</view>
      <view class='p-mao'>:</view>
      <view class='p-time'>{{min}}</view>
      <view class='p-mao'>:</view>
      <view class='p-time'>{{hour}}</view>
      <view class='p-mao'>天</view>
      <view class='p-time'>{{day}}</view>
      <view class='p-text'>剩余</view>
    </view>
    <view class='status-des' wx:if='{{data.status==10}}'>
      <view class='p-des'>
        <view class='p-des-text'>还差</view>
        <view class='p-des-num'>{{data.remainPeople}}人</view>
        <view class='p-des-text'>拼团成功，赶快邀人</view>
      </view>
    </view>
    <view class='status-des' wx:if="{{data.status==11&&isMyself==true}}">
      <view class='p-des'>
        <view class='p-des-num'>拼团成功！</view>
      </view>
    </view>
    <view class='status-des' wx:if="{{data.status==12||data.status==13&&data.couponStatus==0}}">
      <view class='p-des'>
        <view class='p-des-text' style='color:#ccc;'>拼团失败！</view>
      </view>
    </view>
    <button class='share user-motto' wx:if="{{data.status==10&&isMyself==true&&data.couponStatus==0}}" id="shareBtn" open-type="share">邀请好友拼团</button>
    <button class='share user-motto' wx:if="{{data.status==11&&isMyself==true}}" bindtap='gotoUse'>拼团完成</button>
    <button class='share user-motto' wx:if="{{data.status==12||data.status==13&&data.couponStatus==0}}" bindtap='gotoAgain'>重新拼团</button>
    <view class='status-bottom'>
      <view class='position-icon'>
        <image src='{{position}}'></image>
      </view>
      <view class='position'>广场地址：{{data.addr}}</view>
    </view>
  </view>

  <!-- 拼团状态-除拼团失败，拼团超时  wx:if='{{data.status!=10&&!isMyself}}'-->
  <view class='status' wx:if='{{data.status!=10&&!isMyself}}' style='padding:0;overflow:hidden;margin-top:30rpx;'>
    <view class='status-center' style='margin:0 20rpx;width:650rpx;box-sizing:border-box;'>
      <view class='status-lists' style='{{"width:"+(120*data.userList.length>634?634:120*data.userList.length)+"rpx;"+"margin:0 auto;"}}'>
        <view class='tuanzhang touxiangitems' wx:for="{{data.userList}}" wx:key="{{index}}+'*'">
          <view class='touxiang' wx:if='{{item.avatarUrl}}'>
            <image src='{{item.avatarUrl}}'></image>
          </view>
          <view class='tuan-icon' wx:if='{{index==0}}'>
            <image src='{{tuanzhang}}'></image>
          </view> 
          <view class='no-touxiang' wx:if='{{!item.avatarUrl}}'>
            ?
          </view>
        </view>
      </view>
    </view>
    <view class='status-top' style='margin:0 20rpx;width:650rpx;box-sizing:border-box;'>
      <view class='p-status' style='text-align:center;width:100%;'>{{data.statustext}}</view>
    </view>
    <!-- 按钮 -->
    <view class='button' style='padding:0 20rpx;'>
      <button class='share user-motto' bindtap='gotoshare'>发起拼团</button>
      <button class='share user-motto' bindtap='gotoSearch'>更多拼团商品</button>
    </view>
    <view class='status-bottom' style='padding:0 20rpx;box-sizing:border-box;'>
      <view class='position-icon'>
        <image src='{{position}}'></image>
      </view>
      <view class='position'>广场地址：{{data.addr}}</view>
    </view>
  </view>

  <!-- 拼团订单信息 -->
  <view class='order'>
    <view class='order-list'>
      <view class='order-title'>订单编号：</view>
      <view class='order-text'>{{paramData.orderId}}</view>
    </view>
    <view class='order-list'>
      <view class='order-title'>团单编号：</view>
      <view class='order-text'>{{data.orderGroupId}}</view>
    </view>
  </view>
  <view class='alert-bg' wx:if='{{showAlert&&data.status!=11}}' bindtap='gotoClose'></view>
  <view class='alert-box' wx:if='{{showAlert&&data.status!=11}}'>
    <view class='alert-close' bindtap='gotoClose'>
      <image src='{{close03}}'></image>
    </view>
    <view class='alert-title'>商品已下架</view>
    <view class='alert-button'>
      <button class='share user-motto' bindtap='gotoSpellList'>更多拼团商品</button>
    </view>
  </view>
</view>
