111
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/// 资产总览模型
|
||||
/// 資產總覽模型
|
||||
class AssetOverview {
|
||||
final String totalAsset;
|
||||
final String fundBalance;
|
||||
@@ -22,7 +22,7 @@ class AssetOverview {
|
||||
}
|
||||
}
|
||||
|
||||
/// 资金账户模型
|
||||
/// 資金賬戶模型
|
||||
class AccountFund {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -51,7 +51,7 @@ class AccountFund {
|
||||
}
|
||||
}
|
||||
|
||||
/// 交易账户模型(持仓)
|
||||
/// 交易賬戶模型(持倉)
|
||||
class AccountTrade {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -78,7 +78,7 @@ class AccountTrade {
|
||||
});
|
||||
|
||||
factory AccountTrade.fromJson(Map<String, dynamic> json) {
|
||||
// 后端返回 value(当前价值),前端用 currentValue
|
||||
// 後端返回 value(當前價值),前端用 currentValue
|
||||
final quantityNum =
|
||||
double.tryParse(json['quantity']?.toString() ?? '0') ?? 0;
|
||||
final avgPriceNum =
|
||||
@@ -108,7 +108,7 @@ class AccountTrade {
|
||||
);
|
||||
}
|
||||
|
||||
/// 格式化盈亏率
|
||||
/// 格式化盈虧率
|
||||
String get formattedProfitRate {
|
||||
final prefix = profitRate >= 0 ? '+' : '';
|
||||
return '$prefix${profitRate.toStringAsFixed(2)}%';
|
||||
@@ -118,7 +118,7 @@ class AccountTrade {
|
||||
bool get isProfit => profitRate >= 0;
|
||||
}
|
||||
|
||||
/// 资金流水模型
|
||||
/// 資金流水模型
|
||||
class AccountFlow {
|
||||
final int id;
|
||||
final int userId;
|
||||
@@ -155,26 +155,26 @@ class AccountFlow {
|
||||
);
|
||||
}
|
||||
|
||||
/// 流水类型文字
|
||||
/// 流水類型文字
|
||||
String get flowTypeText {
|
||||
switch (flowType) {
|
||||
case '1':
|
||||
return '充值';
|
||||
case '2':
|
||||
return '提现';
|
||||
return '提現';
|
||||
case '3':
|
||||
return '转入交易账户';
|
||||
return '轉入交易賬戶';
|
||||
case '4':
|
||||
return '从交易账户转出';
|
||||
return '從交易賬戶轉出';
|
||||
case '5':
|
||||
return '卖出收入';
|
||||
return '賣出收入';
|
||||
case '6':
|
||||
return '买入支出';
|
||||
return '買入支出';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
/// 是否为收入
|
||||
/// 是否為收入
|
||||
bool get isIncome => ['1', '3', '5'].contains(flowType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user