酷店

KDPEarnViewController.m 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.top.right.left.mas_equalTo(0);
  26. make.height.mas_equalTo(196+KDStatusHeight);
  27. }];
  28. [self.view addSubview:self.tableView];
  29. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.mas_equalTo(self.headView.mas_bottom).offset(-50);
  31. make.left.right.mas_equalTo(0);
  32. make.bottom.mas_equalTo(self.view.mas_bottom);
  33. }];
  34. KDPEarnTableHeadView*headViews=[[KDPEarnTableHeadView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 390)];
  35. headViews.accountBlock = ^{
  36. KDPAccountVC *accountV=[[KDPAccountVC alloc]init];
  37. [self.navigationController pushViewController:accountV animated:YES];
  38. };
  39. headViews.orderBlock = ^{
  40. KDPOderDetailListVC *listV=[[KDPOderDetailListVC alloc]init];
  41. [self.navigationController pushViewController:listV animated:YES];
  42. };
  43. self.tableView.tableHeaderView=headViews;
  44. [self IncomeAndOrderNumber];
  45. }
  46. #pragma mark---IncomeData
  47. -(void)IncomeAndOrderNumber
  48. {
  49. [LoadingView show];
  50. [KDPNetworkRequestHTTP postURL:IncomeDataURL params:nil success:^(id _Nonnull json) {
  51. NSLog(@"%@",json);
  52. _headView.orderNumgL.text=[NSString stringWithFormat:@"%ld",[json[@"order_num"]integerValue]];
  53. _headView.Forecastlabel.text=[NSString stringWithFormat:@"%@",json[@"total_rebate"]];;
  54. } failure:^(NSError * _Nonnull error) {
  55. }];
  56. }
  57. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  58. {
  59. UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cell"];
  60. if (!cell) {
  61. cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  62. }
  63. return cell;
  64. }
  65. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  66. {
  67. return 0;
  68. }
  69. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  70. {
  71. return 0;
  72. }
  73. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  74. {
  75. return 0;
  76. }
  77. #pragma mark---侧滑
  78. -(void)drawerClickButton
  79. {
  80. KDPDrawerVC *vcFrame =[[KDPDrawerVC alloc]init];
  81. CWLateralSlideConfiguration *con =[CWLateralSlideConfiguration defaultConfiguration];
  82. con.distance=SCREEN_WIDTH/3*2;
  83. [self cw_showDrawerViewController:vcFrame animationType:0 configuration:con];
  84. }
  85. -(KDPEarningHeadView *)headView
  86. {
  87. if (!_headView) {
  88. _headView=[[KDPEarningHeadView alloc]init];
  89. _headView.userInteractionEnabled=YES;
  90. __weak KDPEarnViewController *weakself=self;
  91. _headView.forecastBlock = ^{
  92. KDPForecastVC *foreV=[[KDPForecastVC alloc]init];
  93. [weakself.navigationController pushViewController:foreV animated:YES];
  94. };
  95. _headView.drawcBlock = ^{
  96. [self drawerClickButton];
  97. };
  98. }
  99. return _headView;
  100. }
  101. -(UITableView *)tableView
  102. {
  103. if (!_tableView ) {
  104. _tableView =[[UITableView alloc]init];
  105. _tableView.delegate =self;
  106. _tableView.dataSource=self;
  107. _tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
  108. _tableView.backgroundColor=[UIColor clearColor];
  109. }
  110. return _tableView;
  111. }
  112. -(void)viewWillAppear:(BOOL)animated
  113. {
  114. [super viewWillAppear:animated];
  115. self.tabBarController.tabBar.hidden=NO;
  116. }
  117. @end