1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345 |
- import 'dart:math';
- import 'package:flutter/material.dart';
- import 'package:flutter_alipay/flutter_alipay.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:fluwx/fluwx.dart' as fluwx;
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/internal/wode/model/wallet_model.dart';
- import 'package:liftmanager/internal/wode/page/wallet/wallet_detail_page.dart';
- import 'package:liftmanager/internal/wode/presenter/wallet_list_presenter.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/my_card.dart';
- import 'package:liftmanager/widgets/my_refresh_list.dart';
- import 'package:liftmanager/widgets/state_layout.dart';
- import 'package:provider/provider.dart';
- class WalletPage extends StatefulWidget {
- @override
- WalletPageState createState() => WalletPageState();
- }
- class WalletPageState extends BasePageState<WalletPage, WalletListPresenter>
- with AutomaticKeepAliveClientMixin {
- BaseListProvider<Records> provider = BaseListProvider<Records>();
- int _page = 1;
- @override
- void initState() {
- getAuthInfo();
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- setSchema();
- _initFluwx();
- getCoupon();
- _onRefresh();
- }
- bool _isAuth = true;
- void getAuthInfo() {
- NewApiService().getAuthDetail(true, onSuccess: (res) {
- List dataArr = res ?? [];
- if (dataArr?.last['key'] == '1') {
- _isAuth = true;
- } else {
- _isAuth = false;
- }
- setState(() {});
- print("$res");
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- _initFluwx() async {
- await fluwx.registerWxApi(
- appId: "wx0f10e6386fb9969e",
- doOnAndroid: true,
- doOnIOS: true,
- universalLink: "https://www.edtyun.com/");
- var result = await fluwx.isWeChatInstalled();
- setState(() {});
- }
- void setSchema() async {
- // await FlutterAlipay.setIosUrlSchema("tytylift");
- await FlutterAlipay.setIosUrlSchema("com.tyty.lift.managers");
- }
- getBusinessType(int type) {
- String str;
- if (type == 1) {
- str = "充值会员";
- } else if (type == 2) {
- str = "打赏";
- } else if (type == 3) {
- str = "充值";
- } else if (type == 4) {
- str = "诊单业务";
- } else if (type == 5) {
- str = "提现";
- } else if (type == 6) {
- str = "提现失败退款";
- } else if (type == 7) {
- str = "余额消费";
- } else if (type == 8) {
- str = "拒绝接单退款";
- } else if (type == 9) {
- str = "专家惩罚";
- } else if (type == 10) {
- str = "申诉退款";
- } else if (type == 11) {
- str = "粉丝充值返利";
- } else if (type == 12) {
- str = "现金支付";
- } else if (type == 13) {
- str = "差旅费";
- }
- return str;
- }
- Map<String, dynamic> detailOj = {
- "couponNum": 0,
- "balance": 0.0,
- "freezeBalance": 0.0,
- "hongBaoNum": 0
- };
- Future getCoupon() async {
- await NewApiService().getUserCoupons(onSuccess: (res) {
- if (res != null) {
- detailOj["couponNum"] = res["couponNum"];
- detailOj["balance"] = res["balance"];
- detailOj["freezeBalance"] = res["freezeBalance"];
- detailOj["hongBaoNum"] = res["hongBaoNum"];
- setState(() {});
- print(6666544);
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- @override
- void dispose() {
- provider.dispose();
- super.dispose();
- }
- // 确认充值
- void recharge(provider, money) async {
- int payType;
- if (provider == 'alipay') {
- payType = 1;
- await NewApiService().createRecharge(
- payType: payType,
- productPrice: money,
- productName: "用户充值",
- memo: "用户充值",
- onSuccess: (res) {
- getAlipayOrderInfo(res);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- } else if (provider == 'weixin') {
- payType = 2;
- await NewApiService().createRecharge(
- payType: payType,
- productPrice: money,
- productName: "用户充值",
- memo: "用户充值",
- onSuccess: (res) {
- getAlipayOrderInfowx(res);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- }
- }
- // 确认提现
- void ticharge(provider, money) async {
- int payType;
- if (provider == 'alipay') {
- payType = 1;
- await NewApiService().getInsetWithdrwa(
- type: payType,
- amount: money,
- onSuccess: (res) {
- toasts(res);
- getCoupon();
- _onRefresh();
- String initThisUserMoney = randomInt(1111, 9999).toString() +
- DateTime.now().millisecondsSinceEpoch.toString();
- FastNotification.push("initUserMoney", initThisUserMoney);
- Navigator.pop(context);
- },
- onError: (code, msg) {
- toasts(msg);
- if (code == 400) {
- NavigatorUtils.push(context, WodeRouter.bandAccount);
- }
- });
- } else if (provider == 'weixin') {
- payType = 2;
- toasts("暂未开通");
- } else {
- toasts("暂未开通");
- return;
- }
- }
- // 根据orderNo获取支付宝订单信息
- Future getAlipayOrderInfo(ordersNo) async {
- await NewApiService().alipayRecharge(
- payway: 'alipay',
- orders: ordersNo,
- onSuccess: (res) {
- callAlipay(res);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- }
- // 根据orderNo获取wx订单信息
- Future getAlipayOrderInfowx(ordersNo) async {
- await NewApiService().alipayRechargewx(
- payway: 'wx',
- orders: ordersNo,
- onSuccess: (res) {
- wxMethod(res);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- }
- dynamic _wxPay;
- wxMethod(_payInfo) {
- print(_payInfo["appid"]);
- fluwx
- .payWithWeChat(
- appId: _payInfo["appid"],
- partnerId: _payInfo["partnerid"],
- prepayId: _payInfo["prepayid"],
- packageValue: _payInfo["package"],
- nonceStr: _payInfo["noncestr"],
- timeStamp: int.parse(_payInfo["timestamp"]),
- sign: _payInfo["sign"])
- .then((data) {
- print(data);
- });
- _wxPay?.cancel();
- _wxPay = fluwx.responseFromPayment
- .listen((fluwx.WeChatPaymentResponse response) async {
- print("WeChatPaymentResponse" + response.errCode.toString());
- if (response.errCode == -2) {
- //支付取消
- toasts("支付取消");
- } else if (response.errCode == -1) {
- //支付失败
- toasts("支付失败");
- } else if (response.errCode == 0) {
- //支付成功
- toasts("充值成功");
- getCoupon();
- _onRefresh();
- String initThisUserMoney = randomInt(1111, 9999).toString() +
- DateTime.now().millisecondsSinceEpoch.toString();
- FastNotification.push("initUserMoney", initThisUserMoney);
- setState(() {});
- Navigator.pop(context);
- }
- });
- }
- // 调用支付宝
- void callAlipay(String _payInfo) async {
- AlipayResult payResult;
- try {
- print("The pay info is : " + _payInfo);
- payResult = await FlutterAlipay.pay(_payInfo);
- } on Exception catch (e) {
- payResult = null;
- }
- print(payResult);
- if (payResult != null) {
- if (payResult.resultStatus == "9000") {
- toasts("充值成功");
- getCoupon();
- _onRefresh();
- String initThisUserMoney = randomInt(1111, 9999).toString() +
- DateTime.now().millisecondsSinceEpoch.toString();
- FastNotification.push("initUserMoney", initThisUserMoney);
- setState(() {});
- Navigator.pop(context);
- } else {
- toasts(payResult.memo);
- }
- } else {
- toasts("支付异常");
- }
- }
- randomInt(int min, int max) {
- return new Random().nextInt(max) % (max - min + 1) + min;
- }
- FocusNode blankNode = FocusNode();
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return ChangeNotifierProvider<BaseListProvider<Records>>(
- create: (_) => provider,
- child: Scaffold(
- resizeToAvoidBottomPadding: true,
- appBar: MyAppBar(
- centerTitle: "我的钱包",
- isColorTopToBottom: true,
- bgColors: [Color(0xff02ABFF), Color(0xFF15A3FF)],
- titleColor: Colors.white,
- actions: <Widget>[
- FlatButton(
- child: Text("绑定账号"),
- textColor: Colours.dark_text,
- highlightColor: Colors.transparent,
- onPressed: () {
- NavigatorUtils.push(context, WodeRouter.bandAccount);
- },
- )
- ],
- ),
- body: GestureDetector(
- onTap: () {
- // 点击空白页面关闭键盘
- FocusScope.of(context).requestFocus(blankNode);
- },
- child: Container(
- // color: Color(0xFFF1F4FC),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- child: Column(
- children: <Widget>[
- Container(
- height: ScreenUtil().setWidth(180),
- child: Stack(
- children: <Widget>[
- GestureDetector(
- onTap: () {
- // NavigatorUtils.push(context, WodeRouter.personalPage);
- },
- child: Container(
- height: ScreenUtil().setWidth(140),
- decoration: BoxDecoration(
- gradient: const LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [
- Color(0xFF15A3FF),
- Color(0xFF638EFF)
- ],
- ),
- ),
- padding: EdgeInsets.only(
- bottom: ScreenUtil().setWidth(25),
- top: ScreenUtil().setWidth(15)),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: <Widget>[
- Column(
- mainAxisAlignment:
- MainAxisAlignment.center,
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '可用余额',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xffffffff),
- ),
- ),
- SizedBox(height: 5),
- Row(
- crossAxisAlignment:
- CrossAxisAlignment.end,
- children: <Widget>[
- Container(
- padding:
- EdgeInsets.only(bottom: 2),
- child: Text(
- '¥',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(11),
- color: Color(0xffffffff),
- ),
- ),
- ),
- Text(
- detailOj["balance"] != null
- ? detailOj["balance"]
- .toStringAsFixed(2)
- .toString()
- : "",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(22),
- color: Color(0xffffffff),
- ),
- ),
- ],
- )
- ],
- ),
- SizedBox(
- width: 0.5,
- ),
- Column(
- mainAxisAlignment:
- MainAxisAlignment.center,
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '冻结余额',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xffffffff),
- ),
- ),
- SizedBox(height: 5),
- Row(
- // mainAxisAlignment:
- // MainAxisAlignment.end,
- crossAxisAlignment:
- CrossAxisAlignment.end,
- children: <Widget>[
- Container(
- padding:
- EdgeInsets.only(bottom: 2),
- child: Text(
- '¥',
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(11),
- color: Color(0xffffffff),
- ),
- ),
- ),
- Text(
- detailOj["freezeBalance"] !=
- null
- ? detailOj["freezeBalance"]
- .toStringAsFixed(2)
- .toString()
- : "",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(22),
- color: Color(0xffffffff),
- ),
- ),
- ],
- )
- ],
- ),
- ],
- )),
- ),
- Positioned(
- bottom: 10,
- right: 10,
- left: 10,
- child: MyCard(
- child: Container(
- height: 60,
- // margin: EdgeInsets.only(left: 10,right: 10,bottom: 0),
- // padding: EdgeInsets.only(
- // left: ScreenUtil().setWidth(25),
- // right: ScreenUtil().setWidth(25),
- // top: ScreenUtil().setWidth(10)),
- decoration: BoxDecoration(
- color: Colors.white,
- border: Border(
- top: BorderSide(
- width: 0.5, color: Colours.line),
- ),
- ),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: <Widget>[
- GestureDetector(
- child: Container(
- child: Row(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- Icon(
- const IconData(0xe645,
- fontFamily: "Iconfont"),
- size: 20.0,
- color:
- Colours.blue_app_main),
- SizedBox(width: 8),
- Text(
- '提现',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(15),
- color:
- Colours.blue_app_main,
- ),
- ),
- ],
- ),
- ),
- onTap: () {
- showModalBottomSheet(
- isScrollControlled: true,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- context: context,
- builder: (BuildContext context) {
- return StatefulBuilder(
- builder: (context1,
- setBottomSheetState) {
- return MoneyDalog(
- title: "提现",
- confirm:
- (provider, money) {
- ticharge(
- provider, money);
- },
- );
- },
- );
- },
- );
- },
- ),
- Container(
- width: 0.5,
- height: ScreenUtil().setWidth(20),
- color: Color(0xffEEEEEE),
- // color: Colors.red,
- ),
- GestureDetector(
- child: Container(
- child: Row(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- Icon(
- const IconData(0xe667,
- fontFamily: "Iconfont"),
- size: 20.0,
- color:
- Colours.blue_app_main),
- SizedBox(width: 8),
- Text(
- '充值',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil()
- .setSp(15),
- color: Colours
- .blue_app_main),
- ),
- ],
- ),
- ),
- onTap: () {
- if (_isAuth) {
- showToast('功能升级中,暂时不支持充值');
- return;
- }
- showModalBottomSheet(
- isScrollControlled: true,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- context: context,
- builder: (BuildContext context) {
- return StatefulBuilder(
- builder: (context1,
- setBottomSheetState) {
- return MoneyDalog(
- title: "充值",
- confirm:
- (provider, money) {
- recharge(
- provider, money);
- },
- );
- },
- );
- },
- );
- },
- ),
- ],
- ),
- ),
- ))
- ],
- ),
- ),
- LabelTitle(
- title: "零钱明细",
- titleStyle: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- // fontWeight: FontWeight.bold,
- color: Colours.text),
- hasArrow: true,
- isMore: false,
- userTap: () {
- NavigatorUtils.push(context, WodeRouter.smallMoney);
- },
- ),
- ],
- ),
- ),
- Expanded(
- flex: 1,
- child: Consumer<BaseListProvider<Records>>(
- builder: (_, provider, __) {
- return MyListView(
- key: Key('wallet_list'),
- itemCount: provider.list.length,
- stateType: provider.stateType,
- onRefresh: _onRefresh,
- loadMore: _loadMore,
- pageSize: 6,
- hasMore: provider.hasMore,
- itemBuilder: (_, index) {
- return Container(
- child: Column(
- children: <Widget>[
- // index == 0
- // ? Container(
- // child: Column(
- // children: <Widget>[
- // Container(
- // decoration: BoxDecoration(
- // gradient: const LinearGradient(
- // colors: [
- // Color(0xFF00D9FF),
- // Color(0xFF0287FF)
- // ],
- // ),
- // ),
- // height: ScreenUtil().setWidth(140),
- // child: Column(
- // children: <Widget>[
- // GestureDetector(
- // onTap: () {
- // // NavigatorUtils.push(context, WodeRouter.personalPage);
- // },
- // child: Container(
- // padding: EdgeInsets.only(
- // bottom: ScreenUtil()
- // .setWidth(25),
- // top: ScreenUtil()
- // .setWidth(15)),
- // child: Column(
- // mainAxisAlignment:
- // MainAxisAlignment
- // .center,
- // crossAxisAlignment:
- // CrossAxisAlignment
- // .center,
- // children: <Widget>[
- // Text(
- // '余额',
- // textAlign:
- // TextAlign.center,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(16),
- // color: Color(
- // 0xffffffff),
- // ),
- // ),
- // SizedBox(height: 5),
- // Row(
- // mainAxisAlignment:
- // MainAxisAlignment
- // .center,
- // crossAxisAlignment:
- // CrossAxisAlignment
- // .center,
- // children: <Widget>[
- // Text(
- // '¥',
- // textAlign:
- // TextAlign
- // .center,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 14),
- // color: Color(
- // 0xffffffff),
- // ),
- // ),
- // Text(
- // detailOj[
- // "balance"]
- // .toString(),
- // textAlign:
- // TextAlign
- // .center,
- // style: TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 22),
- // color: Color(
- // 0xffffffff),
- // ),
- // ),
- // ],
- // )
- // ],
- // ),
- // ),
- // ),
- // Container(
- // padding: EdgeInsets.only(
- // left: ScreenUtil()
- // .setWidth(25),
- // right: ScreenUtil()
- // .setWidth(25),
- // top: ScreenUtil()
- // .setWidth(10)),
- // decoration: BoxDecoration(
- // border: Border(
- // top: BorderSide(
- // width: 0.5,
- // color: Colours.line),
- // ),
- // ),
- // child: Row(
- // mainAxisAlignment:
- // MainAxisAlignment
- // .spaceAround,
- // children: <Widget>[
- // GestureDetector(
- // child: Container(
- // child: Row(
- // crossAxisAlignment:
- // CrossAxisAlignment
- // .center,
- // children: <Widget>[
- // Icon(
- // IconData(0xe627,
- // fontFamily:
- // "Iconfont"),
- // size: 20.0,
- // color: Color
- // .fromRGBO(
- // 255,
- // 255,
- // 255,
- // 1),
- // ),
- // SizedBox(
- // width: 8),
- // Text(
- // '提现',
- // textAlign:
- // TextAlign
- // .left,
- // style:
- // TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 15),
- // color: Color(
- // 0xffffffff),
- // ),
- // ),
- // ],
- // ),
- // ),
- // onTap: () {
- // showModalBottomSheet(
- // isScrollControlled:
- // true,
- // shape:
- // RoundedRectangleBorder(
- // borderRadius: BorderRadius
- // .all(Radius
- // .circular(
- // 5.0)),
- // ),
- // context: context,
- // builder:
- // (BuildContext
- // context) {
- // return StatefulBuilder(
- // builder: (context1,
- // setBottomSheetState) {
- // return MoneyDalog(
- // title: "提现",
- // confirm:
- // (provider,
- // money) {
- // ticharge(
- // provider,
- // money);
- // },
- // );
- // },
- // );
- // },
- // );
- // },
- // ),
- // Container(
- // width: 0.5,
- // height: ScreenUtil()
- // .setWidth(20),
- // color: Colors.white,
- // ),
- // GestureDetector(
- // child: Container(
- // child: Row(
- // crossAxisAlignment:
- // CrossAxisAlignment
- // .center,
- // children: <Widget>[
- // Icon(
- // IconData(0xe666,
- // fontFamily:
- // "Iconfont"),
- // size: 20.0,
- // color: Color
- // .fromRGBO(
- // 255,
- // 255,
- // 255,
- // 1),
- // ),
- // SizedBox(
- // width: 8),
- // Text(
- // '充值',
- // textAlign:
- // TextAlign
- // .left,
- // style:
- // TextStyle(
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 15),
- // color: Color(
- // 0xffffffff),
- // ),
- // ),
- // ],
- // ),
- // ),
- // onTap: () {
- // showModalBottomSheet(
- // isScrollControlled:
- // true,
- // shape:
- // RoundedRectangleBorder(
- // borderRadius: BorderRadius
- // .all(Radius
- // .circular(
- // 5.0)),
- // ),
- // context: context,
- // builder:
- // (BuildContext
- // context) {
- // return StatefulBuilder(
- // builder: (context1,
- // setBottomSheetState) {
- // return MoneyDalog(
- // title: "充值",
- // confirm:
- // (provider,
- // money) {
- // recharge(
- // provider,
- // money);
- // },
- // );
- // },
- // );
- // },
- // );
- // },
- // ),
- // ],
- // ),
- // ),
- // ],
- // ),
- // ),
- // LabelTitle(
- // title: "零钱明细",
- // hasArrow: true,
- // isMore: false,
- // userTap: () {
- // NavigatorUtils.push(context,
- // WodeRouter.smallMoney);
- // },
- // ),
- // ],
- // ),
- // )
- // : Container(child: null),
- InkWell(
- child: Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(15),
- bottom: ScreenUtil().setWidth(15)),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5, color: Colours.line),
- ),
- color: ThemeUtils.getTabsBg(context),
- ),
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(bottom: 5),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- getBusinessType(provider
- .list[index].businessType),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(16),
- ),
- ),
- Text(
- (provider.list[index].type == 1
- ? "-"
- : "+") +
- (provider.list[index]
- .amount !=
- null
- ? provider
- .list[index].amount
- .toString()
- : ""),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(16),
- color: Colors.red,
- ),
- ),
- ],
- ),
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- provider.list[index].descr ?? "",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(13),
- color: Color(0xff999999),
- ),
- ),
- Text(
- provider.list[index].createTime !=
- null
- ? DateUtils.instance
- .getFormartData(
- timeSamp: provider
- .list[index]
- .createTime,
- format: "yyyy-MM-dd")
- : "",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize:
- ScreenUtil().setSp(13),
- color: Color(0xff999999),
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- onTap: () {
- // print(i);
- Navigator.of(context).push(
- MaterialPageRoute(
- builder: (context) =>
- WalletDetailPage(
- provider.list[index],
- getBusinessType(provider
- .list[index]
- .businessType),
- // isLG: widget.isLG,
- // projectid: model.selectdProJect.id.toString(),
- )));
- // NavigatorUtils.push(context,'${BbsRouter.positionDetail}?id=${provider.list[index].id}');
- },
- )
- ],
- ),
- );
- },
- );
- },
- ),
- )
- ],
- ),
- ),
- ),
- ),
- );
- }
- Future _onRefresh() async {
- _page = 1;
- await presenter.getWalletList(_page);
- }
- Future _loadMore() async {
- _page++;
- await presenter.getWalletList(_page);
- }
- @override
- WalletListPresenter createPresenter() {
- return WalletListPresenter();
- }
- bool get wantKeepAlive => true;
- }
- class MoneyDalog extends StatefulWidget {
- MoneyDalog({Key key, this.title, this.confirm}) : super(key: key);
- final String title;
- final Function(String, String) confirm;
- @override
- _MoneyDalogState createState() => _MoneyDalogState();
- }
- class _MoneyDalogState extends State<MoneyDalog> {
- @override
- initState() {
- super.initState();
- }
- TextEditingController moneyController = new TextEditingController();
- static const payType = [
- {"icon": "tab_first/pay_winxin", "title": "微信", "value": "weixin"},
- {"icon": "tab_first/pay_zhifubao", "title": "支付宝", "value": "alipay"},
- // {"icon": "tab_first/pay_yue", "title": "账户余额支付", "value": "balance"},
- ];
- String checkFalse = "tab_first/check_false";
- String checkTrue = "tab_first/check_true";
- int selectIndex = -1;
- void changeType(index) {
- setState(() {
- selectIndex = index;
- });
- }
- FocusNode blankNode = FocusNode();
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return GestureDetector(
- onTap: () {
- // 点击空白页面关闭键盘
- FocusScope.of(context).requestFocus(blankNode);
- },
- child: Container(
- child: Container(
- height: ScreenUtil().setWidth(330),
- child: Column(
- children: <Widget>[
- Container(
- // color: Colors.red,
- padding: EdgeInsets.only(bottom: 10),
- width: width,
- child: Stack(
- children: <Widget>[
- Container(
- width: width,
- padding: EdgeInsets.only(top: 10),
- child: Text(
- widget.title,
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(17),
- ),
- ),
- ),
- Positioned(
- right: 5,
- top: 5,
- child: GestureDetector(
- onTap: () async {
- Navigator.pop(context);
- },
- child: Icon(
- const IconData(0xe643, fontFamily: "Iconfont"),
- size: 22.0,
- color: Color.fromRGBO(200, 200, 200, 1),
- ),
- ),
- )
- ],
- ),
- ),
- Container(
- height: ScreenUtil().setWidth(200),
- child: ListView(
- children: <Widget>[
- Container(
- // height:260,
- child: Column(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15)),
- width: width,
- child: Text(
- widget.title + "金额",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16),
- ),
- ),
- ),
- SizedBox(height: 10),
- Container(
- // height: 30,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- // color: Colors.yellow,
- child: TextField(
- keyboardType: TextInputType.number,
- controller: moneyController,
- // textInputAction: TextInputAction.go, // 输入框的确定按钮
- // focusNode: focusNode1,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 10,
- right: 5,
- ),
- border: UnderlineInputBorder(
- borderSide: BorderSide(
- color: Colours.text_gray_c, width: 0.8),
- ),
- focusedBorder: UnderlineInputBorder(
- borderSide: BorderSide(
- color: Colours.text_gray_c, width: 0.8),
- ),
- labelText: '¥',
- labelStyle: TextStyle(
- fontSize: ScreenUtil().setSp(24),
- ), // 上标
- hintText: '请输入', // hint 暗示
- hasFloatingPlaceholder: false, // labelText是否漂浮
- // errorText: '错误文本',
- errorBorder: InputBorder.none, // 当error时的border
- prefix: Text('¥'),
- prefixStyle: TextStyle(
- fontSize: ScreenUtil().setSp(24),
- color: Colors.black,
- ),
- filled: false, // 背景色
- ),
- cursorColor: Color(0xFF999999),
- obscureText: false, // 输入变成**
- onChanged: (val) {
- // xxx
- },
- ),
- ),
- Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- ),
- width: width,
- child: Text(
- widget.title + '方式',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16),
- ),
- ),
- ),
- Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- child: Column(
- children: payType.asMap().keys.map((i) {
- return Container(
- decoration: BoxDecoration(),
- height: 40,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- InkWell(
- child: Container(
- child: LoadAssetImage(
- selectIndex == i
- ? checkTrue
- : checkFalse,
- width: ScreenUtil().setWidth(20),
- height: ScreenUtil().setWidth(20),
- ),
- ),
- onTap: () {
- changeType(i);
- },
- ),
- SizedBox(
- width: ScreenUtil().setWidth(20)),
- Row(
- children: <Widget>[
- LoadAssetImage(
- payType[i]["icon"],
- width: ScreenUtil().setWidth(20),
- height: ScreenUtil().setWidth(20),
- ),
- Container(width: 5, child: null),
- Text(
- widget.title == "充值"
- ? payType[i]["title"] + "支付"
- : "提现到" + payType[i]["title"],
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- ],
- ),
- );
- }).toList(),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- Container(
- width: width,
- padding: EdgeInsets.only(
- top: ScreenUtil().setWidth(15),
- bottom: ScreenUtil().setWidth(10),
- left: ScreenUtil().setWidth(25),
- right: ScreenUtil().setWidth(25),
- ),
- color: ThemeUtils.getTabsBg(context),
- child: Container(
- height: ScreenUtil().setWidth(40),
- decoration: BoxDecoration(
- color: Colours.blue_app_main,
- borderRadius:
- BorderRadius.circular(ScreenUtil().setWidth(22)),
- // gradient: const LinearGradient(
- // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
- // ),
- ),
- child: FlatButton(
- // padding: EdgeInsets.all(15.0),
- child: Text("确认"),
- textColor: Colors.white,
- onPressed: () async {
- RegExp exp = RegExp("[0-9]");
- if (selectIndex == -1) {
- toasts("请选择");
- } else {
- if (!exp.hasMatch(moneyController.text) ||
- double.parse(moneyController.text) < 0) {
- toasts("请输入正确的金额");
- } else {
- widget.confirm(payType[selectIndex]['value'],
- moneyController.text);
- }
- }
- },
- ),
- ),
- )
- ],
- ),
- ),
- ),
- );
- }
- }
|