/** * 亚马逊运营工具台 · 工具目录 * * 来源:原 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 = [ { 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 = { 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 = { // 采集数据:圆角方框+向下箭头 collect: '', // ASIN变体采集:两个重叠方框 variant: '', // 数据去重:左右双向箭头 dedupe: '', // 货源查询:地球(圆+经纬线) source: '', // 品牌检测:盾牌+对勾 brand: '', // 外观专利检测:灯泡+对勾 patent: '', // 数据拆分:Y形分叉箭头 split: '', // 格式转换:循环箭头 convert: '', // 上架:方框+向上箭头 list: '', // 删除ASIN:垃圾桶 delasin: '', // 商品风险解决:三角+感叹号 risk: '', // 定时匹配:时钟 time: '', // 跟价:标签 follow: '', // 巡店删除:眼睛 patrol: '', // 查询ASIN:放大镜 qasin: '', // 店铺数据抓取:立方体 scrape: '', // 取款:钱包 cash: '', // 店铺状态查询:店铺 shop: '', // 采购:购物车 purchase: '', // ERP:网格 erp: '', } export const TOOL_MAP: ReadonlyMap = new Map( TOOL_GROUPS.flatMap((group) => group.tools.map((tool) => [tool.id, tool] as const)), ) /** * 工具页页头长描述(参考桌面板 detail_desc,优先于卡片 desc 显示) */ export const TOOL_DETAILS: Readonly> = { 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, allowedKeys: ReadonlyArray, ): 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, allowedKeys: ReadonlyArray, ): 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())) }) }