<!-- packageH/income/ShareholderReward/Shareholder_reward.wxml -->
<wxs module="fun">
  var isTextEmpty = function (str) {
    if ((str == null) || (str == '') || (str == undefined)) {
      return true
    } else {
      return false
    }
  }
  module.exports.isTextEmpty = isTextEmpty;
</wxs>
<wxs module="m1">
  var slice = function (str) {
    return str.slice(0,10)
  }
  module.exports.slice = slice;
</wxs>
<view id="Shareholder_reward">
  <!-- <c-title :hide="false" :text="!fun.isTextEmpty(rewards.name)?rewards.name:''"></c-title> -->
  <van-nav-bar title="{{!fun.isTextEmpty(rewards.name)?rewards.name:''}}" fixed="{{false}}" left-arrow bind:click-left="onClickLeft" />
  <view class="header_box" wx:if="{{!fun.isTextEmpty(rewards.member)}}">
    <view class="header">
      <image src="{{rewards.member.avatar}}"></image>
    </view>
    <view class="name ul">
      <view class="li">{{rewards.member.nickname}}</view>
      <view class="li" wx:if="{{!fun.isTextEmpty(rewards.partnerModel)}}">
        成为股东时间:
        {{m1.slice(rewards.partnerModel.created_at)}}
      </view>
    </view>
  </view>
  <view class="money">
    <view class="gongge ul">
      <view class="li">
        <icon class="iconfont icon-weitixian"></icon>
        <span>未奖励金额</span>
        <view class="b">
          {{not_rewarded}}
          <em>元</em>
        </view>
      </view>
      <view class="li">
        <icon class="iconfont icon-yijiesuan"></icon>
        <span>已奖励金额</span>
        <view class="b">
          {{rewarded}}
          <em>元</em>
        </view>
      </view>
    </view>
  </view>
  <van-tabs active="{{active}}" bind:click="tabHandel">
    <van-tab title="{{!fun.isTextEmpty(rewards.name)?rewards.name:''}}">
      <view class="list_box">
        <view class="box">
          <view class="li" wx:for="{{recordsList}}" wx:key="index">
            <h2 class="monthClass">{{item.create_month}}</h2>
            <view wx:for="{{item.has_many_reward_log}}" wx:for-item="item_child" wx:key="id" wx:for-index="itemIndex" class="boxs" bind:tap="showDetails" data-index="{{ itemIndex }}" data-tab="shareholder">
              <view class="box-child">
                <span>订单号:{{item_child.order_sn}}</span>
                <span style="color:#ffbe5a">{{language['money']}}{{item_child.amount}}</span>
              </view>
              <view class="box-child">
                <span>时间:{{item_child.created_at}}</span>
                <span>{{item_child.status_name}}</span>
              </view>
              <view class="box-details" style="display:{{ shareholderShowDetailsIndex==itemIndex?'block':'none' }}">
                <view class="details-member-list">
                  <view class="details-member-item">
                    <image class="details-member-avatar" src="{{ item_child.has_one_order.has_one_member_shop_info.has_one_member.avatar }}"></image>
                    <view class="details-member-info">
                      <view>
                        {{ item_child.has_one_order.has_one_member_shop_info.has_one_member.nickname }}
                      </view>
                      <view>
                        微信号:{{ item_child.has_one_order.has_one_member_shop_info.wechat ? item_child.has_one_order.has_one_member_shop_info.wechat : "暂无微信号" }}
                      </view>
                    </view>
                  </view>
                </view>
                <view class="details-goods-list">
                  <view class="details-goods-item" wx:for="{{ item_child.has_one_order.order_goods }}" wx:for-item="goodsItem" wx:key="id">
                    <view class="details-goods-warpper">
                      <image class="details-goods-cover" src="{{ goodsItem.thumb }}"></image>
                      <view class="details-goods-info">
                        <view>
                          <text>{{ goodsItem.title }}</text>
                          <text>￥{{ goodsItem.goods_price / goodsItem.total }}</text>
                        </view>
                        <view>x{{ goodsItem.total }}</view>
                      </view>
                    </view>
                    <view class="details-goods-total-price">￥{{ goodsItem.goods_price }}</view>
                  </view>
                </view>
                <view class="details-receiver">
                  <view>收件人：{{ item_child.has_one_order.address.realname || "无" }}</view>
                  <view>
                    手机：{{ item_child.has_one_order.address.mobile ? item_child.has_one_order.address.mobile : "暂无手机" }}
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </van-tab>
    <van-tab title="平级奖励">
      <view class="list_box">
        <view class="box">
          <view class="li" wx:for="{{recordsList}}" wx:key="index" z>
            <view class="monthClass">{{item.create_month}}</view>
            <view wx:for="{{item.has_many_reward_log}}" wx:for-item="item_child" wx:key="id" wx:for-index="itemIndex" class="boxs" bind:tap="showDetails" data-index="{{ itemIndex }}" data-tab="saveLevel">
              <view class="box-child">
                <span>订单号:{{item_child.order_sn}}</span>
                <span style="color:#ffbe5a">{{language['money']}}{{item_child.amount}}</span>
              </view>
              <view class="box-child">
                <span>时间:{{item_child.created_at}}</span>
                <span>{{item_child.status_name}}</span>
              </view>
              <view class="box-details" style="display:{{ sameLevelShowDetailsIndex==itemIndex?'block':'none' }}">
                <view class="details-member-list">
                  <view class="details-member-item">
                    <image class="details-member-avatar" src="{{ item_child.has_one_order.has_one_member_shop_info.has_one_member.avatar }}"></image>
                    <view class="details-member-info">
                      <view>
                        {{ item_child.has_one_order.has_one_member_shop_info.has_one_member.nickname }}
                      </view>
                      <view>
                        微信号:{{ item_child.has_one_order.has_one_member_shop_info.wechat ? item_child.has_one_order.has_one_member_shop_info.wechat : "暂无微信号" }}
                      </view>
                    </view>
                  </view>
                </view>
                <view class="details-goods-list">
                  <view class="details-goods-item" wx:for="{{ item_child.has_one_order.order_goods }}" wx:for-item="goodsItem" wx:key="id">
                    <view class="details-goods-warpper">
                      <image class="details-goods-cover" src="{{ goodsItem.thumb }}"></image>
                      <view class="details-goods-info">
                        <view>
                          <text>{{ goodsItem.title }}</text>
                          <text>￥{{ goodsItem.goods_price / goodsItem.total }}</text>
                        </view>
                        <view>x{{ goodsItem.total }}</view>
                      </view>
                    </view>
                    <view class="details-goods-total-price">￥{{ goodsItem.goods_price }}</view>
                  </view>
                </view>
                <view class="details-receiver">
                  <view>收件人：{{ item_child.has_one_order.address.realname || "无" }}</view>
                  <view>
                    手机：{{ item_child.has_one_order.address.mobile ? item_child.has_one_order.address.mobile : "暂无手机" }}
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </van-tab>
  </van-tabs>
  <view style="width:100%;display: flex;align-items: center;justify-content: center;">
    <image src="https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/no-more-product.png" alt="" style="width:160rpx;margin-top:128rpx;" wx:if="{{fun.isTextEmpty(recordsList)}}" mode="widthFix"></image>
  </view>
</view>