refactor(admin): split GoodsView into dialog components; fix(GoodsView): raw member names, no primary badges, member price grid; feat(tag): 光板 maps to 不打印
This commit is contained in:
@@ -13,10 +13,14 @@ describe('auto-tag-rules / deriveLinkTagNames', () => {
|
||||
).toEqual(['双面印花', '烫画', '不包邮']);
|
||||
});
|
||||
|
||||
it('不打印 + 光板(物流备注)+ 不包邮 → 两个工艺标签 + 不包邮,无印花数量标签', () => {
|
||||
it('不打印 + 光板(物流备注)+ 不包邮 → 归并为单个 不打印 工艺标签(光板即不打印)', () => {
|
||||
expect(
|
||||
deriveLinkTagNames('美国(不包邮光板)180GT恤成人款-JSA002-不打印·美西洛杉矶二仓'),
|
||||
).toEqual(['不打印', '光板', '不包邮']);
|
||||
).toEqual(['不打印', '不包邮']);
|
||||
});
|
||||
|
||||
it('仅光板(无不打印字样)同样归为 不打印', () => {
|
||||
expect(deriveLinkTagNames('美国(包邮光板)T恤-DG001')).toEqual(['不打印', '包邮']);
|
||||
});
|
||||
|
||||
it('直喷命中时不给默认烫画', () => {
|
||||
|
||||
@@ -24,14 +24,19 @@ export interface DerivedTagGroupSpec {
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
/** 派生标签所属组及其全部合法取值 */
|
||||
/** 派生标签所属组及其全部合法取值(光板 = 不打印,不单独设标签) */
|
||||
export const DERIVED_TAG_GROUP_SPECS: DerivedTagGroupSpec[] = [
|
||||
{ group: '物流渠道', tags: ['包邮', '不包邮'] },
|
||||
{ group: '印花数量', tags: ['单面印花', '双面印花'] },
|
||||
{ group: '印刷工艺', tags: ['烫画', '直喷', '不打印', '光板'] },
|
||||
{ group: '印刷工艺', tags: ['烫画', '直喷', '不打印'] },
|
||||
];
|
||||
|
||||
const CRAFT_KEYWORDS = ['直喷', '不打印', '光板'] as const;
|
||||
/** 工艺关键字 → 标签名(光板即为不打印) */
|
||||
const CRAFT_KEYWORD_MAP: Record<string, string> = {
|
||||
直喷: '直喷',
|
||||
不打印: '不打印',
|
||||
光板: '不打印',
|
||||
};
|
||||
const CRAFT_DEFAULT = '烫画';
|
||||
|
||||
/**
|
||||
@@ -45,8 +50,11 @@ export function deriveLinkTagNames(name: string | null | undefined): string[] {
|
||||
if (name.includes('双面印花')) names.push('双面印花');
|
||||
else if (name.includes('单面印花')) names.push('单面印花');
|
||||
|
||||
const craftHits = CRAFT_KEYWORDS.filter((keyword) => name.includes(keyword));
|
||||
if (craftHits.length > 0) names.push(...craftHits);
|
||||
const craftTags = new Set<string>();
|
||||
for (const [keyword, tagName] of Object.entries(CRAFT_KEYWORD_MAP)) {
|
||||
if (name.includes(keyword)) craftTags.add(tagName);
|
||||
}
|
||||
if (craftTags.size > 0) names.push(...craftTags);
|
||||
else names.push(CRAFT_DEFAULT);
|
||||
|
||||
if (name.includes('不包邮')) names.push('不包邮');
|
||||
|
||||
@@ -123,15 +123,18 @@ describe('链接级标签:派生 / 人工接管 / 商品镜像', () => {
|
||||
expect(r1.linksUpdated).toBe(2);
|
||||
expect(r1.goodsUpdated).toBe(2);
|
||||
|
||||
// 链接级:og1 → 单面印花/烫画/包邮;og2 → 不打印/光板/不包邮
|
||||
// 链接级:og1 → 单面印花/烫画/包邮;og2 → 不打印(光板归并为不打印)/不包邮
|
||||
expect(await linkTagNames(og1.id)).toEqual(['包邮', '烫画', '单面印花']);
|
||||
expect(await linkTagNames(og2.id)).toEqual(['不包邮', '不打印', '光板']);
|
||||
expect(await linkTagNames(og2.id)).toEqual(['不包邮', '不打印']);
|
||||
|
||||
// 商品级:镜像各自链接(+人工分组保留,旧自动组剔除)
|
||||
const names1 = await goodTagNames(good1.id);
|
||||
expect(names1).toEqual(expect.arrayContaining(['包邮', '烫画', '单面印花', `潮流${stamp}`]));
|
||||
expect(names1).not.toContain('单面印');
|
||||
expect(await goodTagNames(good2.id)).toEqual(['不包邮', '不打印', '光板']);
|
||||
const names2 = await goodTagNames(good2.id);
|
||||
expect(names2).toEqual(['不包邮', '不打印']);
|
||||
expect(names2).not.toContain('光板');
|
||||
expect(names2).not.toContain('烫画');
|
||||
|
||||
// 幂等
|
||||
const r2 = await recompute.syncFamilyTags(family.id);
|
||||
|
||||
Reference in New Issue
Block a user