diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 49184be1..c3eba2fc 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -142,6 +142,9 @@ class _Manager { ///生活缴费:查询生活缴费信息list String get dailyPaymentList => '/user/dailyPayment/list'; + + ///生活缴费:查询当前用户的房屋是否缴费 + String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment'; } class _Community { diff --git a/lib/model/manager/estate_payment_model.dart b/lib/model/manager/estate_payment_model.dart new file mode 100644 index 00000000..7dbe8ee5 --- /dev/null +++ b/lib/model/manager/estate_payment_model.dart @@ -0,0 +1,21 @@ +class EstatePaymentModel { + int id; + String roomName; + int status; + + EstatePaymentModel({this.id, this.roomName, this.status}); + + EstatePaymentModel.fromJson(Map json) { + id = json['id']; + roomName = json['roomName']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['roomName'] = this.roomName; + data['status'] = this.status; + return data; + } +} \ No newline at end of file diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 60a2c16e..41481123 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -78,7 +78,9 @@ class _LifePayPageState extends State { 32.w.heightBox, GestureDetector( onTap: () { - MyHousePage().to(); + MyHousePage( + needFindPayTag: true, + ).to(); }, child: Row( children: [ diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart index 169cb9df..8e563e85 100644 --- a/lib/pages/life_pay/widget/my_house_page.dart +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -1,5 +1,7 @@ import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/model/manager/estate_payment_model.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart'; +import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; @@ -9,7 +11,8 @@ import 'package:akuCommunity/utils/headers.dart'; import 'package:provider/provider.dart'; class MyHousePage extends StatefulWidget { - MyHousePage({Key key}) : super(key: key); + final bool needFindPayTag; + MyHousePage({Key key, this.needFindPayTag = false}) : super(key: key); @override _MyHousePageState createState() => _MyHousePageState(); @@ -41,6 +44,20 @@ Widget _unPaidTag() { class _MyHousePageState extends State { int _select; + List _list; + List get _unPaidList => _list.where((element) => element.status == 1).toList(); + @override + void initState() { + super.initState(); + if (widget.needFindPayTag) { + ManagerFunc.findEstatelsPayment().then((value) { + _list = value.data; + return _list; + }); + + } + } + Widget _buildCard(String currentHouse, String estateName, int index, {bool paid = false}) { return Container( @@ -65,7 +82,12 @@ class _MyHousePageState extends State { children: [ kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(), 16.w.heightBox, - BeeParse.getEstateName(estateName).text.color(ktextPrimary).size(28.sp).bold.make(), + BeeParse.getEstateName(estateName) + .text + .color(ktextPrimary) + .size(28.sp) + .bold + .make(), ], ), Spacer(), @@ -88,7 +110,10 @@ class _MyHousePageState extends State { children: [ ...userProvider.userDetailModel.estateNames .map((e) => _buildCard(userProvider.currentHouse, e, - userProvider.userDetailModel.estateNames.indexOf(e))) + userProvider.userDetailModel.estateNames.indexOf(e), + paid: widget.needFindPayTag + ? false + : _unPaidList.one((element) => element.roomName == e))) .toList(), ].sepWidget(separate: BeeDivider.horizontal()), ), diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 9e1a2155..f11a6667 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -158,4 +158,12 @@ class ManagerFunc { ); return baseModel; } + + static Future findEstatelsPayment()async{ + BaseModel baseModel = await NetUtil().get( + API.manager.findEstatelsPament, + showMessage: false, + ); + return baseModel.data; + } }