fix(promo): HQ 渠道负责人与关联合伙人展示为公司-人名
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
} from '@dukang/shared-types';
|
||||
import { request, type Paginated } from '../../lib/api';
|
||||
import { ADMIN_OPTIONS_PAGE_SIZE, fmtTime } from '../../lib/constants';
|
||||
import { formatPromoPartnerLabel, formatPromoPartnerNames } from '../../lib/promo-partner-label';
|
||||
import type { PromoCodeDetailContext } from './PromoCodeDetailLayout';
|
||||
import PromoCodeMetricsPanel from './PromoCodeMetricsPanel';
|
||||
|
||||
@@ -53,17 +54,6 @@ const CONVERSION_HINT =
|
||||
|
||||
type PartnerOption = { id: string; companyName?: string | null; name?: string | null; phone?: string | null };
|
||||
|
||||
function formatPartnerLabel(p?: { companyName?: string | null; name?: string | null; phone?: string | null; id: string } | null) {
|
||||
if (!p) return '—';
|
||||
const title = p.companyName || p.name || p.id;
|
||||
return p.phone ? `${title} · ${p.phone}` : title;
|
||||
}
|
||||
|
||||
function formatPartnerNames(partners?: Array<{ companyName?: string | null; name?: string | null; id: string }> | null) {
|
||||
if (!partners?.length) return '—';
|
||||
return partners.map((p) => p.companyName || p.name || p.id).join('、');
|
||||
}
|
||||
|
||||
function StatHint({ label, hint }: { label: string; hint: string }) {
|
||||
return (
|
||||
<span>
|
||||
@@ -107,7 +97,7 @@ export default function PromoCodeDetailPage() {
|
||||
const map = new Map(partners.map((p) => [p.id, p]));
|
||||
for (const p of detail.channelOwners ?? []) map.set(p.id, p);
|
||||
if (detail.assocPartner) map.set(detail.assocPartner.id, detail.assocPartner);
|
||||
return [...map.values()].map((p) => ({ value: p.id, label: formatPartnerLabel(p) }));
|
||||
return [...map.values()].map((p) => ({ value: p.id, label: formatPromoPartnerLabel(p) }));
|
||||
}, [partners, detail.channelOwners, detail.assocPartner]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -229,12 +219,12 @@ export default function PromoCodeDetailPage() {
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="渠道负责人">
|
||||
<span style={{ whiteSpace: 'nowrap' }}>
|
||||
{formatPartnerNames(detail.channelOwners)}
|
||||
{formatPromoPartnerNames(detail.channelOwners)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="关联合伙人">
|
||||
<span style={{ whiteSpace: 'nowrap' }}>
|
||||
{formatPartnerLabel(detail.assocPartner)}
|
||||
{formatPromoPartnerLabel(detail.assocPartner)}
|
||||
</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="备注">{detail.remark || '—'}</Descriptions.Item>
|
||||
|
||||
Reference in New Issue
Block a user