// // YOUPAILZProfitVC.m // VQU // // Created by CY on 2021/7/30. // Copyright © 2021 leo. All rights reserved. // #import "YOUPAILZProfitVC.h" #import "YOUPAILZProfitListVC.h" #import "YOUPAIHRBillDetailVC.h" #import "YOUPAILZWithdrawBtn.h" #import "IQKeyboardManager.h" #import "YOUPAILZProfitTransformCoinVC.h" #import "LZAlertWindow.h" #import "UIViewController+TFPresent.h" @interface YOUPAILZProfitVC () @property (nonatomic, weak) UIScrollView *youpaipscrollView; @property (nonatomic, weak) UILabel *youpaipprofitDescL; @property (nonatomic, weak) UILabel *youpaipprofitL; // 收益 金币 @property (nonatomic, weak) UIView *youpaipwithdrawBgV; // 提现中 @property (nonatomic, weak) UILabel *youpaipwithdrawL; @property (nonatomic, weak) UILabel* botLabel; @property (nonatomic, weak) UIView *moneyItemsBgV; /// 选择提现金额背景 @property (nonatomic, strong) NSMutableArray *moneyItems; @property (nonatomic, strong) UITextField *youpaipnameTextField; @property (nonatomic, strong) UITextField *youpaipaccountTextField; //@property (nonatomic, strong) UITextField *youpaipmoneyTextField; @property (nonatomic, strong) UIButton *youpaipwithdrawBtn; @property(nonatomic,assign)NSInteger youpaipmin_money;//收益的余额 @property(nonatomic,assign)CGFloat youpaipincome_money;//收益的余额 @property(nonatomic,strong)NSMutableArray* youpaipmoneyArray; @property (nonatomic, assign) NSInteger selectedMoney; /// 选中提现的金额 @property(nonatomic,strong)NSString* youpaipname;//真实姓名 @property(nonatomic,strong)NSString* youpaipaccount;//账号 @property(nonatomic,assign)NSInteger youpaipverify;//账户是否通过认证 @property (nonatomic, strong) NSString *youpaipselectedMoney; @end @implementation YOUPAILZProfitVC - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [[IQKeyboardManager sharedManager] setEnable:YES]; [self youpaifrequestWalleetInfo]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[IQKeyboardManager sharedManager] setEnable:NO]; } - (void)youpaifinitData{ @weakify(self); [LCHttpHelper requestWithURLString:WalletWithdraw parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 self.youpaipverify = [[[dict objectForKey:@"data"]objectForKey:LCStr(word39) ] integerValue]; self.youpaipmin_money = [[[dict objectForKey:@"data"]objectForKey:@"min_money"] integerValue]; self.youpaipmoneyArray = [[dict objectForKey:@"data"]objectForKey:@"list"]; self.youpaipaccount = [[dict objectForKey:@"data"]objectForKey:LCStr(word40)]; self.youpaipname = [[dict objectForKey:@"data"]objectForKey:LCStr(word41)]; self.youpaipincome_money = [[[dict objectForKey:@"data"]objectForKey:@"income_money"] floatValue]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineSpacing:6]; NSString *text = [[dict objectForKey:@"data"]objectForKey:@"des"]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:text]; [str addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [text length])]; self.botLabel.attributedText = str; NSInteger cash = [[[dict objectForKey:@"data"]objectForKey:@"cash"] integerValue]; self.youpaipwithdrawL.text = [NSString stringWithFormat:@"%@%@金币",LCStr(word47),@(cash)]; if (cash <= 0) { self.youpaipwithdrawBgV.hidden = YES; [self.youpaipprofitL mas_remakeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.youpaipprofitDescL.mas_bottom).offset(6.0f); make.left.right.bottom.offset(0.0f); }]; [self.youpaipwithdrawBgV mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.bottom.offset(0.0f); }]; }else{ [self.youpaipprofitL mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.top.equalTo(self.youpaipprofitDescL.mas_bottom).offset(6.0f); make.right.offset(0.0f); }]; [self.youpaipwithdrawBgV mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.top.equalTo(self.youpaipprofitL.mas_bottom).offset(6.0f); make.bottom.offset(0.0f); }]; } [self youpaifupdateData]; } }failure:^(NSError *error) { }]; } - (void)youpaifupdateData{ self.moneyItems = [NSMutableArray array]; for (UIView *subv in self.moneyItemsBgV.subviews) { [subv removeFromSuperview]; } NSInteger colCount = 3; CGFloat itemWidth = (KScreenWidth - 28.0f - 12.0f) / colCount; CGFloat itemHeight = 68.0f; CGFloat space = 6.0f; for (NSInteger i = 0; i < self.youpaipmoneyArray.count; i ++) { NSInteger money = [[self.youpaipmoneyArray[i]objectForKey:@"money"] integerValue]; YOUPAILZWithdrawBtn *btn = [[YOUPAILZWithdrawBtn alloc] init]; btn.backgroundColor = [UIColor whiteColor]; NSInteger col = i % colCount; NSInteger row = i / colCount; btn.frame = CGRectMake(col * itemWidth + col * space, row * itemHeight + row * space, itemWidth, itemHeight); btn.youpaipquickV.hidden = YES; btn.tag = money; [btn.action addTarget:self action:@selector(youpaifwithdrawBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [self.moneyItemsBgV addSubview:btn]; [self.moneyItems addObject:btn]; // if (money > self.youpaipincome_money) { // btn.youpaipMoneyL.attributedText = [LCTools setRichTextFormat:@[ // [YOUPAILZRichTextStyle richTextStyleWithText:@"¥" font:LCFont(12.0f) color:LZD3D1D7Color], // [YOUPAILZRichTextStyle richTextStyleWithText:[NSString stringWithFormat:@"%@",@(money)] font:LZDinFont(32.0f) color:LZD3D1D7Color] // ]]; // btn.layer.borderWidth = 1.0f; // btn.layer.borderColor = LZF5F4F7Color.CGColor; // btn.backgroundColor = [UIColor whiteColor]; // btn.userInteractionEnabled = NO; // }else{ btn.youpaipMoneyL.attributedText = [LCTools setRichTextFormat:@[ // [YOUPAILZRichTextStyle richTextStyleWithText:@"¥" font:LCFont(12.0f) color:LZ273145Color], [YOUPAILZRichTextStyle richTextStyleWithText:[NSString stringWithFormat:@"%@元",@(money)] font:[UIFont fontWithName:@"DINAlternate-Bold" size:WHScreenEqualWidth(24)] color:LZ273145Color] ]]; btn.layer.borderWidth = 1.0f; btn.layer.borderColor = LZF5F4F7Color.CGColor; btn.backgroundColor = [UIColor whiteColor]; btn.userInteractionEnabled = YES; // } btn.youpaipSelectedImgV.hidden = YES; btn.selected = NO; } if (self.youpaipincome_money>self.youpaipmin_money) { [self youpaifwithdrawBtnClick:self.moneyItems[0]]; } CGFloat totalRow = (self.youpaipmoneyArray.count + (colCount - 1))/colCount; CGFloat totalHeight = totalRow * itemHeight + space * (totalRow - 1); [self.moneyItemsBgV mas_updateConstraints:^(MASConstraintMaker *make) { make.height.offset(totalHeight); }]; [self.youpaipscrollView layoutIfNeeded]; CGFloat height = CGRectGetMaxY(self.youpaipwithdrawBtn.frame) + 40.0f + SafeHeight; if (height < KScreenHeight - NavBarHeight) { height = KScreenHeight - NavBarHeight + 1; } self.youpaipscrollView.contentSize = CGSizeMake(KScreenWidth, height); self.youpaipnameTextField.text = self.youpaipname; self.youpaipaccountTextField.text = self.youpaipaccount; if (self.youpaipaccount.length >0 && self.youpaipverify==1) { self.youpaipnameTextField.enabled = NO; self.youpaipaccountTextField.enabled = NO; }else{ self.youpaipnameTextField.enabled = YES; self.youpaipaccountTextField.enabled = YES; } [self youpaifverifyWithdrawBtn]; } - (void)youpaifwithdrawBtnClick:(YOUPAILZWithdrawBtn *)sender{ for (YOUPAILZWithdrawBtn *btn in self.moneyItems) { NSInteger money = [[self.youpaipmoneyArray[btn.tag]objectForKey:@"money"] integerValue]; // if (money > self.youpaipincome_money) { // btn.youpaipMoneyL.attributedText = [LCTools setRichTextFormat:@[ // [YOUPAILZRichTextStyle richTextStyleWithText:@"¥" font:LCFont(12.0f) color:LZD3D1D7Color], // [YOUPAILZRichTextStyle richTextStyleWithText:[NSString stringWithFormat:@"%@",@(money)] font:LZDinFont(32.0f) color:LZD3D1D7Color] // ]]; // btn.layer.borderWidth = 1.0f; // btn.layer.borderColor = LZF5F4F7Color.CGColor; // btn.backgroundColor = [UIColor whiteColor]; // btn.userInteractionEnabled = NO; // }else{ btn.youpaipMoneyL.attributedText = [LCTools setRichTextFormat:@[ // [YOUPAILZRichTextStyle richTextStyleWithText:@"¥" font:LCFont(12.0f) color:LZ273145Color], [YOUPAILZRichTextStyle richTextStyleWithText:[NSString stringWithFormat:@"%@元",@(money)] font:[UIFont fontWithName:@"DINAlternate-Bold" size:WHScreenEqualWidth(24)] color:LZ273145Color] ]]; btn.layer.borderWidth = 1.0f; btn.layer.borderColor = LZF5F4F7Color.CGColor; btn.backgroundColor = [UIColor whiteColor]; btn.userInteractionEnabled = YES; // } btn.youpaipSelectedImgV.hidden = YES; btn.selected = NO; } sender.selected = YES; sender.layer.borderColor = LZFE66A4Color.CGColor; sender.layer.borderWidth = 1.5f; // sender.youpaipSelectedImgV.hidden = NO; sender.backgroundColor = [LZFE66A4Color colorWithAlphaComponent:0.04f]; self.selectedMoney = [[self.youpaipmoneyArray[sender.tag]objectForKey:@"money"] integerValue]; } - (void)youpaifverifyWithdrawBtn{ if ( [self.youpaipnameTextField.text isEqualToString:@""]||[self.youpaipaccountTextField.text isEqualToString:@""]||self.selectedMoney <= 0){ [self.youpaipwithdrawBtn setBackgroundImage:nil forState:(UIControlStateNormal)]; self.youpaipwithdrawBtn.userInteractionEnabled = NO; }else{ [self.youpaipwithdrawBtn setBackgroundImage:[LCTools ColorImage:self.youpaipwithdrawBtn.frame.size FromColors:@[LZFFB5DBColor,LZFE66A4Color] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)]; self.youpaipwithdrawBtn.userInteractionEnabled = YES; } } - (void)viewDidLoad { [super viewDidLoad]; self.youpaipmoneyArray = [NSMutableArray array]; self.title = LCStr(word9);//@"我的收益"; [IQKeyboardManager sharedManager].enableAutoToolbar = NO; // 控制是否显示键盘上的工具条 [IQKeyboardManager sharedManager].keyboardDistanceFromTextField = NavBarHeight; // [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES; self.selectedMoney = 0; self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifprofitAction) title:LCStr(word5) font:LCFont14 titleColor:LZA3AABEColor highlightedColor:LZA3AABEColor titleEdgeInsets:UIEdgeInsetsZero];//收支明细 self.view.backgroundColor = [UIColor whiteColor]; [self youpaifinitUI]; [self youpaifinitData]; } - (void)youpaifinitUI{ UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0f, NavBarHeight, KScreenWidth, KScreenHeight - NavBarHeight)]; scrollView.showsVerticalScrollIndicator = NO; scrollView.showsHorizontalScrollIndicator = NO; scrollView.delegate = self; [self.view addSubview:scrollView]; self.youpaipscrollView = scrollView; UIImageView *headerImgV = [[UIImageView alloc] init]; headerImgV.userInteractionEnabled = YES; headerImgV.image = [UIImage imageNamed:@"vqu_images_profit_bg"]; [scrollView addSubview:headerImgV]; [headerImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.width.offset(KScreenWidth - 28.0f); make.top.offset(10.0f); make.height.offset(128.0f); }]; UIView *profitBgV = [[UIView alloc] init]; [headerImgV addSubview:profitBgV]; [profitBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(20.0f); make.centerY.equalTo(headerImgV); }]; UILabel *profitDescL = [[UILabel alloc] init]; profitDescL.font = LCFont14; profitDescL.text = @"我的金币"; //LCStr(word46);//@"我的收益"; profitDescL.textColor = [UIColor whiteColor]; [profitBgV addSubview:profitDescL]; self.youpaipprofitDescL = profitDescL; [profitDescL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(0); make.top.offset(0.0f); make.right.offset(0.0f); }]; UILabel *profitL = [[UILabel alloc] init]; profitL.font = LCFont(36.0f); profitL.attributedText = [LCTools setRichTextFormat:@[ [YOUPAILZRichTextStyle richTextStyleWithText:@"0" font:LZDinFont(36.0f) color:[UIColor whiteColor]], [YOUPAILZRichTextStyle richTextStyleWithText:@"金币" font:LCFont(14.0f) color:[UIColor whiteColor]] ]]; profitL.textColor = [UIColor whiteColor]; [profitBgV addSubview:profitL]; self.youpaipprofitL = profitL; [profitL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); make.top.equalTo(profitDescL.mas_bottom).offset(6.0f); make.right.bottom.offset(0.0f); }]; UIView *youpaipwithdrawBgV = [[UIView alloc] init]; youpaipwithdrawBgV.backgroundColor = LZFE66A4Color; youpaipwithdrawBgV.layer.cornerRadius = 6.0f; youpaipwithdrawBgV.clipsToBounds = YES; youpaipwithdrawBgV.hidden = YES; [profitBgV addSubview:youpaipwithdrawBgV]; self.youpaipwithdrawBgV = youpaipwithdrawBgV; [youpaipwithdrawBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(0.0f); // make.top.equalTo(profitL.mas_bottom).offset(6.0f); make.bottom.offset(0.0f); }]; UILabel *youpaipwithdrawL = [[UILabel alloc] init]; youpaipwithdrawL.font = LCFont(10); youpaipwithdrawL.text = [NSString stringWithFormat:@"%@%@金币",LCStr(word47),@(0)];//@"提现中"; youpaipwithdrawL.textColor = [UIColor whiteColor]; [youpaipwithdrawBgV addSubview:youpaipwithdrawL]; self.youpaipwithdrawL = youpaipwithdrawL; [youpaipwithdrawL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.offset(4); make.right.bottom.offset(-4); }]; UIButton *transformCoinBtn = [UIButton buttonWithType:UIButtonTypeCustom]; transformCoinBtn.backgroundColor = [UIColor whiteColor]; transformCoinBtn.layer.cornerRadius = 15.0f; transformCoinBtn.clipsToBounds = YES; [transformCoinBtn setTitle:@"兑换钻石" forState:UIControlStateNormal]; [transformCoinBtn setTitleColor:LZFE66A4Color forState:UIControlStateNormal]; transformCoinBtn.titleLabel.font = LCFont12; [transformCoinBtn addTarget:self action:@selector(transformCoinBtnClick) forControlEvents:UIControlEventTouchUpInside]; [headerImgV addSubview:transformCoinBtn]; [transformCoinBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.offset(-12.0f); make.centerY.equalTo(profitBgV); make.size.mas_offset(CGSizeMake(68.0f, 30.0f)); }]; UILabel* moneyTip = [[UILabel alloc]init]; moneyTip.textColor = LZA3AABEColor; moneyTip.font = LCFont(12); moneyTip.text = LCStr(word17);//请选择提现金额 [scrollView addSubview:moneyTip]; [moneyTip mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.equalTo(headerImgV.mas_bottom).offset(20.0f); }]; UIView *moneyItemsBgV = [[UIView alloc] init]; [scrollView addSubview:moneyItemsBgV]; self.moneyItemsBgV = moneyItemsBgV; [moneyItemsBgV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(moneyTip.mas_bottom).offset(15.0f); make.left.offset(14.0f); make.width.offset(KScreenWidth - 28.0f); make.height.offset(0.0f); }]; UILabel *labe1 = [[UILabel alloc] init]; labe1.text = LCStr(word6);// @"请输入提现支付宝账户:"; labe1.textColor = LZA3AABEColor; labe1.font = LCFont(12); [scrollView addSubview:labe1]; [labe1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.equalTo(moneyItemsBgV.mas_bottom).offset(20.0f); }]; UIView *nameView = [[UIView alloc] init]; nameView.backgroundColor = LZF7F8FAColor; nameView.layer.cornerRadius = 6; nameView.layer.masksToBounds = YES; [scrollView addSubview:nameView]; [nameView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.equalTo(labe1.mas_bottom).offset(15.0f); make.width.offset(KScreenWidth - 28.0f); make.height.offset(48.0f); }]; UILabel* nameTipLabel = [[UILabel alloc]init]; nameTipLabel.text = LCStr(word48); //支付宝实名: nameTipLabel.textColor = LZ273145Color; nameTipLabel.font = LCFont14; [nameView addSubview:nameTipLabel]; [nameTipLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(12.0f); make.top.bottom.offset(0.0f); make.width.offset(84.0f); }]; UITextField* nameTextField = [[UITextField alloc]init]; self.youpaipnameTextField = nameTextField; nameTextField.tintColor = LZ7C69FEColor; nameTextField.textColor = LZ273145Color; nameTextField.clearButtonMode = UITextFieldViewModeWhileEditing; [[nameTextField valueForKey:@"_clearButton"] setImage:[UIImage imageNamed:@"vqu_images_D_nick_clean"] forState:UIControlStateNormal]; [nameTextField addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged]; NSMutableAttributedString* attrStrName = [[NSMutableAttributedString alloc]initWithString:LCStr(word42)];//@"请输入支付宝认证名字" [attrStrName addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0, attrStrName.length)]; [attrStrName addAttribute:NSForegroundColorAttributeName value:LZD3D1D7Color range:NSMakeRange(0, attrStrName.length)]; nameTextField.attributedPlaceholder = attrStrName; [nameView addSubview:nameTextField]; [nameTextField mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(nameTipLabel.mas_right).offset(0.0f); make.top.bottom.offset(0.0f); make.right.offset(-12.0f); }]; UIView *accountView = [[UIView alloc] init]; accountView.backgroundColor = LZF7F8FAColor; accountView.layer.cornerRadius = 6; accountView.layer.masksToBounds = YES; [scrollView addSubview:accountView]; [accountView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.top.equalTo(nameView.mas_bottom).offset(8.0f); make.width.offset(KScreenWidth - 28.0f); make.height.offset(48.0f); }]; UILabel* accountTipLabel = [[UILabel alloc]init]; accountTipLabel.text = LCStr(word7);//@"支付宝账号:"; accountTipLabel.textColor = LZ273145Color; accountTipLabel.font = LCFont14; [accountView addSubview:accountTipLabel]; [accountTipLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(12.0f); make.top.bottom.offset(0.0f); make.width.offset(84.0f); }]; UITextField* accountTextField = [[UITextField alloc]init]; self.youpaipaccountTextField = accountTextField; accountTextField.tintColor = LZ7C69FEColor; accountTextField.textColor = LZ273145Color; accountTextField.clearButtonMode = UITextFieldViewModeWhileEditing; [[accountTextField valueForKey:@"_clearButton"] setImage:[UIImage imageNamed:@"vqu_images_D_nick_clean"] forState:UIControlStateNormal]; [accountTextField addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged]; NSMutableAttributedString* attrStrAccount = [[NSMutableAttributedString alloc]initWithString:LCStr(word8)];//请输入支付宝账号 [attrStrAccount addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0, attrStrAccount.length)]; [attrStrAccount addAttribute:NSForegroundColorAttributeName value:LZD3D1D7Color range:NSMakeRange(0, attrStrAccount.length)]; accountTextField.attributedPlaceholder = attrStrAccount; [accountView addSubview:accountTextField]; [accountTextField mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(accountTipLabel.mas_right).offset(0.0f); make.top.bottom.offset(0.0f); make.right.offset(-12.0f); }]; UILabel* botLabel = [[UILabel alloc]init]; // botLabel.text = LCStr(word26);//注:真实姓名需与支付宝实名认证相同,否则无法到账 botLabel.textColor = LZA3AABEColor; botLabel.font = LCFont(10); botLabel.numberOfLines = 0; botLabel.textAlignment = NSTextAlignmentLeft; [scrollView addSubview:botLabel]; self.botLabel = botLabel; [botLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(14.0f); make.width.offset(KScreenWidth - 28.0f); make.top.equalTo(accountView.mas_bottom).offset(20.0f); }]; UIButton* withdrawBtn = [[UIButton alloc]initWithFrame:CGRectMake(48, CGRectGetMaxY(botLabel.frame)+30.0f, KScreenWidth-96, 48)]; withdrawBtn.uxy_acceptEventInterval = 3.0; withdrawBtn.userInteractionEnabled = NO; withdrawBtn.backgroundColor = LZD3D1D7Color; withdrawBtn.layer.cornerRadius = 24.0; withdrawBtn.layer.masksToBounds = YES; withdrawBtn.titleLabel.font = LCFont16; [withdrawBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; [withdrawBtn setTitle:LCStr(word18) forState:(UIControlStateNormal)];//立即提现 [withdrawBtn addTarget:self action:@selector(youpaifapplyWithdraw) forControlEvents:(UIControlEventTouchUpInside)]; [scrollView addSubview:withdrawBtn]; [withdrawBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.offset(48); make.width.offset(KScreenWidth - 96); make.top.equalTo(botLabel.mas_bottom).offset(30.0f); make.height.offset(48); }]; self.youpaipwithdrawBtn = withdrawBtn; [scrollView layoutIfNeeded]; CGFloat height = CGRectGetMaxY(self.youpaipwithdrawBtn.frame) + 40.0f + SafeHeight; if (height < KScreenHeight - NavBarHeight) { height = KScreenHeight - NavBarHeight + 1; } scrollView.contentSize = CGSizeMake(KScreenWidth, height); } /// 兑换钻石 - (void)transformCoinBtnClick{ YOUPAILZProfitTransformCoinVC *vc = [[YOUPAILZProfitTransformCoinVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } - (void)youpaifprofitAction{ YOUPAIHRBillDetailVC *vc = [YOUPAIHRBillDetailVC new]; [self.navigationController pushViewController:vc animated:YES]; } - (void)youpaipbindAccount{ @weakify(self); //先绑定账户再提现 [LCHttpHelper requestWithURLString:WalletZFBBind parameters:@{@"card_account":self.youpaipaccountTextField.text,@"card_name":self.youpaipnameTextField.text} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 [self youpaifshowWithdrawConfirmAlert]; } }failure:^(NSError *error) { }]; } - (void)youpaifshowWithdrawConfirmAlert{ @weakify(self); /// 获取提现到账金额 [LCHttpHelper requestWithURLString:GetWithdrawPrice parameters:@{@"money":@(self.selectedMoney)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 NSDictionary *data = [dict objectForKey:@"data"]; NSString *withdraw_money = [data objectForKey:@"withdraw_money"]; NSString *receive_money = [data objectForKey:@"receive_money"]; NSString *account_name = [data objectForKey:@"account_name"]; NSString *account = [data objectForKey:@"account"]; LZAlertAction *cancelAction = [LZAlertAction actionWithTitle:@"取消" handler:^(LZAlertAction *action) { }]; cancelAction.cornerRadius = 24.0f; cancelAction.color = LZ273145Color; cancelAction.bgColor = LZF5F4F7Color; LZAlertAction *confimAction = [LZAlertAction actionWithTitle:@"提交" handler:^(LZAlertAction *action) { @strongify(self); [self youpaifWithdraw]; }]; confimAction.cornerRadius = 24.0f; confimAction.color = [UIColor whiteColor]; confimAction.bgColor = [UIColor colorWithPatternImage:[LCTools ColorImage:CGSizeMake((KScreenWidth - 105.0f) / 2.0f, 48.0f) FromColors:@[LZFFB5DBColor,LZFE66A4Color] ByGradientType:GradientLeftToRight]]; LZAlertWindow *alert = [LZAlertWindow alertWithTitle:@"申请提现AA" content:@"" action:@[cancelAction,confimAction] contentStyleBlock:^(UILabel *contentL) { NSString *contentText = [NSString stringWithFormat:@"提现 %@ 金币,实际到账 %@ 金币\n收款账号:%@(%@)",withdraw_money,receive_money,account_name,account]; NSMutableAttributedString *str = [[NSMutableAttributedString alloc]initWithString:contentText]; [str addAttribute:NSForegroundColorAttributeName value: HexColorFromRGB(0xFF3B30) range:[contentText rangeOfString:withdraw_money]]; [str addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFF3B30) range:[contentText rangeOfString:receive_money]]; contentL.attributedText = str; }]; alert.contentTextAlignment = NSTextAlignmentCenter; [self TFPresentVC:alert completion:^{}]; } }failure:^(NSError *error) { }]; } - (void)youpaifWithdraw{ //直接提现 @weakify(self); [LCHttpHelper requestWithURLString:WithDrawApply parameters:@{@"money":@(self.selectedMoney)} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 [ZCHUDHelper showTitle:LCStr(word19)];//提现已申请成功,请耐心等待 [self.navigationController popViewControllerAnimated:YES]; } }failure:^(NSError *error) { }]; } - (void)youpaifapplyWithdraw{ if (self.youpaipaccount.length >0 && self.youpaipverify==1) { [self youpaifshowWithdrawConfirmAlert]; }else{ [self youpaipbindAccount]; } } -(void)textFieldDidEditing:(UITextField *)textField{ if ( [self.youpaipnameTextField.text isEqualToString:@""]||[self.youpaipaccountTextField.text isEqualToString:@""]||self.selectedMoney <= 0){ [self.youpaipwithdrawBtn setBackgroundImage:nil forState:(UIControlStateNormal)]; self.youpaipwithdrawBtn.userInteractionEnabled = NO; }else{ [self.youpaipwithdrawBtn setBackgroundImage:[LCTools ColorImage:self.youpaipwithdrawBtn.frame.size FromColors:@[LZFFB5DBColor,LZFE66A4Color] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)]; self.youpaipwithdrawBtn.userInteractionEnabled = YES; } } #pragma mark - Request - (void)youpaifrequestWalleetInfo{ @weakify(self); [LCHttpHelper requestWithURLString:WalletInit parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 // CGFloat incomeCoin = [[[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"income_coin"] floatValue]; NSString *incomeMoney = [[[dict objectForKey:@"data"]objectForKey:@"account"]objectForKey:@"income_coin"]; self.youpaipprofitL.attributedText = [LCTools setRichTextFormat:@[ [YOUPAILZRichTextStyle richTextStyleWithText:[NSString stringWithFormat:@"%@",incomeMoney] font:LZDinFont(36.0f) color:[UIColor whiteColor]], [YOUPAILZRichTextStyle richTextStyleWithText:@"金币" font:LCFont(14.0f) color:[UIColor whiteColor]] ]]; } } failure:^(NSError *error) { }]; } @end