This commit is contained in:
sion
2026-04-21 08:09:45 +08:00
parent 0066615054
commit 5264043c21
1831 changed files with 15376 additions and 39973 deletions

View File

@@ -8,7 +8,8 @@ class OrderTrade {
final String price;
final String quantity;
final String amount;
final int status; // 1=待處理, 2=已成, 3=已取消
final int status; // 0=委托中, 1=已成交, 2=失败, 3=已取消
final int? orderType; // 1=市价单, 2=限价单
final DateTime? createTime;
final DateTime? updateTime;
@@ -22,6 +23,7 @@ class OrderTrade {
required this.quantity,
required this.amount,
required this.status,
this.orderType,
this.createTime,
this.updateTime,
});
@@ -37,6 +39,7 @@ class OrderTrade {
quantity: json['quantity']?.toString() ?? '0',
amount: json['amount']?.toString() ?? '0.00',
status: json['status'] as int? ?? 1,
orderType: json['orderType'] as int?,
createTime: json['createTime'] != null
? DateTime.tryParse(json['createTime'])
: null,
@@ -52,10 +55,12 @@ class OrderTrade {
/// 狀態文字
String get statusText {
switch (status) {
case 0:
return '委托中';
case 1:
return '待處理';
return '已成交';
case 2:
return '已完成';
return '失败';
case 3:
return '已取消';
default:
@@ -63,8 +68,14 @@ class OrderTrade {
}
}
/// 是否为委托中
bool get isPending => status == 0;
/// 是否為買入
bool get isBuy => direction == 1;
/// 订单类型文字
String get orderTypeText => orderType == 2 ? '限价' : '市价';
}
/// 充提訂單模型