GrowCard.vue 2.37 KB
<template>
  <div class="md:flex">
    <template v-for="(item, index) in growCardList" :key="item.title">
      <Card
        size="small"
        :loading="loading"
        :title="item.title"
        class="md:w-1/4 w-full !md:mt-0"
        :class="{ '!md:mr-4': index + 1 < 5, '!mt-4': index > 0 }"
      >
        <!-- <template #extra>
          <Tag :color="item.color">{{ item.action }}</Tag>
        </template> -->

        <div class="py-4 px-4 flex justify-between items-center">
          <CountTo :startVal="1" :endVal="item.value" class="text-2xl" />
          <!-- <Icon :icon="item.icon" :size="40" /> -->
        </div>

        <!-- <div class="p-2 px-4 flex justify-between">
          <span>总{{ item.title }}</span>
          <CountTo prefix="$" :startVal="1" :endVal="item.total" />
        </div> -->
      </Card>
    </template>
  </div>
</template>
<script lang="ts" setup>
  import { CountTo } from '/@/components/CountTo/index';
  import Icon from '@/components/Icon/Icon.vue';
  import { Tag, Card } from 'ant-design-vue';
  import { growCardList } from '../data';
  import { useDataStoreWithOut } from '/@/store/modules/data';
  import { computed } from 'vue';

  const dataStore = useDataStoreWithOut();

  const growCardList = computed(() => {
    const data = dataStore.getData;
    return [
      {
        title: '订单完成',
        icon: 'visit-count|svg',
        value: data?.orderFinishedCount || 0,
        total: 120000,
        color: 'green',
        action: '月',
      },
      {
        title: '跟单和质检中',
        icon: 'total-sales|svg',
        value: data?.orderInspectingCount || 0,
        total: 500000,
        color: 'blue',
        action: '月',
      },
      {
        title: '利润分析表待审核',
        icon: 'download-count|svg',
        value: data?.orderProfitWaitAuditCount || 0,
        total: 120000,
        color: 'orange',
        action: '周',
      },
      {
        title: '项目报告书待审核',
        icon: 'transaction|svg',
        value: data?.orderReportWaitAuditCount || 0,
        total: 50000,
        color: 'purple',
        action: '年',
      },
      {
        title: '订单初始化',
        icon: 'transaction|svg',
        value: 5000,
        total: 50000,
        color: 'purple',
        action: '年',
      },
    ];
  });

  defineProps({
    loading: {
      type: Boolean,
    },
  });
</script>