feat(shop): 支持Dashboard订单总数点击跳转指定tab

- 修改Dashboard中订单总数和总营业额跳转链接,默认携带tab参数
- 订单总数点击跳转至/shop/shopOrder?tab=all页面
- 待发货订单跳转至/shop/shopOrder?tab=undelivered,退款申请跳转至?tab=refunded
- shopOrder页面根据路由查询参数初始化激活tab,确保页面首次加载可正确显示对应订单列表
- 为无效或缺省tab参数设置默认值undelivered
- 简化订单页面tab切换逻辑复用公共状态映射函数
This commit is contained in:
2026-07-15 02:35:01 +08:00
parent 6350a9b5a9
commit 57b584df1b
3 changed files with 18 additions and 6 deletions

View File

@@ -374,6 +374,7 @@
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { useRoute } from 'vue-router';
import type { EleProTable } from 'ele-admin-pro';
import type {
DatasourceFunction,
@@ -428,8 +429,13 @@
const showDelivery = ref(false);
// 加载状态
const loading = ref(true);
// 激活的标签
const activeKey = ref<string>('undelivered');
// 激活的标签(支持从路由参数初始化,如 /shop/shopOrder?tab=all
const route = useRoute();
const validTabs = ['all', 'undelivered', 'unreceived', 'completed', 'refunded', 'cancelled'];
const tabFromQuery = route.query.tab as string;
const activeKey = ref<string>(
validTabs.includes(tabFromQuery) ? tabFromQuery : 'undelivered'
);
// ============ 新订单提醒 ============
const { enabled: notifyEnabled, toggle: onNotifyToggle, testNotify: onTestNotify } = useOrderNotify({