完成生活缴费 预缴充值功能

hmxc
张萌 3 years ago
parent f8cfca794d
commit 7d2cbdc4b7

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -113,6 +113,10 @@ class R {
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/alarm.png) /// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/alarm.png)
static const String ASSETS_ICONS_ALARM_PNG = 'assets/icons/alarm.png'; static const String ASSETS_ICONS_ALARM_PNG = 'assets/icons/alarm.png';
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/alipay_round.png)
static const String ASSETS_ICONS_ALIPAY_ROUND_PNG =
'assets/icons/alipay_round.png';
/// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/app_add.png) /// ![preview](file:///Users/zhangmeng/aku_community/assets/icons/app_add.png)
static const String ASSETS_ICONS_APP_ADD_PNG = 'assets/icons/app_add.png'; static const String ASSETS_ICONS_APP_ADD_PNG = 'assets/icons/app_add.png';

@ -209,6 +209,10 @@ class _Manager {
/// ///
String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment'; String get findEstatelsPament => '/user/dailyPayment/findEstateIsPayment';
///id
String get dailyPaymentPrePay =>
'/user/dailyPayment/findAdvancePaymentPriceByEstateId';
///app ///app
String get enventVotingList => '/user/eventVoting/list'; String get enventVotingList => '/user/eventVoting/list';
@ -501,6 +505,13 @@ class _Pay {
///-app -( 0 ) ///-app -( 0 )
String get leaseRentOrderNegative => '/user/myHouse/leaseRentOrderAlipay'; String get leaseRentOrderNegative => '/user/myHouse/leaseRentOrderAlipay';
///app - ( APP )
String get dailPaymentPrePay => '/user/alipay/advancePaymentOrderAlipay';
///-
String get dailPaymentPrePayCheck =>
'/user/alipay/advancePaymentOrderCheckAlipay';
} }
class _House { class _House {

@ -1,4 +1,5 @@
import 'package:aku_community/pages/life_pay/life_pre_pay_page.dart'; import 'package:aku_community/pages/life_pay/life_pre_pay_page.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -47,6 +48,7 @@ class _LifePayPageState extends State<LifePayPage> {
List<LifePayListModel> _models = []; //model, List<LifePayListModel> _models = []; //model,
int _page = 0; int _page = 0;
int _size = 10; int _size = 10;
double _prePrice = 0;
List<LifePayListModel> _selectModels = []; //models List<LifePayListModel> _selectModels = []; //models
@ -232,7 +234,7 @@ class _LifePayPageState extends State<LifePayPage> {
children: [ children: [
'¥'.text.size(28.sp).black.make(), '¥'.text.size(28.sp).black.make(),
16.w.widthBox, 16.w.widthBox,
'2300'.text.size(40.sp).black.bold.make(), _prePrice.text.size(40.sp).black.bold.make(),
Spacer(), Spacer(),
MaterialButton( MaterialButton(
elevation: 0, elevation: 0,
@ -243,7 +245,7 @@ class _LifePayPageState extends State<LifePayPage> {
side: BorderSide(color: Color(0xFF979797), width: 1.w)), side: BorderSide(color: Color(0xFF979797), width: 1.w)),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Get.to(() => LifePrePayPage()); Get.to(() => LifePrePayPage(prePay: _prePrice,));
}, },
child: '预缴充值'.text.size(28.sp).black.make(), child: '预缴充值'.text.size(28.sp).black.make(),
) )
@ -254,6 +256,18 @@ class _LifePayPageState extends State<LifePayPage> {
); );
} }
Future<double> _dailyPaymentPrePay() async {
BaseModel baseModel =
await NetUtil().get(API.manager.dailyPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
});
if (baseModel.status ?? false) {
return (baseModel.data as num).toDouble();
} else {
return 0;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context); final appProvider = Provider.of<AppProvider>(context);
@ -295,6 +309,7 @@ class _LifePayPageState extends State<LifePayPage> {
for (var i = 0; i < _selectModels.length; i++) { for (var i = 0; i < _selectModels.length; i++) {
_selectYears.add(i); _selectYears.add(i);
} }
_prePrice = await _dailyPaymentPrePay();
if (mounted) setState(() {}); if (mounted) setState(() {});
}, },
child: Column( child: Column(

@ -1,18 +1,26 @@
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/pages/life_pay/pay_finish_page.dart';
import 'package:aku_community/pages/life_pay/pay_util.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_divider.dart'; import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/bottom_sheets/pay_mothod_bottom_sheet.dart'; import 'package:aku_community/widget/bottom_sheets/pay_mothod_bottom_sheet.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/others/bee_input_row.dart';
import 'package:aku_community/widget/others/house_head_card.dart'; import 'package:aku_community/widget/others/house_head_card.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:power_logger/power_logger.dart';
class LifePrePayPage extends StatefulWidget { class LifePrePayPage extends StatefulWidget {
LifePrePayPage({Key? key}) : super(key: key); final double prePay;
LifePrePayPage({Key? key, required this.prePay}) : super(key: key);
@override @override
_LifePrePayPageState createState() => _LifePrePayPageState(); _LifePrePayPageState createState() => _LifePrePayPageState();
@ -72,7 +80,10 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.black, color: Colors.black,
), ),
inputFormatters: [FilteringTextInputFormatter.digitsOnly], inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(r"^[0-9][\.\d]*(,\d+)?$"))
],
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
).expand(), ).expand(),
], ],
@ -83,7 +94,8 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
'当前房屋下的预缴金额为 ' '当前房屋下的预缴金额为 '
.richText .richText
.withTextSpanChildren([ .withTextSpanChildren([
'2300' widget.prePay
.toDoubleStringAsFixed()
.textSpan .textSpan
.bold .bold
.size(28.sp) .size(28.sp)
@ -104,45 +116,64 @@ class _LifePrePayPageState extends State<LifePrePayPage> {
), ),
), ),
16.w.heightBox, 16.w.heightBox,
// Container( Container(
// width: double.infinity, width: double.infinity,
// color: Colors.white, color: Colors.white,
// padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
// child: Row( child: Row(
// children: [ children: [
// '缴费方式'.text.size(28.sp).black.make(), '缴费方式'.text.size(28.sp).black.make(),
// Spacer(), Spacer(),
// TextButton( Image.asset(
// onPressed: () async { R.ASSETS_ICONS_ALIPAY_ROUND_PNG,
// Get.bottomSheet(PayMethodBottomSheet(onChoose: (value) { width: 48.w,
// _paymethod = value; height: 48.w,
// Get.back(); ),
// setState(() {}); 16.w.widthBox,
// })); TextButton(
// }, onPressed: () async {
// child: _paymethod.text.size(28.sp).black.make()),
// 24.w.widthBox,
// Icon(
// CupertinoIcons.chevron_right,
// size: 40.w,
// ),
// ],
// ),
// ),
BeeInputRow.button(
title: '支付方式',
hintText: _payMethod,
onPressed: () {
Get.bottomSheet(PayMethodBottomSheet(onChoose: (value) { Get.bottomSheet(PayMethodBottomSheet(onChoose: (value) {
_payMethod = value; _payMethod = value;
Get.back(); Get.back();
setState(() {}); setState(() {});
})); }));
}), },
child: _payMethod.text.size(28.sp).black.make()),
24.w.widthBox,
Icon(
CupertinoIcons.chevron_right,
size: 40.w,
),
],
),
),
], ],
), ),
bottomNavi: BottomButton( bottomNavi: BottomButton(
onPressed: () {}, child: '立即充值'.text.size(32.sp).bold.black.make()), onPressed: () async {
Function cancel = BotToast.showLoading();
try {
BaseModel baseModel =
await NetUtil().post(API.pay.dailPaymentPrePay, params: {
"estateId": UserTool.appProveider.selectedHouse!.estateId,
"payType": 1,
"payPrice": _editingController.text
});
if (baseModel.status ?? false) {
bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.dailPaymentPrePayCheck);
if (result) {
Get.off(() => PayFinishPage());
}
} else {
BotToast.showText(text: baseModel.message??"");
}
} catch (e) {
LoggerData.addData(e);
}
cancel();
},
child: '立即充值'.text.size(32.sp).bold.black.make()),
); );
} }
} }

@ -18,7 +18,7 @@ class PayMethodBottomSheet extends StatelessWidget {
'支付方式'.text.size(32.sp).bold.color(ktextPrimary).isIntrinsic.make(), '支付方式'.text.size(32.sp).bold.color(ktextPrimary).isIntrinsic.make(),
actions: [ actions: [
CupertinoActionSheetAction( CupertinoActionSheetAction(
onPressed: onChoose('支付宝'), onPressed:()=> onChoose('支付宝'),
child: child:
'支付宝'.text.size(32.sp).color(ktextPrimary).isIntrinsic.make()) '支付宝'.text.size(32.sp).color(ktextPrimary).isIntrinsic.make())
], ],

Loading…
Cancel
Save