gaoluyang
2 天以前 b64a0deae5b5d33f9e20671a68936b27f0b9b00b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
 
import { Page } from '@vben/common-ui';
import { erpPriceInputFormatter } from '@vben/utils';
 
import { Card, Col, Row, Statistic } from 'ant-design-vue';
 
import { getPurchaseSummary } from '#/api/erp/purchase/statistics';
import type { ErpPurchaseStatisticsApi } from '#/api/erp/purchase/statistics';
 
defineOptions({ name: 'ErpPurchaseStatistics' });
 
const loading = ref(false);
const summary = ref<ErpPurchaseStatisticsApi.Summary>({});
 
/** 获取统计数据 */
async function fetchSummary() {
  loading.value = true;
  try {
    summary.value = await getPurchaseSummary();
  } finally {
    loading.value = false;
  }
}
 
onMounted(() => {
  fetchSummary();
});
</script>
 
<template>
  <Page auto-content-height>
    <div class="p-4">
      <Card title="采购汇总统计" :loading="loading">
        <Row :gutter="16">
          <Col :span="6">
            <Statistic
              title="总订单数"
              :value="summary.totalOrderCount || 0"
              suffix="单"
            />
          </Col>
          <Col :span="6">
            <Statistic
              title="总订单金额"
              :value="erpPriceInputFormatter(summary.totalOrderAmount) || '0.00'"
              suffix="元"
            />
          </Col>
          <Col :span="6">
            <Statistic
              title="总入库数"
              :value="summary.totalInCount || 0"
              suffix="单"
            />
          </Col>
          <Col :span="6">
            <Statistic
              title="总入库金额"
              :value="erpPriceInputFormatter(summary.totalInAmount) || '0.00'"
              suffix="元"
            />
          </Col>
        </Row>
        <Row :gutter="16" class="mt-4">
          <Col :span="6">
            <Statistic
              title="总退货数"
              :value="summary.totalReturnCount || 0"
              suffix="单"
            />
          </Col>
          <Col :span="6">
            <Statistic
              title="总退货金额"
              :value="erpPriceInputFormatter(summary.totalReturnAmount) || '0.00'"
              suffix="元"
            />
          </Col>
        </Row>
      </Card>
    </div>
  </Page>
</template>