feat: 推广费管理表商品列显示商品名称和编码

- PromotionFeeVO 新增 productName、productCode 字段
- 后端 convertToVO 填充商品基础信息
- 前端表格商品列显示商品名称和编码,副标题显示编码
- 店铺名称列改名为"店铺",调整列顺序

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
小蟑螂
2026-05-08 12:28:40 +08:00
co-authored by Claude Opus 4.7
parent 04f6c413af
commit 654758bf0a
4 changed files with 46 additions and 5 deletions
@@ -56,6 +56,18 @@ public class PromotionFeeVO {
@Schema(description = "商品ID(可选)", example = "1") @Schema(description = "商品ID(可选)", example = "1")
private Long productId; private Long productId;
/**
* 商品名称
*/
@Schema(description = "商品名称", example = "iPhone 15 Pro")
private String productName;
/**
* 商品编码
*/
@Schema(description = "商品编码", example = "IPHONE15PRO001")
private String productCode;
/** /**
* 推广活动名称 * 推广活动名称
*/ */
@@ -19,6 +19,8 @@ import top.xyquan.ecomdmbbackend.modules.ecom.promotion.model.vo.PromotionFeeVO;
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeService; import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeService;
import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeTypeService; import top.xyquan.ecomdmbbackend.modules.ecom.promotion.service.PromotionFeeTypeService;
import top.xyquan.ecomdmbbackend.modules.ecom.platform.service.PlatformService; import top.xyquan.ecomdmbbackend.modules.ecom.platform.service.PlatformService;
import top.xyquan.ecomdmbbackend.modules.ecom.product.model.po.ProductPO;
import top.xyquan.ecomdmbbackend.modules.ecom.product.service.ProductService;
import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService; import top.xyquan.ecomdmbbackend.modules.ecom.shop.service.ShopService;
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext; import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
@@ -36,6 +38,7 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
private final CurrentUserContext currentUserContext; private final CurrentUserContext currentUserContext;
private final ShopService shopService; private final ShopService shopService;
private final PromotionFeeTypeService promotionFeeTypeService; private final PromotionFeeTypeService promotionFeeTypeService;
private final ProductService productService;
/** /**
@@ -179,6 +182,18 @@ public class PromotionFeeServiceImpl implements PromotionFeeService {
} }
} }
// 填充商品名称和编码
if (po.getProductId() != null) {
try {
ProductPO product = productService.getById(po.getProductId());
if (product != null) {
vo.setProductName(product.getName());
vo.setProductCode(product.getProductCode());
}
} catch (Exception ignored) {
}
}
return vo; return vo;
} }
} }
@@ -19,6 +19,10 @@ export namespace PromotionFeeVO {
feeTypeName?: string; feeTypeName?: string;
/** 商品ID(可选) */ /** 商品ID(可选) */
productId?: number; productId?: number;
/** 商品名称 */
productName?: string;
/** 商品编码 */
productCode?: string;
/** 推广活动名称 */ /** 推广活动名称 */
campaignName?: string; campaignName?: string;
/** 推广费金额 */ /** 推广费金额 */
@@ -92,16 +92,17 @@ const gridOptions: VxeGridProps<any> = {
title: '序号', title: '序号',
}, },
{ {
field: 'productId', field: 'shopName',
title: '商品ID', title: '店铺',
minWidth: 'auto', minWidth: 'auto',
showOverflow: 'tooltip' as const, showOverflow: 'tooltip' as const,
}, },
{ {
field: 'shopName', field: 'productName',
title: '店铺名称', title: '商品',
minWidth: 'auto', minWidth: 180,
showOverflow: 'tooltip' as const, showOverflow: 'tooltip' as const,
slots: { default: 'product' },
}, },
{ {
field: 'feeTypeName', field: 'feeTypeName',
@@ -333,6 +334,15 @@ const formatAmount = (amount: number) => `¥${amount.toFixed(2)}`;
</span> </span>
</template> </template>
<template #product="{ row }: { row: any }">
<div>
<div>{{ row.productName || '-' }}</div>
<div v-if="row.productCode" class="text-gray-400 text-xs">
{{ row.productCode }}
</div>
</div>
</template>
<template #action="{ row }: { row: any }"> <template #action="{ row }: { row: any }">
<Space> <Space>
<Button size="small" @click="handleEdit(row)"> 编辑 </Button> <Button size="small" @click="handleEdit(row)"> 编辑 </Button>