<template>
  <div class="dashboard-editor-container">

    <el-row :gutter="20">
      <el-col span="6">
        <el-card class="head-card" shadow="never" @click.native="toNotPass">
          <el-row :gutter="5">
            <el-col span="8">
              <svg-icon icon-class="cny" class="head-card-icon" />
            </el-col>
            <el-col span="16">
              <div class="head-card-t">
                <h6 class="head-card-l">
                  未核帐
                </h6>
                <span class="head-card-v">
                  当天：{{ pan.TodayNotPassQty }} 总计：{{ pan.NotPassQty }}
                </span>
              </div>
            </el-col>
          </el-row>
        </el-card>
        <el-row>
          <div class="details">
            <el-table border :data="detail.NotPass" height="620">
              <el-table-column label="客户" prop="CustomerName" />
              <el-table-column label="金额" prop="Total" />
              <el-table-column label="帐期" prop="AccountingPeriod" /></el-table>
          </div>
        </el-row>
      </el-col>

      <el-col span="6">
        <el-card class="head-card" @click.native="toArrears">
          <el-row :gutter="5">
            <el-col span="8">
              <svg-icon icon-class="order" class="head-card-icon" />
            </el-col>
            <el-col span="16">
              <div class="head-card-t">
                <h6 class="head-card-l">
                  当前欠款帐单
                </h6>
                <span class="head-card-v">
                  {{ pan.ArrearsQty }}个 ￥{{ pan.ArrearsTotal }}
                </span>
              </div>
            </el-col>
          </el-row>
        </el-card>
        <el-row>
          <div class="details">
            <el-table
              border
              :data="detail.Arrears"
              height="620"
              row-class-name="detail-item"
            >
              <el-table-column label="客户" prop="CustomerName">
                <template slot-scope="r">
                  <el-button type="text" @click="toArrearsCustomer(r.row)">{{ r.row.CustomerName }}</el-button>
                </template>
              </el-table-column>
              <el-table-column label="金额" prop="Total" />
              <el-table-column label="最早帐期" prop="AccountingPeriod" />
            </el-table>
          </div>
        </el-row>
      </el-col>

      <el-col span="6">
        <el-card class="head-card" @click.native="toOverdue">
          <el-row :gutter="5">
            <el-col span="8">
              <svg-icon icon-class="cny2" class="head-card-icon" />
            </el-col>
            <el-col span="16">
              <div class="head-card-t">
                <h6 class="head-card-l">
                  当前逾期帐单
                </h6>
                <span class="head-card-v">
                  {{ pan.OverdueQty }}个 ￥{{ pan.OverdueTotal }}
                </span>
              </div>
            </el-col>
          </el-row>
        </el-card>
        <el-row>
          <div class="details">
            <el-table
              border
              :data="detail.Overdue"
              height="620"
              :row-click="toOverdueCustomer"
              row-class-name="detail-item"
            >
              <el-table-column label="客户" prop="CustomerName">
                <template slot-scope="r">
                  <el-button type="text" @click="toOverdueCustomer(r.row)">{{ r.row.CustomerName }}</el-button>
                </template>
              </el-table-column>
              <el-table-column label="金额" prop="Total" />
              <el-table-column label="最早帐期" prop="AccountingPeriod" />
            </el-table>
          </div>
        </el-row>
      </el-col>

      <el-col span="6">
        <el-card class="head-card" @click.native="toPayment">
          <el-row :gutter="5">
            <el-col span="8">
              <svg-icon icon-class="zr" class="head-card-icon" />
            </el-col>
            <el-col span="16">
              <div class="head-card-t">
                <h6 class="head-card-l">
                  已结清
                </h6>
                <span class="head-card-v">
                  {{ pan.PaymentQty }}个 {{ pan.PaymentTotal }}￥
                </span>
              </div>
            </el-col>
          </el-row>
        </el-card>
        <el-row>
          <div class="details">
            <el-table
              border
              :data="detail.Payment"
              height="620"
              :row-click="toPaymentCustomer"
              row-class-name="detail-item"
            >
              <el-table-column label="客户" prop="CustomerName">
                <template slot-scope="r">
                  <el-button type="text" @click="toPaymentCustomer(r.row)">{{ r.row.CustomerName }}</el-button>
                </template>
              </el-table-column>
              <el-table-column label="金额" prop="Total" />
              <el-table-column label="最后帐期" prop="AccountingPeriod" />
              </el-table-column></el-table>
          </div>
        </el-row>
      </el-col>
    </el-row>

    <div>
      <img :src="emptyGif" class="emptyGif">
    </div>
  </div>
</template>

