<template>
  <div>
    <div class="divBox">
      <el-card :bordered="false" dis-hover :padding="12" style="margin: 0 0  20px 0;">
        <div style="height: 20px;margin: 10px;font-weight:bold;"><span>销售统计</span></div>
        <div>
          <el-row>
            <el-col :span="8">
              <div class="box2">
                <div style="font-size: 14px; margin-bottom:15px;">
                  <span>客户总数</span>
                </div>
                <div class="contentC" v-if="count">
                  <span class="content-number spBlock mb15"><count-to :start-val="0" :end-val="count.customerCount" :duration="3200" class="card-panel-num" /></span>
                  <div class="blue-line"></div>
                  <div class="acea-row row-between-wrapper" style="margin-top: 15px;font-size: 12px;">
                    <span class="content-time">今日新增客户</span>
                    <span >{{ count.dayCustomerCount }} 人</span>
                  </div>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="box2">
                <div style="font-size: 14px; margin-bottom:15px;">
                  <span>订单总数</span>
                </div>
                <div class="contentC" v-if="count">
                  <span class="content-number spBlock mb15"><count-to :start-val="0" :end-val="count.storeOrderCount" :duration="3200" class="card-panel-num" /></span>
                  <div class="blue-line"></div>
                  <div class="acea-row row-between-wrapper" style="margin-top: 15px;font-size: 12px;">
                    <span class="content-time">今日新增单数</span>
                    <span >{{ count.dayStoreOrderCount }} 单</span>
                  </div>
                </div>
              </div>
            </el-col>
            <el-col :span="8">
              <div class="box2">
                <div style="font-size: 14px; margin-bottom:15px;">
                  <span>收款总数</span>
                </div>
                <div class="contentC" v-if="count">
                  <span class="content-number spBlock mb15"><count-to :start-val="0" :end-val="count.paymentCount" :duration="3200" class="card-panel-num" /></span>
                  <div class="blue-line"></div>
                  <div class="acea-row row-between-wrapper" style="margin-top: 15px;font-size: 12px;">
                    <span class="content-time">今日新增单数</span>
                    <span >{{ count.dayPaymentCount }} 单</span>
                  </div>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </el-card>
    </div>
    <div class="divBox">
    <el-card :bordered="false" dis-hover>
      <div slot="header">
        <div class="acea-row row-middle">
          <el-avatar
            icon="el-icon-s-operation"
            size="small"
            style="color: #1890ff; background: #e6f7ff; font-size: 13px;margin-left: 10px"
          />
          <span class="ivu-pl-8" style="font-weight:bold;" >统计</span>
        </div>
      </div>
      <el-row :gutter="24">
        <el-col
          :xl="12"
          :lg="12"
          :md="24"
          :sm="24"
          :xs="24"
          class="ivu-mb mb10 dashboard-console-visit"
        >
          <span class="ivu-pl-8">本月订单</span>

          <store-order-chart />
        </el-col>
        <el-col
          :xl="12"
          :lg="12"
          :md="24"
          :sm="24"
          :xs="24"
          class="ivu-mb mb10 dashboard-console-visit"
        >
          <span class="ivu-pl-8">本月收款</span>

          <store-payment-chart />
        </el-col>
      </el-row>
    </el-card>
    </div>
  </div>
</template>
<script>
import CountTo from "vue-count-to";
import { getIndexData } from "@/api/index";
import StorePaymentChart from "@/views/dashboard/StorePaymentChart.vue";
import StoreOrderChart from "@/views/dashboard/StoreOrderChart.vue";
export default {
  components: {
    StoreOrderChart, StorePaymentChart,
    CountTo,
  },
  data() {
    return {
      count: {
        customerCount: 0,
        dayCustomerCount: 0,
        storeOrderCount: 0,
        dayStoreOrderCount: 0,
        paymentCount: 0,
        dayPaymentCount: 0,
        productCount: 0,
        dayProductCount: 0,
      },

    };
  },
  mounted() {
      getIndexData().then(response => {
        this.count = response.data;

      });
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.panel-group {
  margin-top: 18px;


  .card-panel-col {
    margin-bottom: 32px;
  }

  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.05);

    .icon-people {
      color: #40c9c6;
    }

    .icon-message {
      color: #36a3f7;
    }

    .icon-money {
      color: #f4516c;
    }

    .icon-shopping {
      color: #34bfa3;
    }

    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }

    .card-panel-icon {
      float: left;
      font-size: 48px;
    }

    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;

      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }

      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}

