From fbd5f8f74e4fa6c83cc95adc5872b12845ab0586 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Mon, 2 Nov 2026 13:17:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(admin):=20=E6=88=90=E6=9C=AC=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=9D=A5=E6=BA=90=E9=A1=B5=E7=AD=BE=E4=B8=8E=E6=88=90?= =?UTF-8?q?=E6=9C=AC=E5=BC=82=E5=B8=B8=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/cost-center/CostCenterShell.tsx | 37 +++++++++---------- .../admin/cost-center/ProductCatalogPanel.tsx | 36 +++++++++--------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/apps/frontend/src/pages/admin/cost-center/CostCenterShell.tsx b/apps/frontend/src/pages/admin/cost-center/CostCenterShell.tsx index d53ee3a0..42edb0df 100644 --- a/apps/frontend/src/pages/admin/cost-center/CostCenterShell.tsx +++ b/apps/frontend/src/pages/admin/cost-center/CostCenterShell.tsx @@ -23,6 +23,7 @@ import { Typography, } from 'antd' import { useQuery, useQueryClient } from '@tanstack/react-query' +import { useEffect } from 'react' import FinanceSubNav from '@/components/admin/FinanceSubNav' import { usePersistedState } from '@/hooks/usePersistedState' @@ -85,6 +86,13 @@ export default function CostCenterShell() { 'products', isCostCenterTab, ) + const mappingsApplicable = scope === 'all' || scope === 'work_order' + + useEffect(() => { + if (!mappingsApplicable && activeTab === 'mappings') { + setActiveTab('products') + } + }, [activeTab, mappingsApplicable, setActiveTab]) const overviewQuery = useQuery({ queryKey: ['admin-cost-center-overview', scope], @@ -112,8 +120,6 @@ export default function CostCenterShell() { scope === 'all' ? undefined : (scope as 'affiliate_dash' | 'work_order' | 'third_party_voucher' | 'manual') - const mappingsApplicable = scope === 'all' || scope === 'work_order' - return ( , }, - { - key: 'mappings', - label: '渠道映射', - children: mappingsApplicable ? ( - - ) : ( - 归一,不经过渠道映射;要核对采购价请到「成本配置 → 自动发货采购价」。' - : '人工客服的订单项按内部 SKU 归一(man: 前缀),不走渠道映射;要配置消耗积分请到「成本配置 → 人工客服 SKU」。' - } - /> - ), - }, + ...(mappingsApplicable + ? [ + { + key: 'mappings', + label: '渠道映射', + children: , + }, + ] + : []), { key: 'cost', label: '成本配置', diff --git a/apps/frontend/src/pages/admin/cost-center/ProductCatalogPanel.tsx b/apps/frontend/src/pages/admin/cost-center/ProductCatalogPanel.tsx index 22b072df..86c5aa10 100644 --- a/apps/frontend/src/pages/admin/cost-center/ProductCatalogPanel.tsx +++ b/apps/frontend/src/pages/admin/cost-center/ProductCatalogPanel.tsx @@ -659,25 +659,23 @@ export function ProductCatalogPanel() { extra={ canConfig ? ( - {!productSourceFilter || - productSourceFilter === 'work_order' || - productSourceFilter === 'manual' ? ( - { - if (value?.[0] && value?.[1]) setBackfillRange([value[0], value[1]]) - }} - allowClear={false} - /> - ) : null} - {productSourceFilter !== 'affiliate_dash' ? ( - + {productSourceFilter === 'work_order' ? ( + <> + { + if (value?.[0] && value?.[1]) setBackfillRange([value[0], value[1]]) + }} + allowClear={false} + /> + + ) : null}