Files
crawler-plugin/frontend-vue/src/pages/amazon/tool-catalog.ts
T
huangzd1997 11ad68eea4 feat(phase-4/5 用户端): 恢复巡店删除与指定删除ASIN两个功能页与全部表件
用户口径:这两个功能是随 fdaae3c5 连带删错(该退役的只有紫鸟新版/旧版选项控件),
本次按历史逐字找回并摘掉紫鸟引用。

- 页面:BrandDeleteBrandTab.vue(1740行) / BrandPatrolDeleteTab.vue(1370行) 从 fdaae3c5~1 找回,
  两页各摘 5 处 ZiniaoVersionSetting/useZiniaoVersion 引用与 1 个 ziniao_version 载荷字段
  (checkQueuePayload 只钉 taskId,摘掉不触闸;全树其余读点 0 处)
- 表件:router 两条路由、tool-catalog 18→20 工具与四条图标/详情、BrandTopBar 导航两条、
  endpoints 两块(deleteBrand 10 键 / patrolDelete 16 键)、progress-light 10→12、
  java-modules re-export、module-templates 联合、withdraw.ts 巡店段整文件找回(513 行,
  含两个 ProductRisk*Vo import)
- 测试面:9 支退役时改过的用例从 fdaae3c5~1 逐字找回(含 modules-delete-brand.test.ts 167 行/11 例)
- 自证:npm test 854/854 绿(基线 840+找回 14 例)、vue-tsc --noEmit 与 vite build 通过
- 未触碰他人在飞件:BrandSimilarAsinTab.vue / task-status-text.ts / similar-asin-fake-completed.test.ts

注:恢复后的三支大文件将顶破 ops 侧 readability 棘轮,基线随本轮在 ops 仓重锚并登记。
2026-10-16 20:04:40 +08:00

