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

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

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

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

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

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

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

Loading…
Cancel
Save