feat:自动补货/手动采购逻辑修改:批量获取-》打包-》获取Token列表

This commit is contained in:
2026-10-29 16:05:39 +08:00
parent 8198bd6feb
commit 8494fabc82
23 changed files with 3679 additions and 85 deletions
@@ -1,6 +1,7 @@
import { Col, Row, Tag } from 'antd'
import {
CheckCircleOutlined,
CloudServerOutlined,
ExclamationCircleOutlined,
FireOutlined,
ShoppingCartOutlined,
@@ -9,6 +10,8 @@ import type { RockStats } from '../../api'
export interface RockMetricCardsProps {
stats: RockStats | null
upstreamStock: number | null
blackTokenCost: number
availableStock: number
warningStock: number
isStockLow: boolean
@@ -20,6 +23,8 @@ export interface RockMetricCardsProps {
export function RockMetricCards({
stats,
upstreamStock,
blackTokenCost,
availableStock,
warningStock,
isStockLow,
@@ -30,7 +35,38 @@ export function RockMetricCards({
}: RockMetricCardsProps) {
return (
<Row gutter={[16, 16]} style={{ marginBottom: 20 }}>
<Col xs={24} sm={12} lg={6}>
<Col flex="1 1 200px">
<div className="metric-card-box">
<div className="metric-card-header">
<span className="metric-card-title">上游可用库存 (0666.pro)</span>
<div className="metric-card-icon" style={{ background: '#e0f2fe', color: '#0284c7' }}>
<CloudServerOutlined />
</div>
</div>
<div className="metric-card-value" style={{ color: upstreamStock === null ? '#94a3b8' : '#0369a1' }}>
{upstreamStock === null ? '-' : upstreamStock}
<span style={{ fontSize: 13, fontWeight: 500, marginLeft: 4, color: '#64748b' }}>个</span>
</div>
<div className="metric-card-footer">
<span>采购单价: {blackTokenCost.toFixed(2)} 点/个</span>
{upstreamStock === null ? (
<Tag color="warning" style={{ margin: 0, borderRadius: 4 }}>
未获取
</Tag>
) : upstreamStock === 0 ? (
<Tag color="error" style={{ margin: 0, borderRadius: 4 }}>
无库存
</Tag>
) : (
<Tag color="processing" style={{ margin: 0, borderRadius: 4 }}>
实时
</Tag>
)}
</div>
</div>
</Col>
<Col flex="1 1 200px">
<div className="metric-card-box">
<div className="metric-card-header">
<span className="metric-card-title">可用通用库存 (Available)</span>
@@ -45,7 +81,9 @@ export function RockMetricCards({
<div className="metric-card-footer">
<span>警戒水位: {warningStock} 个</span>
{isStockLow ? (
<Tag color="error" style={{ margin: 0, borderRadius: 4 }}>库存紧缺</Tag>
<Tag color="error" style={{ margin: 0, borderRadius: 4 }}>
库存紧缺
</Tag>
) : (
<span style={{ color: '#10b981', fontWeight: 600 }}>储备充足</span>
)}
@@ -53,7 +91,7 @@ export function RockMetricCards({
</div>
</Col>
<Col xs={24} sm={12} lg={6}>
<Col flex="1 1 200px">
<div className="metric-card-box">
<div className="metric-card-header">
<span className="metric-card-title">绑定错误阻断 (Mismatch)</span>
@@ -68,7 +106,9 @@ export function RockMetricCards({
<div className="metric-card-footer">
<span>{hasMismatch ? 'UID强一致校验拦截保护' : '暂无异常阻断'}</span>
{hasMismatch ? (
<Tag color="error" style={{ margin: 0, borderRadius: 4 }}>需核对处理</Tag>
<Tag color="error" style={{ margin: 0, borderRadius: 4 }}>
需核对处理
</Tag>
) : (
<span style={{ color: '#10b981', fontWeight: 600 }}>状态正常</span>
)}
@@ -76,7 +116,7 @@ export function RockMetricCards({
</div>
</Col>
<Col xs={24} sm={12} lg={6}>
<Col flex="1 1 200px">
<div className="metric-card-box">
<div className="metric-card-header">
<span className="metric-card-title">已履约交付 (Redeemed)</span>
@@ -95,7 +135,7 @@ export function RockMetricCards({
</div>
</Col>
<Col xs={24} sm={12} lg={6}>
<Col flex="1 1 200px">
<div className="metric-card-box">
<div className="metric-card-header">
<span className="metric-card-title">0666.pro 账号积分</span>