feat(jd-database): 卡片图底条店铺名→归属分类名(2026-11-21 客户口径「这边改成分类名称就可以 自己分类的那个名称就可以」)

JdProductCard 图底条从店铺名(shopName)改显 groupName(后端 fillGroupNames 按当前分组补,
前端 jd-product-model 既有解析零改),空时显「未分类」且条常驻渲染(原 v-if="shopName"
过滤退役);店铺名不再上卡(详情弹窗仍可看)。类名 .jd-card-shop→.jd-card-category(语义
归位);jd-product-api.ts 的 label 注释同步组长口径。

判据:jd-product-card.mount.test.ts 10 支(分类条/未分类例/.jd-card-shop 退役反钉)+
jd-database-page.mount.test.ts 卡片字段映射例同改;门禁 vue-tsc rc0/node --test 1955/
vitest 27 文件 244(+1 未分类例)/npm run build rc0。
⏳ 发版:随分组下拉组长前缀(后端 jar)同窗发后管。
This commit is contained in:
2026-11-21 20:22:22 +08:00
parent 9991aaaf7d
commit bbadc445af
4 changed files with 23 additions and 7 deletions
@@ -7,6 +7,10 @@
* 图片 hover 出「点击选择/点击取消」提示胶囊、右上角「已下载」角标(CSV 导出成功后
* 页面记 downloadedIds,徽标与信息分同槽竖排堆叠)。
*
* 2026-11-21 用户口径「这边改成分类名称就可以 自己分类的那个名称就可以」:图底条从
* 店铺名改显归属分类名(groupName,后端 fillGroupNames 按当前分组补)——没归入分类的
* 出「未分类」,条常驻渲染;店铺名不再上卡(详情弹窗仍可看)。
*
* 纯展示组件:入参=item+选中态+可勾选档+已下载态;出事件=切换勾选、打开详情、
* 复制编码。卡片整体点击=开详情;勾选与复制 @click.stop 防冒泡(与现表格行
* @click.stop 同形)。healthScore 徽标随图渲染(现表格同款「信息分」),null 不渲染。 */
@@ -68,7 +72,7 @@ function onFigureClick(event: MouseEvent): void {
</span>
<!-- hover 提示胶囊(v1.7):可勾选档才出,随选中态换文案。 -->
<span v-if="props.selectable" class="jd-card-hover-tip">{{ props.selected ? '点击取消' : '点击选择' }}</span>
<span v-if="props.item.shopName" class="jd-card-shop">{{ props.item.shopName }}</span>
<span class="jd-card-category" :title="props.item.groupName || '未分类'">{{ props.item.groupName || '未分类' }}</span>
</div>
<div class="jd-card-body">
<div class="jd-card-title" :title="props.item.title">{{ props.item.title || '-' }}</div>
@@ -200,7 +204,7 @@ function onFigureClick(event: MouseEvent): void {
opacity: 1;
}
.jd-card-shop {
.jd-card-category {
position: absolute;
bottom: 0;
left: 0;
@@ -165,7 +165,8 @@ export interface JdProductGroupPayload {
}
/** 「当前分组」下拉的一项(GET /scope 的 groups[],V203):editable=本账号对该组分类可写
* (建/改名/删除/归类)。跨公司的组名由后端拼进 label,前端不解析公司字段。 */
* (建/改名/删除/归类)。跨组长的组名由后端拼进 label(2026-11-21 用户口径「不是选公司
* 是选超管/管理员」:前缀=组长账号名),前端不解析公司/组长字段。 */
export interface JdCategoryGroupOption {
id: number
name: string
@@ -270,13 +270,15 @@ describe('京东数据库页(v1.6 装配:侧栏+卡片网格)', () => {
wrapper.unmount()
})
it('卡片字段映射(商城款式):主图/店铺徽标/标题/价格区间/编码/采集日期/信息分', async () => {
it('卡片字段映射(商城款式):主图/分类条/标题/价格区间/编码/采集日期/信息分', async () => {
const wrapper = await mountWith({ items: [item(1), item(2, { mainImageUrl: '', healthScore: null })], total: 2, page: 1, pageSize: 50 })
const cards = wrapper.findAll('.jd-card')
expect(cards).toHaveLength(2)
const first = cards[0]
expect(first.find('img.jd-card-thumb').exists()).toBe(true, '有自有桶 URL 的卡片出真图')
expect(first.get('.jd-card-shop').text()).toBe('旗舰自营店', '店铺徽标浮在图底')
// 2026-11-21 用户口径「这边改成分类名称就可以」:图底条显归属分类名,店铺名不上卡。
expect(first.get('.jd-card-category').text()).toBe('甲组', '分类条浮在图底')
expect(first.find('.jd-card-shop').exists()).toBe(false, '店铺名条退役')
expect(first.get('.jd-card-title').text()).toContain('304不锈钢保温杯大容量便携')
expect(first.get('.jd-card-price').text()).toBe('12.9 ~ 15.9', '价格走 jdPriceRange(number 形状不显示 -)')
expect(first.get('.jd-card-code').text()).toContain('JD-1001')
@@ -47,11 +47,14 @@ function item(over: Partial<JdProductItem> = {}): JdProductItem {
}
describe('卡片字段渲染(与现表格「商品信息」列同源)', () => {
it('主图/店铺徽标/标题/价格区间/商品编码/采集日期逐字段上卡', () => {
it('主图/分类条/标题/价格区间/商品编码/采集日期逐字段上卡', () => {
const wrapper = mount(JdProductCard, { props: { item: item(), selected: false, selectable: true } })
const img = wrapper.get('img.jd-card-thumb')
expect(img.attributes('src')).toBe('https://img.example/main-1.jpg')
expect(wrapper.get('.jd-card-shop').text()).toBe('旗舰自营店')
// 2026-11-21 用户口径「这边改成分类名称就可以」:图底条显归属分类名(groupName),
// 店铺名不再上卡(详情弹窗仍可看)。
expect(wrapper.get('.jd-card-category').text()).toBe('甲组')
expect(wrapper.find('.jd-card-shop').exists()).toBe(false, '店铺名条退役')
expect(wrapper.get('.jd-card-title').text()).toBe('304不锈钢保温杯大容量便携')
expect(wrapper.get('.jd-card-price').text()).toBe('12.9 ~ 15.9', '价格走 jdPriceRange(number/字符串都收、去尾零)')
expect(wrapper.get('.jd-card-code').text()).toContain('JD-10086')
@@ -60,6 +63,12 @@ describe('卡片字段渲染(与现表格「商品信息」列同源)', () =
wrapper.unmount()
})
it('未归类商品分类条常驻出「未分类」( groupName 空不过滤条,与归属三档口径同词)', () => {
const wrapper = mount(JdProductCard, { props: { item: item({ groupName: '', groupId: null }) } })
expect(wrapper.get('.jd-card-category').text()).toBe('未分类')
wrapper.unmount()
})
it('无图占位:缺 mainImageUrl 出「无图」占位不出 img 元素;缺价与缺码按占位符兜底', () => {
const wrapper = mount(JdProductCard, {
props: { item: item({ mainImageUrl: '', priceMin: '', priceMax: '', productCode: '', syncedAt: '', healthScore: null }) },