变更内容: - 删除 uni-app x 项目 (app/ 目录) - 新增 Flutter 项目 (flutter_monisuo/ 目录) - 新增部署脚本 (deploy/ 目录) Flutter 项目功能: - 用户登录/注册 - 首页资产概览 - 行情币种列表 - 交易买卖操作 - 资产账户管理 - 充值/提现/划转 - 深色主题 - JWT Token 认证 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
140 lines
3.5 KiB
Dart
140 lines
3.5 KiB
Dart
/// 交易订单模型
|
|
class OrderTrade {
|
|
final int id;
|
|
final String orderNo;
|
|
final int userId;
|
|
final String coinCode;
|
|
final int direction; // 1=买入, 2=卖出
|
|
final String price;
|
|
final String quantity;
|
|
final String amount;
|
|
final int status; // 1=待处理, 2=已完成, 3=已取消
|
|
final DateTime? createTime;
|
|
final DateTime? updateTime;
|
|
|
|
OrderTrade({
|
|
required this.id,
|
|
required this.orderNo,
|
|
required this.userId,
|
|
required this.coinCode,
|
|
required this.direction,
|
|
required this.price,
|
|
required this.quantity,
|
|
required this.amount,
|
|
required this.status,
|
|
this.createTime,
|
|
this.updateTime,
|
|
});
|
|
|
|
factory OrderTrade.fromJson(Map<String, dynamic> json) {
|
|
return OrderTrade(
|
|
id: json['id'] as int? ?? 0,
|
|
orderNo: json['orderNo'] as String? ?? '',
|
|
userId: json['userId'] as int? ?? 0,
|
|
coinCode: json['coinCode'] as String? ?? '',
|
|
direction: json['direction'] as int? ?? 1,
|
|
price: json['price']?.toString() ?? '0.00',
|
|
quantity: json['quantity']?.toString() ?? '0',
|
|
amount: json['amount']?.toString() ?? '0.00',
|
|
status: json['status'] as int? ?? 1,
|
|
createTime: json['createTime'] != null
|
|
? DateTime.tryParse(json['createTime'])
|
|
: null,
|
|
updateTime: json['updateTime'] != null
|
|
? DateTime.tryParse(json['updateTime'])
|
|
: null,
|
|
);
|
|
}
|
|
|
|
/// 方向文字
|
|
String get directionText => direction == 1 ? '买入' : '卖出';
|
|
|
|
/// 状态文字
|
|
String get statusText {
|
|
switch (status) {
|
|
case 1:
|
|
return '待处理';
|
|
case 2:
|
|
return '已完成';
|
|
case 3:
|
|
return '已取消';
|
|
default:
|
|
return '未知';
|
|
}
|
|
}
|
|
|
|
/// 是否为买入
|
|
bool get isBuy => direction == 1;
|
|
}
|
|
|
|
/// 充提订单模型
|
|
class OrderFund {
|
|
final int id;
|
|
final String orderNo;
|
|
final int userId;
|
|
final int orderType; // 1=充值, 2=提现
|
|
final String amount;
|
|
final int status; // 1=待审核, 2=已通过, 3=已拒绝, 4=已取消
|
|
final String remark;
|
|
final String? auditRemark;
|
|
final DateTime? createTime;
|
|
final DateTime? auditTime;
|
|
|
|
OrderFund({
|
|
required this.id,
|
|
required this.orderNo,
|
|
required this.userId,
|
|
required this.orderType,
|
|
required this.amount,
|
|
required this.status,
|
|
required this.remark,
|
|
this.auditRemark,
|
|
this.createTime,
|
|
this.auditTime,
|
|
});
|
|
|
|
factory OrderFund.fromJson(Map<String, dynamic> json) {
|
|
return OrderFund(
|
|
id: json['id'] as int? ?? 0,
|
|
orderNo: json['orderNo'] as String? ?? '',
|
|
userId: json['userId'] as int? ?? 0,
|
|
orderType: json['orderType'] as int? ?? 1,
|
|
amount: json['amount']?.toString() ?? '0.00',
|
|
status: json['status'] as int? ?? 1,
|
|
remark: json['remark']?.toString() ?? '',
|
|
auditRemark: json['auditRemark']?.toString(),
|
|
createTime: json['createTime'] != null
|
|
? DateTime.tryParse(json['createTime'])
|
|
: null,
|
|
auditTime: json['auditTime'] != null
|
|
? DateTime.tryParse(json['auditTime'])
|
|
: null,
|
|
);
|
|
}
|
|
|
|
/// 订单类型文字
|
|
String get orderTypeText => orderType == 1 ? '充值' : '提现';
|
|
|
|
/// 状态文字
|
|
String get statusText {
|
|
switch (status) {
|
|
case 1:
|
|
return '待审核';
|
|
case 2:
|
|
return '已通过';
|
|
case 3:
|
|
return '已拒绝';
|
|
case 4:
|
|
return '已取消';
|
|
default:
|
|
return '未知';
|
|
}
|
|
}
|
|
|
|
/// 是否为充值
|
|
bool get isDeposit => orderType == 1;
|
|
|
|
/// 是否可取消
|
|
bool get canCancel => status == 1;
|
|
}
|