feat(frontend): 优化"最大"按钮计算,支持保留2位小数
- 修改前:只能整数数量,导致余额浪费 - 示例:余额2.95U,价格0.86 → 数量3张(浪费0.37U) - 修改后:保留2位小数,充分利用余额 - 示例:余额2.95U,价格0.86 → 数量3.43张(利用全部余额) Made-with: Cursor
This commit is contained in:
@@ -886,9 +886,10 @@ const CryptoTailMonitor: React.FC = () => {
|
||||
return
|
||||
}
|
||||
|
||||
// 最大数量 = Math.floor(可用余额 / 价格)
|
||||
const maxSize = Math.floor(balance / price)
|
||||
// 最大数量 = 余额 / 价格,保留2位小数
|
||||
let maxSize = Math.floor((balance / price) * 100) / 100
|
||||
|
||||
// 确保至少 1 张
|
||||
if (maxSize < 1) {
|
||||
message.warning(t('cryptoTailMonitor.manualOrder.insufficientBalanceForMax'))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user