<template name="group">
  <view class="group">
    <scroll-view scroll-y="{{true}}">
      <view class="group-container">
        <block wx:for="{{groupData.recommendList}}" wx:key="{{index}}">
          <view class="group-bars">
            <view class="group-head">
              <image src="{{item.avatar}}"></image>
              <text>{{item.wechatName}}</text>
            </view>
            <view class="group-jion">
              <view class="top-title">
                <text>{{item.productTitle}}</text>
                <text>{{item.headCount}}人团</text>
              </view>
              <view class="group-detail">
                <view class="number">
                  <text>还剩<text class="red-text">{{item.headCount - item.joinCount}}</text>人成团</text>
                  <text>剩余{{item.lastTime}}结束</text>
                </view>
                <view class="jion-btn" bindtap="groupDetail" data-ind="{{index}}" data-id="{{item.id}}" >
                  {{groupData.isIOS ? '助力' : '去参团'}}
                </view>
              </view>
            </view>
          </view>
        </block>
        <view class="btn-area">
            <view class="btn-item" bindtap='toMyCollage' wx:if="{{groupData.myGroupGoing > 0 && groupData.totalSize >3 }}">我的{{groupData.isIOS ? '助力' : '拼团'}}<text class="red-text">({{groupData.myGroupGoing}})</text>
              <!-- <image src="../../static/image/little_firends.png" /> -->
            </view>
            <view class="btn-item {{groupData.totalSize === 0 ? 'expect-margin' : ''}}"  wx:if="{{groupData.myGroupGoing <= 0 || groupData.totalSize <=3 }}" bindtap="more" data-type="course ">
               开个团试试
              <!-- <image src="../../static/image/little_firends.png" /> -->
            </view>
            <view class="btn-item" wx:if="{{groupData.totalSize >3}}" bindtap="change">换一批看看
              <!-- <image src="../../static/image/refresh.png" /> -->
            </view>
            <!-- <view class="btn-item expect-margin"  wx:if="{{groupData.totalSize === 0}}" bindtap="more" data-type="course ">
               开个团试试
              <image src="../../static/image/little_firends.png" />
            </view> -->
        </view>
      </view>
      <view class="title">
        <text class="title-regular left">全部课程</text>
        <!-- <view class="right" bindtap="more" data-type="course">
          更多
          <image src="../../static/image/black_to.png" />
        </view> -->
      </view>
      <view class="whole-group">
        <view class="group-box">
          <block wx:for="{{groupData.bookList}}" wx:key="{{index}}">
            <view class="group-item" data-id="{{item.id}}" data-title="{{item.title}}" bindtap="goToBook">
              <image class="item-img" src="{{item.iconImg}}"></image>
              <view id="grade">{{item.subTitle}}</view>
            </view>
          </block>
        </view>
      </view>
    </scroll-view>
  </view>
  <!-- <MyToast bindShowAlert="showAlert" wx:if="{{groupData.alertFlag}}"  /> -->
</template>