BogoInviteWithDrawLogViewController.m 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // BogoVirsualDetailViewController.m
  3. // BuguLive
  4. //
  5. // Created by Mac on 2021/1/23.
  6. // Copyright © 2021 xfg. All rights reserved.
  7. //
  8. #import "BogoInviteWithDrawLogViewController.h"
  9. #import "BogoVirsualDetailListCell.h"
  10. #import "BogoWithDrawBindAlipayPopView.h"
  11. #import "BogoNetworkKit.h"
  12. #import "BogoShopKit.h"
  13. #import "BogoShopWithDrawListModel.h"
  14. @interface BogoInviteWithDrawLogViewController ()<UITableViewDelegate,UITableViewDataSource>
  15. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  16. @property(nonatomic, strong) NSMutableArray *dataArray;
  17. @property(nonatomic, assign) NSInteger page;
  18. @property(nonatomic, copy) NSString *time;//输入要查询的时间【格式:2021-04】
  19. @end
  20. @implementation BogoInviteWithDrawLogViewController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. // Do any additional setup after loading the view from its nib.
  24. self.title =ASLocalizedString( @"提现记录");
  25. [self.tableView registerNib:[UINib nibWithNibName:@"BogoVirsualDetailListCell" bundle:kShopKitBundle] forCellReuseIdentifier:@"BogoVirsualDetailListCell"];
  26. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
  27. self.tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
  28. NSDate *currentDate = [NSDate date];
  29. NSDateFormatter *formater = [[NSDateFormatter alloc]init];
  30. formater.dateFormat = @"yyyy-MM";
  31. self.time = [formater stringFromDate:currentDate];
  32. self.tableView.frame = CGRectMake(0, 0, kScreenW, kScreenHeight - kTopHeight);
  33. [self headerRefresh];
  34. }
  35. - (void)headerRefresh{
  36. _page = 1;
  37. [self requestData];
  38. }
  39. - (void)footerRefresh{
  40. _page ++;
  41. [self requestData];
  42. }
  43. - (void)comeBack{
  44. [self.navigationController popViewControllerAnimated:YES];
  45. }
  46. - (void)requestData{
  47. // /mapi/index.php?ctl=invite_vue&act=recode_new&uid=165999&page=1
  48. [[BogoNetwork shareInstance] POSTV3:@"" param:@{@"act":@"recode_new",@"ctl":@"invite_vue",@"":@(self.page)} success:^(BogoNetworkResponseModel * _Nonnull responseObject) {
  49. if (self.page == 1) {
  50. [self.dataArray removeAllObjects];
  51. }
  52. NSArray *dataArray = (NSArray *)responseObject.data;
  53. for (NSDictionary *dict in responseObject.data) {
  54. BogoShopWithDrawListModel *model = [BogoShopWithDrawListModel mj_objectWithKeyValues:dict];
  55. [self.dataArray addObject:model];
  56. }
  57. [self.tableView reloadData];
  58. [self.tableView.mj_header endRefreshing];
  59. if (dataArray.count < 20) {
  60. [self.tableView.mj_footer endRefreshingWithNoMoreData];
  61. }else{
  62. [self.tableView.mj_footer endRefreshing];
  63. }
  64. } failure:^(NSString * _Nonnull error) {
  65. [[BGHUDHelper sharedInstance] tipMessage:error];
  66. [self.tableView.mj_header endRefreshing];
  67. [self.tableView.mj_footer endRefreshing];
  68. }];
  69. }
  70. #pragma mark - UITableViewDelegate,UITableViewDataSource
  71. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  72. return self.dataArray.count;
  73. }
  74. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  75. BogoVirsualDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BogoVirsualDetailListCell" forIndexPath:indexPath];
  76. if (indexPath.row < self.dataArray.count) {
  77. // cell.type = self.type;
  78. cell.model = self.dataArray[indexPath.row];
  79. }
  80. return cell;
  81. }
  82. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  83. return 65;
  84. }
  85. - (NSMutableArray *)dataArray{
  86. if (!_dataArray) {
  87. _dataArray = [NSMutableArray array];
  88. }
  89. return _dataArray;
  90. }
  91. @end