<style lang="scss" scoped>
.emptyGif {
    display: block;
    width: 45%;
    margin: 0 auto;
  }

  .dashboard-editor-container {
    background-color: #e3e3e3;
    min-height: 100vh;
    padding: 50px 60px 0px;
    .pan-info-roles {
      font-size: 12px;
      font-weight: 700;
      color: #333;
      display: block;
    }
    .info-container {
      position: relative;
      margin-left: 190px;
      height: 150px;
      line-height: 200px;
      .display_name {
        font-size: 48px;
        line-height: 48px;
        color: #212121;
        position: absolute;
        top: 25px;
      }
    }
  }

  .detail-item{cursor: pointer;
  }
  .head-card{cursor: pointer;}
  .head-card-t{text-align: right;}
  .head-card-l{font-size: 16px;margin: 0;margin:15px 0;font-weight: 200;}
  .head-card-v{font-size: 18px; margin: 0;font-weight: 800;}
  .head-card-icon{font-size: 40px;line-height: 80px;height: 80px;}
  .head-card{padding:0 10px;margin-top: 20px;margin-bottom: 2px;}
  .problem_piece  .head-card-icon{
    background: #fff;
  border: 4px solid #f1f3f7;
  font-size: 60px;padding:10px;
  ;line-height: 60px;height: 60px;
  border-radius: 50%;
  }
  .problem_piece
  {
        border:none;
        box-shadow: var(--p-card-shadow,0 0 0 1px rgba(63,63,68,.05),0 1px 3px 0 rgba(63,63,68,.15));
        border-radius: var(--p-border-radius-wide,3px);
    padding:20px;
    cursor: pointer;
  }
  .problem_piece .head-card-l{
    margin-top: 0;
    font-size: 14px;
  }
   .problem_piece .head-card-v{
     font-size: 32px;
     color:#643be2;
   }
  .problem_piece:hover{
    color:#fff;
    background: #643be2;
  }
  .problem_piece:hover .head-card-v{
    color:#fff;
  }

  .pp{
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    width: 100%;
  }
  .p1{
    color:#643be2;
    font-size: 14px;
  }
  .p2{
    list-style: none;
    margin:0;
    font-size: 14px;
  }
  .p2 li
  {
    display: inline-block;
    margin: 0 10px;
  }
  .p2 li .n{
    padding:5px 10px;
    background: #643be2;
    color: #fff;
    border-radius: 50%;
  }
  .info {
    margin: 10px;
    height: 220px;
  }
  .info dt
  {
    font-size: 14px;
    padding: none;
    margin:none;
  }
  .info dd{
    font-size: 12px;
    padding: none;
    margin:none;
    color: #999;
    margin-inline-start:0;
    margin-bottom: 10px;
  }
  .navbar{display:none !important;}

  #app .el-card{
          border: none;
    -webkit-box-shadow: var(--p-card-shadow,0 0 0 1px rgba(63,63,68,.05),0 1px 3px 0 rgba(63,63,68,.15));
    box-shadow: var(--p-card-shadow,0 0 0 1px rgba(63,63,68,.05),0 1px 3px 0 rgba(63,63,68,.15));
    border-radius: var(--p-border-radius-wide,3px);
  }

</style>
<style>
  ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-thumb {
        background-color: rgb(168, 167, 167);
        border-radius: 5px;
    }
</style>
<script>
import { _getCustomerDeliveryPanelAsync, _getCustomerDeliveryPanelDetail } from '@/api/financeCustomerDelivery'
export default {
  name: 'CustomerDashboard',
  data() {
    return {
      emptyGif: 'https://wpimg.wallstcn.com/0e03b7da-db9e-4819-ba10-9016ddfdaed3',
      pan: {
        TodayNotPassQty: 0,
        NotPassQty: 0
      },
      detail: {}
    }
  },
  created() {
    debugger
    _getCustomerDeliveryPanelAsync().then(r => {
      this.pan = r
    })
    _getCustomerDeliveryPanelDetail().then(r => {
      this.detail = r
    })
  },
  methods: {
    toNotPass() {
      this.$router.push('/finance/customer')
    },
    toArrears() {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Arrears')
    },
    toOverdue() {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Overdue')
    },
    toPayment() {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Payment')
    },
    toPaymentCustomer(r) {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Payment&customerId=' + r.CustomerId)
    },
    toOverdueCustomer(r) {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Overdue&customerId=' + r.CustomerId)
    },
    toArrearsCustomer(r) {
      this.$router.push('/finance/customerAccount/RemittanceMange?status=Arrears&customerId=' + r.CustomerId)
    }
  }
}
</script>
