酷店

KDPEarnViewController.m 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // KDPEarnViewController.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/4.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPEarnViewController.h"
  9. #import "KDPEarningHeadView.h"
  10. #import "KDPEarnTableHeadView.h"
  11. #import "KDPAccountVC.h"
  12. #import "KDPForecastVC.h"
  13. @interface KDPEarnViewController ()<UITableViewDelegate,UITableViewDataSource>
  14. @property(nonatomic,strong)NSDictionary *incomeDic;
  15. @property(nonatomic,strong)KDPEarningHeadView *headView;
  16. @property(nonatomic,strong)UITableView *tableView;
  17. @end
  18. @implementation KDPEarnViewController
  19. - (void)viewDidLoad {
  20. [super viewDidLoad];
  21. self.view.backgroundColor=[UIColor colorWithHexString:LineColor];
  22. self.navBar.hidden=YES;
  23. [self.view addSubview:self.headView];
  24. [self.headView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(forecastVC)]];
  25. [self.headView mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.top.right.left.mas_equalTo(0);
  27. make.height.mas_equalTo(196+KDStatusHeight);
  28. }];
  29. [self.view addSubview:self.tableView];
  30. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.mas_equalTo(self.headView.mas_bottom).offset(-50);
  32. make.left.right.mas_equalTo(0);
  33. make.bottom.mas_equalTo(self.view.mas_bottom);
  34. }];
  35. KDPEarnTableHeadView*headViews=[[KDPEarnTableHeadView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 390)];
  36. headViews.accountBlock = ^{
  37. KDPAccountVC *accountV=[[KDPAccountVC alloc]init];
  38. [self.navigationController pushViewController:accountV animated:YES];
  39. };
  40. headViews.orderBlock = ^{
  41. KDPOderDetailListVC *listV=[[KDPOderDetailListVC alloc]init];
  42. [self.navigationController pushViewController:listV animated:YES];
  43. };
  44. self.tableView.tableHeaderView=headViews;
  45. [self IncomeAndOrderNumber];
  46. }
  47. #pragma mark---IncomeData
  48. -(void)IncomeAndOrderNumber
  49. {
  50. [LoadingView show];
  51. [KDPNetworkRequestHTTP postURL:IncomeDataURL params:nil success:^(id _Nonnull json) {
  52. NSLog(@"%@",json);
  53. _headView.orderNumgL.text=[NSString stringWithFormat:@"%ld",[json[@"order_num"]integerValue]];
  54. _headView.Forecastlabel.text=[NSString stringWithFormat:@"%@",json[@"total_rebate"]];;
  55. } failure:^(NSError * _Nonnull error) {
  56. }];
  57. }
  58. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  59. {
  60. UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];
  61. if (!cell) {
  62. cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  63. }
  64. return cell;
  65. }
  66. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  67. {
  68. return 0;
  69. }
  70. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  71. {
  72. return 0;
  73. }
  74. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  75. {
  76. return 0;
  77. }
  78. #pragma mark---侧滑
  79. -(void)drawerClickButton
  80. {
  81. KDPDrawerVC *vcFrame =[[KDPDrawerVC alloc]init];
  82. CWLateralSlideConfiguration *con =[CWLateralSlideConfiguration defaultConfiguration];
  83. con.distance=SCREEN_WIDTH/3*2;
  84. [self cw_showDrawerViewController:vcFrame animationType:0 configuration:con];
  85. }
  86. -(KDPEarningHeadView *)headView
  87. {
  88. if (!_headView) {
  89. _headView=[[KDPEarningHeadView alloc]init];
  90. _headView.userInteractionEnabled=YES;
  91. __weak KDPEarnViewController *weakself=self;
  92. _headView.forecastBlock = ^{
  93. [weakself forecastVC];
  94. };
  95. _headView.drawcBlock = ^{
  96. [weakself drawerClickButton];
  97. };
  98. }
  99. return _headView;
  100. }
  101. -(void)forecastVC
  102. {
  103. KDPForecastVC *foreV=[[KDPForecastVC alloc]init];
  104. [self.navigationController pushViewController:foreV animated:YES];
  105. }
  106. -(UITableView *)tableView
  107. {
  108. if (!_tableView ) {
  109. _tableView =[[UITableView alloc]init];
  110. _tableView.delegate =self;
  111. _tableView.dataSource=self;
  112. _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
  113. _tableView.backgroundColor=[UIColor clearColor];
  114. }
  115. return _tableView;
  116. }
  117. -(void)viewWillAppear:(BOOL)animated
  118. {
  119. [super viewWillAppear:animated];
  120. self.tabBarController.tabBar.hidden=NO;
  121. }
  122. @end