生活缴费默认选中

hmxc
张萌 4 years ago
parent 431f8926a7
commit d64b7b2dd7

@ -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/pages/life_pay/life_pay_record_page.dart';
import 'package:akuCommunity/provider/app_provider.dart'; import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.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/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/widget/life_pay_detail_page.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/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/utils/bee_parse.dart';
@ -215,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);
@ -238,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;
@ -286,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