390 lines
16 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 亚马逊运营工具台 · 工具目录
*
* 来源:原 tkinter 版工具台(reference/数富AI工具台_含源代码,已废弃删除)的 CATS 数据,
* 页面链接按现有 BrandTopBar 导航映射到既有功能页(表单 + 右侧任务全部保留现有)。
*/
export type ToolInfo = {
/** 工具 id(与参考桌面板一致) */
id: string
/** 工具名称 */
name: string
/** 卡片一句话描述 */
desc: string
/** 角标文字(如 流程·1 / 重点 / 核心),无则不显示 */
tag?: string
/** 是否核心工具(角标走核心样式) */
core?: boolean
/** 现有功能页面地址;未提供表示暂未开通 */
href?: string
/** 菜单权限键(小写),与 BrandTopBar 导航一致 */
permissionKeys: string[]
}
export type WorkflowStep = {
name: string
desc: string
/** 指向的工具 id,用于点击跳转 */
toolId?: string
}
export type ToolGroup = {
key: 'front' | 'ops' | 'logi'
/** 菜单权限组键(与 BrandTopBar 一致) */
columnKey: string
name: string
desc: string
/** 分类主色 */
color: string
/** 分类弱色(角标底、编号圆底) */
weak: string
tools: ToolInfo[]
/** 标准工作流时间线(后勤无) */
workflowTitle?: string
workflowBadge?: string
workflowHint?: string
workflow?: WorkflowStep[]
}
export const TOOL_GROUPS: ReadonlyArray<ToolGroup> = [
{
key: 'front',
columnKey: 'brand_front_tools',
name: '前端工具',
desc: '采集 · 清洗 · 查品,产出安全可上架的数据',
color: '#2DD4BF',
weak: '#0F2E28',
workflowTitle: '前端工具 · 标准工作流',
workflowBadge: '产出完整安全数据',
workflowHint: '8步工作流 · 从采集到上架,一步不缺',
workflow: [
{ name: '采集数据', desc: '站点批量采集', toolId: 'collect' },
{ name: 'ASIN变体采集', desc: '按ASIN拉变体', toolId: 'variant' },
{ name: '数据去重', desc: '谁先采集归谁', toolId: 'dedupe' },
{ name: '货源查询·第一遍', desc: '粗略不扣费', toolId: 'source' },
{ name: '品牌检测', desc: '精确+嵌入', toolId: 'brand' },
{ name: '外观专利检测', desc: '规避专利风险', toolId: 'patent' },
{ name: '货源查询·第二遍', desc: '精细扣费', toolId: 'source' },
{ name: '上传后台', desc: '可上架数据', toolId: 'convert' },
],
tools: [
{
id: 'collect',
name: '采集数据',
desc: '批量采集站点商品数据,按照自己要求数据',
tag: '流程·1',
href: '/collect-data',
permissionKeys: ['collect-data'],
},
{
id: 'variant',
name: 'ASIN变体采集',
desc: '支持粘贴和文档,按照采集国家选择导出',
tag: '流程·2',
href: '/variant-collection',
permissionKeys: ['variant-collection'],
},
{
id: 'dedupe',
name: '数据去重',
desc: '全站唯一 ASIN 归属:谁先采集归谁,自动过滤撞款',
tag: '重点',
core: true,
href: '/dedupe',
permissionKeys: ['dedupe'],
},
{
id: 'source',
name: '货源查询',
desc: '关闭图片检查和类目检测不扣费,打开需要算力费用',
tag: '流程·4',
href: '/similar-asin',
permissionKeys: ['similar-asin'],
},
{
id: 'brand',
name: '品牌检测',
desc: '核查上架数据品牌风险,精确 / 嵌入两种策略',
tag: '流程·5',
href: '/brand',
permissionKeys: ['brand'],
},
{
id: 'patent',
name: '外观专利检测',
desc: '检测商品外观专利,版权,标题,图片。详细页风险,规避下架',
tag: '流程·6',
href: '/appearance-patent',
permissionKeys: ['appearance-patent'],
},
{
id: 'split',
name: '数据拆分',
desc: '大文件按规则拆分,便于分批处理与上传',
href: '/split',
permissionKeys: ['split'],
},
{
id: 'convert',
name: '格式转换',
desc: '数据格式一键转换,适配各工具导入',
href: '/convert',
permissionKeys: ['convert'],
},
],
},
{
key: 'ops',
columnKey: 'brand_operation_tools',
name: '运营工具',
desc: '上架 · 跟价 · 查品 · 巡店,日常店铺运营与维护',
color: '#60A5FA',
weak: '#12243D',
workflowTitle: '运营工具 · 标准工作流',
workflowBadge: '日常运营与维护',
workflowHint: '10步工作流 · 从上架到复盘,环环相扣',
workflow: [
{ name: '上架', desc: '安全数据批量上架', toolId: 'list' },
{ name: '指定删除ASIN', desc: '批量清理无效ASIN', toolId: 'delasin' },
{ name: '商品风险解决', desc: '3类风险一键处理', toolId: 'risk' },
{ name: '定时匹配', desc: '定时价格匹配', toolId: 'time' },
{ name: '跟价', desc: '跟价规则配置', toolId: 'follow' },
{ name: '巡店删除', desc: '巡检店铺状态', toolId: 'patrol' },
{ name: '查询ASIN', desc: '排查ASIN在售状态', toolId: 'qasin' },
{ name: '店铺数据抓取', desc: '抓取运营数据', toolId: 'scrape' },
{ name: '取款', desc: '留足平台扣款费用', toolId: 'cash' },
{ name: '店铺状态查询', desc: '查询店铺账号状态', toolId: 'shop' },
],
tools: [
{
id: 'list',
name: '上架',
desc: '把安全数据批量上架到指定店铺',
href: '/publish',
permissionKeys: ['publish'],
},
{
id: 'delasin',
name: '指定删除ASIN',
desc: '批量删除需清理的 ASIN(风险 / 优化 / 邮箱汇总)',
href: '/delete-brand',
permissionKeys: ['delete-brand'],
},
{
id: 'risk',
name: '商品风险解决',
desc: '3 类风险一键处理:禁止显示 / 需要批准 / 详情已删',
tag: '高频',
core: true,
href: '/product-risk',
permissionKeys: ['product-risk'],
},
{
id: 'time',
name: '定时匹配',
desc: '定时价格匹配,更快更及时抢回购物车',
href: '/shop-match',
permissionKeys: ['shop-match'],
},
{
id: 'follow',
name: '跟价',
desc: '核心工具 · 时时跟价抢购物车,支持指定 ASIN 快速跟价',
tag: '核心',
core: true,
href: '/price-track',
permissionKeys: ['pricing', 'price-track'],
},
{
id: 'patrol',
name: '巡店删除',
desc: '按商品状态巡店清理,摸清店铺商品全貌',
href: '/patrol-delete',
permissionKeys: ['patrol-delete'],
},
{
id: 'qasin',
name: '查询ASIN',
desc: '排查出单 ASIN 是否仍在售,保住优质数据',
href: '/query-asin',
permissionKeys: ['query-asin'],
},
{
id: 'scrape',
name: '店铺数据抓取',
desc: '核心 · 抓取店铺排名 / 品牌 / 销售,支撑复查与优化',
tag: '核心',
core: true,
href: '/shop-data-crawl',
permissionKeys: ['shop-data-crawl', 'shop_data_crawl'],
},
{
id: 'cash',
name: '取款',
desc: '留足平台扣款费用,其余全部提现',
href: '/withdraw',
permissionKeys: ['withdraw'],
},
{
id: 'shop',
name: '店铺状态查询',
desc: '查询店铺账号当前状态,及时发现异常',
permissionKeys: ['shop-status', 'shop'],
},
],
},
{
key: 'logi',
columnKey: 'brand_logistics_tools',
name: '后勤工具',
desc: '采购 · ERP,供应链与系统对接',
color: '#A78BFA',
weak: '#221E38',
tools: [
{
id: 'purchase',
name: '采购',
desc: '供应链采购与订单管理',
permissionKeys: ['purchase'],
},
{
id: 'erp',
name: 'ERP',
desc: '对接 ERP 系统,同步库存与订单',
permissionKeys: ['erp'],
},
],
},
]
/** 图标渐变背景(照 icons.py ICON_COLORS 转 CSS) */
export const TOOL_ICON_GRADIENTS: Record<string, string> = {
collect: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
variant: 'linear-gradient(180deg, #93C5FD, #3B82F6)',
dedupe: 'linear-gradient(180deg, #C4B5FD, #8B5CF6)',
source: 'linear-gradient(180deg, #F9A8D4, #EC4899)',
brand: 'linear-gradient(180deg, #FDBA74, #F97316)',
patent: 'linear-gradient(180deg, #FDE047, #EAB308)',
split: 'linear-gradient(180deg, #86EFAC, #22C55E)',
convert: 'linear-gradient(180deg, #FCA5A5, #EF4444)',
list: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
delasin: 'linear-gradient(180deg, #93C5FD, #3B82F6)',
risk: 'linear-gradient(180deg, #C4B5FD, #8B5CF6)',
time: 'linear-gradient(180deg, #F9A8D4, #EC4899)',
follow: 'linear-gradient(180deg, #FDBA74, #F97316)',
patrol: 'linear-gradient(180deg, #FDE047, #EAB308)',
qasin: 'linear-gradient(180deg, #86EFAC, #22C55E)',
scrape: 'linear-gradient(180deg, #FCA5A5, #EF4444)',
cash: 'linear-gradient(180deg, #5EEAD4, #14B8A6)',
shop: 'linear-gradient(180deg, #93C5FD, #3B82F6)',
purchase: 'linear-gradient(180deg, #C4B5FD, #8B5CF6)',
erp: 'linear-gradient(180deg, #F9A8D4, #EC4899)',
}
/**
* 图标白色图形(48x48,照 icons.py 各 icon_* 坐标转 SVG 路径)
* 默认描边 stroke:#fff width:3(方头 butt),实心填充 shape 用 .fill 标记
*/
export const TOOL_ICON_SHAPES: Record<string, string> = {
// 采集数据:圆角方框+向下箭头
collect: '<rect x="10" y="8" width="28" height="24"/><line x1="24" y1="14" x2="24" y2="36"/><path class="fill" d="M19 33 L29 33 L24 38 Z"/>',
// ASIN变体采集:两个重叠方框
variant: '<rect x="8" y="10" width="20" height="20"/><rect x="20" y="18" width="20" height="20"/>',
// 数据去重:左右双向箭头
dedupe: '<line x1="10" y1="24" x2="38" y2="24"/><path class="fill" d="M15 19 L15 29 L10 24 Z"/><path class="fill" d="M33 19 L33 29 L38 24 Z"/>',
// 货源查询:地球(圆+经纬线)
source: '<circle cx="24" cy="24" r="14"/><line x1="24" y1="10" x2="24" y2="38"/><line x1="10" y1="24" x2="38" y2="24"/><path d="M24 38 A 10 14 0 0 1 24 10"/><path d="M24 10 A 10 14 0 0 1 24 38"/>',
// 品牌检测:盾牌+对勾
brand: '<path d="M14 10 L34 10 L34 28 L24 38 L14 28 Z"/><path d="M19 22 L23 25 L29 17"/>',
// 外观专利检测:灯泡+对勾
patent: '<circle cx="24" cy="20" r="12"/><rect x="18" y="32" width="12" height="6"/><path d="M19 20 L23 23 L29 15"/>',
// 数据拆分:Y形分叉箭头
split: '<line x1="24" y1="12" x2="24" y2="24"/><line x1="24" y1="24" x2="14" y2="36"/><line x1="24" y1="24" x2="34" y2="36"/><path class="fill" d="M10 32 L18 32 L14 36 Z"/><path class="fill" d="M30 32 L38 32 L34 36 Z"/>',
// 格式转换:循环箭头
convert: '<path d="M11.88 31 A 14 14 0 0 1 36.12 17"/><path d="M36.12 17 A 14 14 0 0 1 11.88 31"/><path class="fill" d="M32 18 L40 18 L36 14 Z"/><path class="fill" d="M8 30 L16 30 L12 34 Z"/>',
// 上架:方框+向上箭头
list: '<rect x="10" y="16" width="28" height="24"/><line x1="24" y1="34" x2="24" y2="12"/><path class="fill" d="M19 15 L29 15 L24 10 Z"/>',
// 删除ASIN:垃圾桶
delasin: '<rect x="10" y="10" width="28" height="6"/><path d="M13 18 L35 18 L33 40 L15 40 Z"/><line x1="20" y1="22" x2="20" y2="36"/><line x1="28" y1="22" x2="28" y2="36"/>',
// 商品风险解决:三角+感叹号
risk: '<path d="M24 8 L40 38 L8 38 Z"/><line x1="24" y1="18" x2="24" y2="28" stroke-width="3"/><circle class="fill" cx="24" cy="33" r="2"/>',
// 定时匹配:时钟
time: '<circle cx="24" cy="24" r="16"/><line x1="24" y1="14" x2="24" y2="24"/><line x1="24" y1="24" x2="32" y2="28"/>',
// 跟价:标签
follow: '<path d="M10 12 L32 12 L40 24 L32 36 L10 36 Z"/><circle cx="32" cy="23" r="2" stroke-width="2"/>',
// 巡店删除:眼睛
patrol: '<ellipse cx="24" cy="24" rx="16" ry="8"/><circle class="fill" cx="24" cy="24" r="4"/>',
// 查询ASIN:放大镜
qasin: '<circle cx="20" cy="20" r="12"/><line x1="28" y1="28" x2="40" y2="40" stroke-width="4"/>',
// 店铺数据抓取:立方体
scrape: '<path d="M24 8 L40 16 L24 24 L8 16 Z"/><path d="M8 16 L24 24 L24 40 L8 32 Z"/><path d="M40 16 L24 24 L24 40 L40 32 Z"/>',
// 取款:钱包
cash: '<rect x="8" y="14" width="32" height="22"/><rect x="8" y="10" width="20" height="8"/><circle class="fill" cx="35" cy="25" r="3"/>',
// 店铺状态查询:店铺
shop: '<path d="M8 20 L24 8 L40 20 Z"/><rect x="10" y="20" width="28" height="20"/><rect x="20" y="26" width="8" height="14"/>',
// 采购:购物车
purchase: '<path d="M10 14 L34 14 L30 34 L14 34 Z"/><line x1="34" y1="14" x2="40" y2="14"/><line x1="40" y1="14" x2="38" y2="20"/><circle class="fill" cx="19" cy="39" r="3"/><circle class="fill" cx="33" cy="39" r="3"/>',
// ERP:网格
erp: '<rect x="8" y="8" width="32" height="32"/><line x1="24" y1="8" x2="24" y2="40"/><line x1="8" y1="24" x2="40" y2="24"/>',
}
export const TOOL_MAP: ReadonlyMap<string, ToolInfo> = new Map(
TOOL_GROUPS.flatMap((group) => group.tools.map((tool) => [tool.id, tool] as const)),
)
/**
* 工具页页头长描述(参考桌面板 detail_desc,优先于卡片 desc 显示)
*/
export const TOOL_DETAILS: Readonly<Record<string, string>> = {
collect: '默认勾选有排名和FBM这两个选择',
dedupe: '去重之后,切记一定上传到数富后台去重数据库',
brand: '核查上架数据品牌风险,先跑精确匹配,后跑嵌入式',
delasin: '收集统一要删除的ASIN,批量删除清理',
risk:
'A 搜索结果中禁止显示;B 需要批准(最通用、使用频率最高);C 详情页面已删除。',
patrol: '巡店删除是按商品状态删除,如审核多次不通过的商品。不放任何状态跑一遍,可清楚掌握店铺数据情况。',
follow:
'一个虚拟桌面跟一个国家,错开跑即可时时跟价抢购物车。指定 ASIN 文档跟价:用后台有利润数据快速跟价,下班前跑一下,确保出单数据及时是我们的购物车。',
qasin: '通过店小蜜导出出单 ASIN,上传后台,时不时排查是否还在店铺售卖,确保优质数据时刻在店。',
scrape:
'没排名、久未出单数据可优化删除;获取店铺所有数据的排名、品牌和销售情况。半个月到一个月复查一次品牌,确保数据没有被注册。',
}
export type VisibleGroup = ToolGroup & { tools: ToolInfo[] }
/**
* 按菜单权限过滤分组(逻辑与 BrandTopBar.visibleNavGroups 一致):
* 组键(brand_front_tools 等)命中则整组展示;否则只展示有权限的工具;
* 无任何可见工具的分组整体隐藏。
*/
export function filterGroupsByPermission(
groups: ReadonlyArray<ToolGroup>,
allowedKeys: ReadonlyArray<string>,
): VisibleGroup[] {
const allowedSet = new Set(allowedKeys.map((key) => String(key || '').trim().toLowerCase()).filter(Boolean))
return groups.flatMap((group) => {
if (allowedSet.has(group.columnKey)) {
return [{ ...group, tools: [...group.tools] }]
}
const tools = group.tools.filter((tool) =>
tool.permissionKeys.some((key) => allowedSet.has(key.toLowerCase())),
)
return tools.length ? [{ ...group, tools }] : []
})
}
/** 从工作流时间线中截取有权限的步骤(与分组逻辑共用权限集合) */
export function filterWorkflowByPermission(
steps: ReadonlyArray<WorkflowStep>,
allowedKeys: ReadonlyArray<string>,
): WorkflowStep[] {
const allowedSet = new Set(allowedKeys.map((key) => String(key || '').trim().toLowerCase()).filter(Boolean))
return steps.filter((step) => {
if (!step.toolId) return true
const tool = TOOL_MAP.get(step.toolId)
if (!tool) return true
return tool.permissionKeys.some((key) => allowedSet.has(key.toLowerCase()))
})
}