feat: 设置持仓支持今日首次买入

This commit is contained in:
hzm
2026-03-18 20:02:08 +08:00
parent 12229e8eeb
commit e8bd65e499
3 changed files with 61 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
export default function HoldingActionModal({ fund, onClose, onAction, hasHistory }) {
export default function HoldingActionModal({ fund, onClose, onAction, hasHistory, pendingCount }) {
const handleOpenChange = (open) => {
if (!open) {
onClose?.();
@@ -39,11 +39,26 @@ export default function HoldingActionModal({ fund, onClose, onAction, hasHistory
display: 'flex',
alignItems: 'center',
gap: 4,
position: 'relative',
}}
title="查看交易记录"
>
<span>📜</span>
<span>交易记录</span>
{pendingCount > 0 && (
<span
style={{
position: 'absolute',
top: -4,
right: -4,
width: 10,
height: 10,
borderRadius: '50%',
backgroundColor: '#ef4444',
border: '2px solid var(--background)',
}}
/>
)}
</button>
</div>
<button className="icon-button" onClick={onClose} style={{ border: 'none', background: 'transparent' }}>

View File

@@ -8,7 +8,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
export default function HoldingEditModal({ fund, holding, onClose, onSave }) {
export default function HoldingEditModal({ fund, holding, onClose, onSave, onOpenTrade }) {
const [mode, setMode] = useState('amount'); // 'amount' | 'share'
const dwjz = fund?.dwjz || fund?.gsz || 0;
@@ -124,6 +124,23 @@ export default function HoldingEditModal({ fund, holding, onClose, onSave }) {
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<SettingsIcon width="20" height="20" />
<span>设置持仓</span>
{typeof onOpenTrade === 'function' && (
<button
type="button"
onClick={onOpenTrade}
className="button secondary"
style={{
height: 28,
padding: '0 10px',
borderRadius: 999,
fontSize: 12,
background: 'rgba(255,255,255,0.06)',
color: 'var(--primary)',
}}
>
今日买入去加仓
</button>
)}
</div>
<button className="icon-button" onClick={onClose} style={{ border: 'none', background: 'transparent' }}>
<CloseIcon width="20" height="20" />