pull/1/head
张萌 3 years ago
commit 825ec82985

@ -262,6 +262,12 @@ class _Pay {
///app ///app
String get jcookOrderCheckAlipay => '/app/user/alipay/jcookOrderCheckAlipay'; String get jcookOrderCheckAlipay => '/app/user/alipay/jcookOrderCheckAlipay';
///
String get createPrepaymentOrder => '/app/user/alipay/createPrepaymentOrder';
///app
String get prepaymentOrderCheckAlipay => '/app/user/alipay/prepaymentOrderCheckAlipay';
} }
@ -272,5 +278,9 @@ class _LifePay{
/// ///
String get paymentRecordList => '/app/user/livingExpenses/paymentRecord'; String get paymentRecordList => '/app/user/livingExpenses/paymentRecord';
///
String get findEstateBalance => '/app/user/livingExpenses/findEstateBalance';
} }

@ -1,3 +1,6 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/models/life_pay/life_pay_record_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
@ -5,7 +8,9 @@ import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'widget/bill_card.dart'; import 'widget/bill_card.dart';
class LifePayBillPage extends StatefulWidget { class LifePayBillPage extends StatefulWidget {
LifePayBillPage({Key? key}) : super(key: key); final LifePayRecordModel model;
LifePayBillPage({Key? key, required this.model}) : super(key: key);
@override @override
_LifePayBillPageState createState() => _LifePayBillPageState(); _LifePayBillPageState createState() => _LifePayBillPageState();
@ -35,6 +40,14 @@ class _LifePayBillPageState extends State<LifePayBillPage> {
); );
} }
Map<int, String> getPayType = {
1: '支付宝',
2: '微信',
3: '现金',
4: 'pos',
5: '预缴扣除'
};
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
@ -53,13 +66,71 @@ class _LifePayBillPageState extends State<LifePayBillPage> {
), ),
child: Column( child: Column(
children: [ children: [
_cardList('收费项目', '公共能耗费'), _cardList('收费项目', widget.model.chargesName),
SizedBox(height: 30.w), SizedBox(height: 30.w),
_cardList('收费地址', '深蓝公寓 1幢1单元306室'), _cardList('收费地址',
'${S.of(context)!.tempPlotName} ${widget.model.unitName + widget.model.estateName}'),
], ],
), ),
), ),
BillCard(), Container(
margin: EdgeInsets.only(
top: 32.w,
left: 32.w,
right: 32.w,
),
padding: EdgeInsets.only(
left: 20.w,
right: 20.w,
bottom: 32.w,
top: 2.w,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_billItem('账单月份',DateUtil.formatDate(DateTime.parse(widget.model.billDateStart),
format: 'yyyy-MM'),),
_billItem('缴纳金额','¥'+widget.model.payAmount.toStringAsFixed(2),isRed: true),
_billItem('缴费时间',DateUtil.formatDate(DateTime.parse(widget.model.createDate),
format: 'yyyy/MM/dd hh:mm'),),
_billItem('付款方式', '${getPayType[widget.model.payType]}'),
_billItem('账单创建时间',DateUtil.formatDate(DateTime.parse(widget.model.billCreateDate),
format: 'yyyy/MM/dd hh:mm'),),
_billItem('流水号',widget.model.code,),
]
),
),
],
),
);
}
Container _billItem(String title,String value, { bool isRed = false}) {
return Container(
margin: EdgeInsets.only(top: 30.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
fontSize: BaseStyle.fontSize28,
color: ktextSubColor,
),
),
Text(
value,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize28,
color: isRed?Color(0xFFF5222D) :ktextPrimary,
),
),
], ],
), ),
); );

