<template>
  <div id="centerRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <!-- <span>
          <icon name="chart-line" class="text-icon"></icon>
        </span> -->
        <div class="d-flex">
          <span class="fs-xl text mx-2">今日订单</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board class="dv-scr-board" :config="config" v-if="config.data.length>0"  />
      </div>
    </div>
  </div>
</template>

<script>
import asyncRequest from "@/apis/service/bigScreen";
// import resToken from "@/mixins/resToken";
export default {
  data() {
    return {
      config: {
        header: ['部门', '单数', '金额'],
        data: [
          

        ],
        // rowNum: 5, //表格行数
        headerHeight: 35,
        headerBGC: '#0f1325', //表头
        oddRowBGC: '#0f1325', //奇数行
        evenRowBGC: '#171c33', //偶数行
        index: true,
        columnWidth: [50],
        align: ['center'],

        datatodaysale:[],
      }
    }
  },
  mounted() {
    // this.rowNum = this.config.data.length

    this.initHttp()
  },
  methods:{
    async initHttp(){
     let res = await asyncRequest.datatodaysale();
     if(res.code == 0){
       res.data.forEach((item,index) => {
        item.total_price = this.getNum(item.total_price)
        this.$set(this.config.data, index, [item.companyName,item.total_order,item.total_price])
        
      });
     }else{
       this.$message.error(res.message)
       return;
     }
   },
   getNum(num){
        num = Number(num);
        if(!num) return '0.00';
        if(num > 10000 || num < -10000){
          const moneys = num/10000
          const realVal =parseFloat(moneys).toFixed(2);
          return realVal+"万"
        }else{
          return num.toFixed(2)
        }
      }
  }
}
</script>

<style lang="scss" scoped>
$box-height: 410px;
$box-width: 400px;
#centerRight1 {
  padding: 16px;
  padding-top: 20px;
  height: $box-height;
  width: 100%;
  // background: orange;
  border-radius: 5px;
  .bg-color-black {
    height: $box-height - 30px;
    border-radius: 10px;
  }
  .text {
    font-size: 12px;
    // margin-bottom: 8px;
    color: #c3cbde;
    display: inline-block;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-scr-board {
      width: 100%;
      height: 340px;
      /deep/ .rows{
    height: 320px !important;
  }
      /deep/ .row-item{
    height: 75px !important;
    line-height: 75px !important;
  }
    }
  }
 
}
</style>
