线上所有马甲包模板,与《猎豆》同UI。域名zhuadd

HSQToMoneyViewController.m 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. //
  2. // HSQToMoneyViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/6/11.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "HSQToMoneyViewController.h"
  9. #import "HSQChildCommissionCell.h"
  10. #import "HSQAccountHeader.h"
  11. #import "HSQChildOrderCell.h"
  12. #import "HSQChildOrderModel.h"
  13. #import "HSQWithdrawDetailController.h"
  14. @interface HSQToMoneyViewController ()
  15. <
  16. UITableViewDelegate,
  17. UITableViewDataSource
  18. >
  19. {
  20. UIView *_sectionHeader;
  21. CGFloat rebate_account;//累计成功提现
  22. NSInteger allTimes;
  23. }
  24. @property (nonatomic, assign) NSInteger page;
  25. @property (nonatomic, strong) NSMutableArray *dataArr;
  26. @end
  27. @implementation HSQToMoneyViewController
  28. - (void)viewDidAppear:(BOOL)animated {
  29. [super viewDidAppear:animated];
  30. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  31. }
  32. - (void)viewDidLoad {
  33. [super viewDidLoad];
  34. [self configTableView];
  35. [self request];
  36. }
  37. - (void)configTableView {
  38. self.page = 1;
  39. [self.view addSubview:self.tableView];
  40. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshList:) name:RefreshWithDrawHistory object:nil];
  41. }
  42. - (void)refreshList:(NSNotification *)noti {
  43. [self.dataArr removeAllObjects];
  44. _page = 1;
  45. [self.tableView reloadData];
  46. [self request];
  47. }
  48. - (void)backAction {
  49. [self.navigationController popViewControllerAnimated:YES];
  50. }
  51. - (void)request {
  52. NSString *url=[NSString stringWithFormat:@"%@/api/v2/adzoneCreate/commissionList",BaseURL];
  53. NSDictionary *dic=@{
  54. @"type":@(2),
  55. @"page":@(self.page)
  56. };
  57. [HSQHttp post:url params:dic success:^(id json) {
  58. rebate_account = [json[@"rebate_account"] floatValue];
  59. allTimes = [json[@"allTimes"] integerValue];;
  60. NSArray *arr = [NSArray yy_modelArrayWithClass:[HSQChildOrderModel class] json:json[@"data"]];
  61. if (arr.count>0) {
  62. [self.dataArr addObjectsFromArray:arr];
  63. [self.tableView.mj_footer endRefreshing];
  64. }else {
  65. [self setUpNoDataView];
  66. [self noMoreDataWithArray:arr];
  67. }
  68. [self.tableView reloadData];
  69. } failure:^(NSError *error) {
  70. [self.tableView.mj_footer endRefreshing];
  71. }];
  72. }
  73. - (void)noMoreDataWithArray:(NSArray *)array {
  74. if (array==nil || array.count <= 0) {
  75. [self.tableView.mj_footer endRefreshingWithNoMoreData];
  76. }
  77. }
  78. - (void)setUpNoDataView {
  79. self.tableView.showNoDataView = YES;
  80. self.tableView.defaultNoDataText = @"您还没有任何记录";
  81. self.tableView.defaultNoDataImage = [UIImage imageNamed:@"noData"];
  82. }
  83. #pragma mark ------ scrollView delegate -----
  84. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  85. if (!self.childCanScroll) {
  86. scrollView.contentOffset = CGPointZero;
  87. }
  88. if (scrollView.contentOffset.y <= 0) {
  89. self.childCanScroll = NO;
  90. scrollView.contentOffset = CGPointZero;
  91. [[NSNotificationCenter defaultCenter] postNotificationName:@"childDetailleaveTop" object:nil];//到顶通知父视图改变状态
  92. }
  93. }
  94. #pragma mark -------- UITableView Delegate -----
  95. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  96. if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
  97. [cell setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 15)];
  98. }
  99. }
  100. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  101. return self.dataArr.count;
  102. }
  103. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  104. return 67;
  105. }
  106. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  107. return 37;
  108. }
  109. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
  110. return 0.1;
  111. }
  112. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  113. HSQChildOrderCell *cell = [HSQChildOrderCell cellWithTableView:tableView];
  114. HSQChildOrderModel *model = self.dataArr[indexPath.row];
  115. cell.model=model;
  116. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  117. return cell;
  118. }
  119. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  120. _sectionHeader = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 37)];
  121. _sectionHeader.backgroundColor = [UIColor YHColorWithHex:0xF4F4F4];
  122. UILabel *priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(25, 0, 200, 37)];
  123. priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  124. priceLabel.font = [UIFont systemFontOfSize:12];
  125. priceLabel.text = [NSString stringWithFormat:@"累计成功提现%ld次,共%.2f元",(long)allTimes,rebate_account];
  126. [_sectionHeader addSubview:priceLabel];
  127. return _sectionHeader;
  128. }
  129. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  130. HSQChildOrderModel *model = self.dataArr[indexPath.row];
  131. if ([model.state_of_embodiment isEqualToString:@"1"]) {
  132. HSQWithdrawDetailController *detail = [[HSQWithdrawDetailController alloc] init];
  133. detail.detailId = model.Id;
  134. [self.navigationController pushViewController:detail animated:YES];
  135. }
  136. }
  137. #pragma mark ------- layzer ------
  138. - (UITableView *)tableView {
  139. if (!_tableView) {
  140. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-40) style:UITableViewStylePlain];
  141. _tableView.estimatedSectionHeaderHeight = 0;
  142. _tableView.estimatedSectionFooterHeight = 0;
  143. _tableView.sectionFooterHeight = 0;
  144. _tableView.sectionHeaderHeight = 0;
  145. _tableView.estimatedRowHeight = 0;
  146. _tableView.delegate = self;
  147. _tableView.dataSource = self;
  148. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  149. _tableView.backgroundColor = [UIColor yhGrayColor];
  150. _tableView.bounces = YES;
  151. _tableView.showsVerticalScrollIndicator = NO;
  152. _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
  153. _tableView.separatorColor = [UIColor YHColorWithHex:0xEEEEEE];
  154. _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
  155. self.page ++;
  156. [self request];
  157. }];
  158. }
  159. return _tableView;
  160. }
  161. - (NSMutableArray *)dataArr {
  162. if (!_dataArr) {
  163. _dataArr = [NSMutableArray array];
  164. }
  165. return _dataArr;
  166. }
  167. - (void)didReceiveMemoryWarning {
  168. [super didReceiveMemoryWarning];
  169. // Dispose of any resources that can be recreated.
  170. }
  171. /*
  172. #pragma mark - Navigation
  173. // In a storyboard-based application, you will often want to do a little preparation before navigation
  174. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  175. // Get the new view controller using [segue destinationViewController].
  176. // Pass the selected object to the new view controller.
  177. }
  178. */
  179. @end