From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目

---
 src/views/mall/home/components/OperationDataCard.vue |  106 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/src/views/mall/home/components/OperationDataCard.vue b/src/views/mall/home/components/OperationDataCard.vue
new file mode 100644
index 0000000..1a1ffb9
--- /dev/null
+++ b/src/views/mall/home/components/OperationDataCard.vue
@@ -0,0 +1,106 @@
+<template>
+  <el-card shadow="never">
+    <template #header>
+      <CardTitle title="杩愯惀鏁版嵁" />
+    </template>
+    <div class="flex flex-row flex-wrap items-center gap-8 p-4">
+      <div
+        v-for="item in data"
+        :key="item.name"
+        class="h-20 w-20% flex flex-col cursor-pointer items-center justify-center gap-2"
+        @click="handleClick(item.routerName)"
+      >
+        <CountTo
+          :decimals="item.decimals"
+          :end-val="item.value"
+          :prefix="item.prefix"
+          class="text-3xl"
+        />
+        <span class="text-center">{{ item.name }}</span>
+      </div>
+    </div>
+  </el-card>
+</template>
+<script lang="ts" setup>
+import * as ProductSpuApi from '@/api/mall/product/spu'
+import * as TradeStatisticsApi from '@/api/mall/statistics/trade'
+import * as PayStatisticsApi from '@/api/mall/statistics/pay'
+import { CardTitle } from '@/components/Card'
+
+/** 杩愯惀鏁版嵁鍗$墖 */
+defineOptions({ name: 'OperationDataCard' })
+
+const router = useRouter() // 璺敱
+
+/** 鏁版嵁 */
+const data = reactive({
+  orderUndelivered: { name: '寰呭彂璐ц鍗�', value: 9, routerName: 'TradeOrder' },
+  orderAfterSaleApply: { name: '閫�娆句腑璁㈠崟', value: 4, routerName: 'TradeAfterSale' },
+  orderWaitePickUp: { name: '寰呮牳閿�璁㈠崟', value: 0, routerName: 'TradeOrder' },
+  productAlertStock: { name: '搴撳瓨棰勮', value: 0, routerName: 'ProductSpu' },
+  productForSale: { name: '涓婃灦鍟嗗搧', value: 0, routerName: 'ProductSpu' },
+  productInWarehouse: { name: '浠撳簱鍟嗗搧', value: 0, routerName: 'ProductSpu' },
+  withdrawAuditing: { name: '鎻愮幇寰呭鏍�', value: 0, routerName: 'TradeBrokerageWithdraw' },
+  rechargePrice: {
+    name: '璐︽埛鍏呭��',
+    value: 0.0,
+    prefix: '锟�',
+    decimals: 2,
+    routerName: 'PayWalletRecharge'
+  }
+})
+
+/** 鏌ヨ璁㈠崟鏁版嵁 */
+const getOrderData = async () => {
+  const orderCount = await TradeStatisticsApi.getOrderCount()
+  if (orderCount.undelivered != null) {
+    data.orderUndelivered.value = orderCount.undelivered
+  }
+  if (orderCount.afterSaleApply != null) {
+    data.orderAfterSaleApply.value = orderCount.afterSaleApply
+  }
+  if (orderCount.pickUp != null) {
+    data.orderWaitePickUp.value = orderCount.pickUp
+  }
+  if (orderCount.auditingWithdraw != null) {
+    data.withdrawAuditing.value = orderCount.auditingWithdraw
+  }
+}
+
+/** 鏌ヨ鍟嗗搧鏁版嵁 */
+const getProductData = async () => {
+  const productCount = await ProductSpuApi.getTabsCount()
+  data.productForSale.value = productCount['0']
+  data.productInWarehouse.value = productCount['1']
+  data.productAlertStock.value = productCount['3']
+}
+
+/** 鏌ヨ閽卞寘鍏呭�兼暟鎹� */
+const getWalletRechargeData = async () => {
+  const paySummary = await PayStatisticsApi.getWalletRechargePrice()
+  data.rechargePrice.value = paySummary.rechargePrice
+}
+
+/**
+ * 璺宠浆鍒板搴旈〉闈�
+ *
+ * @param routerName 璺敱椤甸潰缁勪欢鐨勫悕绉�
+ */
+const handleClick = (routerName: string) => {
+  router.push({ name: routerName })
+}
+
+/** 婵�娲绘椂 */
+onActivated(() => {
+  getOrderData()
+  getProductData()
+  getWalletRechargeData()
+})
+
+/** 鍒濆鍖� **/
+onMounted(() => {
+  getOrderData()
+  getProductData()
+  getWalletRechargeData()
+})
+</script>

--
Gitblit v1.8.0