<template>
  <div class="app-container home" style="align-content: center;">
    <el-row :gutter="20" style="margin-left: 0.5rem">
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="k-title">用户剩余金币</div>
          <div class="k-content">{{ undefined!=dataMap["userCount"]?dataMap["userCount"]["coin"]:0.00 }}</div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="k-title">用户剩余余额</div>
          <div class="k-content">{{ undefined!=dataMap["userCount"]?dataMap["userCount"]["diamondCoin"]:0.00 }}</div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="grid-content bg-purple">
            <div class="k-title">充值总额</div>
            <div class="k-content">{{ undefined!=dataMap["rechargeCount"]?dataMap["rechargeCount"]["diamondCoinSum"]:0.00 }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="grid-content bg-purple">
            <div class="k-title">总兑换余额</div>
            <div class="k-content">{{ undefined!=dataMap["exchangeCount"]?dataMap["exchangeCount"]["diamondCoinSum"]:0.00 }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="grid-content bg-purple">
            <div class="k-title">总兑换金币</div>
            <div class="k-content">{{ undefined!=dataMap["exchangeCount"]?dataMap["exchangeCount"]["coinSum"]:0.00 }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="grid-content bg-purple">
            <div class="k-title">玩家游戏金币消耗</div>
            <div class="k-content">{{ undefined!=dataMap["bettingAmountSum"]?dataMap["bettingAmountSum"]["coinSum"]:0.00 }}</div>
          </div>
        </div>
      </el-col>
      <el-col :span="3">
        <div class="grid-content bg-purple">
          <div class="grid-content bg-purple">
            <div class="k-title">玩家游戏余额消耗</div>
            <div class="k-content">{{ undefined!=dataMap["bettingAmountSum"]?dataMap["bettingAmountSum"]["diamondCoinSum"]:0.00 }}</div>
          </div>
        </div>
      </el-col>
    </el-row>
    <div style="    font-size: 14px;color: #606266;margin-left: 1rem">
      <el-radio v-model="dateRadio" label="1">昨日</el-radio>
      <el-radio v-model="dateRadio" label="2">今日</el-radio>
      <el-radio v-model="dateRadio" label="3">本周</el-radio>
      <el-radio v-model="dateRadio" label="4">上周</el-radio>
      <el-radio v-model="dateRadio" label="5">最近七天</el-radio>
      <el-radio v-model="dateRadio" label="6">本月</el-radio>
      <el-radio v-model="dateRadio" label="7">上月</el-radio>
      <span style="padding-right: 10px">日期查询</span>
      <el-date-picker
        v-model="daterange"
        style="width: 240px"
        value-format="yyyy-MM-dd"
        type="daterange"
        range-separator="-"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
        @change="dateChage"
      ></el-date-picker>
      <span style="padding-left: 20px">
        <el-button type="primary" round @click="search">查询</el-button>
      </span>
    </div>
    <div style="padding-top: 1rem">
      <el-tabs v-model="activeName">
        <el-tab-pane label="余额统计" name="first">
          <el-row>
            <el-col :span="25" class="card-box">
              <el-card>
                <div slot="header"><span></span></div>
                <div class="el-table el-table--enable-row-hover el-table--medium">
                  <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
                    <thead>
                    <tr>
                      <th class="el-table__cell is-leaf"><div class="cell"></div></th>
                      <th class="el-table__cell is-leaf"><div class="cell">线上充值总额</div></th>
                      <th class="el-table__cell is-leaf"><div class="cell">人工充值</div></th>
                      <th class="el-table__cell is-leaf"><div class="cell">充值总额</div></th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值总额</div></td>
                      <td class="el-table__cell is-leaf"><div class="cell">支付宝：{{getVal(getCharge('8085'),0)}}</div></td>
                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">充值：{{getVal(getCharge('4'),1)}}</div></td>
                      <td class="el-table__cell is-leaf" rowspan="6"><div class="cell">总额：{{getTotal()}}</div></td>
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf"><div class="cell" >微信：{{getVal(getCharge('8086'),0)}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf"><div class="cell" >OKPAY：{{getVal(getCharge('8084'),0)}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf"><div class="cell" >cbpay：{{getVal(getCharge('8088'),0)}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf"><div class="cell" >银行卡：{{getVal(getCharge('8087'),0)}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf"><div class="cell" >其他：{{getVal(getCharge('-1'),0)}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">提现总额</div></td>
                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell">支付宝：{{getCash("1")}}</div></td>
                      <td class="el-table__cell is-leaf" rowspan="5"><div class="cell">总额：{{getCash(null)}}</div></td>
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >微信：{{getCash("2")}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >银行卡：{{getCash("3")}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >OKPAY：{{getCash("4")}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
                    </tr>
                    <tr>
                      <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >cbpay：{{getCash("5")}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" >银行卡</div></td>-->
                    </tr>
                    </tbody>
                  </table>
                  <h3>下注</h3>
                  <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
                    <thead>
                    <tr>
    <!--                  <th class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></th>-->
                      <th class="el-table__cell is-leaf"><div class="cell">金币投注</div></th>
                      <th class="el-table__cell is-leaf"><div class="cell">余额投注</div></th>
    <!--                  <th class="el-table__cell is-leaf"><div class="cell"></div></th>-->
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
    <!--                  <td class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></td>-->
                      <td class="el-table__cell is-leaf"><div class="cell">{{ undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["coinSum"]:0.00 }}</div></td>
                      <td class="el-table__cell is-leaf"><div class="cell">{{undefined!=dataMap["bettingAmountDateSum"]?dataMap["bettingAmountDateSum"]["diamondCoinSum"]:0.00}}</div></td>
    <!--                  <td class="el-table__cell is-leaf"><div class="cell" ></div></td>-->
                    </tr>
                    </tbody>
                  </table>
                </div>
              </el-card>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="金币统计" name="second">
          <div slot="header"><span></span></div>
          <div class="el-table el-table--enable-row-hover el-table--medium">
            <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
              <tbody>
              <tr>
                <td class="el-table__cell is-leaf" rowspan="10"><div class="cell">收入</div></td>
                <td class="el-table__cell is-leaf" rowspan="10"><div class="cell">总额：{{getCoinTotal()}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >连续登录：{{getCoinVal(getCoin("1205",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >签到：{{getCoinVal(getCoin("1206",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >转账：{{getCoinVal(getCoin("1602",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >余额兑换金币：{{getCoinVal(getCoin("1303",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >游戏奖励：{{getCoinVal(getCoin("1103",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >直播收益：{{getCoinVal(getCoin("5005",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >收红包：{{getCoinVal(getCoin("20102",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >邀请奖励：{{getCoinVal(getCoin("1208",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
<!--              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >游戏中奖：{{getVal(getCharge('-1'),0)}}</div></td>
                &lt;!&ndash;                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>&ndash;&gt;
              </tr>-->
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell" >开通贵族赠送金币：{{getCoinVal(getCoin("1203",0))}}</div></td>
                <!--                  <td class="el-table__cell is-leaf"><div class="cell" >微信</div></td>-->
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" rowspan="19"><div class="cell">支出</div></td>
                <td class="el-table__cell is-leaf" rowspan="19"><div class="cell">总额：{{getExCoinTotal()}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >后台扣除：{{getCoinVal(getCoin("1108",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >转账：{{getCoinVal(getCoin("1602",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通贵族：{{getCoinVal(getCoin("2701",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买坐骑：{{getCoinVal(getCoin("2901",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买门票：{{getCoinVal(getCoin("1203",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >金币兑换余额：{{getCoinVal(getCoin("1203",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >游戏下注：{{getCoinVal(getCoin("20001",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >直播间打赏礼物：{{getCoinVal(getCoin("2001",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >短视频打赏礼物：{{getCoinVal(getCoin("2002",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >聊天打赏：{{getCoinVal(getCoin("2003",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >个人主页打赏：{{getCoinVal(getCoin("2005",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >发红包：{{getCoinVal(getCoin("20101",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >宝箱抽奖：{{getCoinVal(getCoin("1203",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通守护：{{getCoinVal(getCoin("2401",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >开通粉丝团：{{getCoinVal(getCoin("2501",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >付费弹幕：{{getCoinVal(getCoin("2601",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >兑换实物：{{getCoinVal(getCoin("1305",1))}}</div></td>
              </tr>
              <tr>
                <td class="el-table__cell is-leaf" colspan="2"><div class="cell" >购买贵族席：{{getCoinVal(getCoin("20702",1))}}</div></td>
              </tr>
              </tbody>
            </table>
            <h3>金币兑换余额</h3>
            <table cellspacing="0" style="width: 70rem;border-bottom: 1px solid black">
              <thead>
              <tr>
                <!--                  <th class="el-table__cell is-leaf" rowspan="2"><div class="cell">游戏投注</div></th>-->
                <th class="el-table__cell is-leaf"><div class="cell">消耗金币</div></th>
                <th class="el-table__cell is-leaf"><div class="cell">获得余额</div></th>
              </tr>
              </thead>
              <tbody>
              <tr>
                <td class="el-table__cell is-leaf"><div class="cell">{{ undefined!=dataMap["exchange"]?dataMap["exchange"]["coin"]:0.00 }}</div></td>
                <td class="el-table__cell is-leaf"><div class="cell">{{undefined!=dataMap["exchange"]?dataMap["exchange"]["diamondCoin"]:0.00}}</div></td>
              </tr>
              </tbody>
            </table>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script>
import { indexStatics } from "@/api/business/user";
import { parseTime } from "@/utils/ruoyi.js"
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      dateRadio: "2",
      queryParams:{},
      daterange:[],
      daterange2:[],
      dataMap:{},
      activeName:"first"
    };
  },
  created() {
    // console.log(parseTime())
    this.search();
  },
  methods: {
    dateChage(val){
      if(undefined == this.daterange || null == this.daterange){
        this.dateRadio = "2";
      }else{
        this.dateRadio = null;
      }
    },
    search(){
      let radio = "2";
      let that = this;
      that.queryParams = {};
      if(!that.dataRadio){
        radio = that.dateRadio;
      }
      if(this.daterange == undefined || this.daterange == null || this.daterange.length < 1){
        let curDate = new Date();
        if("1" == radio){
          curDate = curDate.setDate(curDate.getDate()-1);
          that.setQueryParam(curDate,curDate);
        }else if("2" == radio){
          that.setQueryParam(curDate,curDate);
        }else if("3" == radio){
          // 获取当前日期是本周的第几天（0代表周日，1代表周一，...，6代表周六）
          const dayOfWeek = curDate.getDay();
          // 获取当前日期距离本周第一天的天数差（负数代表本周之前的天数，正数或零代表本周之后的天数）
          const diffToFirstDay = dayOfWeek > 0 ? -(dayOfWeek - 1) : -6;
          // 获取本周第一天的日期对象
          const firstDayOfWeek = new Date(curDate);
          firstDayOfWeek.setDate(curDate.getDate() + diffToFirstDay);
          // 获取本周最后一天的日期对象
          const lastDayOfWeek = new Date(curDate);
          lastDayOfWeek.setDate(firstDayOfWeek.getDate() + 6);
          that.setQueryParam(firstDayOfWeek,lastDayOfWeek);
        }else if("4" == radio){
          // 获取当前日期是本周的第几天（0代表周日，1代表周一，...，6代表周六）
          const date = curDate.setDate(curDate.getDate()-6);
          let dayOfWeek = new Date(date).getDay();
          // 获取当前日期距离本周第一天的天数差（负数代表本周之前的天数，正数或零代表本周之后的天数）
          const diffToFirstDay = dayOfWeek > 0 ? -(dayOfWeek - 1) : -6;
          // 获取本周第一天的日期对象
          const firstDayOfWeek = new Date(curDate);
          firstDayOfWeek.setDate(curDate.getDate() + diffToFirstDay);
          // 获取本周最后一天的日期对象
          const lastDayOfWeek = new Date(curDate);
          lastDayOfWeek.setDate(firstDayOfWeek.getDate() + 6);
          that.setQueryParam(firstDayOfWeek,lastDayOfWeek);
        }else if("5" == radio){
          const dayOfWeek = new Date().setDate(new Date().getDate()-6);
          that.setQueryParam(dayOfWeek,curDate);
        }else if("6" == radio){
          // 获取本月开始时间
          var startOfMonth = new Date();
          startOfMonth.setDate(1);
          startOfMonth.setHours(0, 0, 0, 0);

          // 获取本月结束时间
          var endOfMonth = new Date();
          endOfMonth.setMonth(endOfMonth.getMonth() + 1, 0);
          endOfMonth.setHours(23, 59, 59, 999);
          that.setQueryParam(startOfMonth,endOfMonth);
        }else if("7" == radio){
          // 获取本月开始时间
          var startOfMonth = new Date(curDate.setMonth(curDate.getMonth()-1));
          startOfMonth.setDate(1);
          startOfMonth.setHours(0, 0, 0, 0);

          // 获取本月结束时间
          var endOfMonth = curDate;
          endOfMonth.setMonth(endOfMonth.getMonth() + 1, 0);
          endOfMonth.setHours(23, 59, 59, 999);
          that.setQueryParam(startOfMonth,endOfMonth);
        }
      }else{
        that.queryParams["beginTime"] = this.daterange[0];
        that.queryParams["endTime"] = this.daterange[1];
      }

      indexStatics(this.queryParams).then(response => {
        that.dataMap = response.data;
      });
    },
    setQueryParam(beginDate,endDate){
      let that = this;
      that.queryParams["beginTime"] = parseTime(beginDate,"{y}-{m}-{d}");
      that.queryParams["endTime"] = parseTime(endDate,"{y}-{m}-{d}");
    },
    getCharge(type){
      let dataMap = this.dataMap;
      let res = {};
      for(var i in dataMap["rechargeByDateSum"]){
        var item = dataMap["rechargeByDateSum"][i];
        if(item["type"] == type){
          res = item;
          break;
        }
      }
      return res;
    },
    getCoin(type,sumType){
      let dataMap = this.dataMap;
      let res = null;
      for(var i in dataMap["coinTypeSum"]){
        var item = dataMap["coinTypeSum"][i];
        if(item["type"] == type){
          if(sumType == 0 && item["coin"] != undefined && item["coin"]*1 > 0){
            res = item;
            break;
          }else if(sumType == 1 && item["coin"] != undefined && item["coin"]*1 <= 0){
            res = item;
            break;
          }

        }
      }
      return res;
    },
    getOtherCharge(types){
      let arr = types.split(",");
      let dataMap = this.dataMap;
      let res = {};
      for(var i in dataMap["rechargeByDateSum"]){
        var item = dataMap["rechargeByDateSum"][i];
        if(!arr.includes(item["type"])){
          res = item;
          break;
        }
      }
      return res;
    },
    getVal(val,type){
      //type 3 统计线上+线下
      let diamondCoin = 0.00;
      let platformService = 0.00;
      if(type == 0 || type == 3) {
        //线上
        if (val["diamondCoinUpSum"] != undefined) {
          diamondCoin += val["diamondCoinUpSum"];
        }
        if(val["platformServiceDiamondCoinUpSum"] != undefined){
          platformService += val["platformServiceDiamondCoinUpSum"];
        }
      }
      if(type == 1 || type == 3){
        //线下
        if (val["diamondCoinDownSum"] != undefined) {
          diamondCoin += val["diamondCoinDownSum"];
        }
        if(val["platformServiceDiamondCoinDownSum"] != undefined){
          platformService += val["platformServiceDiamondCoinDownSum"];
        }
      }
      return diamondCoin + " （包含手续费" + platformService + "）";
    },
    getTotal(){
      //支付宝
      let ali = this.getCharge("8085");
      //微信
      let wexin = this.getCharge("8086");
      //OKPAY
      let okpay = this.getCharge("8084");
      //cbpay
      let cbpay = this.getCharge("8088");
      //bank
      let bank = this.getCharge("8087");
      //线下
      let down = this.getCharge("4");
      let total = 0;
      let totalService = 0;
      if (down["diamondCoinDownSum"] != undefined) {
        total += down["diamondCoinDownSum"];
      }
      if(down["platformServiceDiamondCoinDownSum"] != undefined){
        totalService += down["platformServiceDiamondCoinDownSum"];
      }

      if (ali["diamondCoinUpSum"] != undefined) {
        total += ali["diamondCoinUpSum"];
      }
      if(ali["platformServiceDiamondCoinUpSum"] != undefined){
        totalService += ali["platformServiceDiamondCoinUpSum"];
      }

      if (wexin["diamondCoinUpSum"] != undefined) {
        total += wexin["diamondCoinUpSum"];
      }
      if(wexin["platformServiceDiamondCoinUpSum"] != undefined){
        totalService += wexin["platformServiceDiamondCoinUpSum"];
      }

      if (okpay["diamondCoinUpSum"] != undefined) {
        total += okpay["diamondCoinUpSum"];
      }
      if(okpay["platformServiceDiamondCoinUpSum"] != undefined){
        totalService += okpay["platformServiceDiamondCoinUpSum"];
      }

      if (cbpay["diamondCoinUpSum"] != undefined) {
        total += cbpay["diamondCoinUpSum"];
      }
      if(cbpay["platformServiceDiamondCoinUpSum"] != undefined){
        totalService += cbpay["platformServiceDiamondCoinUpSum"];
      }

      if (bank["diamondCoinUpSum"] != undefined) {
        total += bank["diamondCoinUpSum"];
      }
      if(bank["platformServiceDiamondCoinUpSum"] != undefined){
        totalService += bank["platformServiceDiamondCoinUpSum"];
      }

      return total + " (包含手续费："+totalService+")"

    },
    getCoinTotal(){
      let coin = 0;
      //游戏奖励
      let game = this.getCoin("1103",0);
      if(undefined != game && null != game){
        coin += this.getCoinVal(game);
      }
      //后台充值
      let recharge = this.getCoin("1108",0);
      if(undefined != recharge && null != recharge){
        coin += this.getCoinVal(recharge);
      }
      //购买贵族赠送金币
      let buySend = this.getCoin("1203",0);
      if(undefined != buySend && null != buySend){
        coin += this.getCoinVal(buySend);
      }
      //连续登录
      let login = this.getCoin("1205",0);
      if(undefined != login && null != login){
        coin += this.getCoinVal(login);
      }
      //签到奖励
      let reward = this.getCoin("1206",0);
      if(undefined != reward && null != reward){
        coin += this.getCoinVal(reward);
      }
      //邀请奖励
      let invite = this.getCoin("1208",0);
      if(undefined != invite && null != invite){
        coin += this.getCoinVal(invite);
      }
      //余额兑换金币
      let exchange = this.getCoin("1303",0);
      if(undefined != exchange && null != exchange){
        coin += this.getCoinVal(exchange);
      }
      //金币转账
      let turn = this.getCoin("1602",0);
      if(undefined != turn && null != turn){
        coin += this.getCoinVal(turn);
      }
      //直播间赠送礼物
      // let giveGift = this.getCoin("2001",0);
      //直播收益
      let live = this.getCoin("5005",0);
      if(undefined != live && null != live){
        coin += this.getCoinVal(live);
      }
      //领红包
      let red = this.getCoin("20102",0);
      if(undefined != red && null != red){
        coin += this.getCoinVal(red);
      }
      //红包退回20103

      return coin;
    },
    getExCoinTotal(){
      let coin = 0;
      //后台充值（扣减）
      let recharge = this.getCoin("1108",1);
      coin += this.getCoinVal(recharge);
      //金币兑换商品
      let exchange = this.getCoin("1305",1);
      coin += this.getCoinVal(exchange);
      //金币转账
      let turn = this.getCoin("1602",1);
      coin += this.getCoinVal(turn);
      //直播礼物打赏
      let give = this.getCoin("2001",1);
      coin += this.getCoinVal(give);
      //短视频打赏
      let short = this.getCoin("2002",1);
      coin += this.getCoinVal(short);
      //聊天打赏
      let chat = this.getCoin("2003",1);
      coin += this.getCoinVal(chat);
      //个人主页打赏
      let people = this.getCoin("2005",1);
      coin += this.getCoinVal(people);
      //开通守护
      let sh = this.getCoin("2401",1);
      coin += this.getCoinVal(sh);
      //粉丝团
      let team = this.getCoin("2501",1);
      coin += this.getCoinVal(team);
      //付费弹幕
      let ffdm = this.getCoin("2601",1);
      coin += this.getCoinVal(ffdm);
      //购买贵族
      let gz = this.getCoin("2701",1);
      coin += this.getCoinVal(gz);
      //购买坐骑
      let zq = this.getCoin("2901",1);
      coin += this.getCoinVal(zq);
      //游戏下注
      let game = this.getCoin("20001",1);
      coin += this.getCoinVal(game);
      //发红包
      let red = this.getCoin("20101",1);
      coin += this.getCoinVal(red);
      //购买贵族席
      let gzx = this.getCoin("20702",1);
      coin += this.getCoinVal(gzx);
      return coin;

    },
    getCash(type){
      let amount = 0;
      let serviceAmount = 0;
      for(var i in this.dataMap["withdrawByDateSum"]){
        let item  = this.dataMap["withdrawByDateSum"][i];
        if(type != null) {
          if (item["type"] == type) {
            amount += item["moneySum"];
            serviceAmount += item["platformServiceSum"];
          }
        }else{
          amount += item["moneySum"];
          serviceAmount += item["platformServiceSum"];
        }
      }
      return amount + " （包含手续费"+serviceAmount+"）";
    },
    getCoinVal(item){
      if(undefined == item || null == item){
        return 0;
      }
      return parseInt(item["coin"]);
    }
  }
};
</script>

<style>
table {
  width: 50%;
}

.k-title{
  font-size: 14px;
  text-align: center;
  /* margin-top: -85px; */
  color: white;
  line-height: 2rem;
  background-color: #4079c4;
}
.k-content{
  color: black;
  text-align: center;
  line-height: 5rem;
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #99a9bf;
}
.bg-purple {
  background: #eef5fd;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 100px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
</style>

