123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/res/gaps.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/internal/search/search_router.dart';
- import 'package:liftmanager/widgets/app_search_bar.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/internal/wode/page/wallet/small_money.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/internal/wode/model/wallet_model.dart';
- import 'package:liftmanager/internal/wode/presenter/wallet_list_presenter.dart';
- import 'package:liftmanager/widgets/my_refresh_list.dart';
- import 'package:liftmanager/widgets/state_layout.dart';
- import 'package:provider/provider.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/log_util.dart';
- import 'package:flutter_alipay/flutter_alipay.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'dart:math';
- import 'package:fluwx/fluwx.dart' as fluwx;
- import 'package:liftmanager/utils/theme_utils.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() {
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- setSchema();
- getCoupon();
- _onRefresh();
- }
- 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(
- orders: ordersNo,
- onSuccess: (res) {
- callAlipay(res);
- },
- onError: (code, msg) {
- toasts(msg);
- });
- }
- // 根据orderNo获取wx订单信息
- Future getAlipayOrderInfowx(ordersNo) async {
- await NewApiService().alipayRechargewx(
- 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: "我的钱包",
- 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(
- 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: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: <Widget>[
- 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"] != null
- ? detailOj["balance"].toStringAsFixed(2).toString()
- : "",
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(22),
- color: Color(0xffffffff),
- ),
- ),
- ],
- )
- ],
- ),
- 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["freezeBalance"] != null
- ? detailOj["freezeBalance"].toStringAsFixed(2).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: "myfont"),
- 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: "myfont"),
- 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);
- },
- );
- },
- );
- },
- );
- },
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- LableTitle(
- title: "零钱明细",
- 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:
- // "myfont"),
- // 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:
- // "myfont"),
- // 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);
- // },
- // );
- // },
- // );
- // },
- // );
- // },
- // ),
- // ],
- // ),
- // ),
- // ],
- // ),
- // ),
- // LableTitle(
- // 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);
- // NavigatorUtils.push(context, BbsRouter.positionDetail);
- },
- )
- ],
- ),
- );
- },
- );
- },
- ),
- )
- ],
- ),
- ),
- ),
- ),
- );
- }
- 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(
- IconData(0xe62a, fontFamily: "myfont"),
- 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(
- 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);
- }
- }
- },
- ),
- ),
- )
- ],
- ),
- ),
- ),
- );
- }
- }
|