@ -13,6 +13,7 @@ import 'package:aku_new_community/pages/life_pay/pay_util.dart';
import 'package:aku_new_community/pages/life_pay/widget/life_pay_detail_page.dart'; import 'package:aku_new_community/pages/life_pay/widget/life_pay_detail_page.dart';
import 'package:aku_new_community/pages/life_pay/widget/life_pay_detail_page_new.dart'; import 'package:aku_new_community/pages/life_pay/widget/life_pay_detail_page_new.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart';
import 'package:aku_new_community/utils/bee_parse.dart'; import 'package:aku_new_community/utils/bee_parse.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart'; import 'package:aku_new_community/utils/network/base_list_model.dart';
@ -84,6 +85,15 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
void initState() { void initState() {
super.initState(); super.initState();
_controller = EasyRefreshController(); _controller = EasyRefreshController();
Future.delayed(Duration.zero,(){
if( UserTool.userProvider.defaultHouse==null){
Get.off(()=>MyHousePage());
BotToast.showText(text: '请先选择您的房屋');
}
});
_models = [ _models = [
LifePayModel( LifePayModel(
id: 1, id: 1,
@ -358,8 +368,8 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
Future<double> _dailyPaymentPrePay() async { Future<double> _dailyPaymentPrePay() async {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().get(API.manager.dailyPaymentPrePay, params: { await NetUtil().get(SAASAPI.lifePay.findEstateBalance, params: {
"estateId": 5,//UserTool.appProvider.selectedHouse!.estateId, "estateId": UserTool.userProvider.defaultHouse!.id
}); });
if (baseModel.success) { if (baseModel.success) {
return (baseModel.data as num).toDouble(); return (baseModel.data as num).toDouble();
@ -390,78 +400,28 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
header: MaterialHeader(), header: MaterialHeader(),
controller: _controller, controller: _controller,
onRefresh: () async { onRefresh: () async {
_page = 1;
_size = 10; _prePrice = await _dailyPaymentPrePay();
// BaseListModel baseListModel = await NetUtil()
// .getList(SAASAPI.lifePay.livingExpensesList, params: {
// "pageNum": _page,
// "size": _size,
// 'estateId': 5//appProvider.selectedHouse!.estateId
// });
// _models = baseListModel.rows
// .map((e) => LifePayModel.fromJson(e))
// .toList();
_selectMonths.clear(); _selectMonths.clear();
_models = [
LifePayModel( BaseModel model = await NetUtil()
id: 1, .get(SAASAPI.lifePay.livingExpensesList, params: {
createDate: '2022-02-11 00:00:01', 'estateId': UserTool.userProvider.defaultHouse!.id
payPrincipal: 100, });
billDateStart: '2022-02-11 00:00:01', if(model.success){
chargesName: '物业费', if(model.data!=null)
defaultAmount: 50,
billDateEnd: '2022-03-11 00:00:01'),
LifePayModel( _models = ( model.data as List)
id: 2, .map((e) => LifePayModel.fromJson(e))
createDate: '2022-02-12 00:00:01', .toList() ;
payPrincipal: 100, }
billDateStart: '2022-02-11 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-03-12 00:00:01'),
LifePayModel(
id: 3,
createDate: '2022-03-11 00:00:01',
payPrincipal: 100,
billDateStart: '2022-03-11 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-04-11 00:00:01'),
LifePayModel(
id: 4,
createDate: '2022-04-11 00:00:01',
payPrincipal: 100,
billDateStart: '2022-04-11 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-05-11 00:00:01'),
LifePayModel(
id: 5,
createDate: '2022-02-15 00:00:01',
payPrincipal: 100,
billDateStart: '2022-02-15 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-03-15 00:00:01'),
LifePayModel(
id: 6,
createDate: '2022-02-16 00:00:01',
payPrincipal: 100,
billDateStart: '2022-02-16 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-03-16 00:00:01'),
LifePayModel(
id: 7,
createDate: '2022-03-18 00:00:01',
payPrincipal: 100,
billDateStart: '2022-03-11 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-04-19 00:00:01'),
];
/// ///
if(_models.isNotEmpty)
_models.forEach((element) { _models.forEach((element) {
if (_selectMonths.isEmpty) { if (_selectMonths.isEmpty) {
_selectMonths.add(MonthPay( _selectMonths.add(MonthPay(
@ -500,8 +460,6 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
} }
}); });
_prePrice = 0;
if (mounted) setState(() {}); if (mounted) setState(() {});
}, },
child: Column( child: Column(

@ -1,5 +1,6 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/life_pay/life_pay_record_model.dart'; import 'package:aku_new_community/models/life_pay/life_pay_record_model.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart'; import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
@ -8,6 +9,9 @@ import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'life_pay_bill_page/life_pay_bill_page.dart';
class LifePayRecordPage extends StatefulWidget { class LifePayRecordPage extends StatefulWidget {
LifePayRecordPage({Key? key}) : super(key: key); LifePayRecordPage({Key? key}) : super(key: key);
@ -41,10 +45,10 @@ class _LifePayRecordPageState extends State<LifePayRecordPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '生活缴费', title: '缴费记录',
body: BeeListView( body: BeeListView(
path: API.manager.paymentRecord, path: SAASAPI.lifePay.paymentRecordList,
extraParams: {"estateId": UserTool.appProvider.selectedHouse!.estateId}, extraParams: {"estateId": UserTool.userProvider.defaultHouse!.id},
controller: _refreshController, controller: _refreshController,
convert: (models) { convert: (models) {
return models.rows return models.rows
@ -82,77 +86,82 @@ class _LifePayRecordPageState extends State<LifePayRecordPage> {
} }
Widget _buildRecordCard(LifePayRecordModel model) { Widget _buildRecordCard(LifePayRecordModel model) {
return Column( return GestureDetector(
children: [ onTap: (){
Container( Get.to(()=>LifePayBillPage(model: model,));
padding: EdgeInsets.symmetric(vertical: 8.w,horizontal: 24.w), },
decoration: BoxDecoration( child: Column(
color: Colors.black.withOpacity(0.06), children: [
borderRadius: BorderRadius.circular(8.w), Container(
), padding: EdgeInsets.symmetric(vertical: 8.w,horizontal: 24.w),
child: DateUtil.formatDate( decoration: BoxDecoration(
DateTime.parse(model.createDate), color: Colors.black.withOpacity(0.06),
format: 'MM-dd hh-mm').text borderRadius: BorderRadius.circular(8.w),
.size(24.sp) ),
.color(Colors.black.withOpacity(0.45)) child: DateUtil.formatDate(
.make(), DateTime.parse(model.createDate),
format: 'MM-dd hh-mm').text
),
Row(
children: [
model.chargesName.text
.size(30.sp)
.color(ktextPrimary)
.bold
.make(),
Spacer(),
'${S.of(context)!.tempPlotName} ${model.unitName+model.estateName}'
.text
.size(24.sp) .size(24.sp)
.color(Color(0xFF999999)) .color(Colors.black.withOpacity(0.45))
.make()
],
),
16.w.heightBox,
Row(
children: [
'缴纳金额'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${model.payAmount}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
Row(
children: [
'付款方式'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${getPayType[model.payType]}'
.text
.color(ktextPrimary)
.size(28.sp)
.make(), .make(),
],
),
Row(
children: [
'流水号'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${model.code}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
Row( ),
children: [ Row(
'流水号'.text.color(ktextSubColor).size(28.sp).make(), children: [
Spacer(), model.chargesName.text
'${model.code}'.text.color(ktextPrimary).size(28.sp).make(), .size(30.sp)
], .color(ktextPrimary)
), .bold
.make(),
Spacer(),
'${S.of(context)!.tempPlotName} ${model.unitName+model.estateName}'
.text
.size(24.sp)
.color(Color(0xFF999999))
.make()
],
),
16.w.heightBox,
Row(
children: [
'缴纳金额'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${model.payAmount}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
Row(
children: [
'付款方式'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${getPayType[model.payType]}'
.text
.color(ktextPrimary)
.size(28.sp)
.make(),
],
),
Row(
children: [
'流水号'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${model.code}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
Row(
children: [
'流水号'.text.color(ktextSubColor).size(28.sp).make(),
Spacer(),
'${model.code}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
].sepWidget(separate: 24.w.heightBox), ].sepWidget(separate: 24.w.heightBox),
) )
.box .box
.color(Colors.white) .color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 32.w, horizontal: 20.w)) .padding(EdgeInsets.symmetric(vertical: 32.w, horizontal: 20.w))
.make(); .make(),
);
} }
} }

@ -1,5 +1,6 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart'; import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart';
import 'package:aku_new_community/pages/life_pay/pay_util.dart'; import 'package:aku_new_community/pages/life_pay/pay_util.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
@ -30,6 +31,7 @@ class LifePrePayPage extends StatefulWidget {
class _LifePrePayPageState extends State<LifePrePayPage> { class _LifePrePayPageState extends State<LifePrePayPage> {
late TextEditingController _editingController; late TextEditingController _editingController;
String _payMethod = '支付宝'; String _payMethod = '支付宝';
num amount = 0;
@override @override
void initState() { void initState() {
@ -66,6 +68,14 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
16.w.widthBox, 16.w.widthBox,
TextField( TextField(
controller: _editingController, controller: _editingController,
onChanged: (String value){
if(value.isEmpty){
amount = 0;
}else{
amount = double.parse(value);
}
},
decoration: InputDecoration( decoration: InputDecoration(
hintText: '0.0', hintText: '0.0',
hintStyle: TextStyle( hintStyle: TextStyle(
@ -156,24 +166,29 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
Function cancel = BotToast.showLoading(); Function cancel = BotToast.showLoading();
try { try {
BaseModel baseModel = BaseModel baseModel =
await NetUtil().post(API.pay.dailPaymentPrePay, params: { await NetUtil().post(SAASAPI.pay.createPrepaymentOrder,
"estateId": UserTool.appProvider.selectedHouse!.estateId, params: {
"payType": 1, 'estateId': UserTool.userProvider.defaultHouse!.id,
"payPrice": _editingController.text 'payAmount':amount
}); },
showMessage: true);
if (baseModel.success) { if (baseModel.success) {
bool result = await PayUtil() bool result = await PayUtil().callAliPay(
.callAliPay(baseModel.msg, API.pay.dailPaymentPrePayCheck); (baseModel.data as String),
SAASAPI.pay.prepaymentOrderCheckAlipay);
if (result) { if (result) {
Get.off(() => PayFinishPage()); Get.off(() => PayFinishPage());
} else {
///
BotToast.showText(text: '充值失败');
} }
} else {
BotToast.showText(text: baseModel.msg);
} }
cancel();
} catch (e) { } catch (e) {
cancel();
LoggerData.addData(e); LoggerData.addData(e);
} }
cancel();
}, },
child: '立即充值'.text.size(32.sp).bold.black.make()), child: '立即充值'.text.size(32.sp).bold.black.make()),
); );

@ -45,8 +45,6 @@ class PayFinishPage extends StatelessWidget {
), ),
70.w.heightBox, 70.w.heightBox,
'支付成功'.text.size(48.sp).color(Colors.white).bold.make(), '支付成功'.text.size(48.sp).color(Colors.white).bold.make(),
16.w.heightBox,
'Payment successful'.text.size(20.sp).color(Colors.white).make(),
], ],
), ),
), ),

@ -1,3 +1,5 @@
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/profile/new_house/my_house_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -24,7 +26,7 @@ class HouseHeadCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppProvider appProvider = Provider.of<AppProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
return Material( return Material(
color: kForeGroundColor, color: kForeGroundColor,
child: Padding( child: Padding(
@ -36,7 +38,7 @@ class HouseHeadCard extends StatelessWidget {
32.w.heightBox, 32.w.heightBox,
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.to(() => PickMyHousePage()); Get.to(() => MyHousePage());
if (onChanged != null) onChanged!(); if (onChanged != null) onChanged!();
}, },
child: Row( child: Row(
@ -61,7 +63,9 @@ class HouseHeadCard extends StatelessWidget {
.make(), .make(),
10.w.heightBox, 10.w.heightBox,
(appProvider.selectedHouse!=null?appProvider.selectedHouse!.roomName:'').text.black (userProvider.defaultHouse!=null?(userProvider.defaultHouse!.buildingName+'栋-'
+userProvider.defaultHouse!.unitName+'单元-'+userProvider.defaultHouse!.estateName+''
):'').text.black
.size(32.sp) .size(32.sp)
.bold .bold
.make() .make()

Loading…
Cancel
Save