From 015dfc2db677351b80f7f55e0a21e4c8c1db9413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Wed, 10 Mar 2021 10:46:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=8F=90=E7=8E=B0=E5=A2=9E=E5=8A=A0=E6=94=AF?= =?UTF-8?q?=E5=AE=9D=E7=89=88=E5=AE=9A=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/android/app/build.gradle | 6 +- .../MainActivity.java | 6 +- example/pubspec.yaml | 2 +- lib/pages/withdraw_page/withdraw_page.dart | 134 +++++++----------- 4 files changed, 60 insertions(+), 88 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 79ef042..ae6cba5 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -108,14 +108,14 @@ android { } -// // 应用信息配置 + // 应用信息配置 // productFlavors { // // 智夜生活 // zhiying { // applicationId "cn.zhios.zhiying" -// versionCode 48 +// versionCode 50 // dimension "app" -// versionName '1.3.6' +// versionName '1.3.10' // // 签名信息 // signingConfig signingConfigs.zhiying // } diff --git a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java index 14272b9..33e1cda 100644 --- a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java +++ b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java @@ -154,9 +154,9 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN @Override public Map getSetting() { Map map = new HashMap(); - //map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); - map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn68703914 - map.put("master_id", "68703914"); + map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); + // map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn68703914 + map.put("master_id", "123456"); map.put("secret_key", "123456"); // map.put("token", "123465"); return map; diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 7eaacb0..f8887ea 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -40,7 +40,7 @@ dev_dependencies: zhiying_moments: #path: ../zhiying_moments git: - ref: 0.1.8 + ref: 0.2.0 url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_moments.git #会员升级 zhiying_member_upgrade: diff --git a/lib/pages/withdraw_page/withdraw_page.dart b/lib/pages/withdraw_page/withdraw_page.dart index 1feeda6..60b4050 100644 --- a/lib/pages/withdraw_page/withdraw_page.dart +++ b/lib/pages/withdraw_page/withdraw_page.dart @@ -2,6 +2,7 @@ import 'package:event_bus/event_bus.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:zhiying_base_widget/dialog/tip_dialog/tip_dialog.dart'; import 'package:zhiying_base_widget/pages/bil_detail_page/bil_detail_page.dart'; import 'package:zhiying_base_widget/pages/withdraw_page/bloc/withdraw_bloc.dart'; import 'package:zhiying_base_widget/pages/withdraw_page/models/withdraw_model.dart'; @@ -71,8 +72,6 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { super.initState(); } - - reload() { _bloc.loadData(widget.data['skip_identifier']); _bloc.loadWithdrawData(); @@ -117,14 +116,15 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { return AppBar( elevation: 1, brightness: Brightness.light, - backgroundColor: HexColor.fromHex(model?.appBarBgColor??""), + backgroundColor: HexColor.fromHex(model?.appBarBgColor ?? ""), leading: Navigator.canPop(context) ? GestureDetector( child: Container( padding: EdgeInsets.zero, child: Icon( Icons.arrow_back_ios, - size: 20, + size: 18, + color: HexColor.fromHex(model?.appBarNameColor??""), ), ), onTap: () { @@ -137,27 +137,24 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { centerTitle: true, title: Text( model.appBarName, - style: TextStyle( - fontSize: 17, - color: HexColor.fromHex(model.appBarNameColor), - fontWeight: FontWeight.w600 - ), + style: TextStyle(fontSize: 17, color: HexColor.fromHex(model.appBarNameColor), fontWeight: FontWeight.w600), ), - actions:[ GestureDetector( - child: Center( - child: Padding( - padding: EdgeInsets.only(right: 16), - child: Text( - model.appBarRightText, - style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.appBarNameColor??"")), + actions: [ + GestureDetector( + child: Center( + child: Padding( + padding: EdgeInsets.only(right: 16), + child: Text( + model.appBarRightText, + style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.appBarNameColor ?? "")), + ), ), ), - ), - onTap: () { - RouterUtil.route( - model.detailSkipModel, model.detailSkipModel.toJson(), context); - }, - )], + onTap: () { + RouterUtil.route(model.detailSkipModel, model.detailSkipModel.toJson(), context); + }, + ) + ], ); } @@ -166,8 +163,7 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { return Container( width: double.infinity, height: 97, - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(10)), child: Stack( children: [ Container( @@ -206,24 +202,12 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { Widget _createVerify(WithdrawModel model) { var data = _bloc.withdrawDataModel; - var param = { - 'status': _bloc.aliPayModel, - Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, - 'data': _bloc.aliPayModel - }; + var param = {'status': _bloc.aliPayModel, Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, 'data': _bloc.aliPayModel}; return GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { Logger.debug('绑定支付宝'); - RouterUtil.route( - model.gotoAliPay, - { - 'status': _bloc.aliPayModel, - Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, - 'data': param - }, - context) - .then((value) { + RouterUtil.route(model.gotoAliPay, {'status': _bloc.aliPayModel, Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, 'data': param}, context).then((value) { reload(); }); }, @@ -232,28 +216,20 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { child: Row( children: [ CachedNetworkImage( - imageUrl: (data?.alipayUserName == null || - data?.alipayUserName.length == 0) - ? model.unbindAlipayImg - : model.bindAlipayImg, + imageUrl: (data?.alipayUserName == null || data?.alipayUserName.length == 0) ? model.unbindAlipayImg : model.bindAlipayImg, height: 23, ), Expanded( child: Padding( padding: const EdgeInsets.only(left: 8, right: 8), child: Text( - (data?.alipayUserName == null || - data?.alipayUserName.length == 0) - ? model.unbindAlipayText - : data.alipayUserName, + (data?.alipayUserName == null || data?.alipayUserName.length == 0) ? model.unbindAlipayText : data.alipayUserName, style: TextStyle(fontSize: 11, color: Color(0xff999999)), ), ), ), Text( - (data?.alipayUserName == null || data?.alipayUserName.length == 0) - ? model.unbindAlipayGotoText - : model.bindAlipayGotoText, + (data?.alipayUserName == null || data?.alipayUserName.length == 0) ? model.unbindAlipayGotoText : model.bindAlipayGotoText, style: TextStyle(fontSize: 11, color: Color(0xff999999)), ), Icon( @@ -268,8 +244,7 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { } Widget _createPrice(WithdrawModel model) { - if (_controller.text.length == 0 && - model.cashOutDashbordItems[_currentIndex].name != "自定义") { + if (_controller.text.length == 0 && model.cashOutDashbordItems[_currentIndex].name != "自定义") { _controller.text = model.cashOutDashbordItems[0].value; } return GridView.builder( @@ -293,17 +268,11 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { }, child: Container( decoration: BoxDecoration( - color: index == _currentIndex - ? HexColor.fromHex( - model.cashOutDashbordItemsSelectedBgColor ?? '') - : HexColor.fromHex( - model.cashOutDashbordItemsUnselectedBgColor ?? ''), + color: + index == _currentIndex ? HexColor.fromHex(model.cashOutDashbordItemsSelectedBgColor ?? '') : HexColor.fromHex(model.cashOutDashbordItemsUnselectedBgColor ?? ''), borderRadius: BorderRadius.circular(5), border: Border.all( - color: index == _currentIndex - ? HexColor.fromHex( - model.cashOutDashbordItemsSelectedColor ?? '') - : HexColor.fromHex('#d2d2d2'), + color: index == _currentIndex ? HexColor.fromHex(model.cashOutDashbordItemsSelectedColor ?? '') : HexColor.fromHex('#d2d2d2'), ), ), child: Center( @@ -311,11 +280,8 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { item.name, style: TextStyle( fontSize: 14, - color: index == _currentIndex - ? HexColor.fromHex( - model.cashOutDashbordItemsSelectedColor ?? '') - : HexColor.fromHex( - model.cashOutDashbordItemsUnselectedColor ?? ''), + color: + index == _currentIndex ? HexColor.fromHex(model.cashOutDashbordItemsSelectedColor ?? '') : HexColor.fromHex(model.cashOutDashbordItemsUnselectedColor ?? ''), ), ), ), @@ -365,8 +331,7 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { onChanged: (value) { _checkSubmit(value); }, - placeholderStyle: - TextStyle(fontSize: 26, color: Colors.grey[400]), + placeholderStyle: TextStyle(fontSize: 26, color: Colors.grey[400]), ), ), Container( @@ -397,12 +362,8 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { // } try { var currentWithdraw = num.tryParse(_controller.text); - var finValue = num.tryParse(_bloc.withdrawDataModel.finValue); - if (currentWithdraw != null && - currentWithdraw != 0 && - finValue != null && - finValue != 0 && - currentWithdraw <= finValue) { + var finValue = num.tryParse(_bloc.withdrawDataModel?.finValue??"0"); + if (currentWithdraw != null && currentWithdraw != 0 && finValue != null && finValue != 0 && currentWithdraw <= finValue) { _submitable = true; } else { _submitable = false; @@ -413,18 +374,32 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { } return GestureDetector( - onTap: () { + onTap: () async { + ///提现 if (_submitable) { + if (_bloc?.withdrawDataModel != null && _bloc?.withdrawDataModel?.isBindAlipay == "0") { + var result = await showDialog( + context: context, + child: TipDialog( + content: "请绑定支付宝", + btnText: "前往绑定支付宝", + )); + if (result != null && result) { + var param = {'status': _bloc.aliPayModel, Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, 'data': _bloc.aliPayModel}; + RouterUtil.route(model.gotoAliPay, {'status': _bloc.aliPayModel, Constants.SkipIdentifierName: model.gotoAliPay.skipIdentifier, 'data': param}, context).then((value) { + reload(); + }); + } + return; + } _bloc.submitApply(context, _controller.text); } }, child: Container( height: 50, decoration: BoxDecoration( - color: _submitable - ? HexColor.fromHex(model.cashOutBtnTextAvailableBgColor ?? '') - : HexColor.fromHex(model.cashOutBtnTextUnavailableBgColor ?? ''), + color: _submitable ? HexColor.fromHex(model.cashOutBtnTextAvailableBgColor ?? '') : HexColor.fromHex(model.cashOutBtnTextUnavailableBgColor ?? ''), borderRadius: BorderRadius.circular(7.5), ), child: Center( @@ -432,10 +407,7 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { model.cashOutBtnText ?? '', style: TextStyle( fontSize: 15, - color: _submitable - ? HexColor.fromHex(model.cashOutBtnTextAvailableColor ?? '') - : HexColor.fromHex( - model.cashOutBtnTextUnavailableColor ?? ''), + color: _submitable ? HexColor.fromHex(model.cashOutBtnTextAvailableColor ?? '') : HexColor.fromHex(model.cashOutBtnTextUnavailableColor ?? ''), ), ), ),