From d64b7b2dd7c629dbdc65ed92a91fc4f05bbfca43 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 9 Apr 2021 10:48:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=B4=BB=E7=BC=B4=E8=B4=B9=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/life_pay/life_pay_page.dart | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index c84b44aa..0ad0452b 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,4 +1,3 @@ -import 'package:akuCommunity/constants/app_values.dart'; import 'package:akuCommunity/pages/life_pay/life_pay_record_page.dart'; import 'package:akuCommunity/provider/app_provider.dart'; import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart'; @@ -14,7 +13,6 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/pages/life_pay/widget/life_pay_detail_page.dart'; -import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; @@ -215,6 +213,15 @@ class _LifePayPageState extends State { ); } + double getPayTotal(LifePayModel list) { + num total = 0; + for (var item in list.dailyPaymentTypeVos) { + total += ((item.detailedVoList[1].paymentPrice ?? 0) + + (item.detailedVoList[2].paymentPrice ?? 0)); + } + return total; + } + @override Widget build(BuildContext context) { UserProvider userProvider = Provider.of(context); @@ -238,12 +245,15 @@ class _LifePayPageState extends State { controller: _controller, extraParams: {'estateId': appProvider.selectedHouse.estateId}, convert: (model) { - _selectPay = List.generate( - (_selectPay.length ?? 0) + model.tableList.length, - (index) => SelectPay(payCount: 0, payTotal: 0.0)); - return model.tableList - .map((e) => LifePayModel.fromJson(e)) - .toList(); + List lifePayModels = + model.tableList.map((e) => LifePayModel.fromJson(e)).toList(); + _selectPay.addAll(lifePayModels + .map((e) => SelectPay( + payCount: e.dailyPaymentTypeVos.length, + payTotal: getPayTotal(e), + )) + .toList()); + return lifePayModels; }, builder: (items) { _models = items; @@ -286,7 +296,7 @@ class _LifePayPageState extends State { if (!_selectYears.contains(i)) { _selectYears.add(i); } - } + } _totalCost = 0; _count = 0; for (var item in _selectPay) {