From 5bed095fe5b4b1a8b46917343f144bca8b9b5170 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 14 Jul 2021 11:42:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=B4=BB=E7=BC=B4=E8=B4=B9=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=87=91=E9=A2=9D=E7=AE=97=E6=B3=95=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/life_pay/life_pay_list_model.dart | 31 ++++++++++++++----- .../life_pay/life_pay_list_model.g.dart | 12 +++++++ lib/pages/life_pay/life_pay_page.dart | 2 +- .../life_pay/widget/life_pay_detail_page.dart | 6 ++-- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/lib/models/life_pay/life_pay_list_model.dart b/lib/models/life_pay/life_pay_list_model.dart index c783df19..29ac491a 100644 --- a/lib/models/life_pay/life_pay_list_model.dart +++ b/lib/models/life_pay/life_pay_list_model.dart @@ -15,12 +15,12 @@ class LifePayListModel extends Equatable { }); factory LifePayListModel.fromJson(Map 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 toJson() => _$LifePayListModelToJson(this); @override List 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; DetailedVoList({ required this.groupId, required this.paymentPrice, + required this.overdueFine, required this.detailsVoList, }); factory DetailedVoList.fromJson(Map json) => _$DetailedVoListFromJson(json); Map toJson() => _$DetailedVoListToJson(this); @override - List get props => [groupId, paymentPrice, detailsVoList]; + List 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 json) => _$DetailsVoListFromJson(json); @@ -98,6 +110,11 @@ class DetailsVoList extends Equatable { endDate, unitPriceType, number, + paymentPrice, + status, + rate, + paymentTerm, + overdueFine, ]; } } diff --git a/lib/models/life_pay/life_pay_list_model.g.dart b/lib/models/life_pay/life_pay_list_model.g.dart index 4d49d710..07dc8dc5 100644 --- a/lib/models/life_pay/life_pay_list_model.g.dart +++ b/lib/models/life_pay/life_pay_list_model.g.dart @@ -46,6 +46,7 @@ DetailedVoList _$DetailedVoListFromJson(Map json) { return DetailedVoList( groupId: json['groupId'] as int, paymentPrice: json['paymentPrice'] as num, + overdueFine: json['overdueFine'] as num, detailsVoList: (json['detailsVoList'] as List) .map((e) => DetailsVoList.fromJson(e as Map)) .toList(), @@ -56,6 +57,7 @@ Map _$DetailedVoListToJson(DetailedVoList instance) => { 'groupId': instance.groupId, 'paymentPrice': instance.paymentPrice, + 'overdueFine': instance.overdueFine, 'detailsVoList': instance.detailsVoList.map((e) => e.toJson()).toList(), }; @@ -70,6 +72,11 @@ DetailsVoList _$DetailsVoListFromJson(Map 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 _$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, }; diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 06adf7cf..b4528bf3 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -72,7 +72,7 @@ class _LifePayPageState extends State { element.detailedVoList.forEach((element) { element.detailsVoList.forEach((element) { count++; - price += element.costPrice; + price += (element.paymentPrice+element.overdueFine); ids.add(element.id); }); }); diff --git a/lib/pages/life_pay/widget/life_pay_detail_page.dart b/lib/pages/life_pay/widget/life_pay_detail_page.dart index e71fab42..24b0d76b 100644 --- a/lib/pages/life_pay/widget/life_pay_detail_page.dart +++ b/lib/pages/life_pay/widget/life_pay_detail_page.dart @@ -40,7 +40,7 @@ class _LifePayDetailPageState extends State { 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 { ? '${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 { 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