生活缴费支付金额算法更改

hmxc
张萌 3 years ago
parent 62c58222c0
commit 5bed095fe5

@ -15,12 +15,12 @@ class LifePayListModel extends Equatable {
}); });
factory LifePayListModel.fromJson(Map<String, dynamic> json) => factory LifePayListModel.fromJson(Map<String, dynamic> json) =>
_$LifePayListModelFromJson(json); _$LifePayListModelFromJson(json);
factory LifePayListModel.zero() => // factory LifePayListModel.zero() =>
LifePayListModel(years: 0, paymentNum: 0, dailyPaymentTypeVos: [ // LifePayListModel(years: 0, paymentNum: 0, dailyPaymentTypeVos: [
DailyPaymentTypeVos(id: 0, name: '', detailedVoList: [ // DailyPaymentTypeVos(id: 0, name: '', detailedVoList: [
DetailedVoList(groupId: 0, paymentPrice: 0, detailsVoList: []) // DetailedVoList(groupId: 0, paymentPrice: 0, detailsVoList: [])
]) // ])
]); // ]);
Map<String, dynamic> toJson() => _$LifePayListModelToJson(this); Map<String, dynamic> toJson() => _$LifePayListModelToJson(this);
@override @override
List<Object?> get props => [years, paymentNum, dailyPaymentTypeVos]; List<Object?> get props => [years, paymentNum, dailyPaymentTypeVos];
@ -47,17 +47,19 @@ class DailyPaymentTypeVos extends Equatable {
class DetailedVoList extends Equatable { class DetailedVoList extends Equatable {
final int groupId; final int groupId;
final num paymentPrice; final num paymentPrice;
final num overdueFine;
final List<DetailsVoList> detailsVoList; final List<DetailsVoList> detailsVoList;
DetailedVoList({ DetailedVoList({
required this.groupId, required this.groupId,
required this.paymentPrice, required this.paymentPrice,
required this.overdueFine,
required this.detailsVoList, required this.detailsVoList,
}); });
factory DetailedVoList.fromJson(Map<String, dynamic> json) => factory DetailedVoList.fromJson(Map<String, dynamic> json) =>
_$DetailedVoListFromJson(json); _$DetailedVoListFromJson(json);
Map<String, dynamic> toJson() => _$DetailedVoListToJson(this); Map<String, dynamic> toJson() => _$DetailedVoListToJson(this);
@override @override
List<Object> get props => [groupId, paymentPrice, detailsVoList]; List<Object> get props => [groupId, paymentPrice, overdueFine, detailsVoList];
} }
@JsonSerializable(createToJson: true, explicitToJson: true) @JsonSerializable(createToJson: true, explicitToJson: true)
@ -72,6 +74,11 @@ class DetailsVoList extends Equatable {
final String unitPriceType; final String unitPriceType;
@JsonKey(name: 'num') @JsonKey(name: 'num')
final int number; final int number;
final num paymentPrice;
final int status;
final num rate;
final String paymentTerm;
final num overdueFine;
DetailsVoList({ DetailsVoList({
required this.id, required this.id,
required this.month, required this.month,
@ -82,6 +89,11 @@ class DetailsVoList extends Equatable {
required this.endDate, required this.endDate,
required this.unitPriceType, required this.unitPriceType,
required this.number, required this.number,
required this.paymentPrice,
required this.status,
required this.rate,
required this.paymentTerm,
required this.overdueFine,
}); });
factory DetailsVoList.fromJson(Map<String, dynamic> json) => factory DetailsVoList.fromJson(Map<String, dynamic> json) =>
_$DetailsVoListFromJson(json); _$DetailsVoListFromJson(json);
@ -98,6 +110,11 @@ class DetailsVoList extends Equatable {
endDate, endDate,
unitPriceType, unitPriceType,
number, number,
paymentPrice,
status,
rate,
paymentTerm,
overdueFine,
]; ];
} }
} }

