<ep-navBar title="拼团详情" background='linear-gradient(90deg,#ff5041 0%,#ff695c 100%)' back="{{true}}" iconTheme='white' color='#fff' bindback="handlerGobackClick"/>
<view class="pinBox">
  <view class="pinStatus bg-f mb10" wx:if="{{pin_info.state==1}}">
    <view class="title">
      <text class="iconfont icon-gou"></text> 拼团成功</view>
    <view class="tip" wx:if="{{is_me ==1}}">
      <block wx:if="{{order_type!='ignore'}}">
        已成功下单，可在会员中心
        <text bindtap="goLink" data-link="/eaterplanet_ecommerce/pages/order/order?id={{order_id}}">查看订单</text>
      </block>
    </view>
    <view class="tip" wx:else>团长人气太高，已拼团成功啦</view>
  </view>
  <view class="goodsInfo">
    <text class="iconfont icon-pintuanzhong" wx:if="{{pin_info.state==0}}"></text>
    <text class="iconfont icon-pintuanchenggong" wx:elif="{{pin_info.state==1}}"></text>
    <text class="iconfont icon-pintuanshibai" wx:elif="{{pin_info.state==2}}"></text>
    <i-goods-info goodsInfo="{{goods_info}}" skin="{{skin}}"></i-goods-info>
  </view>
  <!-- 团长信息 -->
  <view class='group bg-f mb10' bindtap="goLink" wx:if="{{pintuan_model_buy==1&&pintuan_show_community_info==1&&changeCommunity&&changeCommunity.communityName}}" data-link="{{hide_community_change_btn==0?'/eaterplanet_ecommerce/pages/position/community':''}}">
    <view class="group-avatar">
      <image src='{{changeCommunity.headImg||changeCommunity.disUserHeadImg}}'></image>
    </view>
    <view class='group-m'>
      <view class='group-title'>{{changeCommunity.communityName}}</view>
      <view class='group-desc'><text style="color:#333;">取货地址:</text>{{changeCommunity.fullAddress}}</view>
    </view>
    <view class='group-r' wx:if="{{hide_community_change_btn==0}}">
      <image class="group-r-icon" src="../../images/community-right-arrow.png"></image>
    </view>
  </view>

  <view class="pinMember bg-f mb10">
    <view class="status">
      <block wx:if="{{pin_info.state==0}}">
        <view class="title">仅剩
          <text class="red" style="color:{{skin.color}}">{{surplus}}</text>个名额，团满即可拼团成功</view>
        <view class="time">
          <i-count-down countdownClass="count-down" itemClass="item-time" showDay="{{true}}" target="{{seconds}}">
            <span class="count-down-left-text">仅剩</span>
          </i-count-down>
        </view>
      </block>
      <block wx:elif="{{pin_info.state==2}}">
        <view class="failTit red" style="color:{{skin.color}}">该团未能按时凑齐人数，拼团失败</view>
        <view class="tip">退款金额将原路返回</view>
      </block>
    </view>
    <view class="pinMemberList">
      <view class="item" wx:for="{{pin_order_arr}}" wx:key="id">
        <i-img defaultImage="../../images/placeholder-refund.png" height="200" width="180" iClass="avatar" loadImage="{{item.avatar}}"></i-img>
        <text class="name" wx:if="{{index==0}}">团长</text>
      </view>
      <view class="item" wx:for="{{pin_info.need_count-pin_order_arr.length}}" wx:key="id" wx:if="{{index<14}}">
        <text class="iconfont icon-wenhao avatar"></text>
      </view>
      <block wx:if="{{showAllUser}}">
        <view class="item" wx:for="{{pin_info.need_count-pin_order_arr.length}}" wx:key="id" wx:if="{{index>=14}}">
          <text class="iconfont icon-wenhao avatar"></text>
        </view>
      </block>
      <view class="pin-more" bindtap="showAllBtn" wx:if="{{pin_info.need_count-pin_order_arr.length>14}}">
        <block wx:if="{{showAllUser}}">收起 <text class="iconfont icon-shang" style="font-size:22rpx;"></text></block>
        <block wx:else>查看全部 <text class="iconfont icon-youjiantou" style="font-size:22rpx;"></text></block>
      </view>
    </view>
    <block wx:if="{{pin_info.state==0}}">
      <view class="btn" wx:if="{{me_take_in==0}}" bindtap="openSku" style="background:{{skin.color}}">我要参团</view>
      <button wx:elif="{{me_take_in==1}}" open-type="share" class="btn" style="background:{{skin.color}}">邀请好友参团</button>
    </block>
    <block wx:if="{{pin_info.state==1 && is_me ==1}}">
      <block wx:if="{{order_type=='ignore'}}">
        <view bindtap="goLink" class="btn" data-link="/eaterplanet_ecommerce/moduleA/pin/index" style="background:{{skin.color}}">查看更多拼团商品</view>
      </block>
      <block wx:else>
        <view bindtap="goLink" class="btn" data-link="/eaterplanet_ecommerce/pages/order/order?id={{order_id}}" style="background:{{skin.color}}">查看订单详情</view>
      </block>
    </block>
    <block wx:if="{{pin_info.state==1 && is_me ==0}}">
      <view bindtap="goLink" class="btn" data-link="/eaterplanet_ecommerce/moduleA/pin/index" style="background:{{skin.color}}">查看更多拼团商品</view>
    </block>
    <block wx:if="{{pin_info.state==2}}">
      <view bindtap="goLink" class="btn" data-link="/eaterplanet_ecommerce/moduleA/pin/index" style="background:{{skin.color}}">查看更多拼团商品</view>
    </block>
  </view>

  <!-- 规则 -->
  <!-- 返利拼团 -->
  <view class="pinRecords buyRecords bg-f" wx:if="{{pin_info.is_pintuan_rebate==1}}">
      <view class="pinIntro" bindtap="goLink" data-link="/eaterplanet_ecommerce/pages/user/rule?type=pintuanRebate">
        <view class="i-flex i-flex-spb pinIntro-top">
          <view class="pinIntro-title">拼团玩法</view>
          <view class="">查看规则<text class="iconfont icon-youjiantou"></text></view>
        </view>
        <view class="i-flex i-flex-spb pinIntro-bot">
          <view class="rule-item">
            <view class="step">1</view>
            <view class="p">支付开团</view>
            <view class="p">参团</view>
          </view>
          <view class="rule-item">
            <view class="step">2</view>
            <view class="p">邀请用户</view>
            <view class="p">参团</view>
          </view>
          <view class="rule-item">
            <view class="step">3</view>
            <view class="p">拼团成功中</view>
            <view class="p">奖人员发货</view>
          </view>
          <view class="rule-item">
            <view class="step">4</view>
            <view class="p">未中奖人员退</view>
            <view class="p">款发放奖励</view>
          </view>
        </view>
      </view>
    </view>
    <!-- 普通拼团 -->
    <view class="pinRecords buyRecords bg-f" wx:else>
      <view class="pinIntro" bindtap="goLink" data-link="/eaterplanet_ecommerce/pages/user/rule?type=pintuan">
        <view class="i-flex i-flex-spb pinIntro-top">
          <view class="pinIntro-title">拼团玩法</view>
          <view class="">查看规则<text class="iconfont icon-youjiantou"></text></view>
        </view>
        <view class="i-flex i-flex-spb pinIntro-bot">
          <view class="rule-item">
            <view class="step">1</view>
            <view class="p">支付开团</view>
            <view class="p">参团</view>
          </view>
          <view class="rule-item">
            <view class="step">2</view>
            <view class="p">邀请用户</view>
            <view class="p">参团</view>
          </view>
          <view class="rule-item">
            <view class="step">3</view>
            <view class="p">拼团成功</view>
            <view class="p">按时送达</view>
          </view>
          <view class="rule-item">
            <view class="step">4</view>
            <view class="p">逾期未成</view>
            <view class="p">团退款</view>
          </view>
        </view>
      </view>
    </view>

  <!-- 猜你喜欢 -->
  <view class="guessLike" wx:if="{{is_show_order_guess_like==1&&likeList.length}}">
    <view class="guessLikeTitle">——猜你喜欢——</view>
    <view class="bg-f">
      <i-spu class="item" wx:for="{{likeList}}" wx:key="actId" spuItem="{{item}}" reduction="{{reduction}}" skin="{{skin}}" goods_sale_unit="{{goods_sale_unit}}"></i-spu>
    </view>
  </view>
