<template>
  <div
    class="big-dataservice-box"
    style="border-color:#e1bee7!important"
    :class="{ 'hide-border': shouType == '5' }"
  >
    <div class="tag-title" style="background:#e1bee7!important">财务动态</div>
    <div class="row q-gutter-md">
      <q-card flat>
        <div class="data-title">收入</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ numberFormat(d.IncomeMoney.split(",")[0]).value }}
              <span class="unit">{{
                numberFormat(d.IncomeMoney.split(",")[0]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ numberFormat(d.IncomeMoney.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.IncomeMoney.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ numberFormat(d.IncomeMoney.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.IncomeMoney.split(",")[2]).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">待收</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value green">
              {{ numberFormat(d.UnIncomeMoney).value
              }}<span class="unit">{{
                numberFormat(d.UnIncomeMoney).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">支出</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value">
              {{ numberFormat(d.PayMoney.split(",")[0]).value }}
              <span class="unit">{{
                numberFormat(d.PayMoney.split(",")[0]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">当周</div>
            <div class="value samll">
              {{ numberFormat(d.PayMoney.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.PayMoney.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">当月</div>
            <div class="value samll">
              {{ numberFormat(d.PayMoney.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.PayMoney.split(",")[2]).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">待支出</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当日</div>
            <div class="value red">
              {{ numberFormat(d.UnPayMoney).value
              }}<span class="unit">{{ numberFormat(d.UnPayMoney).unit }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">提成</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当月发放</div>
            <div class="value">
              {{ numberFormat(d.MonthCommission).value }}
              <span class="unit">{{
                numberFormat(d.MonthCommission).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">累计发放</div>
            <div class="value samll">
              {{ numberFormat(d.SumCommission).value
              }}<span class="unit">{{
                numberFormat(d.SumCommission).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">待发放</div>
            <div class="value samll">
              {{ numberFormat(d.UnPubCommission).value
              }}<span class="unit">{{
                numberFormat(d.UnPubCommission).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">月度奖金</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">当月发放</div>
            <div class="value">
              {{ numberFormat(d.RewardInfo.split(",")[0]).value }}
              <span class="unit">{{
                numberFormat(d.RewardInfo.split(",")[0]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">上月发放</div>
            <div class="value samll">
              {{ numberFormat(d.RewardInfo.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.RewardInfo.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div>
            <div class="label big">年度奖励达标汇总</div>
            <div class="value samll">
              {{ d.RewardInfo.split(",")[2] }}<span class="unit">人次</span>
            </div>
          </div>
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">内部佣金</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">本月</div>
            <div class="value">
              {{ numberFormat(d.PrivateReturnCommission.split(",")[3]).value }}
              <span class="unit">{{
                numberFormat(d.PrivateReturnCommission.split(",")[3]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">已提现</div>
            <div class="value samll">
              {{ numberFormat(d.PrivateReturnCommission.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.PrivateReturnCommission.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">待结算</div>
            <div class="value samll">
              {{ numberFormat(d.PrivateReturnCommission.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.PrivateReturnCommission.split(",")[2]).unit
              }}</span>
            </div>
          </div>
          <!-- <div>
            <div class="label big">累计</div>
            <div class="value samll">
              {{ numberFormat(d.PrivateReturnCommission.split(",")[0]).value
              }}<span class="unit">{{
                numberFormat(d.PrivateReturnCommission.split(",")[0]).unit
              }}</span>
            </div>
          </div> -->
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">同业佣金</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">本月</div>
            <div class="value">
              {{ numberFormat(d.CustomerReturnCommission.split(",")[3]).value }}
              <span class="unit">{{
                numberFormat(d.CustomerReturnCommission.split(",")[3]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">已提现</div>
            <div class="value samll">
              {{ numberFormat(d.CustomerReturnCommission.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.CustomerReturnCommission.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">待结算</div>
            <div class="value samll">
              {{ numberFormat(d.CustomerReturnCommission.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.CustomerReturnCommission.split(",")[2]).unit
              }}</span>
            </div>
          </div>
          <!-- <div>
            <div class="label big">累计</div>
            <div class="value samll">
              {{ numberFormat(d.CustomerReturnCommission.split(",")[0]).value
              }}<span class="unit">{{
                numberFormat(d.CustomerReturnCommission.split(",")[0]).unit
              }}</span>
            </div>
          </div> -->
        </div>
      </q-card>
      <q-card flat>
        <div class="data-title">学员佣金</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">本月</div>
            <div class="value">
              {{ numberFormat(d.StuReturnCommission.split(",")[3]).value }}
              <span class="unit">{{
                numberFormat(d.StuReturnCommission.split(",")[3]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">已提现</div>
            <div class="value samll">
              {{ numberFormat(d.StuReturnCommission.split(",")[1]).value
              }}<span class="unit">{{
                numberFormat(d.StuReturnCommission.split(",")[1]).unit
              }}</span>
            </div>
          </div>
          <div class="q-mr-lg">
            <div class="label big">待结算</div>
            <div class="value samll">
              {{ numberFormat(d.StuReturnCommission.split(",")[2]).value
              }}<span class="unit">{{
                numberFormat(d.StuReturnCommission.split(",")[2]).unit
              }}</span>
            </div>
          </div>
          <!-- <div>
            <div class="label big">累计</div>
            <div class="value samll">
              {{ numberFormat(d.StuReturnCommission.split(",")[0]).value
              }}<span class="unit">{{
                numberFormat(d.StuReturnCommission.split(",")[0]).unit
              }}</span>
            </div>
          </div> -->
        </div>
      </q-card>

      <q-card flat>
        <div class="data-title">剩余课耗</div>
        <div class="data-time">{{ formatDate.date }} {{ formatDate.week }}</div>
        <div class="wrapper">
          <div class="col">
            <div class="label">剩余时长</div>
            <div class="value">
              {{ d.SurplusHours.split(",")[0] }}
              <span class="unit">课时</span>
            </div>
          </div>
          <div>
            <div class="label">剩余金额</div>
            <div class="value">
              {{ numberFormat(d.SurplusHours.split(",")[1]).value }}
              <span class="unit">{{
                numberFormat(d.SurplusHours.split(",")[1]).unit
              }}</span>
            </div>
          </div>
        </div>
      </q-card>
    </div>
  </div>
</template>

<script>
export default {
  props: ["d", "formatDate", "shouType"],
  data() {
    return {};
  },
  methods: {
    numberFormat(value) {
      let param = {};
      let k = 10000;
      let sizes = ["元", "万", "亿", "万亿"];
      let i;
      if (value < k) {
        param.value = parseFloat(value).toFixed(2);
        param.unit = "元";
      } else {
        i = Math.floor(Math.log(value) / Math.log(k));
        param.value = (value / Math.pow(k, i)).toFixed(2);
        param.unit = sizes[i];
      }
      return param;
    }
  }
};
</script>

<style></style>