@ -46,6 +46,7 @@ DetailedVoList _$DetailedVoListFromJson(Map<String, dynamic> json) {
return DetailedVoList( return DetailedVoList(
groupId: json['groupId'] as int, groupId: json['groupId'] as int,
paymentPrice: json['paymentPrice'] as num, paymentPrice: json['paymentPrice'] as num,
overdueFine: json['overdueFine'] as num,
detailsVoList: (json['detailsVoList'] as List<dynamic>) detailsVoList: (json['detailsVoList'] as List<dynamic>)
.map((e) => DetailsVoList.fromJson(e as Map<String, dynamic>)) .map((e) => DetailsVoList.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
@ -56,6 +57,7 @@ Map<String, dynamic> _$DetailedVoListToJson(DetailedVoList instance) =>
<String, dynamic>{ <String, dynamic>{
'groupId': instance.groupId, 'groupId': instance.groupId,
'paymentPrice': instance.paymentPrice, 'paymentPrice': instance.paymentPrice,
'overdueFine': instance.overdueFine,
'detailsVoList': instance.detailsVoList.map((e) => e.toJson()).toList(), 'detailsVoList': instance.detailsVoList.map((e) => e.toJson()).toList(),
}; };
@ -70,6 +72,11 @@ DetailsVoList _$DetailsVoListFromJson(Map<String, dynamic> json) {
endDate: json['endDate'] as String, endDate: json['endDate'] as String,
unitPriceType: json['unitPriceType'] as String, unitPriceType: json['unitPriceType'] as String,
number: json['num'] as int, number: json['num'] as int,
paymentPrice: json['paymentPrice'] as num,
status: json['status'] as int,
rate: json['rate'] as num,
paymentTerm: json['paymentTerm'] as String,
overdueFine: json['overdueFine'] as num,
); );
} }
@ -84,4 +91,9 @@ Map<String, dynamic> _$DetailsVoListToJson(DetailsVoList instance) =>
'endDate': instance.endDate, 'endDate': instance.endDate,
'unitPriceType': instance.unitPriceType, 'unitPriceType': instance.unitPriceType,
'num': instance.number, 'num': instance.number,
'paymentPrice': instance.paymentPrice,
'status': instance.status,
'rate': instance.rate,
'paymentTerm': instance.paymentTerm,
'overdueFine': instance.overdueFine,
}; };

@ -72,7 +72,7 @@ class _LifePayPageState extends State<LifePayPage> {
element.detailedVoList.forEach((element) { element.detailedVoList.forEach((element) {
element.detailsVoList.forEach((element) { element.detailsVoList.forEach((element) {
count++; count++;
price += element.costPrice; price += (element.paymentPrice+element.overdueFine);
ids.add(element.id); ids.add(element.id);
}); });
}); });

@ -40,7 +40,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
element.detailedVoList.forEach((element) { element.detailedVoList.forEach((element) {
element.detailsVoList.forEach((element) { element.detailsVoList.forEach((element) {
count++; count++;
price += element.costPrice; price += (element.paymentPrice+element.overdueFine);
ids.add(element.id); ids.add(element.id);
}); });
}); });
@ -74,7 +74,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
? '${widget.year}上半年'.text.black.size(28.sp).make() ? '${widget.year}上半年'.text.black.size(28.sp).make()
: '${widget.year}下半年'.text.black.size(28.sp).make(), : '${widget.year}下半年'.text.black.size(28.sp).make(),
Spacer(), Spacer(),
'¥${model.paymentPrice.toStringAsFixed(2)}' '¥${(model.paymentPrice+model.overdueFine).toStringAsFixed(2)}'
.text .text
.color(kDangerColor) .color(kDangerColor)
.size(28.sp) .size(28.sp)
@ -119,7 +119,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
12.w.widthBox, 12.w.widthBox,
model.month.toString().text.size(26.sp).black.make(), model.month.toString().text.size(26.sp).black.make(),
Spacer(), Spacer(),
'¥${model.totalPrice.toStringAsFixed(2)}' '¥${(model.paymentPrice+model.overdueFine).toStringAsFixed(2)}'
.text .text
.size(26.sp) .size(26.sp)
.black .black

Loading…
Cancel
Save