|
@@ -9,19 +9,18 @@
|
|
|
#import "WithdrawalController.h"
|
|
#import "WithdrawalController.h"
|
|
|
#import "BindPhoneController.h"
|
|
#import "BindPhoneController.h"
|
|
|
|
|
|
|
|
-@interface WithdrawalController ()<UITextFieldDelegate>
|
|
|
|
|
-{
|
|
|
|
|
|
|
+@interface WithdrawalController () <UITextFieldDelegate> {
|
|
|
NSString *amount;
|
|
NSString *amount;
|
|
|
NSString *useAmount;
|
|
NSString *useAmount;
|
|
|
NSString *name;
|
|
NSString *name;
|
|
|
NSString *account;
|
|
NSString *account;
|
|
|
}
|
|
}
|
|
|
-@property (nonatomic, strong) UILabel *moneyLabel;
|
|
|
|
|
-@property (nonatomic, strong) UILabel *totalMoneyLabel;
|
|
|
|
|
-@property (nonatomic, strong) UILabel *withdrawalLabel;
|
|
|
|
|
-@property (nonatomic, strong) UILabel *accountNameLabel;
|
|
|
|
|
-@property (nonatomic, strong) UILabel *phoneLabel;
|
|
|
|
|
-@property (nonatomic, strong) UITextField *priceTF; //提现金额
|
|
|
|
|
|
|
+@property(nonatomic, strong) UILabel *moneyLabel;
|
|
|
|
|
+@property(nonatomic, strong) UILabel *totalMoneyLabel;
|
|
|
|
|
+@property(nonatomic, strong) UILabel *withdrawalLabel;
|
|
|
|
|
+@property(nonatomic, strong) UILabel *accountNameLabel;
|
|
|
|
|
+@property(nonatomic, strong) UILabel *phoneLabel;
|
|
|
|
|
+@property(nonatomic, strong) UITextField *priceTF; //提现金额
|
|
|
@end
|
|
@end
|
|
|
|
|
|
|
|
@implementation WithdrawalController
|
|
@implementation WithdrawalController
|
|
@@ -31,8 +30,8 @@
|
|
|
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
|
|
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
|
|
|
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
|
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
|
|
|
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
|
|
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
|
|
|
- [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
|
|
|
|
|
+
|
|
|
[self getDataFromNetworking];
|
|
[self getDataFromNetworking];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -46,7 +45,7 @@
|
|
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
[super viewDidLoad];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
self.view.backgroundColor = RGBValueColor(0xf7f7f7, 1.0);
|
|
self.view.backgroundColor = RGBValueColor(0xf7f7f7, 1.0);
|
|
|
//设置导航条
|
|
//设置导航条
|
|
|
[self creatNavBar];
|
|
[self creatNavBar];
|
|
@@ -63,20 +62,20 @@
|
|
|
self.title = @"提现";
|
|
self.title = @"提现";
|
|
|
|
|
|
|
|
//返回
|
|
//返回
|
|
|
- UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
|
|
+ UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
btn.frame = CGRectMake(0, 0, 40, 40);
|
|
btn.frame = CGRectMake(0, 0, 40, 40);
|
|
|
[btn setImage:[UIImage imageNamed:@"fanhui1"] forState:UIControlStateNormal];
|
|
[btn setImage:[UIImage imageNamed:@"fanhui1"] forState:UIControlStateNormal];
|
|
|
- btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
|
|
|
|
|
|
|
+ btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
|
|
|
[btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
|
|
[btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside];
|
|
|
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
|
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
|
|
|
- UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
|
|
|
|
|
+
|
|
|
// nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
|
|
// nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整
|
|
|
self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
|
|
self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)backClick {
|
|
- (void)backClick {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (self.passBackAmount) {
|
|
if (self.passBackAmount) {
|
|
|
self.passBackAmount(amount);
|
|
self.passBackAmount(amount);
|
|
|
}
|
|
}
|
|
@@ -84,64 +83,64 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)creatSubViews {
|
|
- (void)creatSubViews {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
CGFloat headerHeight = (HeightStatusBar == 44) ? 277 : 233;
|
|
CGFloat headerHeight = (HeightStatusBar == 44) ? 277 : 233;
|
|
|
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, headerHeight)];
|
|
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, headerHeight)];
|
|
|
UIImageView *bgView = [[UIImageView alloc] initWithFrame:headerView.bounds];
|
|
UIImageView *bgView = [[UIImageView alloc] initWithFrame:headerView.bounds];
|
|
|
[bgView setImage:[UIImage imageNamed:@"jianbianbeijing"]];
|
|
[bgView setImage:[UIImage imageNamed:@"jianbianbeijing"]];
|
|
|
[headerView addSubview:bgView];
|
|
[headerView addSubview:bgView];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
UIImageView *verticalImageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth / 2, headerHeight - 125, 1, 75)];
|
|
UIImageView *verticalImageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth / 2, headerHeight - 125, 1, 75)];
|
|
|
verticalImageView.image = [UIImage imageNamed:@"shufenge"];
|
|
verticalImageView.image = [UIImage imageNamed:@"shufenge"];
|
|
|
[headerView addSubview:verticalImageView];
|
|
[headerView addSubview:verticalImageView];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
- UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, Height_NaviBar + 50, ScreenWidth/2, 14)];
|
|
|
|
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, Height_NaviBar + 50, ScreenWidth / 2, 14)];
|
|
|
titleLabel.text = @"资产总额";
|
|
titleLabel.text = @"资产总额";
|
|
|
titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
titleLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
titleLabel.font = [UIFont systemFontOfSize:14];
|
|
titleLabel.font = [UIFont systemFontOfSize:14];
|
|
|
titleLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
titleLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
|
[headerView addSubview:titleLabel];
|
|
[headerView addSubview:titleLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
- self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(titleLabel.frame) + 25, ScreenWidth/2, 30)];
|
|
|
|
|
|
|
+ self.moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(titleLabel.frame) + 25, ScreenWidth / 2, 30)];
|
|
|
self.moneyLabel.textAlignment = NSTextAlignmentCenter;
|
|
self.moneyLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.moneyLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
self.moneyLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
|
NSString *str = @"0元";
|
|
NSString *str = @"0元";
|
|
|
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str];
|
|
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str];
|
|
|
- [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0,str.length - 1)];
|
|
|
|
|
- [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str.length - 1,1)];
|
|
|
|
|
|
|
+ [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0, str.length - 1)];
|
|
|
|
|
+ [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str.length - 1, 1)];
|
|
|
self.moneyLabel.attributedText = attrString;
|
|
self.moneyLabel.attributedText = attrString;
|
|
|
[headerView addSubview:self.moneyLabel];
|
|
[headerView addSubview:self.moneyLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
- UILabel *moneyTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(verticalImageView.frame), Height_NaviBar + 50, ScreenWidth/2, 14)];
|
|
|
|
|
|
|
+ UILabel *moneyTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(verticalImageView.frame), Height_NaviBar + 50, ScreenWidth / 2, 14)];
|
|
|
moneyTitleLabel.text = @"可提现";
|
|
moneyTitleLabel.text = @"可提现";
|
|
|
moneyTitleLabel.textAlignment = NSTextAlignmentCenter;
|
|
moneyTitleLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
moneyTitleLabel.font = [UIFont systemFontOfSize:14];
|
|
moneyTitleLabel.font = [UIFont systemFontOfSize:14];
|
|
|
moneyTitleLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
moneyTitleLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
|
[headerView addSubview:moneyTitleLabel];
|
|
[headerView addSubview:moneyTitleLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//
|
|
//
|
|
|
- self.totalMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(verticalImageView.frame), CGRectGetMaxY(moneyTitleLabel.frame) + 25, ScreenWidth/2, 30)];
|
|
|
|
|
|
|
+ self.totalMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(verticalImageView.frame), CGRectGetMaxY(moneyTitleLabel.frame) + 25, ScreenWidth / 2, 30)];
|
|
|
self.totalMoneyLabel.textAlignment = NSTextAlignmentCenter;
|
|
self.totalMoneyLabel.textAlignment = NSTextAlignmentCenter;
|
|
|
self.totalMoneyLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
self.totalMoneyLabel.textColor = RGBValueColor(0xffffff, 1.0);
|
|
|
NSString *str1 = @"0元";
|
|
NSString *str1 = @"0元";
|
|
|
NSMutableAttributedString *attrString1 = [[NSMutableAttributedString alloc] initWithString:str1];
|
|
NSMutableAttributedString *attrString1 = [[NSMutableAttributedString alloc] initWithString:str1];
|
|
|
- [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0,str1.length - 1)];
|
|
|
|
|
- [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str1.length - 1,1)];
|
|
|
|
|
|
|
+ [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0, str1.length - 1)];
|
|
|
|
|
+ [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str1.length - 1, 1)];
|
|
|
self.totalMoneyLabel.attributedText = attrString1;
|
|
self.totalMoneyLabel.attributedText = attrString1;
|
|
|
[headerView addSubview:self.totalMoneyLabel];
|
|
[headerView addSubview:self.totalMoneyLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[self.view addSubview:headerView];
|
|
[self.view addSubview:headerView];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 白色背景 views
|
|
// 白色背景 views
|
|
|
UIImageView *whiteImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(headerView.frame) + 10, ScreenWidth, 163)];
|
|
UIImageView *whiteImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(headerView.frame) + 10, ScreenWidth, 163)];
|
|
|
whiteImageView.userInteractionEnabled = YES;
|
|
whiteImageView.userInteractionEnabled = YES;
|
|
|
whiteImageView.image = [UIImage imageNamed:@"beisebeijing"];
|
|
whiteImageView.image = [UIImage imageNamed:@"beisebeijing"];
|
|
|
[self.view addSubview:whiteImageView];
|
|
[self.view addSubview:whiteImageView];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//我的提现账户
|
|
//我的提现账户
|
|
|
UILabel *accountlabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, ScreenWidth / 2 - 20, 56)];
|
|
UILabel *accountlabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, ScreenWidth / 2 - 20, 56)];
|
|
|
accountlabel.textAlignment = NSTextAlignmentLeft;
|
|
accountlabel.textAlignment = NSTextAlignmentLeft;
|
|
@@ -149,7 +148,7 @@
|
|
|
accountlabel.text = @"我的提现账户";
|
|
accountlabel.text = @"我的提现账户";
|
|
|
accountlabel.font = [UIFont systemFontOfSize:16];
|
|
accountlabel.font = [UIFont systemFontOfSize:16];
|
|
|
[whiteImageView addSubview:accountlabel];
|
|
[whiteImageView addSubview:accountlabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//管理提现账户
|
|
//管理提现账户
|
|
|
UILabel *managerAccountlabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth / 2, 0, ScreenWidth / 2 - 40, 56)];
|
|
UILabel *managerAccountlabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth / 2, 0, ScreenWidth / 2 - 40, 56)];
|
|
|
managerAccountlabel.textAlignment = NSTextAlignmentRight;
|
|
managerAccountlabel.textAlignment = NSTextAlignmentRight;
|
|
@@ -157,7 +156,7 @@
|
|
|
managerAccountlabel.text = @"管理提现账户";
|
|
managerAccountlabel.text = @"管理提现账户";
|
|
|
managerAccountlabel.font = [UIFont systemFontOfSize:16];
|
|
managerAccountlabel.font = [UIFont systemFontOfSize:16];
|
|
|
[whiteImageView addSubview:managerAccountlabel];
|
|
[whiteImageView addSubview:managerAccountlabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//右箭头
|
|
//右箭头
|
|
|
UIImageView *arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 28, 22.5, 8, 14)];
|
|
UIImageView *arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 28, 22.5, 8, 14)];
|
|
|
arrowView.image = [UIImage imageNamed:@"youjiantou"];
|
|
arrowView.image = [UIImage imageNamed:@"youjiantou"];
|
|
@@ -166,12 +165,12 @@
|
|
|
clickBtn.frame = CGRectMake(ScreenWidth / 2, 0, ScreenWidth / 2, 56);
|
|
clickBtn.frame = CGRectMake(ScreenWidth / 2, 0, ScreenWidth / 2, 56);
|
|
|
[clickBtn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
|
|
[clickBtn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[whiteImageView addSubview:clickBtn];
|
|
[whiteImageView addSubview:clickBtn];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//分割线
|
|
//分割线
|
|
|
UIImageView *lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 56, ScreenWidth, 1)];
|
|
UIImageView *lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 56, ScreenWidth, 1)];
|
|
|
lineView.image = [UIImage imageNamed:@"fengexian"];
|
|
lineView.image = [UIImage imageNamed:@"fengexian"];
|
|
|
[whiteImageView addSubview:lineView];
|
|
[whiteImageView addSubview:lineView];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//提现账户(支付宝
|
|
//提现账户(支付宝
|
|
|
self.withdrawalLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(lineView.frame) + 17, ScreenWidth, 14)];
|
|
self.withdrawalLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(lineView.frame) + 17, ScreenWidth, 14)];
|
|
|
self.withdrawalLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.withdrawalLabel.textAlignment = NSTextAlignmentLeft;
|
|
@@ -179,7 +178,7 @@
|
|
|
self.withdrawalLabel.font = [UIFont systemFontOfSize:14.0];
|
|
self.withdrawalLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
self.withdrawalLabel.text = @"提现账户(支付宝)";
|
|
self.withdrawalLabel.text = @"提现账户(支付宝)";
|
|
|
[whiteImageView addSubview:self.withdrawalLabel];
|
|
[whiteImageView addSubview:self.withdrawalLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//账户姓名(支付宝)
|
|
//账户姓名(支付宝)
|
|
|
self.accountNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(self.withdrawalLabel.frame) + 17, ScreenWidth, 14)];
|
|
self.accountNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(self.withdrawalLabel.frame) + 17, ScreenWidth, 14)];
|
|
|
self.accountNameLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.accountNameLabel.textAlignment = NSTextAlignmentLeft;
|
|
@@ -187,7 +186,7 @@
|
|
|
self.accountNameLabel.font = [UIFont systemFontOfSize:14.0];
|
|
self.accountNameLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
self.accountNameLabel.text = @"账户姓名(支付宝)";
|
|
self.accountNameLabel.text = @"账户姓名(支付宝)";
|
|
|
[whiteImageView addSubview:self.accountNameLabel];
|
|
[whiteImageView addSubview:self.accountNameLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//未绑定手机
|
|
//未绑定手机
|
|
|
self.phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(self.accountNameLabel.frame) + 17, ScreenWidth, 14)];
|
|
self.phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(self.accountNameLabel.frame) + 17, ScreenWidth, 14)];
|
|
|
self.phoneLabel.textAlignment = NSTextAlignmentLeft;
|
|
self.phoneLabel.textAlignment = NSTextAlignmentLeft;
|
|
@@ -195,12 +194,12 @@
|
|
|
self.phoneLabel.font = [UIFont systemFontOfSize:14.0];
|
|
self.phoneLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
self.phoneLabel.text = @"未绑定支付宝";
|
|
self.phoneLabel.text = @"未绑定支付宝";
|
|
|
[whiteImageView addSubview:self.phoneLabel];
|
|
[whiteImageView addSubview:self.phoneLabel];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//金额输入框背景
|
|
//金额输入框背景
|
|
|
- UIImageView *amtBg = [[UIImageView alloc]initWithFrame:CGRectMake(20, CGRectGetMaxY(whiteImageView.frame) + 55, ScreenWidth - 40, 45)];
|
|
|
|
|
|
|
+ UIImageView *amtBg = [[UIImageView alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(whiteImageView.frame) + 55, ScreenWidth - 40, 45)];
|
|
|
amtBg.image = [UIImage imageNamed:@"chakan"];
|
|
amtBg.image = [UIImage imageNamed:@"chakan"];
|
|
|
[self.view addSubview:amtBg];
|
|
[self.view addSubview:amtBg];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//金额输入框
|
|
//金额输入框
|
|
|
UITextField *priceTF = [[UITextField alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(whiteImageView.frame) + 64, ScreenWidth - 40, 30)];
|
|
UITextField *priceTF = [[UITextField alloc] initWithFrame:CGRectMake(20, CGRectGetMaxY(whiteImageView.frame) + 64, ScreenWidth - 40, 30)];
|
|
|
priceTF.textAlignment = NSTextAlignmentCenter;
|
|
priceTF.textAlignment = NSTextAlignmentCenter;
|
|
@@ -212,7 +211,7 @@
|
|
|
priceTF.delegate = self;
|
|
priceTF.delegate = self;
|
|
|
[self.view addSubview:priceTF];
|
|
[self.view addSubview:priceTF];
|
|
|
self.priceTF = priceTF;
|
|
self.priceTF = priceTF;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
//提现按钮
|
|
//提现按钮
|
|
|
UIButton *withdrawalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
UIButton *withdrawalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
withdrawalBtn.frame = CGRectMake(20, CGRectGetMaxY(priceTF.frame) + 20, ScreenWidth - 40, 45);
|
|
withdrawalBtn.frame = CGRectMake(20, CGRectGetMaxY(priceTF.frame) + 20, ScreenWidth - 40, 45);
|
|
@@ -225,58 +224,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark -- 网络请求
|
|
#pragma mark -- 网络请求
|
|
|
|
|
+
|
|
|
- (void)getDataFromNetworking {
|
|
- (void)getDataFromNetworking {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
ModelUser *modelUser = [ModelUser user];
|
|
ModelUser *modelUser = [ModelUser user];
|
|
|
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:modelUser.modelpk,@"modelpk", nil];
|
|
|
|
|
-
|
|
|
|
|
- [YanCNetWorkManager requestPostWithURLStr:Url_alipayoutcashload(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
-
|
|
|
|
|
- NSString *issuccess = dataDic[@"msg"];
|
|
|
|
|
- if ([issuccess isEqualToString:@"success"]) {
|
|
|
|
|
- NSDictionary *dic = dataDic[@"data"];
|
|
|
|
|
- amount = dic[@"coin_a"];
|
|
|
|
|
- useAmount = dic[@"coin_use"];
|
|
|
|
|
- name = dic[@"name"];
|
|
|
|
|
- account = dic[@"alipayid"];
|
|
|
|
|
-
|
|
|
|
|
- [self updateUI];
|
|
|
|
|
- } else {
|
|
|
|
|
- [MBProgressHUD showInfo:@"请求失败!"];
|
|
|
|
|
- }
|
|
|
|
|
- } enError:^(NSError *error) {
|
|
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
- }];
|
|
|
|
|
|
|
+ NSDictionary *dic = @{@"modelpk": modelUser.modelpk};
|
|
|
|
|
+
|
|
|
|
|
+ [YanCNetWorkManager requestPostWithURLStr:Url_alipayoutcashload(PublicUrl)
|
|
|
|
|
+ parameters:dic
|
|
|
|
|
+ finish:^(id dataDic) {
|
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *issuccess = dataDic[@"msg"];
|
|
|
|
|
+ if ([issuccess isEqualToString:@"success"]) {
|
|
|
|
|
+ NSDictionary *data = dataDic[@"data"];
|
|
|
|
|
+ amount = data[@"coin_a"];
|
|
|
|
|
+ useAmount = data[@"coin_use"];
|
|
|
|
|
+ name = data[@"name"];
|
|
|
|
|
+ account = data[@"alipayid"];
|
|
|
|
|
+
|
|
|
|
|
+ [self updateUI];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [MBProgressHUD showInfo:@"请求失败!"];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ enError:^(NSError *error) {
|
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
+ }];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -- 刷新界面
|
|
#pragma mark -- 刷新界面
|
|
|
--(void)updateUI{
|
|
|
|
|
-
|
|
|
|
|
- NSString *str = [NSString stringWithFormat:@"%@元",amount];
|
|
|
|
|
|
|
+
|
|
|
|
|
+- (void)updateUI {
|
|
|
|
|
+
|
|
|
|
|
+ NSString *str = [NSString stringWithFormat:@"%@元", amount];
|
|
|
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str];
|
|
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:str];
|
|
|
- [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0,str.length - 1)];
|
|
|
|
|
- [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str.length - 1,1)];
|
|
|
|
|
|
|
+ [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0, str.length - 1)];
|
|
|
|
|
+ [attrString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str.length - 1, 1)];
|
|
|
self.moneyLabel.attributedText = attrString;
|
|
self.moneyLabel.attributedText = attrString;
|
|
|
-
|
|
|
|
|
- NSString *str1 = [NSString stringWithFormat:@"%@元",useAmount];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSString *str1 = [NSString stringWithFormat:@"%@元", useAmount];
|
|
|
NSMutableAttributedString *attrString1 = [[NSMutableAttributedString alloc] initWithString:str1];
|
|
NSMutableAttributedString *attrString1 = [[NSMutableAttributedString alloc] initWithString:str1];
|
|
|
- [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0,str1.length - 1)];
|
|
|
|
|
- [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str1.length - 1,1)];
|
|
|
|
|
|
|
+ [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:30] range:NSMakeRange(0, str1.length - 1)];
|
|
|
|
|
+ [attrString1 addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16] range:NSMakeRange(str1.length - 1, 1)];
|
|
|
self.totalMoneyLabel.attributedText = attrString1;
|
|
self.totalMoneyLabel.attributedText = attrString1;
|
|
|
-
|
|
|
|
|
- self.withdrawalLabel.text = [NSString stringWithFormat:@"提现账户(支付宝):%@",account];
|
|
|
|
|
- self.accountNameLabel.text = [NSString stringWithFormat:@"账户姓名(支付宝):%@",name];
|
|
|
|
|
-
|
|
|
|
|
- if (account.length>0 && name.length>0) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ self.withdrawalLabel.text = [NSString stringWithFormat:@"提现账户(支付宝):%@", account];
|
|
|
|
|
+ self.accountNameLabel.text = [NSString stringWithFormat:@"账户姓名(支付宝):%@", name];
|
|
|
|
|
+
|
|
|
|
|
+ if (account.length > 0 && name.length > 0) {
|
|
|
self.phoneLabel.hidden = YES;
|
|
self.phoneLabel.hidden = YES;
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
self.phoneLabel.hidden = NO;
|
|
self.phoneLabel.hidden = NO;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -- 管理我的账户
|
|
#pragma mark -- 管理我的账户
|
|
|
|
|
+
|
|
|
- (void)clickBtn {
|
|
- (void)clickBtn {
|
|
|
NSLog(@"管理我的账户");
|
|
NSLog(@"管理我的账户");
|
|
|
BindPhoneController *bindPhoneVC = [[BindPhoneController alloc] init];
|
|
BindPhoneController *bindPhoneVC = [[BindPhoneController alloc] init];
|
|
@@ -284,57 +289,60 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -- 提现
|
|
#pragma mark -- 提现
|
|
|
|
|
+
|
|
|
- (void)withdrawalBtnAction {
|
|
- (void)withdrawalBtnAction {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (account.length == 0 || name.length == 0) {
|
|
if (account.length == 0 || name.length == 0) {
|
|
|
[MBProgressHUD showInfo:@"请先去绑定支付宝"];
|
|
[MBProgressHUD showInfo:@"请先去绑定支付宝"];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (self.priceTF.text.length == 0) {
|
|
if (self.priceTF.text.length == 0) {
|
|
|
[MBProgressHUD showInfo:@"请输入提现金额"];
|
|
[MBProgressHUD showInfo:@"请输入提现金额"];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if ([self.priceTF.text doubleValue] > [useAmount doubleValue]) {
|
|
if ([self.priceTF.text doubleValue] > [useAmount doubleValue]) {
|
|
|
[MBProgressHUD showInfo:@"提现金额不能大于可提现总额"];
|
|
[MBProgressHUD showInfo:@"提现金额不能大于可提现总额"];
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
ModelUser *modelUser = [ModelUser user];
|
|
ModelUser *modelUser = [ModelUser user];
|
|
|
- NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:modelUser.modelpk,@"modelpk",self.priceTF.text,@"fee", nil];
|
|
|
|
|
-
|
|
|
|
|
|
|
+ NSDictionary *dic = @{@"modelpk": modelUser.modelpk, @"fee": self.priceTF.text};
|
|
|
|
|
+
|
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_alipayoutcash(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
[YanCNetWorkManager requestPostWithURLStr:Url_alipayoutcash(PublicUrl) parameters:dic finish:^(id dataDic) {
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
-
|
|
|
|
|
- NSString *issuccess = dataDic[@"msg"];
|
|
|
|
|
- if ([issuccess isEqualToString:@"success"]) {
|
|
|
|
|
- NSDictionary *dic = dataDic[@"data"];
|
|
|
|
|
- amount = dic[@"coin_a"];
|
|
|
|
|
- useAmount = dic[@"coin_use"];
|
|
|
|
|
- name = dic[@"name"];
|
|
|
|
|
- account = dic[@"alipayid"];
|
|
|
|
|
-
|
|
|
|
|
- [self updateUI];
|
|
|
|
|
- self.priceTF.text = @"";
|
|
|
|
|
- [MBProgressHUD showInfo:@"提现成功"];
|
|
|
|
|
- } else {
|
|
|
|
|
- [MBProgressHUD showInfo:@"提现失败!"];
|
|
|
|
|
- }
|
|
|
|
|
- } enError:^(NSError *error) {
|
|
|
|
|
- [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
- }];
|
|
|
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
+
|
|
|
|
|
+ NSString *issuccess = dataDic[@"msg"];
|
|
|
|
|
+ if ([issuccess isEqualToString:@"success"]) {
|
|
|
|
|
+ NSDictionary *dic = dataDic[@"data"];
|
|
|
|
|
+ amount = dic[@"coin_a"];
|
|
|
|
|
+ useAmount = dic[@"coin_use"];
|
|
|
|
|
+ name = dic[@"name"];
|
|
|
|
|
+ account = dic[@"alipayid"];
|
|
|
|
|
+
|
|
|
|
|
+ [self updateUI];
|
|
|
|
|
+ self.priceTF.text = @"";
|
|
|
|
|
+ [MBProgressHUD showInfo:@"提现成功"];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [MBProgressHUD showInfo:@"提现失败!"];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ enError:^(NSError *error) {
|
|
|
|
|
+ [MBProgressHUD hideHUDForView:self.view animated:YES];
|
|
|
|
|
+ }];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#pragma mark ----- UITextFieldDelegate
|
|
#pragma mark ----- UITextFieldDelegate
|
|
|
|
|
+
|
|
|
- (void)textFieldDidEndEditing:(UITextField *)textField {
|
|
- (void)textFieldDidEndEditing:(UITextField *)textField {
|
|
|
NSLog(@"textField.text = %@", textField.text);
|
|
NSLog(@"textField.text = %@", textField.text);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
|
|
if (textField.tag == 1000) {
|
|
if (textField.tag == 1000) {
|
|
|
- if(![self isValidAboutInputText:textField shouldChangeCharactersInRange:range replacementString:string decimalNumber:2]) {
|
|
|
|
|
|
|
+ if (![self isValidAboutInputText:textField shouldChangeCharactersInRange:range replacementString:string decimalNumber:2]) {
|
|
|
return NO;
|
|
return NO;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -344,46 +352,46 @@
|
|
|
//输入框中只能输入数字和小数点,且小数点只能输入一位,参数number 可以设置小数的位数,该函数在-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string调用;
|
|
//输入框中只能输入数字和小数点,且小数点只能输入一位,参数number 可以设置小数的位数,该函数在-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string调用;
|
|
|
|
|
|
|
|
- (BOOL)isValidAboutInputText:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string decimalNumber:(NSInteger)number {
|
|
- (BOOL)isValidAboutInputText:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string decimalNumber:(NSInteger)number {
|
|
|
-
|
|
|
|
|
- NSScanner *scanner = [NSScanner scannerWithString:string];
|
|
|
|
|
|
|
+
|
|
|
|
|
+ NSScanner *scanner = [NSScanner scannerWithString:string];
|
|
|
NSCharacterSet *numbers;
|
|
NSCharacterSet *numbers;
|
|
|
- NSRange pointRange = [textField.text rangeOfString:@"."];
|
|
|
|
|
- if ( (pointRange.length > 0) && (pointRange.location < range.location || pointRange.location > range.location + range.length) ){
|
|
|
|
|
|
|
+ NSRange pointRange = [textField.text rangeOfString:@"."];
|
|
|
|
|
+ if ((pointRange.length > 0) && (pointRange.location < range.location || pointRange.location > range.location + range.length)) {
|
|
|
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
|
|
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789"];
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
|
|
numbers = [NSCharacterSet characterSetWithCharactersInString:@"0123456789."];
|
|
|
}
|
|
}
|
|
|
- if ( [textField.text isEqualToString:@""] && [string isEqualToString:@"."] ){
|
|
|
|
|
|
|
+ if ([textField.text isEqualToString:@""] && [string isEqualToString:@"."]) {
|
|
|
return NO;
|
|
return NO;
|
|
|
}
|
|
}
|
|
|
short remain = number; //保留 number位小数
|
|
short remain = number; //保留 number位小数
|
|
|
NSString *tempStr = [textField.text stringByAppendingString:string];
|
|
NSString *tempStr = [textField.text stringByAppendingString:string];
|
|
|
NSUInteger strlen = [tempStr length];
|
|
NSUInteger strlen = [tempStr length];
|
|
|
- if(pointRange.length > 0 && pointRange.location > 0){ //判断输入框内是否含有“.”。
|
|
|
|
|
- if([string isEqualToString:@"."]){ //当输入框内已经含有“.”时,如果再输入“.”则被视为无效。
|
|
|
|
|
|
|
+ if (pointRange.length > 0 && pointRange.location > 0) { //判断输入框内是否含有“.”。
|
|
|
|
|
+ if ([string isEqualToString:@"."]) { //当输入框内已经含有“.”时,如果再输入“.”则被视为无效。
|
|
|
return NO;
|
|
return NO;
|
|
|
}
|
|
}
|
|
|
- if(strlen > 0 && (strlen - pointRange.location) > remain+1){ //当输入框内已经含有“.”,当字符串长度减去小数点前面的字符串长度大于需要要保留的小数点位数,则视当次输入无效。
|
|
|
|
|
|
|
+ if (strlen > 0 && (strlen - pointRange.location) > remain + 1) { //当输入框内已经含有“.”,当字符串长度减去小数点前面的字符串长度大于需要要保留的小数点位数,则视当次输入无效。
|
|
|
return NO;
|
|
return NO;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
NSRange zeroRange = [textField.text rangeOfString:@"0"];
|
|
NSRange zeroRange = [textField.text rangeOfString:@"0"];
|
|
|
- if(zeroRange.length == 1 && zeroRange.location == 0){ //判断输入框第一个字符是否为“0”
|
|
|
|
|
- if(![string isEqualToString:@"0"] && ![string isEqualToString:@"."] && [textField.text length] == 1){ //当输入框只有一个字符并且字符为“0”时,再输入不为“0”或者“.”的字符时,则将此输入替换输入框的这唯一字符。
|
|
|
|
|
|
|
+ if (zeroRange.length == 1 && zeroRange.location == 0) { //判断输入框第一个字符是否为“0”
|
|
|
|
|
+ if (![string isEqualToString:@"0"] && ![string isEqualToString:@"."] && [textField.text length] == 1) { //当输入框只有一个字符并且字符为“0”时,再输入不为“0”或者“.”的字符时,则将此输入替换输入框的这唯一字符。
|
|
|
textField.text = string;
|
|
textField.text = string;
|
|
|
return NO;
|
|
return NO;
|
|
|
- }else{
|
|
|
|
|
- if(pointRange.length == 0 && pointRange.location > 0){ //当输入框第一个字符为“0”时,并且没有“.”字符时,如果当此输入的字符为“0”,则视当此输入无效。
|
|
|
|
|
- if([string isEqualToString:@"0"]){
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (pointRange.length == 0 && pointRange.location > 0) { //当输入框第一个字符为“0”时,并且没有“.”字符时,如果当此输入的字符为“0”,则视当此输入无效。
|
|
|
|
|
+ if ([string isEqualToString:@"0"]) {
|
|
|
return NO;
|
|
return NO;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
NSString *buffer;
|
|
NSString *buffer;
|
|
|
- if ( ![scanner scanCharactersFromSet:numbers intoString:&buffer] && ([string length] != 0) ){
|
|
|
|
|
|
|
+ if (![scanner scanCharactersFromSet:numbers intoString:&buffer] && ([string length] != 0)) {
|
|
|
return NO;
|
|
return NO;
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
return YES;
|
|
return YES;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|