Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  调整生活缴费界面,修复生活缴费选择问题
hmxc
小赖 4 years ago
commit 1e66c49bbf

@ -60,7 +60,7 @@ class DailyPaymentTypeVos {
class DetailedVoList { class DetailedVoList {
int groupId; int groupId;
int paymentPrice; double paymentPrice;
List<DetailsVoList> detailsVoList; List<DetailsVoList> detailsVoList;
DetailedVoList({this.groupId, this.paymentPrice, this.detailsVoList}); DetailedVoList({this.groupId, this.paymentPrice, this.detailsVoList});
@ -91,9 +91,9 @@ class DetailedVoList {
class DetailsVoList { class DetailsVoList {
int id; int id;
String month; String month;
int costPrice; double costPrice;
int paidPrice; double paidPrice;
int totalPrice; double totalPrice;
String beginDate; String beginDate;
String endDate; String endDate;
String unitPriceType; String unitPriceType;

@ -119,7 +119,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
), ),
SizedBox(height: 10.w), SizedBox(height: 10.w),
Text( Text(
BeeParse.getEstateName(subtitle), subtitle,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 32.sp, fontSize: 32.sp,

@ -1,4 +1,6 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart';
import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/others/bee_header_house.dart'; import 'package:akuCommunity/widget/others/bee_header_house.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -31,27 +33,16 @@ class LifePayPage extends StatefulWidget {
class SelectPay { class SelectPay {
double payTotal; double payTotal;
int payCount; int payCount;
SelectPay(); SelectPay({this.payCount, this.payTotal});
} }
class _LifePayPageState extends State<LifePayPage> { class _LifePayPageState extends State<LifePayPage> {
EasyRefreshController _controller; EasyRefreshController _controller;
// List<SelectList> selectItems = [];
List<int> _selectYears = []; List<int> _selectYears = [];
List<LifePayModel> _models = []; List<LifePayModel> _models = [];
List<SelectPay> _selectPay = []; List<SelectPay> _selectPay = [];
double _totalCost = 0; double _totalCost = 0;
int _count = 0; int _count = 0;
// int _getLength(LifePayModel model) {
// int count = 0;
// model.dailyPaymentTypeVos.forEach((element) {
// element.detailedVoList.forEach((element) {
// count++;
// });
// });
// return count;
// }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -64,59 +55,61 @@ class _LifePayPageState extends State<LifePayPage> {
super.dispose(); super.dispose();
} }
// Widget _buildHouseCard( Widget _buildHouseCard() {
// String title, UserProvider userProvider = Provider.of<UserProvider>(context);
// String detail, return Material(
// ) { color: kForeGroundColor,
// return Material( child: Padding(
// color: kForeGroundColor, padding: EdgeInsets.all(32.w),
// child: Padding( child: Column(
// padding: EdgeInsets.all(32.w), crossAxisAlignment: CrossAxisAlignment.start,
// child: Column( children: [
// crossAxisAlignment: CrossAxisAlignment.start, '当前房屋'.text.black.size(28.sp).make(),
// children: [ 32.w.heightBox,
// '当前房屋'.text.black.size(28.sp).make(), GestureDetector(
// 32.w.heightBox, onTap: () {
// GestureDetector( MyHousePage(
// onTap: () { needFindPayTag: true,
// MyHousePage( ).to();
// needFindPayTag: true, },
// ).to(); child: Row(
// }, children: [
// child: Row( Image.asset(
// children: [ R.ASSETS_ICONS_HOUSE_PNG,
// Image.asset( width: 60.w,
// R.ASSETS_ICONS_HOUSE_PNG, height: 60.w,
// width: 60.w, ),
// height: 60.w, 40.w.widthBox,
// ), Expanded(
// 40.w.widthBox, child: Column(
// Expanded( crossAxisAlignment: CrossAxisAlignment.start,
// child: Column( children: [
// crossAxisAlignment: CrossAxisAlignment.start, kEstateName.text.black.size(32.sp).bold.make(),
// children: [ 10.w.heightBox,
// title.text.black.size(32.sp).bold.make(), userProvider.currentHouse.text.black
// 10.w.heightBox, .size(32.sp)
// detail.text.black.size(32.sp).bold.make() .bold
// ], .make()
// ), ],
// ), ),
// Icon( ),
// CupertinoIcons.chevron_forward, Icon(
// size: 40.w, CupertinoIcons.chevron_forward,
// ), size: 40.w,
// ], ),
// ).material(color: Colors.transparent), ],
// ), ).material(color: Colors.transparent),
// 24.w.heightBox, ),
// ], 24.w.heightBox,
// ), ],
// ), ),
// ); ),
// } );
}
Widget _buildCard(LifePayModel model, int index) { Widget _buildCard(LifePayModel model, int index) {
return Container( return Container(
padding: EdgeInsets.symmetric(vertical: 20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor), borderRadius: BorderRadius.circular(8.w), color: kForeGroundColor),
child: Row( child: Row(
@ -127,70 +120,26 @@ class _LifePayPageState extends State<LifePayPage> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// if (selectItems[index].selected.length == setState(() {
// _getLength(model)) { if (_selectYears.contains(index)) {
// selectItems[index].value = false; _selectYears.remove(index);
// selectItems[index].selected.clear(); _totalCost -= (_selectPay[index].payTotal ?? 0.0);
// _selectYears.remove(index); _count -= (_selectPay[index].payCount ?? 0);
// } else { } else {
// selectItems[index].value = true; _selectYears.add(index);
// _selectYears.add(index); _totalCost += (_selectPay[index].payTotal ?? 0.0);
// for (var i = 0; i < model.dailyPaymentTypeVos.length; i++) { _count += (_selectPay[index].payCount ?? 0);
// for (var j = 0; }
// i < });
// model
// .dailyPaymentTypeVos[i].detailedVoList.length;
// i++) {
// String id = model.dailyPaymentTypeVos[i].id.toString() +
// model.dailyPaymentTypeVos[i].detailedVoList[j]
// .groupId
// .toString();
// if (!selectItems[index].selected.contains(id)) {
// selectItems[index].selected.add(id);
// }
// }
// }
// }
// setState(() {});
if (_selectYears.contains(index)) {
_selectYears.remove(index);
_totalCost -= _selectPay[index].payTotal;
_count -= _selectPay[index].payCount;
} else {
_selectYears.add(index);
_totalCost += _selectPay[index].payTotal;
_count += _selectPay[index].payCount;
}
setState(() {});
}, },
child: BeeCheckRadio( child: BeeCheckRadio(
value: index, value: index,
groupValue: _selectYears, groupValue: _selectYears,
// onChange: (value) {
// if (value) {
// selectItems[index].value=false;
// selectItems[index].selected.clear();
// } else {
// selectItems[index].value=true;
// for (var i = 0; i < model.dailyPaymentTypeVos.length; i++) {
// for (var j = 0;
// i <
// model
// .dailyPaymentTypeVos[i].detailedVoList.length;
// i++) {
// selectItems[index].selected.add(
// model.dailyPaymentTypeVos[i].id.toString() +
// model.dailyPaymentTypeVos[i].detailedVoList[j]
// .groupId
// .toString());
// }
// }
// }
// },
), ),
), ),
], ],
), ),
24.w.widthBox,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -201,7 +150,7 @@ class _LifePayPageState extends State<LifePayPage> {
.size(28.sp) .size(28.sp)
.make(), .make(),
24.w.heightBox, 24.w.heightBox,
'待缴:${model.paymentNum}' '待缴:${model.paymentNum} 已选${_selectPay[index].payCount}'
.text .text
.color(ktextPrimary) .color(ktextPrimary)
.size(28.sp) .size(28.sp)
@ -216,26 +165,26 @@ class _LifePayPageState extends State<LifePayPage> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
children: [ children: [
TextSpan( TextSpan(
text: '¥', text: '¥ ${_selectPay[index].payTotal}',
style: TextStyle( style: TextStyle(
color: kDangerColor, color: kDangerColor,
fontSize: 28.sp, fontSize: 28.sp,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
])) ]))
], ],
), ).expand(),
Column( Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () async {
List payMent = LifePayDetailPage( List payMent = await LifePayDetailPage(
model: _models[index], model: _models[index],
// selectItems: selectItems[index].selected,
).to(); ).to();
_selectPay[index].payCount = payMent[0]; _selectPay[index].payCount = payMent[0];
_selectPay[index].payTotal = payMent[1]; _selectPay[index].payTotal = payMent[1];
setState(() {});
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -279,6 +228,8 @@ class _LifePayPageState extends State<LifePayPage> {
'estateId': userProvider.currentHouseId, 'estateId': userProvider.currentHouseId,
}, },
convert: (model) { convert: (model) {
_selectPay = List.generate(model.tableList.length,
(index) => SelectPay(payCount: 0, payTotal: 0.0));
return model.tableList return model.tableList
.map((e) => LifePayModel.fromJson(e)) .map((e) => LifePayModel.fromJson(e))
.toList(); .toList();
@ -287,13 +238,7 @@ class _LifePayPageState extends State<LifePayPage> {
_models = items; _models = items;
return Column( return Column(
children: [ children: [
// _buildHouseCard( _buildHouseCard(),
// kEstateName,
// userProvider.userDetailModel.estateNames.isEmpty
// ? ''
// : BeeParse.getEstateName(
// userProvider.userDetailModel.estateNames[0])),
BeeHeaderHouse(),
16.w.heightBox, 16.w.heightBox,
Container( Container(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
@ -305,7 +250,8 @@ class _LifePayPageState extends State<LifePayPage> {
children: [ children: [
'缴费账单'.text.color(ktextPrimary).size(28.sp).make(), '缴费账单'.text.color(ktextPrimary).size(28.sp).make(),
...List.generate(items.length, ...List.generate(items.length,
(index) => _buildCard(items[index], index)), (index) => _buildCard(items[index], index))
.sepWidget(separate: BeeDivider.horizontal()),
], ],
), ),
), ),
@ -318,19 +264,6 @@ class _LifePayPageState extends State<LifePayPage> {
32.w, 16.w, 32.w, 12.w + MediaQuery.of(context).padding.bottom), 32.w, 16.w, 32.w, 12.w + MediaQuery.of(context).padding.bottom),
child: Row( child: Row(
children: [ children: [
// BeeCheckBox.round(
// onChange: (value) {
// if (value) {
// _selectYears.clear();
// } else {
// for (var i = 0; i < _models.length; i++) {
// _selectYears.add(i);
// }
// }
// setState(() {});
// },
// size: 40.w,
// ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (_models.length == _selectYears.length) { if (_models.length == _selectYears.length) {
@ -396,7 +329,7 @@ class _LifePayPageState extends State<LifePayPage> {
fontSize: 32.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
])), ])),
'$_count'.text.color(ktextSubColor).size(20.sp).make(), '已选$_count'.text.color(ktextSubColor).size(20.sp).make(),
], ],
), ),
24.w.widthBox, 24.w.widthBox,

@ -44,11 +44,9 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
return listLength == _selectItems.length; return listLength == _selectItems.length;
} }
Widget _buildTile(int groupId, int id, int years, int price) { Widget _buildTile(int groupId, int id, int years, double price) {
return Row( return GestureDetector(
children: [ onTap: () {
GestureDetector(
onTap: () {
String item = id.toString() + groupId.toString(); String item = id.toString() + groupId.toString();
if (_selectItems.contains(item)) { if (_selectItems.contains(item)) {
_selectItems.remove(item); _selectItems.remove(item);
@ -62,21 +60,25 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
setState(() {}); setState(() {});
}, },
child: BeeCheckRadio( child: Row(
value: id.toString() + groupId.toString(), children: [
groupValue: _selectItems)),
24.w.widthBox, BeeCheckRadio(
groupId == 1 value: id.toString() + groupId.toString(),
? '$years上半年'.text.black.size(28.sp).make() groupValue: _selectItems),
: '$years下半年'.text.black.size(28.sp).make(), 24.w.widthBox,
Spacer(), groupId == 1
'¥${price.toString()}'.text.color(kDangerColor).size(28.sp).bold.make(), ? '$years上半年'.text.black.size(28.sp).make()
24.w.widthBox, : '$years下半年'.text.black.size(28.sp).make(),
Icon( Spacer(),
CupertinoIcons.chevron_forward, '¥${price.toString()}'.text.color(kDangerColor).size(28.sp).bold.make(),
size: 40.w, 24.w.widthBox,
), Icon(
], CupertinoIcons.chevron_forward,
size: 40.w,
),
],
).material(color: Colors.transparent),
); );
} }
@ -90,7 +92,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [ children: [
model.name.text.black.size(30.sp).bold.make(), model.name.text.black.size(30.sp).bold.make(),
Spacer(), Spacer(),
'$kEstateName ${BeeParse.getEstateName(userProvider.currentHouse)}' '$kEstateName ${userProvider.currentHouse}'
.text .text
.color(ktextSubColor) .color(ktextSubColor)
.size(24.sp) .size(24.sp)
@ -127,34 +129,36 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if (isAllSelect) { setState(() {
_selectItems.clear(); if (isAllSelect) {
_payNum = 0; _selectItems.clear();
_payTotal = 0; _payNum = 0;
} else { _payTotal = 0;
for (var i = 0; } else {
i < widget.model.dailyPaymentTypeVos.length; for (var i = 0;
i++) { i < widget.model.dailyPaymentTypeVos.length;
for (var j = 0;
i <
widget.model.dailyPaymentTypeVos[i].detailedVoList
.length;
i++) { i++) {
String id = for (var j = 0;
widget.model.dailyPaymentTypeVos[i].id.toString() + i <
widget.model.dailyPaymentTypeVos[i] widget.model.dailyPaymentTypeVos[i].detailedVoList
.detailedVoList[j].groupId .length;
.toString(); i++) {
if (!_selectItems.contains(id)) { String id =
_selectItems.add(id); widget.model.dailyPaymentTypeVos[i].id.toString() +
_payNum += 1; widget.model.dailyPaymentTypeVos[i]
_payTotal += widget.model.dailyPaymentTypeVos[i] .detailedVoList[j].groupId
.detailedVoList[j].paymentPrice.toDouble(); .toString();
if (!_selectItems.contains(id)) {
_selectItems.add(id);
_payNum += 1;
_payTotal += widget.model.dailyPaymentTypeVos[i]
.detailedVoList[j].paymentPrice
.toDouble();
}
} }
} }
} }
} });
setState(() {});
}, },
child: AnimatedContainer( child: AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
@ -196,7 +200,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
fontSize: 32.sp, fontSize: 32.sp,
fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold)),
])), ])),
'$_payNum'.text.color(ktextSubColor).size(20.sp).make(), '已选$_payNum'.text.color(ktextSubColor).size(20.sp).make(),
], ],
), ),
MaterialButton( MaterialButton(

@ -64,7 +64,7 @@ class _MyHousePageState extends State<MyHousePage> {
} }
} }
Widget _buildCard(String currentHouse, String estateName, int index, Widget _buildCard(int currentHouseId, String estateName, int index,
{bool paid = false}) { {bool paid = false}) {
UserProvider userProvider = Provider.of<UserProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
return Container( return Container(
@ -97,7 +97,7 @@ class _MyHousePageState extends State<MyHousePage> {
], ],
), ),
Spacer(), Spacer(),
currentHouse == estateName currentHouseId == BeeParse.getEstateNameId(estateName)
? _currentHouseTag() ? _currentHouseTag()
: paid : paid
? _unPaidTag() ? _unPaidTag()
@ -118,7 +118,7 @@ class _MyHousePageState extends State<MyHousePage> {
...userProvider.userDetailModel.estateNames.isEmpty ...userProvider.userDetailModel.estateNames.isEmpty
? [SizedBox()] ? [SizedBox()]
: userProvider.userDetailModel.estateNames : userProvider.userDetailModel.estateNames
.map((e) => _buildCard(userProvider.currentHouse, e, .map((e) => _buildCard(userProvider.currentHouseId, e,
userProvider.userDetailModel.estateNames.indexOf(e), userProvider.userDetailModel.estateNames.indexOf(e),
paid: widget.needFindPayTag paid: widget.needFindPayTag
? false ? false

@ -141,7 +141,7 @@ class UserProvider extends ChangeNotifier {
/// ///
String _currentHouse; String _currentHouse;
int get currentHouseId => BeeParse.getEstateNameId(_currentHouse); int get currentHouseId => BeeParse.getEstateNameId(_currentHouse);
String get currentHouse => _currentHouse; String get currentHouse => BeeParse.getEstateName(_currentHouse);
setCurrentHouse(String house) { setCurrentHouse(String house) {
_currentHouse = house; _currentHouse = house;
notifyListeners(); notifyListeners();

@ -17,8 +17,11 @@ class BeeCheckRadio<T> extends StatefulWidget {
class _BeeCheckRadioState extends State<BeeCheckRadio> { class _BeeCheckRadioState extends State<BeeCheckRadio> {
bool get _selected { bool get _selected {
if (widget.groupValue.contains(widget.value)) return true; if (widget.groupValue.contains(widget.value)) {
return false; return true;
} else {
return false;
}
} }
@override @override

@ -49,7 +49,7 @@ class _BeeHeaderHouseState extends State<BeeHeaderHouse> {
children: [ children: [
kEstateName.text.black.size(32.sp).bold.make(), kEstateName.text.black.size(32.sp).bold.make(),
10.w.heightBox, 10.w.heightBox,
BeeParse.getEstateName(userProvider.currentHouse) userProvider.currentHouse
.text .text
.black .black
.size(32.sp) .size(32.sp)

Loading…
Cancel
Save