|
|
@@ -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:<Widget>[ GestureDetector( |
|
|
|
child: Center( |
|
|
|
child: Padding( |
|
|
|
padding: EdgeInsets.only(right: 16), |
|
|
|
child: Text( |
|
|
|
model.appBarRightText, |
|
|
|
style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.appBarNameColor??"")), |
|
|
|
actions: <Widget>[ |
|
|
|
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: <Widget>[ |
|
|
|
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: <Widget>[ |
|
|
|
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 ?? ''), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|