From 57b584df1b3ab1e8ba623fbea76003c5413189de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Wed, 15 Jul 2026 02:35:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(shop):=20=E6=94=AF=E6=8C=81Dashboard?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=80=BB=E6=95=B0=E7=82=B9=E5=87=BB=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E6=8C=87=E5=AE=9Atab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改Dashboard中订单总数和总营业额跳转链接,默认携带tab参数 - 订单总数点击跳转至/shop/shopOrder?tab=all页面 - 待发货订单跳转至/shop/shopOrder?tab=undelivered,退款申请跳转至?tab=refunded - shopOrder页面根据路由查询参数初始化激活tab,确保页面首次加载可正确显示对应订单列表 - 为无效或缺省tab参数设置默认值undelivered - 简化订单页面tab切换逻辑复用公共状态映射函数 --- .workbuddy/memory/2026-07-15.md | 6 ++++++ src/views/shop/dashboard/index.vue | 8 ++++---- src/views/shop/shopOrder/index.vue | 10 ++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.workbuddy/memory/2026-07-15.md b/.workbuddy/memory/2026-07-15.md index 55b6007..8237cca 100644 --- a/.workbuddy/memory/2026-07-15.md +++ b/.workbuddy/memory/2026-07-15.md @@ -5,3 +5,9 @@ - 根因:`activeKey` 默认为 `'undelivered'`,但 `datasource` 函数只设了 `where.type = 0`,没有设 `statusFilter`。`statusFilter` 只在用户点击 tab 触发 `onTabs` 时才设置。所以页面初次加载时查的是全部订单而非待发货订单。 - 修复:提取 `getStatusFilterByTab(key)` 公共映射函数,在 `datasource` 中当 `where.statusFilter` 未设置时从 `activeKey` 自动推导。`onTabs` 也简化为复用同一函数。 - 文件:`src/views/shop/shopOrder/index.vue` + +## Dashboard 订单总数点击跳转支持指定 tab + +- Dashboard 中"订单总数"/"总营业额"跳转链接改为 `/shop/shopOrder?tab=all`,"待发货订单"改为 `?tab=undelivered`,"退款申请"改为 `?tab=refunded`。 +- shopOrder 页面读取 `route.query.tab` 初始化 `activeKey`,无效值回退到 `'undelivered'`。 +- 文件:`src/views/shop/dashboard/index.vue`、`src/views/shop/shopOrder/index.vue` diff --git a/src/views/shop/dashboard/index.vue b/src/views/shop/dashboard/index.vue index dbdac18..2857d4f 100644 --- a/src/views/shop/dashboard/index.vue +++ b/src/views/shop/dashboard/index.vue @@ -282,8 +282,8 @@ const loading = computed(() => siteLoading.value || statisticsLoading.value); // 核心统计数据(使用computed确保响应式更新) const coreStats = computed(() => [ { icon: '🏸', label: '用户总数', value: userCount.value || 0, desc: '注册用户', color: 'blue', to: '/system/user' }, - { icon: '📦', label: '订单总数', value: orderCount.value || 0, desc: '全部订单', color: 'orange', to: '/shop/shopOrder' }, - { icon: '💰', label: '总营业额', value: totalSales.value || 0, desc: '元', color: 'purple', to: '/shop/shopOrder' }, + { icon: '📦', label: '订单总数', value: orderCount.value || 0, desc: '全部订单', color: 'orange', to: '/shop/shopOrder?tab=all' }, + { icon: '💰', label: '总营业额', value: totalSales.value || 0, desc: '元', color: 'purple', to: '/shop/shopOrder?tab=all' }, { icon: '⏱️', label: '运行天数', value: runDays.value || 0, desc: '系统运行', color: 'green', to: '' }, ]); @@ -294,8 +294,8 @@ const couponUsedCount = computed(() => statisticsStore.safeCouponUsedCount); // 待处理事项(使用computed确保响应式更新) const todoItems = computed(() => [ - { label: '待发货订单', value: pendingShipmentCount.value, to: '/shop/shopOrder', tagColor: 'blue', dotColor: 'dot-blue', urgent: pendingShipmentCount.value > 0 }, - { label: '退款申请', value: pendingRefundCount.value, to: '/shop/shopOrder', tagColor: 'orange', dotColor: 'dot-orange', urgent: pendingRefundCount.value > 0 }, + { label: '待发货订单', value: pendingShipmentCount.value, to: '/shop/shopOrder?tab=undelivered', tagColor: 'blue', dotColor: 'dot-blue', urgent: pendingShipmentCount.value > 0 }, + { label: '退款申请', value: pendingRefundCount.value, to: '/shop/shopOrder?tab=refunded', tagColor: 'orange', dotColor: 'dot-orange', urgent: pendingRefundCount.value > 0 }, // { label: '优惠券使用', value: couponUsedCount.value, to: '/market/coupon', tagColor: 'cyan', dotColor: 'dot-cyan', urgent: false }, ]); diff --git a/src/views/shop/shopOrder/index.vue b/src/views/shop/shopOrder/index.vue index 1951b68..88b0e53 100644 --- a/src/views/shop/shopOrder/index.vue +++ b/src/views/shop/shopOrder/index.vue @@ -374,6 +374,7 @@