From 5c08941e3490cd451e6e31569867faff64a368a9 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 1 Feb 2021 14:57:28 +0800 Subject: [PATCH] dock interface:dailyPayment/list --- lib/constants/api.dart | 3 + lib/model/manager/life_pay_model.dart | 138 ++++++++++++++++++++++ lib/pages/life_pay/life_pay_page.dart | 119 ++++++++++++------- lib/pages/life_pay/widget/order_card.dart | 19 ++- 4 files changed, 225 insertions(+), 54 deletions(-) create mode 100644 lib/model/manager/life_pay_model.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 3482c98d..0da0fa35 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -139,6 +139,9 @@ class _Manager { ///借还管理:报损 String get fromLoss => '/user/articleBorrow/frmLoss'; + + ///生活缴费:查询生活缴费信息list + String get dailyPaymentList => '/user/dailyPayment/list'; } class _Community { diff --git a/lib/model/manager/life_pay_model.dart b/lib/model/manager/life_pay_model.dart new file mode 100644 index 00000000..fc23dbb2 --- /dev/null +++ b/lib/model/manager/life_pay_model.dart @@ -0,0 +1,138 @@ +class LifePayMolde { + int years; + int paymentNum; + List dailyPaymentTypeVos; + + LifePayMolde({this.years, this.paymentNum, this.dailyPaymentTypeVos}); + + LifePayMolde.fromJson(Map json) { + years = json['years']; + paymentNum = json['paymentNum']; + if (json['dailyPaymentTypeVos'] != null) { + dailyPaymentTypeVos = new List(); + json['dailyPaymentTypeVos'].forEach((v) { + dailyPaymentTypeVos.add(new DailyPaymentTypeVos.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['years'] = this.years; + data['paymentNum'] = this.paymentNum; + if (this.dailyPaymentTypeVos != null) { + data['dailyPaymentTypeVos'] = + this.dailyPaymentTypeVos.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DailyPaymentTypeVos { + int id; + String name; + List detailedVoList; + + DailyPaymentTypeVos({this.id, this.name, this.detailedVoList}); + + DailyPaymentTypeVos.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['detailedVoList'] != null) { + detailedVoList = new List(); + json['detailedVoList'].forEach((v) { + detailedVoList.add(new DetailedVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + if (this.detailedVoList != null) { + data['detailedVoList'] = + this.detailedVoList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DetailedVoList { + int groupId; + int paymentPrice; + List detailsVoList; + + DetailedVoList({this.groupId, this.paymentPrice, this.detailsVoList}); + + DetailedVoList.fromJson(Map json) { + groupId = json['groupId']; + paymentPrice = json['paymentPrice']; + if (json['detailsVoList'] != null) { + detailsVoList = new List(); + json['detailsVoList'].forEach((v) { + detailsVoList.add(new DetailsVoList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + data['groupId'] = this.groupId; + data['paymentPrice'] = this.paymentPrice; + if (this.detailsVoList != null) { + data['detailsVoList'] = + this.detailsVoList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class DetailsVoList { + int id; + String month; + int costPrice; + int paidPrice; + int totalPrice; + String beginDate; + String endDate; + String unitPriceType; + int num; + + DetailsVoList( + {this.id, + this.month, + this.costPrice, + this.paidPrice, + this.totalPrice, + this.beginDate, + this.endDate, + this.unitPriceType, + this.num}); + + DetailsVoList.fromJson(Map json) { + id = json['id']; + month = json['month']; + costPrice = json['costPrice']; + paidPrice = json['paidPrice']; + totalPrice = json['totalPrice']; + beginDate = json['beginDate']; + endDate = json['endDate']; + unitPriceType = json['unitPriceType']; + num = json['num']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['month'] = this.month; + data['costPrice'] = this.costPrice; + data['paidPrice'] = this.paidPrice; + data['totalPrice'] = this.totalPrice; + data['beginDate'] = this.beginDate; + data['endDate'] = this.endDate; + data['unitPriceType'] = this.unitPriceType; + data['num'] = this.num; + return data; + } +} diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 1a825d83..bad4699e 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,18 +1,20 @@ // Flutter imports: +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/personal/widget/order_card.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; // Package imports: import 'package:velocity_x/velocity_x.dart'; // Project imports: -import 'package:akuCommunity/pages/life_pay/life_pay_info_page/life_pay_info_page.dart'; import 'package:akuCommunity/pages/life_pay/life_pay_record_page/life_pay_record_page.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'widget/order_card.dart'; -import 'widget/submit_bar.dart'; class LifePayPage extends StatefulWidget { LifePayPage({Key key}) : super(key: key); @@ -22,6 +24,21 @@ class LifePayPage extends StatefulWidget { } class _LifePayPageState extends State { + EasyRefreshController _controller; + @override + void initState() { + super.initState(); + _controller = EasyRefreshController(); + } + + @override + void dispose() { + _controller?.dispose(); + super.dispose(); + } + + + @override Widget build(BuildContext context) { return BeeScaffold( @@ -38,45 +55,61 @@ class _LifePayPageState extends State { ), ), ], - body: Stack( - children: [ - ListView( - padding: EdgeInsets.only(bottom: 130.w), - children: [ - Container( - margin: EdgeInsets.only( - top: 32.w, - left: 32.w, - right: 32.w, - ), - child: RichText( - text: TextSpan( - style: - TextStyle(fontSize: 28.sp, color: Color(0xff666666)), - children: [ - TextSpan( - text: '深圳华茂悦峰', - ), - TextSpan( - text: '1幢-1单元-702室', - style: TextStyle(fontWeight: FontWeight.bold), - ), - ]), - ), - ), - OrderCard( - fun: LifePayInfoPage( - bundle: Bundle() - ..putMap('commentMap', {'title': '明细', 'isActions': false}), - ).to), - ], - ), - Positioned( - bottom: 0, - child: SubmitBar(title: '去缴费'), - ), - ], - ), + // body: Stack( + // children: [ + // ListView( + // padding: EdgeInsets.only(bottom: 130.w), + // children: [ + // Container( + // margin: EdgeInsets.only( + // top: 32.w, + // left: 32.w, + // right: 32.w, + // ), + // child: RichText( + // text: TextSpan( + // style: + // TextStyle(fontSize: 28.sp, color: Color(0xff666666)), + // children: [ + // TextSpan( + // text: '深圳华茂悦峰', + // ), + // TextSpan( + // text: '1幢-1单元-702室', + // style: TextStyle(fontWeight: FontWeight.bold), + // ), + // ]), + // ), + // ), + // OrderCard( + // fun: LifePayInfoPage( + // bundle: Bundle() + // ..putMap('commentMap', {'title': '明细', 'isActions': false}), + // ).to), + // ], + // ), + // Positioned( + // bottom: 0, + // child: SubmitBar(title: '去缴费'), + // ), + // ], + // ), + body: BeeListView( + path: API.manager.dailyPaymentList, + controller: _controller, + convert: (model) { + return model.tableList + .map((e) => LifePayMolde.fromJson(e)) + .toList(); + }, + builder: (items){ + return ListView.builder(itemBuilder: (context, index){ + // return _buildCard(items[index]); + return OrderCard(); + }, + // itemCount: items.length, + ) ; + }), ); } } diff --git a/lib/pages/life_pay/widget/order_card.dart b/lib/pages/life_pay/widget/order_card.dart index 959b4558..327df524 100644 --- a/lib/pages/life_pay/widget/order_card.dart +++ b/lib/pages/life_pay/widget/order_card.dart @@ -4,20 +4,17 @@ import 'package:flutter/material.dart'; // Project imports: import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/pages/life_pay/life_pay_info_page/life_pay_info_page.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/utils/headers.dart'; class OrderCard extends StatefulWidget { - final Function fun; - OrderCard({Key key,this.fun}) : super(key: key); + OrderCard({Key key,}) : super(key: key); @override _OrderCardState createState() => _OrderCardState(); } class _OrderCardState extends State { - Container _orderInfo() { + Widget _orderInfo() { return Container( margin: EdgeInsets.only( top: 20.w, @@ -77,11 +74,11 @@ class _OrderCardState extends State { ); } - InkWell _checkInfo(Function fun) { + Widget _checkInfo() { return InkWell( onTap: (){ - LifePayInfoPage(bundle: Bundle() - ..putMap('detailMap', {'title': '去年(2019年)'}),).to; + // LifePayInfoPage(bundle: Bundle() + // ..putMap('detailMap', {'title': '去年(2019年)'}),).to; }, child: Container( margin: EdgeInsets.only(top: 20.w), @@ -115,7 +112,7 @@ class _OrderCardState extends State { padding: EdgeInsets.symmetric(horizontal: 32.w), decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(6)), + borderRadius: BorderRadius.all(Radius.circular(8.w)), ), child: InkWell( onTap: () {}, @@ -132,8 +129,8 @@ class _OrderCardState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - _orderInfo(), - _checkInfo(widget.fun), + // _orderInfo(), + // _checkInfo(), ], ), )