import { CapsuleTabs, Tag } from 'antd-mobile' import { useState } from 'react' import { formatMoney, formatNumber } from '../../../utils/format' import type { SnapshotSlot, TodaySnapshot } from '../types' type TodaySnapshotSectionProps = { snapshots: TodaySnapshot[] } const statusMap = { pending: { color: 'default', label: '待生成' }, success: { color: 'success', label: '已生成' }, failed: { color: 'danger', label: '生成失败' }, temporary: { color: 'warning', label: '临时数据' }, } as const export function TodaySnapshotSection({ snapshots }: TodaySnapshotSectionProps) { const [activeSlot, setActiveSlot] = useState('1015') const activeSnapshot = snapshots.find((snapshot) => snapshot.slot === activeSlot) ?? snapshots[0] const status = statusMap[activeSnapshot.status] return (

今日节点

抢购 / 寄卖快报

{status.label}
setActiveSlot(key as SnapshotSlot)}> {snapshots.map((snapshot) => ( ))}

{activeSnapshot.message}

{activeSnapshot.generatedAt &&

生成时间:{activeSnapshot.generatedAt}

}
采购用户{formatNumber(activeSnapshot.purchaseUsers)}人 订单数{formatNumber(activeSnapshot.orderCount)}单 成交额{formatMoney(activeSnapshot.dealAmount)} 支付额{formatMoney(activeSnapshot.paidAmount)} 新增商品{formatNumber(activeSnapshot.newMerchandiseCount)}件 奖金变化{formatMoney(Number(activeSnapshot.selfBonusChange) + Number(activeSnapshot.shareBonusChange))}
) }