PolicyConfirmHeader.tsx 1.62 KB
import { InfoCircleFilled } from '@ant-design/icons';
import { UText } from '@uj/ui';

export interface PolicyConfirmHeaderProps {
  storeName?: string;
  /** 总解析行数(兜底用) */
  totalRows?: number;
  /** 校验通过行数(failRows>0 时优先显示这个) */
  passRows?: number;
  /** 校验失败行数(> 0 时,红框数量改用 passRows 显示) */
  failRows?: number;
}

export function PolicyConfirmHeader({
  storeName = '巴州强冠东风汽车销售服务有限公司',
  totalRows = 12,
  passRows,
  failRows,
}: PolicyConfirmHeaderProps) {
  /**
   * 显示数量规则(与 Step4 SubmitConfirmCard 两处红框保持一致):
   * - 有失败行(failRows > 0)→ 只显示通过数量 passRows
   * - 全通过 → 显示 totalRows(= 总解析行数 productCategoryRowCount)
   */
  const displayRows =
    typeof failRows === 'number' && failRows > 0 && typeof passRows === 'number'
      ? passRows
      : totalRows;

  return (
    <div
      style={{
        display: 'flex',
        justifyContent: 'space-between',
        alignItems: 'center',
        marginBottom: 12,
        padding: '0 2px',
      }}
    >
      <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
        <InfoCircleFilled style={{ color: '#2B5CE6', fontSize: 14 }} />
        <span style={{ fontSize: 15, fontWeight: 600, color: '#1A202C' }}>
          商务政策确认 · {storeName} / 共 {displayRows} 行
        </span>
      </div>
      <UText type="secondary" style={{ fontSize: 12 }}>
        唯一项 = 门店 + 业务场景 + 产品分类 · 列按三组横向分块
      </UText>
    </div>
  );
}