小赖 4 years ago
commit 7522de6181

@ -1,3 +1,6 @@
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';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -9,12 +12,9 @@ import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_record_page.dart';
import 'package:akuCommunity/pages/life_pay/widget/life_pay_detail_page.dart'; import 'package:akuCommunity/pages/life_pay/widget/life_pay_detail_page.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart';
import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_divider.dart';
@ -213,6 +213,15 @@ class _LifePayPageState extends State<LifePayPage> {
); );
} }
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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
@ -236,12 +245,15 @@ class _LifePayPageState extends State<LifePayPage> {
controller: _controller, controller: _controller,
extraParams: {'estateId': appProvider.selectedHouse.estateId}, extraParams: {'estateId': appProvider.selectedHouse.estateId},
convert: (model) { convert: (model) {
_selectPay = List.generate( List<LifePayModel> lifePayModels =
(_selectPay.length ?? 0) + model.tableList.length, model.tableList.map((e) => LifePayModel.fromJson(e)).toList();
(index) => SelectPay(payCount: 0, payTotal: 0.0)); _selectPay.addAll(lifePayModels
return model.tableList .map((e) => SelectPay(
.map((e) => LifePayModel.fromJson(e)) payCount: e.dailyPaymentTypeVos.length,
.toList(); payTotal: getPayTotal(e),
))
.toList());
return lifePayModels;
}, },
builder: (items) { builder: (items) {
_models = items; _models = items;
@ -284,7 +296,7 @@ class _LifePayPageState extends State<LifePayPage> {
if (!_selectYears.contains(i)) { if (!_selectYears.contains(i)) {
_selectYears.add(i); _selectYears.add(i);
} }
} }
_totalCost = 0; _totalCost = 0;
_count = 0; _count = 0;
for (var item in _selectPay) { for (var item in _selectPay) {

Loading…
Cancel
Save