@media (max-width: 550px) {
  .card-panel-description {
    display: none;
  }

  .card-panel-icon-wrapper {
    float: none !important;
    width: 100%;
    height: 100%;
    margin: 0 !important;

    .svg-icon {
      display: block;
      margin: 14px auto !important;
      float: none !important;
    }
  }
}
.baseInfo {
  ::v-deep .el-card__header {
    padding: 15px 20px !important;
  }
}

.ivu-mb {
  margin-bottom: 10px;
  font-size: 12px!important;
}
.up,
.el-icon-caret-top {
  color: #f5222d;
  font-size: 12px;
  opacity: 1 !important;
}

.down,
.el-icon-caret-bottom {
  color: #39c15b;
  font-size: 12px;
  /*opacity: 100% !important;*/
}

.content {
  &-number {
    font-size: 30px;
  }
  &-time {
    font-size: 14px;
    /*color: #8C8C8C;*/
  }
}
.spBlock {
  display: block;
}


.app-container{
  border: 1px solid #e6e6e6;
  padding: 12px;

  .app-content{
    background-color: white;
    .title{
      padding: 20px 30px 0px 30px;
      font-size: 18px;
      font-weight: bold;
      color: black;

    }
    .search-form{
      margin: 20px 30px 0px 30px;
    }
    .data-box{
      padding: 30px;
      background-color:  rgb(255, 255, 255);
      height: 100%;

      .echart-box{
        margin: 0 auto;
        text-align: center;
      }
      .el-select{
        margin: 5px 10px;
      }
      .table-box{
        margin-top: 15px;
        .export{
          float: right;
          margin: 10px 0px;
        }
      }
    }
  }
}
#echart-customer{
  width:100%;
  height:350px
}
#echart-customer2{
  width:100%;
  height:350px
}
.vue-treeselect{
  width: 217px;
  height: 36px;
}

.vue-treeselect__control{
  display: block;
}

.box {
  height: 100px;
  border: 1px solid #e7e7e7;
  border-radius: 3px;
  transition: border-radius 0.3s, background-color 0.3s;
  margin: 20px 20px 20px 20px;
  display: flex;
  padding: 10px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* 水平偏移 0px，垂直偏移 0px，模糊半径 10px，阴影颜色为半透明黑色 */
  transition: box-shadow 0.1s; /* 添加过渡效果，使阴影变化更加平滑 */
}
.box2 {
  height: 120px;
  border: 1px solid #e7e7e7;
  border-radius: 3px;
  transition: border-radius 0.3s, background-color 0.3s;
  margin: 10px 15px 30px 10px;
  padding: 10px 20px 20px 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* 水平偏移 0px，垂直偏移 0px，模糊半径 10px，阴影颜色为半透明黑色 */
  transition: box-shadow 0.1s; /* 添加过渡效果，使阴影变化更加平滑 */
}
.box2:hover {
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3); /* 鼠标悬停时阴影效果变化 */
}
.number{
  margin-top: 10px;
  font-size: 20px;
}

.box:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* 鼠标悬停时阴影效果变化 */
}
.box1 {
  height: 100px;
  border: 1px solid #e7e7e7;
  border-radius: 4px;
  margin: 10px 10px 20px 10px;
  background: rgb(235, 235, 240);
  padding: 20px;

}
.boxt {
  font-size: 15px;
  display: block;
  margin-bottom: 15px;
  color: #666;
}
.boxc {
  font-size: 15px;
  padding-top: 2px;
  padding-right: 6px;
  color: #666;
}
.number1 {
  margin-top: 15px;
  font-size: 24px;
}
.blue-line {
  width: 40%;
  height: 2px; /* 横线高度 */
  background-color: rgb(0, 82, 204);
  float: right;
}
</style>
