50 lines
1.6 KiB
Dart
Raw Normal View History

2025-09-18 16:13:37 +08:00
class AccountBill {
final int id;
final int? memberId;
final int? accountId;
final double moneyBalance; // 当前余额
final double beforeBalance; // 变动前余额
final double afterBalance; // 变动后余额
final double changeAmount; // 变动金额
final int changeType; // 变动类型1收入 2支出
final String changeDesc; // 变动描述
final String source; // 变动来源
final String createTime; // 创建时间
final int createBy;
final String updateTime;
AccountBill({
required this.id,
this.memberId,
this.accountId,
this.moneyBalance = 0.0,
this.beforeBalance = 0.0,
this.afterBalance = 0.0,
this.changeAmount = 0.0,
this.changeType = 1,
this.changeDesc = '',
this.source = '未知来源',
this.createTime = '',
this.createBy = 0,
this.updateTime = '',
});
factory AccountBill.fromJson(Map<String, dynamic> json) {
return AccountBill(
id: json['id'] ?? 0,
memberId: json['member_id'],
accountId: json['account_id'],
moneyBalance: (json['money_balance'] as num?)?.toDouble() ?? 0.0,
beforeBalance: (json['before_balance'] as num?)?.toDouble() ?? 0.0,
afterBalance: (json['after_balance'] as num?)?.toDouble() ?? 0.0,
changeAmount: (json['change_amount'] as num?)?.toDouble() ?? 0.0,
changeType: json['change_type'] ?? 1,
changeDesc: json['change_desc'] ?? '',
source: json['source'] ?? '未知来源',
createTime: json['create_time'] ?? '',
createBy: json['create_by'] ?? 0,
updateTime: json['update_time'] ?? '',
);
}
}