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

@ -262,6 +262,12 @@ class _Pay {
///app
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 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:aku_new_community/utils/headers.dart';
@ -5,7 +8,9 @@ import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'widget/bill_card.dart';
class LifePayBillPage extends StatefulWidget {
LifePayBillPage({Key? key}) : super(key: key);
final LifePayRecordModel model;
LifePayBillPage({Key? key, required this.model}) : super(key: key);
@override
_LifePayBillPageState createState() => _LifePayBillPageState();
@ -35,6 +40,14 @@ class _LifePayBillPageState extends State<LifePayBillPage> {
);
}
Map<int, String> getPayType = {
1: '支付宝',
2: '微信',
3: '现金',
4: 'pos',
5: '预缴扣除'
};
@override
Widget build(BuildContext context) {
return BeeScaffold(
@ -53,13 +66,71 @@ class _LifePayBillPageState extends State<LifePayBillPage> {
),
child: Column(
children: [
_cardList('收费项目', '公共能耗费'),
_cardList('收费项目', widget.model.chargesName),
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_new.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/headers.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart';
@ -84,6 +85,15 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
void initState() {
super.initState();
_controller = EasyRefreshController();
Future.delayed(Duration.zero,(){
if( UserTool.userProvider.defaultHouse==null){
Get.off(()=>MyHousePage());
BotToast.showText(text: '请先选择您的房屋');
}
});
_models = [
LifePayModel(
id: 1,
@ -358,8 +368,8 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
Future<double> _dailyPaymentPrePay() async {
BaseModel baseModel =
await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
"estateId": 5,//UserTool.appProvider.selectedHouse!.estateId,
await NetUtil().get(SAASAPI.lifePay.findEstateBalance, params: {
"estateId": UserTool.userProvider.defaultHouse!.id
});
if (baseModel.success) {
return (baseModel.data as num).toDouble();
@ -390,78 +400,28 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
header: MaterialHeader(),
controller: _controller,
onRefresh: () async {
_page = 1;
_size = 10;
// 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();
_prePrice = await _dailyPaymentPrePay();
_selectMonths.clear();
_models = [
LifePayModel(
id: 1,
createDate: '2022-02-11 00:00:01',
payPrincipal: 100,
billDateStart: '2022-02-11 00:00:01',
chargesName: '物业费',
defaultAmount: 50,
billDateEnd: '2022-03-11 00:00:01'),
LifePayModel(
id: 2,
createDate: '2022-02-12 00:00:01',
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'),
];
BaseModel model = await NetUtil()
.get(SAASAPI.lifePay.livingExpensesList, params: {
'estateId': UserTool.userProvider.defaultHouse!.id
});
if(model.success){
if(model.data!=null)
_models = ( model.data as List)
.map((e) => LifePayModel.fromJson(e))
.toList() ;
}
///
if(_models.isNotEmpty)
_models.forEach((element) {
if (_selectMonths.isEmpty) {
_selectMonths.add(MonthPay(
@ -500,8 +460,6 @@ class _LifePayPageNewState extends State<LifePayPageNew> {
}
});
_prePrice = 0;
if (mounted) setState(() {});
},
child: Column(

@ -1,5 +1,6 @@
import 'package:aku_new_community/base/base_style.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/pages/things_page/widget/bee_list_view.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:flutter/material.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 {
LifePayRecordPage({Key? key}) : super(key: key);
@ -41,10 +45,10 @@ class _LifePayRecordPageState extends State<LifePayRecordPage> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '生活缴费',
title: '缴费记录',
body: BeeListView(
path: API.manager.paymentRecord,
extraParams: {"estateId": UserTool.appProvider.selectedHouse!.estateId},
path: SAASAPI.lifePay.paymentRecordList,
extraParams: {"estateId": UserTool.userProvider.defaultHouse!.id},
controller: _refreshController,
convert: (models) {
return models.rows
@ -82,77 +86,82 @@ class _LifePayRecordPageState extends State<LifePayRecordPage> {
}
Widget _buildRecordCard(LifePayRecordModel model) {
return Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 8.w,horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(8.w),
),
child: DateUtil.formatDate(
DateTime.parse(model.createDate),
format: 'MM-dd hh-mm').text
.size(24.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
),
Row(
children: [
model.chargesName.text
.size(30.sp)
.color(ktextPrimary)
.bold
.make(),
Spacer(),
'${S.of(context)!.tempPlotName} ${model.unitName+model.estateName}'
.text
return GestureDetector(
onTap: (){
Get.to(()=>LifePayBillPage(model: model,));
},
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(vertical: 8.w,horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.06),
borderRadius: BorderRadius.circular(8.w),
),
child: DateUtil.formatDate(
DateTime.parse(model.createDate),
format: 'MM-dd hh-mm').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)
.color(Colors.black.withOpacity(0.45))
.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(),
],
),
),
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)
.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),
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 32.w, horizontal: 20.w))
.make();
].sepWidget(separate: 24.w.heightBox),
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 32.w, horizontal: 20.w))
.make(),
);
}
}

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

@ -45,8 +45,6 @@ class PayFinishPage extends StatelessWidget {
),
70.w.heightBox,
'支付成功'.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/material.dart';
@ -24,7 +26,7 @@ class HouseHeadCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
AppProvider appProvider = Provider.of<AppProvider>(context);
UserProvider userProvider = Provider.of<UserProvider>(context);
return Material(
color: kForeGroundColor,
child: Padding(
@ -36,7 +38,7 @@ class HouseHeadCard extends StatelessWidget {
32.w.heightBox,
GestureDetector(
onTap: () {
Get.to(() => PickMyHousePage());
Get.to(() => MyHousePage());
if (onChanged != null) onChanged!();
},
child: Row(
@ -61,7 +63,9 @@ class HouseHeadCard extends StatelessWidget {
.make(),
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)
.bold
.make()

Loading…
Cancel
Save