feat(frontend): 手动下单功能增强与金额模式支持

- 后端返回 amountMode 和 amountValue 字段,支持前端获取策略配置
- 手动下单确认弹窗显示用户可用余额(绿色高亮)
- 价格输入框右侧添加"获取最新价"按钮,支持实时更新价格
- 数量输入框右侧添加"最大"按钮,根据余额自动计算最大购买数量
- 修正数量计算逻辑:FIXED 和 RATIO 模式均按实际金额计算数量,保留2位小数
  - FIXED 模式:使用配置的固定金额
  - RATIO 模式:按比例计算可用余额
- 数量计算使用保留小数方式(而非向上取整),确保精确匹配投入金额
  - 示例:固定1U,价格0.4,自动填充2.5张
  - 示例:比例30%,余额20U,价格0.4,自动填充15张

Made-with: Cursor
This commit is contained in:
WrBug
2026-02-26 21:19:06 +08:00
parent 9b4d8fc001
commit 79b154515d
6 changed files with 175 additions and 31 deletions
+10 -1
View File
@@ -1676,7 +1676,16 @@
"failed": "Manual order failed: {{reason}}",
"errorSigning": "Signing failed: {reason}",
"errorNetwork": "Network error, please try again later",
"priceNotLoaded": "Price data not loaded"
"priceNotLoaded": "Price data not loaded",
"insufficientBalance": "Insufficient balance, available amount less than 1 USDC",
"fetchBalanceFailed": "Failed to fetch account balance",
"availableBalance": "Available Balance",
"fetchLatestPrice": "Latest Price",
"priceUpdated": "Price updated",
"maxSize": "Max",
"invalidPriceOrBalance": "Invalid price or balance",
"insufficientBalanceForMax": "Insufficient balance for max size",
"maxSizeUpdated": "Updated to max size"
}
}
}