<view class="shared_partner">
  <view class="info-box">
    <view class="member-header">
      <view class="member-img">
        <image src="{{member.src}}"></image>
      </view>
      <view class="member-info">
        <view class="nickname">{{member.nickname || ''}}</view>
        <view class="member-id">会员ID:{{member.member_id}}</view>
        <view class="member-level" catchtap="gotoMemberGrade">
          <view class="member-level-name">
            <image class="level-icon" src="../../image/level-icon.png"></image>
            <text>{{member.level_name}}</text>
            <van-icon name="arrow" />
          </view>
          <view class="member-level-time" wx:if="{{member.validity_value}}">{{member.validity_value}}</view>
        </view>
      </view>
      <view style="font-size: 24rpx;color: #2f2f2f;" catchtap="explainIsShow">分成说明</view>
    </view>
    <view class="profit">
      <view class="title">
        <view class="line"></view>
        <view class="text">共享合伙人收益</view>
      </view>
      <view class="content">
        <view class="content-item">
          <view class="amount">￥{{member.cumulative_share_amoun}}</view>
          <view>累计分成金额</view>
        </view>
        <view class="content-item">
          <view class="amount">￥{{member.last_period}}</view>
          <view>上期分成金额</view>
        </view>
        <view class="content-item">
          <view class="amount">{{member.frequency}}</view>
          <view>累计分成次数</view>
        </view>
      </view>
    </view>
  </view>

  <view class="list">
    <view class="operation">
      <view class="sort" bindtap="sorting">
        <view>分成金额</view>
        <view>
          <view class="arrow {{active?'arrow-up':'arrow-up1'}}"></view>
          <view class="arrow {{active?'arrow-down1':'arrow-down'}}"></view>
        </view>
      </view>
      <view class="date select" style="position: relative;" catchtap="tapRotateIcon">
        <view class="select-text">{{statusText}}</view>
        <van-icon name="arrow-down" class="{{rotateIcon?'select-icon1':'select-icon'}}" />
        <view class="select-pick-status" wx:if="{{pickStatusShow}}">
          <view class="pick-status-box">
            <view class="pick-status-text" data-status="{{''}}" data-text="全部" catchtap="tapPickStatus">
              全部
            </view>
            <view class="pick-status-text" data-status="{{'0'}}" data-text="待领取" catchtap="tapPickStatus">
              待领取
            </view>
            <view class="pick-status-text" data-status="{{'1'}}" data-text="已分成" catchtap="tapPickStatus">
              已分成
            </view>
            <view class="pick-status-text" data-status="{{'2'}}" data-text="未达标" catchtap="tapPickStatus">
              未达标
            </view>
          </view>
        </view>
      </view>
      <view class="date" bindtap="tapCalendar">
        <van-icon name="calendar-o" />
        <view class="text">{{date?date:"请选择日期"}}</view>
        <van-icon name="close" catchtap="delDate" />
      </view>
    </view>

    <view class="list-item" wx:for="{{list}}" wx:key="index">
      <view class="list-item-info">
        <view class="title">
          <view class="price"><text style="font-size: 11px;">￥</text>{{item.money}}</view>
          <view class="status">{{item.status==1?"已分成":item.status==2?"未达标":"待领取"}}</view>
        </view>
        <view class="time">{{item.created_at}}</view>
      </view>
      <view class="btn receive" wx:if="{{item.status == 0}}" catchtap="receive" data-item="{{item}}">领取</view>
      <view class="btn" catchtap="detailedIsShow" data-item="{{item}}">明细</view>
    </view>
  </view>
</view>

<van-popup show="{{ calendarShow }}" position="bottom" >
  <van-datetime-picker type="date" title='选择年月日' value="{{ currentDate }}" min-date="{{ minDate }}" max-date="{{ maxDate }}" bind:cancel="onClose" bind:confirm="onConfirm" formatter="{{ formatter }}" />
</van-popup>

<van-overlay show="{{detailed}}">
  <view class="detailed-box">
    <view>
      <view class="detailed">
        <view class="title">分成明细</view>
        <view class="detailed-item">
          <view class="label">分成明细：</view>
          <view class="content">{{detailedData.created_at}}</view>
        </view>
        <view class="detailed-item">
          <view class="label">分成时会员等级：</view>
          <view class="content">{{detailedData.level_name}}</view>
        </view>
        <view class="detailed-item">
          <view class="label">分成金额：</view>
          <view class="content price">{{detailedData.money}}元</view>
        </view>
        <view class="detailed-item">
          <view class="label">当期分成池总数：</view>
          <view class="content">{{detailedData.total_money}}人</view>
        </view>
        <view class="detailed-item">
          <view class="label">当期等级总人数：</view>
          <view class="content">{{detailedData.level_count}}人</view>
        </view>
        <view class="detailed-item">
          <view class="label">当期分成比列：</view>
          <view class="content">{{detailedData.ratio}}</view>
        </view>
        <view class="detailed-item">
          <view class="label">当期分成总金额：</view>
          <view class="content price">{{detailedData.level_money}}元</view>
        </view>
        <view class="detailed-item">
          <view class="label">分成状态：</view>
          <view class="content status">
            {{detailedData.status==1?"已分成":detailedData.status==0?"待领取":"未达标"}}
          </view>
        </view>
        <view class="detailed-item" wx:if="{{detailedData.remark}}">
          <view style="width:80rpx;flex-shrink: 0;">备注：</view>
          <view class="content price" style="white-space: pre-wrap;text-align: right;display: flex;align-items: center;">{{detailedData.remark}}</view>
        </view>
      </view>
      <view class="close-overlay">
        <van-icon name="close" size="57rpx" color="#fff" catchtap="detailedIsShowClose" />
      </view>
    </view>
  </view>
</van-overlay>

<van-popup show="{{explain}}" custom-style="border-radius: 10rpx;background: transparent;">
  <view class="detailed">
    <view class="title">分成说明</view>
    <view class="explain_html" style="overflow-y: scroll;padding:0 20rpx;max-height: 70vh;">
      <rich-text nodes="{{explain_html}}"></rich-text>
    </view>
  </view>
  <view class="close-overlay">
    <van-icon name="close" size="57rpx" color="#fff" catchtap="explainIsShow" />
  </view>
</van-popup>