import { Button, Input, Space, Tooltip } from 'antd' import type { ClaimProductInfo } from '@/types/claim' export function ClaimProductItems({ product, compact = false, }: { product: ClaimProductInfo | null compact?: boolean }) { const items = getProductItems(product) const hasMultipleItems = Boolean(product?.isBundle || items.length > 1) if (!items.length) { return null } return (
{hasMultipleItems ? '包含商品' : '商品明细'} {hasMultipleItems ? {items.length} 项 : null}
{items.map((item) => (
{item.name} x{item.quantity}
))}
) } export function UidEditRow({ uidInput, submitting, onChange, onSubmit, }: { uidInput: string submitting: boolean onChange: (value: string) => void onSubmit: () => void }) { return ( onChange(event.target.value.replace(/\D/g, '').slice(0, 15))} onPressEnter={onSubmit} /> ) } export function InfoTile({ label, value }: { label: string; value: string }) { return (
{label} {value}
) } export function InfoRow({ label, value }: { label: string; value: string }) { return (
{label} {value}
) } function getProductItems(product: ClaimProductInfo | null) { const items = Array.isArray(product?.items) ? product.items : [] return items .map((item) => ({ key: item.cloudSkuId || item.name, name: String(item.name || '').trim(), quantity: Math.max(1, Number(item.quantity || 1) || 1), })) .filter((item) => item.name) }