<template>
    <div>
        <crumbs title="控制台"></crumbs>
        <div class="console">
            <h2>平台数据</h2>
            <el-row :gutter="20">
                <el-col :span="6">
                    <router-link to="/admin/LT-DDXT-CPXSQLB" query="{status:'0'}">
                        <div class="card">
                            <h3>待审核订单数量</h3>
                            <div class="count">
                                <span>总计</span>
                                <span class="num"><b>{{orderCount}}</b>个</span>
                            </div>
                        </div>
                    </router-link>
                </el-col>
                <el-col :span="6">
                    <router-link to="/admin/LT-KHZX-CGXX">
                        <div class="card">
                            <h3>待认证账号数量</h3>
                            <div class="count">
                                <span>总计</span>
                                <span class="num"><b>{{authCount}}</b>个</span>
                            </div>
                        </div>
                    </router-link>
                </el-col>
            </el-row>
        </div>
    </div>
</template>

<script>
  import api from '@api/admin.js';

  export default {
    name: 'admin-console',
   /* props:['hasConcole'],*/
    data: function () {
      return {
        orderCount: '...',
        authCount: '...'
      }
    },
    beforeRouteEnter(to,form,next){
      next(vm=>{
        /*if(!vm.hasConcole){
          vm.$emit('redirect-page');
          return;
        }*/
        //获取控制台默认显示数字
        api.getOrderNum().then((res) => {
          const result = res.data;
          if (result.code == '0') {
            vm.orderCount = result.data.count;
          }
        }).catch((error) => {
          console.log(error)
        });
        api.getAuthNum().then((res) => {
          const result = res.data;
          if (result.code == '0') {
            vm.authCount = result.data.count;
          }
        }).catch((error) => {
          console.log(error)
        });
      });
    },
  }
</script>

<style lang="less" scoped>
    @import '../../less/common.less';

    .console {
        padding: 60px 20px 0;
    }

    h2 {
        color: #999;
        font-size: 14px;
        font-weight: normal;
        margin-bottom: 15px;
    }

    .card {
        border: 1px @gray solid;
        box-shadow: 0 0 1px @shadowColor;
        border-radius: @borderWidth;
        padding: 15px;
        background: #fff;
        cursor: pointer;
        color: @baseFontColor;
    }

    .count {
        font-size: 12px;
        color: #aaa;

    .num {
        color: @adminBase;

    b {
        font-size: 30px;
        margin: 0 5px;
    }

    }

    }
    h3 {
        font-size: 14px;
        margin-bottom: 15px;
    }
</style>