BogoInviteWithDrawViewController.m 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // BogoInviteWithDrawViewController.m
  3. // UniversalApp
  4. //
  5. // Created by Mac on 2021/6/10.
  6. // Copyright © 2021 voidcat. All rights reserved.
  7. //
  8. #import "BogoInviteWithDrawViewController.h"
  9. #import "BogoInviteDetailTopView.h"
  10. #import "BogoInviteDetailBottomView.h"
  11. #import "BogoInviteWithDrawResponseModel.h"
  12. #import "SIdentificationVC.h"
  13. #import "BogoNetworkKit.h"
  14. #import "BogoWithDrawBindAlipayPopView.h"
  15. #import "BogoShopKit.h"
  16. @interface BogoInviteWithDrawViewController ()<BogoInviteDetailBottomViewDelegate,BogoWithDrawBindAlipayPopViewDelegate>
  17. @property(nonatomic, strong) BogoInviteDetailTopView *topView;
  18. @property(nonatomic, strong) BogoInviteDetailBottomView *bottomView;
  19. @property(nonatomic, strong) BogoInviteWithDrawResponseModel *model;
  20. @property(nonatomic, strong) BogoWithDrawBindAlipayPopView *aliPopView;
  21. @end
  22. @implementation BogoInviteWithDrawViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. // Do any additional setup after loading the view.
  26. self.title =ASLocalizedString( @"提现");
  27. [self.view addSubview:self.topView];
  28. self.topView.logBtn.hidden = YES;
  29. self.topView.withDrawBtn.hidden = YES;
  30. [self.view addSubview:self.bottomView];
  31. [self performSelector:@selector(updateLayout) afterDelay:0.25];
  32. [self requestData];
  33. }
  34. - (void)updateLayout{
  35. self.topView.height = 98;
  36. self.bottomView.height = 328;
  37. }
  38. - (void)requestData{
  39. // /mapi/index.php?ctl=invite_vue&act=reward_new&uid=2
  40. [[BogoNetwork shareInstance] POSTV4:@"" param:@{@"ctl":@"invite_vue",@"act":@"reward_new"} success:^(id _Nonnull result) {
  41. self.model = [BogoInviteWithDrawResponseModel mj_objectWithKeyValues:result];
  42. NSString *money = self.model.data.invite_coin;
  43. [[NSNotificationCenter defaultCenter] postNotificationName:@"upldateTopViewMoney" object:money];
  44. self.bottomView.model = self.model;
  45. } failure:^(NSString * _Nonnull error) {
  46. [[BGHUDHelper sharedInstance] tipMessage:error];
  47. }];
  48. }
  49. #pragma mark - BogoWithDrawBindAlipayPopViewDelegate
  50. - (void)bindPopView:(BogoWithDrawBindAlipayPopView *)bindPopView didClickSubmitBtn:(UIButton *)sender{
  51. // /mapi/index.php?ctl=invite_vue&act=pinless_add_new&pay=1111@qq.com&pay_name=邮箱
  52. [[BogoNetwork shareInstance] POSTV4:@"" param:@{@"ctl":@"invite_vue",@"act":@"pinless_add_new",@"pay":bindPopView.accountTextField.text,@"pay_name":bindPopView.nameTextField.text} success:^(id _Nonnull result) {
  53. [[BGHUDHelper sharedInstance] tipMessage:[NSString stringWithFormat:@"%@",result[@"error"]]];
  54. self.model.data.alipay_name = bindPopView.nameTextField.text;
  55. self.model.data.alipay_account = bindPopView.accountTextField.text;
  56. self.bottomView.model = self.model;
  57. } failure:^(NSString * _Nonnull error) {
  58. [[BGHUDHelper sharedInstance] tipMessage:error];
  59. }];
  60. }
  61. #pragma mark - BogoInviteDetailBottomViewDelegate
  62. - (void)bottomView:(BogoInviteDetailBottomView *)bottomView didClickAuthBtn:(UIButton *)sender{
  63. if (self.model.data.alipay_name.length) {
  64. return;
  65. }
  66. [self.aliPopView show:[UIApplication sharedApplication].keyWindow type:FDPopTypeCenter];
  67. }
  68. - (void)bottomView:(BogoInviteDetailBottomView *)bottomView didClickAgreementBtn:(UIButton *)sender{
  69. BGBaseWebViewController *webVC = [BGBaseWebViewController webControlerWithUrlStr:[GlobalVariables sharedInstance].appModel.Withdrawal_agree isShowIndicator:NO isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:NO];
  70. [self.navigationController pushViewController:webVC animated:YES];
  71. }
  72. - (void)bottomView:(BogoInviteDetailBottomView *)bottomView didClickWithDrawBtn:(UIButton *)sender{
  73. if (!self.model.data.alipay_name.length) {
  74. [[BGHUDHelper sharedInstance] tipMessage:ASLocalizedString(@"请先授权微信")];
  75. return;
  76. }
  77. // if (!self.model.data.is_auth) {
  78. // [[BGHUDHelper sharedInstance] tipMessage:ASLocalizedString(@"请先进行实名认证")];
  79. // SIdentificationVC *identificationVC = [[SIdentificationVC alloc]init];
  80. //// identificationVC.user_id = self.userModel.user_id;
  81. //// identificationVC.sexString = self.userModel.sex;
  82. //// identificationVC.nameString = self.userModel.nick_name;
  83. // [[AppDelegate sharedAppDelegate] pushViewController:identificationVC animated:YES];
  84. // return;
  85. // }
  86. if (!self.bottomView.selectModel) {
  87. [[BGHUDHelper sharedInstance] tipMessage:ASLocalizedString(@"请先选择提现金额")];
  88. return;
  89. }
  90. // /mapi/index.php?ctl=invite_vue&act=add_reward&uid=165999&id=12
  91. [[BogoNetwork shareInstance] POSTV4:@"" param:@{@"ctl":@"invite_vue",@"act":@"add_reward",@"id":self.bottomView.selectModel.id} success:^(id _Nonnull result) {
  92. [[BGHUDHelper sharedInstance] tipMessage:[NSString stringWithFormat:@"%@",result[@"error"]]];
  93. [self requestData];
  94. } failure:^(NSString * _Nonnull error) {
  95. [[BGHUDHelper sharedInstance] tipMessage:error];
  96. }];
  97. }
  98. - (BogoWithDrawBindAlipayPopView *)aliPopView{
  99. if (!_aliPopView) {
  100. _aliPopView = [kShopKitBundle loadNibNamed:@"BogoWithDrawBindAlipayPopView" owner:nil options:nil].lastObject;
  101. _aliPopView.delegate = self;
  102. }
  103. return _aliPopView;
  104. }
  105. - (BogoInviteDetailTopView *)topView{
  106. if (!_topView) {
  107. _topView = [[NSBundle mainBundle] loadNibNamed:@"BogoInviteDetailTopView" owner:nil options:nil].lastObject;
  108. }
  109. return _topView;
  110. }
  111. - (BogoInviteDetailBottomView *)bottomView{
  112. if (!_bottomView) {
  113. _bottomView = [[NSBundle mainBundle] loadNibNamed:@"BogoInviteDetailBottomView" owner:nil options:nil].lastObject;
  114. _bottomView.delegate = self;
  115. }
  116. return _bottomView;
  117. }
  118. @end