Newer
Older
smartKitchenFront / src / views / dashboard / components / supplierList.vue
<template>
  <!-- 供应商注册、审核通过、注册设备数量 -->
  <div class="container" :style="{ 'height': height, 'width': width }">
    <div v-for="(item) of device" class="device" :key="item.title">
      <div>
        <svg-icon :icon-class="item.icon"></svg-icon>
      </div>
      <div class="title">{{ item.title }}</div>
      <div class="count">{{ item.count }}</div>
    </div>
  </div>
</template>
    
<script>
import SvgIcon from "@/components/SvgIcon";
import { getSupplierCount } from "@/api/cockpit/cockpit";
export default {
  name: "supplierList",
  components: {
    SvgIcon,
  },
  props: {
    width: {
      type: String,
      default: '500px'
    },
    height: {
      type: String,
      default: '300px'
    }
  },
  data() {
    return {
      device: [
        {
          title: "供应商注册设备总数量",
          count: "",
          icon: "cockpit-device-register",
          type: "deviceCount",
        },
        {
          title: "供应商审核通过总数量",
          count: "",
          icon: "cockpit-approved",
          type: "approvedCount",
        },
        {
          title: "供应商注册总数量",
          count: "",
          icon: "cockpit-supplier-register",
          type: "approvedCount",
        },
      ],
    };
  },
  methods: {
    fetchData() {
      // 供应商注册、审核通过、注册设备数量
      getSupplierCount().then((res) => {
        for (var i = 0; i < this.device.length; i++) {
          for (var device in res.data) {
            if (this.device[i].type === device) {
              this.device[i].count = res.data[device]
            }
          }
        }
      });
    },
  },
  created() {
    this.fetchData();
  },
};
</script>
    
<style lang="scss" scoped>
.container {
  display: flex;
  background: #edf5f8;
  border-radius: 8px;
  margin: 10px;
  padding: 10px;
  justify-content: space-around;
  align-items: center;
  .device {
    color: #2076a1;
    font-size:16px;
    font-weight: 700;
    ::v-deep .svg-icon {
      width: 80px;
      height: 80px;
      color: rgb(64, 158, 255);
    }
    .count{
      width: 80px;
      font-size: 48px;
      color: #ffb400;
      font-weight: 700;
      text-align: center;
    }
    .title{
      width: 80px;
      word-wrap: break-word;
    }
  }
}
</style>