feat: 订单管理页商品信息列支持悬停详情和点击跳转

- 商品信息列增加 popover 显示完整信息(名称/链接名称/编码)
- 店铺名称和商品名称均可点击跳转对应详情页
- 规格信息列保留 popover 显示链接名称和规格编码
- ProductVO/SpecInfo 类型定义补充 linkName 字段
This commit is contained in:
小蟑螂
2026-04-14 22:48:22 +08:00
parent 5a9fb45b51
commit aee87723f4
2 changed files with 71 additions and 10 deletions
@@ -11,6 +11,8 @@ export namespace ProductVO {
companyId: number;
/** 商品名称 */
name: string;
/** 链接商品名称 */
linkName?: string;
/** 商品编码 */
productCode?: string;
/** 主图URL */
@@ -61,6 +63,8 @@ export namespace ProductVO {
productName: string;
/** 规格名称 */
name: string;
/** 链接规格名称 */
linkName?: string;
/** 规格编码 */
specCode?: string;
/** 商品成本 */
@@ -7,10 +7,12 @@ import type { PageQueryDTO } from '#/types/common';
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { Page } from '@vben/common-ui';
import { createIconifyIcon } from '@vben/icons';
import { Button, message, Popconfirm, Space, Tag } from 'ant-design-vue';
import { Button, message, Popconfirm, Popover, Space, Tag } from 'ant-design-vue';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import { deleteOrderApi, getOrderPageApi } from '#/api/ecommerce/order';
@@ -22,6 +24,15 @@ import OrderFormModal from './components/OrderFormModal.vue';
defineOptions({ name: 'OrderManagement' });
// 创建图标组件
const PlusIcon = createIconifyIcon('lucide:plus');
const router = useRouter();
function goToShopDetail(shopId: number) {
router.push(`/ecom/shop/overview/${shopId}`);
}
function goToProductDetail(productId: number) {
router.push(`/ecom/product/details/${productId}`);
}
// 响应式数据
const loading = ref(false);
@@ -122,15 +133,23 @@ const gridOptions: VxeGridProps<any> = {
{
field: 'shopName',
title: '店铺名称',
minWidth: 'auto',
showOverflow: 'tooltip' as const,
minWidth: 140,
showOverflow: false,
sortable: true,
slots: { default: 'shopName' },
},
{
title: '商品信息',
minWidth: 'auto',
minWidth: 160,
showOverflow: false,
slots: { default: 'productInfo' },
},
{
title: '规格信息',
minWidth: 160,
showOverflow: false,
slots: { default: 'specInfo' },
},
{
field: 'quantity',
title: '数量',
@@ -406,17 +425,55 @@ onMounted(async () => {
</Space>
</template>
<!-- 店铺名称列 -->
<template #shopName="{ row }: { row: any }">
<a
style="color: #1890ff; cursor: pointer"
@click="goToShopDetail(row.shopId)"
>
{{ row.shopName }}
</a>
</template>
<!-- 商品信息列 -->
<template #productInfo="{ row }: { row: any }">
<div v-if="row.linkProductName">
<div style="font-weight: bold">{{ row.linkProductName }}</div>
<div v-if="row.linkSpecName" style="color: #666; font-size: 12px">
{{ row.linkSpecName }}
</div>
</div>
<Popover
v-if="row.product?.name"
:title="undefined"
trigger="hover"
>
<template #content>
<div>商品名称:{{ row.product.name }}</div>
<div>链接名称:{{ row.product.linkName || '-' }}</div>
<div>商品编码:{{ row.product.productCode || '-' }}</div>
</template>
<a
style="color: #1890ff; cursor: pointer"
@click.stop="goToProductDetail(row.productId)"
>
{{ row.product.name }}
</a>
</Popover>
<span v-else style="color: #999">暂无商品信息</span>
</template>
<!-- 规格信息列 -->
<template #specInfo="{ row }: { row: any }">
<Popover
v-if="row.productSpec?.name"
:title="undefined"
trigger="hover"
>
<template #content>
<div>规格名称:{{ row.productSpec.name }}</div>
<div>链接名称:{{ row.productSpec.linkName || '-' }}</div>
<div>规格编码:{{ row.productSpec.specCode || '-' }}</div>
</template>
<span style="cursor: default">{{ row.productSpec.name }}</span>
</Popover>
<span v-else style="color: #999">-</span>
</template>
<!-- 数量列 -->
<template #quantity="{ row }: { row: any }">
{{ row.quantity || 0 }}