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

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

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

@ -46,6 +46,7 @@ DetailedVoList _$DetailedVoListFromJson(Map<String, dynamic> json) {
return DetailedVoList(
groupId: json['groupId'] as int,
paymentPrice: json['paymentPrice'] as num,
overdueFine: json['overdueFine'] as num,
detailsVoList: (json['detailsVoList'] as List<dynamic>)
.map((e) => DetailsVoList.fromJson(e as Map<String, dynamic>))
.toList(),
@ -56,6 +57,7 @@ Map<String, dynamic> _$DetailedVoListToJson(DetailedVoList instance) =>
<String, dynamic>{
'groupId': instance.groupId,
'paymentPrice': instance.paymentPrice,
'overdueFine': instance.overdueFine,
'detailsVoList': instance.detailsVoList.map((e) => e.toJson()).toList(),
};
@ -70,6 +72,11 @@ DetailsVoList _$DetailsVoListFromJson(Map<String, dynamic> json) {
endDate: json['endDate'] as String,
unitPriceType: json['unitPriceType'] as String,
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,
'unitPriceType': instance.unitPriceType,
'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.detailsVoList.forEach((element) {
count++;
price += element.costPrice;
price += (element.paymentPrice+element.overdueFine);
ids.add(element.id);
});
});

@ -40,7 +40,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
element.detailedVoList.forEach((element) {
element.detailsVoList.forEach((element) {
count++;
price += element.costPrice;
price += (element.paymentPrice+element.overdueFine);
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(),
Spacer(),
'¥${model.paymentPrice.toStringAsFixed(2)}'
'¥${(model.paymentPrice+model.overdueFine).toStringAsFixed(2)}'
.text
.color(kDangerColor)
.size(28.sp)
@ -119,7 +119,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
12.w.widthBox,
model.month.toString().text.size(26.sp).black.make(),
Spacer(),
'¥${model.totalPrice.toStringAsFixed(2)}'
'¥${(model.paymentPrice+model.overdueFine).toStringAsFixed(2)}'
.text
.size(26.sp)
.black

Loading…
Cancel
Save