</view>

<i-aside-btn showHome="{{true}}"></i-aside-btn>

<view class="mask" bindtap='closeSku' hidden="{{!visible}}"></view>
<!---规格选择begin-->
<view bind:cancel="close" class='sku-content' scrollUp="{{true}}" hidden="{{!visible}}">
  <view class="sku-card">
    <view bindtap="closeSku" class="close">
      <image src="../../images/icon-sku-close.png"></image>
    </view>
    <view class="sku-header">
      <image src='{{cur_sku_arr.skuImage}}' style="width:80px;height:80px;" class='sku-img'></image>
      <view class="sku-desc">
        <view class="sku-title">
          <span>{{cur_sku_arr.spuName}}</span>
        </view>
        <view class="sku-price">
          <view class="sale-price" wx:if="{{order.buy_type=='pindan'}}">
            ¥
            <span>{{cur_sku_arr.actPrice[0]}}</span>.{{cur_sku_arr.actPrice[1]}}
          </view>
          <view class="sale-price" wx:if="{{order.buy_type=='pintuan'}}">
            ¥
            <span>{{cur_sku_arr.pinprice[0]}}</span>.{{cur_sku_arr.pinprice[1]}}
          </view>
          <view class="market-price" wx:if="{{cur_sku_arr.marketPrice}}">¥{{cur_sku_arr.marketPrice[0]}}.{{cur_sku_arr.marketPrice[1]}}</view>
        </view>
        <view class="sku-switch-on" wx:if="{{cur_sku_arr.spec}}">已选择：{{cur_sku_arr.spec}}</view>
      </view>
    </view>
    <view class="sku-spec" wx:for="{{skuList.list}}" wx:key="id">
      <view class="title">{{item.name}}</view>
      <view class="spec-list">
        <span bindtap="selectSku" class="{{idx==sku[index]['idx']?'on':''}}" data-disabled="{{item.canBuyNum-value<0}}" data-type="{{index}}_{{idx}}_{{value.option_value_id}}_{{value.name}}" wx:for-index="idx" wx:key="idx" data-idx="{{idx}}" wx:for="{{item.option_value}}"
          wx:for-item="value">{{value.name}}</span>
      </view>
    </view>
    <view class="sku-num-content">
      <view class="title">数量</view>
      <view class="i-class i-input-number i-input-number-size-{{size}}">
        <view bindtap="setNum" data-type="decrease" class="i-input-number-minus {{value<=min?'i-input-number-disabled':''}}">
          <image src="../../images/icon-input-reduce.png"></image>
        </view>
        <input bindblur="handleBlur" bindfocus="handleFocus" class="i-input-number-text {{min>=max?'i-input-number-disabled':''}}" disabled="true" type="number" value="{{sku_val}}"></input>
        <view bindtap="setNum" data-type="add" class="i-input-number-plus {{value>=max?'i-input-number-disabled':''}}">
          <image src="../../images/icon-input-add.png"></image>
        </view>
      </view>
      <view class="msg" wx:if="{{skuList[current].isLimit}}">
        <span wx:if="{{skuList[current].limitMemberNum>-1}}">每人限{{skuList[current].limitMemberNum}}单</span>
        <span wx:if="{{skuList[current].limitOrderNum>-1}}">每单限{{skuList[current].limitOrderNum}}份</span>
        <span></span>
      </view>
      <view class="even-num" wx:elif="{{!skuList[current].isLimit&&skuList[current].canBuyNum-value<=10&&skuList[current].canBuyNum-value>-1}}">还可以购买 {{skuList[current].canBuyNum-value}} 件</view>
    </view>
    <form bindsubmit="gocarfrom" report-submit="true">
      <button formType="submit" class="sku-confirm" disabled='{{cur_sku_arr.stock==0 ? true : false}}'>
        <view>{{cur_sku_arr.stock==0?"已抢光":"确定"}}</view>
      </button>
    </form>
  </view>
</view>
<!---规格选择end-->

<i-new-auth needAuth="{{needAuth&&showAuthModal}}" bind:authSuccess="authSuccess" bind:cancel="authModal" needPosition="{{true}}"></i-new-auth>

<!-- 团长切换 -->
<i-change-community wx:if="{{showChangeCommunity}}" visible="{{showChangeCommunity}}" changeCommunity="{{changeCommunity}}" community="{{community}}" bind:changeComunity="confrimChangeCommunity" canChange="{{hide_community_change_btn==0}}" groupInfo="{{groupInfo}}" bind:noChange="cancelChangeCommunity" cancelFn="{{true}}"></i-change-community>

<i-vip-modal visible="{{showVipModal}}" imgUrl="{{pop_vipmember_buyimage}}" />
