IncomeViewController.m 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. //
  2. // IncomeViewController.m
  3. // BuguLive
  4. //
  5. // Created by 岳克奎 on 16/8/18.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "IncomeViewController.h"
  9. #import "myProfitModel.h"
  10. #import "ConverViewController.h"
  11. #import "ReceiverRecordViewController.h"
  12. //#import "LPhoneLoginVC.h"
  13. //#import "WXContextViewController.h"
  14. #import "MyProfitConverModel.h"
  15. #import "BingdingStateModel.h"
  16. #import "SaleCell.h"
  17. #import "AuctionCell.h"
  18. #import "InComeDataCell.h"
  19. #import "YInComeHeaderView.h"
  20. #import "GainsAccountBindVC.h"
  21. #import "AuctionAloneCell.h"
  22. #import "GainsWithdrawVC.h"
  23. #import "ExplainCell.h"
  24. #import "PhoneLoginViewController.h"
  25. #pragma mark----------------数据宏定义 ---------------
  26. #define viewHeight 120
  27. #define labelHeight 50
  28. //3种行高
  29. #define kRowHightOne 50
  30. #define kRowHightSecond 100
  31. #define kRowHightThird 70
  32. #define kHeaderViewHight 240+1+12
  33. @interface IncomeViewController ()<UITableViewDelegate,UITableViewDataSource,AInComeDataCellDelegate,AuctionAloneCellDelegate>
  34. {
  35. NSString *binding_wx;//是否绑定微信
  36. NSString *mobile_exist;//是否绑定手机
  37. NSString *subscribe; //是否关注微信号
  38. NSString *subscription; //微信平台名称
  39. NSString *binding_alipay;
  40. NSString *refund_exist;
  41. BOOL __isOpen[10];
  42. BOOL _isFirstLoad;
  43. }
  44. @property (nonatomic, strong) NSMutableArray *withdrawdeposiArray;
  45. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  46. @property(nonatomic,strong) BingdingStateModel * model;
  47. @end
  48. @implementation IncomeViewController
  49. - (void)viewWillAppear:(BOOL)animated
  50. {
  51. [super viewWillAppear:animated];
  52. if (!_isFirstLoad)
  53. {
  54. [self headerReresh];
  55. }
  56. _isFirstLoad = NO;
  57. self.navigationController.navigationBar.hidden = YES;
  58. }
  59. - (void)viewDidLoad
  60. {
  61. [super viewDidLoad];
  62. _isFirstLoad = YES;
  63. }
  64. #pragma mark 初始化变量
  65. - (void)initFWVariables
  66. {
  67. [super initFWVariables];
  68. _withdrawdeposiArray = [NSMutableArray array];
  69. }
  70. #pragma mark UI创建
  71. - (void)initFWUI
  72. {
  73. [super initFWUI];
  74. // self.navigationItem.title = ASLocalizedString(@"收益");
  75. // self.navigationController.navigationBar.backgroundColor = kBackGroundColor;
  76. self.view.backgroundColor = kBackGroundColor;
  77. // self.view.backgroundColor = [UIColor colorWithHexString:@"#F5F5F5"];
  78. UIImageView * navView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationHeight)];
  79. // navView.image = [UIImage imageNamed:@"mine_navbg"];
  80. navView.userInteractionEnabled = YES;
  81. [self.view addSubview:navView];
  82. UIButton * backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  83. [backBtn setImage:[UIImage imageNamed:@"back_w"] forState:UIControlStateNormal];
  84. backBtn.frame = CGRectMake(10, StatusBarHeight, 44, 44);
  85. [backBtn addTarget:self action:@selector(backLastVC) forControlEvents:UIControlEventTouchUpInside];
  86. [navView addSubview:backBtn];
  87. UILabel * titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];
  88. titleLabel.centerX = SCREEN_WIDTH/2;
  89. titleLabel.centerY = backBtn.centerY;
  90. titleLabel.text = ASLocalizedString(@"收益");
  91. titleLabel.textColor = UIColor.whiteColor;
  92. titleLabel.font = [UIFont boldSystemFontOfSize:18];
  93. titleLabel.textAlignment = NSTextAlignmentCenter;
  94. [navView addSubview:titleLabel];
  95. UIButton * rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  96. // [backBtn setImage:[UIImage imageNamed:@"com_arrow_vc_back"] forState:UIControlStateNormal];
  97. rightBtn.frame = CGRectMake(SCREEN_WIDTH - 60 - 10, StatusBarHeight, 60, 44);
  98. [rightBtn addTarget:self action:@selector(receiveAction) forControlEvents:UIControlEventTouchUpInside];
  99. [rightBtn setTitle:ASLocalizedString(@"明细") forState:UIControlStateNormal];
  100. rightBtn.titleLabel.font = [UIFont systemFontOfSize:12];
  101. [rightBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  102. if (![VersionNum isEqualToString:self.BuguLive.appModel.ios_checkVersionStr]) {
  103. [navView addSubview:rightBtn];
  104. }
  105. [self initRefresh];
  106. [self initTableView];
  107. [self setNavItem];
  108. }
  109. - (void)backLastVC {
  110. [self.navigationController popViewControllerAnimated:YES];
  111. }
  112. #pragma mark 加载数据
  113. - (void)initFWData
  114. {
  115. [super initFWData];
  116. }
  117. #pragma initRefresh
  118. - (void)initRefresh
  119. {
  120. [BGMJRefreshManager refresh:self.tableView target:self headerRereshAction:@selector(headerReresh) footerRereshAction:nil];
  121. }
  122. #pragma mark - headerReresh
  123. - (void)headerReresh
  124. {
  125. [self myProfitRequest];
  126. [self myProfitConverRequest];
  127. }
  128. #pragma mark -Item
  129. - (void)setNavItem
  130. {
  131. // 返回按钮
  132. [self setupBackBtnWithBlock:nil];
  133. // if (![VersionNum isEqualToString:self.BuguLive.appModel.ios_checkVersionStr] )
  134. // {
  135. // UIButton *rightButton = [[UIButton alloc]initWithFrame:CGRectMake(kScreenW-80, 5, 70, 30)];
  136. // [rightButton setTitle:ASLocalizedString(@"明细")forState:0];
  137. // rightButton.titleLabel.font = [UIFont systemFontOfSize:15];
  138. // [rightButton setTitleColor:kAppGrayColor1 forState:0];
  139. // [rightButton addTarget:self action:@selector(receiveAction) forControlEvents:UIControlEventTouchUpInside];
  140. // UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
  141. // self.navigationItem.rightBarButtonItem = rightBarButtonItem;
  142. //
  143. // [rightButton setTintColor:kAppGrayColor2];
  144. // }
  145. }
  146. #pragma mark -tableView
  147. - (void)initTableView
  148. {
  149. [self registCell];
  150. _tableView.delegate = self;
  151. _tableView.dataSource = self;
  152. [self initHeaderViewWithModel:nil];
  153. _tableView.backgroundColor = kBackGroundColor;
  154. _tableView.showsVerticalScrollIndicator = NO;
  155. }
  156. #pragma mark -HeaderView
  157. #pragma mark -
  158. - (void)setTableViewHeaderView
  159. {
  160. ReceiverRecordViewController *receiveVC =[[ReceiverRecordViewController alloc]init];
  161. [[AppDelegate sharedAppDelegate] pushViewController:receiveVC animated:YES];
  162. }
  163. #pragma mark -表头 自定义
  164. - (void)initHeaderViewWithModel:(BingdingStateModel*)model
  165. {
  166. //隐藏
  167. CGRect rect;
  168. if ([VersionNum isEqualToString:self.BuguLive.appModel.ios_checkVersionStr])
  169. {
  170. rect = CGRectMake(0, 0, kScreenW, kHeaderViewHight-75-45);
  171. }
  172. else
  173. {
  174. rect = CGRectMake(0, 0, kScreenW, kHeaderViewHight - 50);
  175. }
  176. UIView *header_F_View =[[UIView alloc]initWithFrame:rect];
  177. YInComeHeaderView *header_S_View =[YInComeHeaderView createYInComeHeaderViewWithFram:rect];
  178. header_S_View.model = model;
  179. [header_F_View addSubview:header_S_View];
  180. _tableView.tableHeaderView = header_F_View;
  181. [_tableView reloadData];
  182. }
  183. #pragma mark --------------------- cell部分 -------------------------
  184. #pragma mark -regist -Cell
  185. - (void)registCell
  186. {
  187. //0 区cell
  188. [self.tableView registerNib:[UINib nibWithNibName:@"AuctionCell" bundle:nil] forCellReuseIdentifier:@"AuctionCell"];
  189. // 1 区cell
  190. [self.tableView registerNib:[UINib nibWithNibName:@"SaleCell" bundle:nil] forCellReuseIdentifier:@"SaleCell"];
  191. //
  192. [self.tableView registerNib:[UINib nibWithNibName:@"InComeDataCell" bundle:nil] forCellReuseIdentifier:@"InComeDataCell"];
  193. }
  194. #pragma mark -row 行数
  195. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  196. {
  197. if ([self.BuguLive.appModel.open_pai_module integerValue] == 1)
  198. {
  199. if (section == 0 ||section == 2)
  200. {
  201. return 0;
  202. }
  203. if (section == 1)
  204. {
  205. if (!__isOpen[section])
  206. {
  207. return 0;
  208. }
  209. else
  210. {
  211. return 0;
  212. }
  213. }
  214. if (section == 3)
  215. {
  216. if (!__isOpen[section])
  217. {
  218. return 0;
  219. }
  220. else
  221. {
  222. return 1;
  223. }
  224. }
  225. }
  226. if (section ==4)
  227. {
  228. return _withdrawdeposiArray.count;
  229. }
  230. else if (section == 5)
  231. {
  232. return 1;
  233. }
  234. else
  235. {
  236. return 0;
  237. }
  238. }
  239. #pragma mark -rowHight 行高
  240. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  241. {
  242. if (indexPath.section == 0 || indexPath.section == 2)
  243. {
  244. return kRowHightOne;
  245. }
  246. else if(indexPath.section == 1 || indexPath.section == 3)
  247. {
  248. return kRowHightSecond;
  249. }
  250. else if (indexPath.section == 5)
  251. {
  252. return self.model.explainCellHeight;
  253. }
  254. else
  255. {
  256. return kRowHightThird;
  257. }
  258. }
  259. - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
  260. {
  261. if (indexPath.section == 0 || indexPath.section == 2) {
  262. return kRowHightOne;
  263. }else if(indexPath.section == 1 || indexPath.section == 3)
  264. {
  265. return kRowHightSecond;
  266. }else{
  267. return kRowHightThird;
  268. }
  269. }
  270. #pragma mark -cell
  271. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  272. {
  273. if(indexPath.section == 0|| indexPath.section == 2)
  274. {
  275. SaleCell* cell =[tableView dequeueReusableCellWithIdentifier:@"SaleCell" forIndexPath:indexPath];
  276. if (indexPath.section == 0)
  277. {
  278. cell.left_Name_Lab.text = ASLocalizedString(@"我拍卖的商品收入");
  279. }
  280. else
  281. {
  282. cell.left_Name_Lab.text = ASLocalizedString(@"我销售的商品收入");
  283. }
  284. return cell;
  285. }
  286. else if(indexPath.section == 1|| indexPath.section == 3)
  287. {
  288. InComeDataCell* cell =[tableView dequeueReusableCellWithIdentifier:@"InComeDataCell" forIndexPath:indexPath];
  289. return cell;
  290. }
  291. else if(indexPath.section == 4)
  292. {
  293. AuctionAloneCell *cell = [AuctionAloneCell cellWithTbaleview:tableView];
  294. cell.tile = _withdrawdeposiArray[indexPath.row];
  295. cell.delegate =self;
  296. return cell;
  297. }
  298. else
  299. {
  300. ExplainCell * cell = [ExplainCell cellWithTableView:tableView];
  301. if (_model) {
  302. cell.model = self.model;
  303. }
  304. return cell;
  305. }
  306. }
  307. #pragma mark -sectionNum 区数
  308. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  309. {
  310. if (self.model.refund_explain && self.model.refund_explain.count>0)
  311. {
  312. return 6;
  313. }
  314. else
  315. {
  316. return 5;
  317. }
  318. }
  319. #pragma mark - sectionHight 区高
  320. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  321. {
  322. if (section == 4)
  323. {
  324. return 16.0f;
  325. }
  326. else
  327. {
  328. return 0.7f;
  329. }
  330. }
  331. #pragma mark -section_View 区试图
  332. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  333. {
  334. int add_Width =0;
  335. if (section ==4)
  336. {
  337. add_Width =7+8;
  338. }
  339. if (section == 0)
  340. {
  341. add_Width =10;
  342. }
  343. UIView *section_View = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 1+add_Width)];
  344. section_View.backgroundColor = kWhiteColor;
  345. return section_View;
  346. }
  347. #pragma mark -----------------Method 方法 部分-----------------
  348. #pragma mark -didSelect -选择cell的方法
  349. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  350. {
  351. if (indexPath.section ==0 || indexPath.section == 2)
  352. {
  353. __isOpen[indexPath.section+1] = ! __isOpen[indexPath.section+1];
  354. //刷新下个区
  355. NSIndexSet *indexSet_next=[[NSIndexSet alloc]initWithIndex:indexPath.section+1];
  356. [self.tableView reloadSections:indexSet_next withRowAnimation:UITableViewRowAnimationAutomatic];
  357. //找到cell
  358. SaleCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
  359. if (__isOpen[indexPath.section+1])
  360. {
  361. [self rorateAnimation:cell.expand_ImgView];
  362. }
  363. else
  364. {
  365. [self resumeAnimation:cell.expand_ImgView];
  366. }
  367. }
  368. }
  369. #pragma mark - resumeAnimation- 区打开标志 打开
  370. - (void)rorateAnimation:(UIImageView *)sender
  371. {
  372. sender.transform = CGAffineTransformMakeRotation(M_PI);
  373. }
  374. #pragma mark - resumeAnimation- 区打开标志 闭合
  375. #pragma mark - 恢复
  376. - (void)resumeAnimation:(UIImageView *)sender
  377. {
  378. sender.transform = CGAffineTransformIdentity;
  379. }
  380. #pragma mark -去兑换/微信提现VC
  381. - (void)goNextVC:(UIButton *)sender
  382. {
  383. //兑换 1 //微信提现 2
  384. if(sender.tag ==1)
  385. {
  386. ConverViewController *converVC =[[ConverViewController alloc]init];
  387. [[AppDelegate sharedAppDelegate] pushViewController:converVC animated:YES];
  388. }
  389. else if(sender.tag ==2)
  390. {
  391. [self weixinRequest];
  392. }
  393. else if (sender.tag == 3)
  394. {
  395. GainsAccountBindVC *vc = [[GainsAccountBindVC alloc] initWithNibName:@"GainsAccountBindVC" bundle:nil];
  396. [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  397. }
  398. }
  399. - (void)buttonActionGoNetVC:(NSString *)tile
  400. {
  401. [[BGHUDHelper sharedInstance] syncLoading];
  402. [[IMAPlatform sharedInstance].host getMyInfo:^(AppBlockModel *blockModel) {
  403. [[BGHUDHelper sharedInstance] syncStopLoading];
  404. if(0)
  405. {
  406. [FanweMessage alert:ASLocalizedString(@"男用户暂时不支持提现")];
  407. }
  408. else
  409. {
  410. if ([tile isEqualToString:ASLocalizedString(@"兑换")])
  411. {
  412. ConverViewController *converVC =[[ConverViewController alloc]init];
  413. [[AppDelegate sharedAppDelegate] pushViewController:converVC animated:YES];
  414. }
  415. else if ([tile isEqualToString:ASLocalizedString(@"微信提现")])
  416. {
  417. if ([refund_exist integerValue] == 1)
  418. {
  419. [FanweMessage alert:ASLocalizedString(@"您还有未处理的提现")];
  420. return;
  421. }
  422. [self weixinRequest];
  423. }
  424. else if ([tile isEqualToString:ASLocalizedString(@"提现")])
  425. {
  426. // if ([refund_exist integerValue] == 1)
  427. // {
  428. // [FanweMessage alert:ASLocalizedString(@"您还有未处理的提现")];
  429. // return;
  430. // }
  431. [self judgereDrawWithAlipay];
  432. }
  433. }
  434. }];
  435. }
  436. #pragma mark -roratesign 标签转动(不好封装)
  437. - (void)rorateSign:(UIButton *)sender
  438. {
  439. //不好封装到对应的cell
  440. }
  441. #pragma mark - 跳转到领取记录
  442. - (void)receiveAction
  443. {
  444. NSString *pay_nobleUrl = [GlobalVariables sharedInstance].appModel.h5_url.emcee_income_log_url;
  445. BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:pay_nobleUrl isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES];
  446. tmpController.navTitleStr = ASLocalizedString(@"");
  447. [[AppDelegate sharedAppDelegate] pushViewController:tmpController animated:YES];
  448. // ReceiverRecordViewController *receiveVC =[[ReceiverRecordViewController alloc]init];
  449. // [[AppDelegate sharedAppDelegate] pushViewController:receiveVC animated:YES];
  450. }
  451. #pragma mark -竞拍管理(未实现----预留)
  452. - (void)auctionManagementBtnClick:(UIButton *)sender
  453. {
  454. }
  455. #pragma mark ------------------------ 数 据 部 分 -------------------
  456. #pragma mark- 我的 收益 初始化
  457. - (void)myProfitRequest
  458. {
  459. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  460. [parmDict setObject:@"user_center" forKey:@"ctl"];
  461. [parmDict setObject:@"profit" forKey:@"act"];
  462. FWWeakify(self)
  463. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  464. {
  465. FWStrongify(self)
  466. if ([responseJson toInt:@"status"] ==1)
  467. {
  468. [self.withdrawdeposiArray removeAllObjects];
  469. [self.withdrawdeposiArray addObject:ASLocalizedString(@"兑换")];
  470. self.model = [BingdingStateModel mj_objectWithKeyValues:responseJson];
  471. BingdingStateModel *model =[[BingdingStateModel alloc]init];
  472. model =[BingdingStateModel mj_objectWithKeyValues: responseJson];
  473. binding_wx =model.binding_wx;
  474. mobile_exist =model.mobile_exist;
  475. subscribe =model.subscribe;
  476. subscription =model.subscription;
  477. binding_alipay = model.binding_alipay;
  478. refund_exist = model.refund_exist;
  479. [self.tableView reloadData];
  480. if ([model.withdrawals_wx integerValue] == 1)
  481. {
  482. [self.withdrawdeposiArray addObject:ASLocalizedString(@"微信提现")];
  483. }
  484. // if ([model.withdrawals_alipay integerValue] == 1 )
  485. // {
  486. [self.withdrawdeposiArray addObject:ASLocalizedString(@"提现")];
  487. // }
  488. //必须重新 调用
  489. [self initHeaderViewWithModel:model];
  490. if ([VersionNum isEqualToString:self.BuguLive.appModel.ios_checkVersionStr])
  491. {
  492. [self.withdrawdeposiArray removeAllObjects];
  493. }
  494. [self.tableView reloadData];
  495. }
  496. [BGMJRefreshManager endRefresh:self.tableView];
  497. } FailureBlock:^(NSError *error)
  498. {
  499. [BGMJRefreshManager endRefresh:self.tableView];
  500. }];
  501. }
  502. #pragma marlk 我的收益兑换初始化
  503. - (void)myProfitConverRequest
  504. {
  505. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  506. [parmDict setObject:@"user_center" forKey:@"ctl"];
  507. [parmDict setObject:@"exchange" forKey:@"act"];
  508. FWWeakify(self)
  509. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  510. {
  511. FWStrongify(self)
  512. if ((NSNull *)responseJson != [NSNull null])
  513. {
  514. if ([responseJson toInt:@"status"] ==1)
  515. {
  516. MyProfitConverModel *model = [[MyProfitConverModel alloc]init];
  517. model =[MyProfitConverModel mj_objectWithKeyValues: responseJson];
  518. [self.tableView reloadData];
  519. }
  520. }
  521. [BGMJRefreshManager endRefresh:self.tableView];
  522. } FailureBlock:^(NSError *error)
  523. {
  524. [BGMJRefreshManager endRefresh:self.tableView];
  525. }];
  526. }
  527. #pragma marlk 微信提现初始化
  528. - (void)weixinRequest
  529. {
  530. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  531. [parmDict setObject:@"user_center" forKey:@"ctl"];
  532. [parmDict setObject:@"money_carry_wx" forKey:@"act"];
  533. FWWeakify(self)
  534. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  535. {
  536. FWStrongify(self)
  537. if ((NSNull *)responseJson != [NSNull null])
  538. {
  539. if ([responseJson toInt:@"status"] ==1)
  540. {
  541. [self judgereDraw];
  542. }
  543. }
  544. } FailureBlock:^(NSError *error)
  545. {
  546. }];
  547. }
  548. #pragma marlk 判断提现条件
  549. - (void)judgereDraw
  550. {
  551. if ([binding_wx intValue] ==0 )
  552. {
  553. [self loginByWechat];
  554. }
  555. if ([binding_wx intValue] == 1 && [mobile_exist intValue] == 1)
  556. {
  557. if ([subscribe intValue]==0)
  558. {
  559. UIPasteboard *pasteboard=[UIPasteboard generalPasteboard];
  560. pasteboard.string = subscription;
  561. [[BGHUDHelper sharedInstance] tipMessage:ASLocalizedString(@"复制成功")];
  562. [self performSelector:@selector(delayMethod) withObject:nil afterDelay:0.5];
  563. }
  564. else
  565. {
  566. [FanweMessage alert:[NSString stringWithFormat:ASLocalizedString(@"请前往“%@”公众号进行提现"), subscription]];
  567. }
  568. }
  569. if ([binding_wx intValue] ==1 &&[mobile_exist intValue]==0)
  570. {
  571. PhoneLoginViewController *phoneVC =[[PhoneLoginViewController alloc]initWithNibName:NSStringFromClass([PhoneLoginViewController class]) bundle:[NSBundle mainBundle]];
  572. phoneVC.LSecBPhone = YES;
  573. [[AppDelegate sharedAppDelegate] pushViewController:phoneVC animated:YES];
  574. }
  575. }
  576. - (void)judgereDrawWithAlipay
  577. {
  578. // if ([binding_alipay integerValue] == 0)
  579. // {
  580. // GainsAccountBindVC *vc = [[GainsAccountBindVC alloc] initWithNibName:@"GainsAccountBindVC" bundle:nil];
  581. // [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  582. // }
  583. // else
  584. // {
  585. // GainsWithdrawVC *vc = [[GainsWithdrawVC alloc] initWithNibName:@"GainsWithdrawVC" bundle:nil];
  586. // vc.model = self.model;
  587. // [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  588. // }
  589. GainsWithdrawVC *vc = [[GainsWithdrawVC alloc] init];//WithNibName:@"GainsWithdrawVC" bundle:kShopKitBundle];
  590. vc.model = self.model;
  591. [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  592. // NSString *url = [NSString stringWithFormat:@"%@&token=%@",[GlobalVariables sharedInstance].appModel.h5_url.withdrawal_account_url,[GlobalVariables sharedInstance].token];
  593. //
  594. //
  595. // BGMainWebViewController *tmpController = [BGMainWebViewController webControlerWithUrlStr:url isShowIndicator:YES isShowNavBar:YES isShowBackBtn:YES isShowCloseBtn:NO];
  596. // [self.navigationController pushViewController:tmpController animated:NO];
  597. }
  598. - (void)delayMethod
  599. {
  600. [FanweMessage alert:[NSString stringWithFormat:ASLocalizedString(@"微信搜索关注“%@”公众号领取红包"), subscription]];
  601. }
  602. #pragma marlk 微信提现
  603. - (void)WXDrawrequest
  604. {
  605. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  606. [parmDict setObject:@"user_center" forKey:@"ctl"];
  607. [parmDict setObject:@"submitrefundwx" forKey:@"act"];
  608. FWWeakify(self)
  609. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  610. {
  611. FWStrongify(self)
  612. if ((NSNull *)responseJson != [NSNull null])
  613. {
  614. if ([responseJson toInt:@"status"] ==1)
  615. {
  616. [self judgereDraw];
  617. }
  618. }
  619. } FailureBlock:^(NSError *error)
  620. {
  621. }];
  622. }
  623. #pragma mark 绑定微信
  624. - (void)loginByWechat
  625. {
  626. FWWeakify(self)
  627. [[UMSocialManager defaultManager] getUserInfoWithPlatform:UMSocialPlatformType_WechatSession currentViewController:self completion:^(id result, NSError *error) {
  628. FWStrongify(self)
  629. UMSocialUserInfoResponse *resp = result;
  630. if (resp)
  631. {
  632. NSMutableDictionary *parmDict = [NSMutableDictionary dictionary];
  633. [parmDict setObject:@"user_center" forKey:@"ctl"];
  634. [parmDict setObject:@"update_wxopenid" forKey:@"act"];
  635. [parmDict setObject:resp.openid forKey:@"openid"];
  636. [parmDict setObject:resp.accessToken forKey:@"access_token"];
  637. [self.httpsManager POSTWithParameters:parmDict SuccessBlock:^(NSDictionary *responseJson)
  638. {
  639. if ([responseJson toInt:@"status"] == 1)
  640. {
  641. NSString * binding_wx1 =[responseJson objectForKey:@"binding_wx"];
  642. if ([binding_wx1 intValue] ==1)
  643. {
  644. [FanweMessage alert:ASLocalizedString(@"绑定成功")];
  645. [self myProfitRequest];
  646. }
  647. else
  648. {
  649. [FanweMessage alert:ASLocalizedString(@"绑定失败")];
  650. }
  651. }
  652. }FailureBlock:^(NSError *error){
  653. }];
  654. }
  655. }];
  656. }
  657. @end