53 lines
2.0 KiB
Dart
53 lines
2.0 KiB
Dart
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 sourceName; // 变动来源文案
|
||
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.sourceName = '未知来源',
|
||
this.createTime = '',
|
||
this.createBy = 0,
|
||
this.updateTime = '',
|
||
});
|
||
|
||
factory AccountBill.fromJson(Map<String, dynamic> json) {
|
||
return AccountBill(
|
||
id: int.tryParse(json['id']?.toString() ?? '') ?? 0,
|
||
memberId: json['memberId'] != null ? int.tryParse(json['memberId'].toString()) : null,
|
||
accountId: json['accountId'] != null ? int.tryParse(json['accountId'].toString()) : null,
|
||
moneyBalance: double.tryParse(json['moneyBalance']?.toString() ?? '0') ?? 0.0,
|
||
beforeBalance: double.tryParse(json['beforeBalance']?.toString() ?? '0') ?? 0.0,
|
||
afterBalance: double.tryParse(json['afterBalance']?.toString() ?? '0') ?? 0.0,
|
||
changeAmount: double.tryParse(json['changeAmount']?.toString() ?? '0') ?? 0.0,
|
||
changeType: int.tryParse(json['changeType']?.toString() ?? '1') ?? 1,
|
||
changeDesc: json['changeDesc'] ?? '',
|
||
source: json['source']?.toString() ?? '未知来源',
|
||
sourceName: json['sourceName']?.toString() ?? '未知sourceName',
|
||
createTime: json['createTime'] ?? '',
|
||
createBy: int.tryParse(json['createBy']?.toString() ?? '0') ?? 0,
|
||
updateTime: json['updateTime'] ?? '',
|
||
);
|
||
}
|
||
}
|