130 lines
4.7 KiB
Objective-C
130 lines
4.7 KiB
Objective-C
//
|
|
// QXFamilyPriceRecordViewController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/11/26.
|
|
//
|
|
|
|
#import "QXFamilyPriceRecordViewController.h"
|
|
#import "QXWalletDateView.h"
|
|
#import "QXFamilyPriceRecordCell.h"
|
|
#import "QXMineNetwork.h"
|
|
|
|
@interface QXFamilyPriceRecordViewController ()<QXWalletDateViewDelegate,UITableViewDelegate,UITableViewDataSource>
|
|
@property (nonatomic,strong)UIView *contentView;
|
|
@property (nonatomic,strong)UITableView *tableView;
|
|
@property (nonatomic,strong)QXWalletDateView *dateView;
|
|
|
|
@property (nonatomic,strong)NSString* startTime;
|
|
@property (nonatomic,strong)NSString* endTime;
|
|
@end
|
|
|
|
@implementation QXFamilyPriceRecordViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
[super viewWillAppear:animated];
|
|
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
|
}
|
|
-(void)setNavgationItems{
|
|
[super setNavgationItems];
|
|
self.navigationItem.title = QXText(@"总收益");
|
|
}
|
|
-(void)initSubViews{
|
|
self.page = 1;
|
|
UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, SCREEN_HEIGHT-NavContentHeight-12)];
|
|
[contentView addRoundedCornersWithRadius:16];
|
|
contentView.backgroundColor = RGB16(0xffffff);
|
|
self.contentView = contentView;
|
|
[self.view addSubview:contentView];
|
|
|
|
[contentView addSubview:self.dateView];
|
|
[contentView addSubview:self.tableView];
|
|
}
|
|
-(void)setUserId:(NSString *)userId{
|
|
_userId = userId;
|
|
self.page = 1;
|
|
[self getList];
|
|
}
|
|
-(void)getList{
|
|
__weak typeof(self) weakSelf = self;
|
|
[QXMineNetwork getFamilyEarningWithUserId:self.userId page:self.page start_time:self.startTime end_time:self.endTime successBlock:^(NSArray<QXFamilyEarningModel *> * _Nonnull list) {
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
if (!strongSelf) {
|
|
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
|
|
return;
|
|
}
|
|
if (strongSelf.page == 1) {
|
|
[strongSelf.dataArray removeAllObjects];
|
|
}
|
|
[strongSelf.dataArray addObjectsFromArray:list];
|
|
[strongSelf.tableView reloadData];
|
|
if (list.count == 0) {
|
|
strongSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
|
}else{
|
|
[strongSelf.tableView.mj_footer endRefreshing];
|
|
}
|
|
[strongSelf.tableView.mj_header endRefreshing];
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
if (strongSelf) {
|
|
[strongSelf.tableView.mj_header endRefreshing];
|
|
[strongSelf.tableView.mj_footer endRefreshing];
|
|
}
|
|
});
|
|
}];
|
|
//
|
|
// }];
|
|
}
|
|
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
|
return self.dataArray.count;
|
|
}
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
QXFamilyPriceRecordCell *cell = [QXFamilyPriceRecordCell cellWithTableView:tableView];
|
|
cell.model = self.dataArray[indexPath.row];
|
|
return cell;
|
|
}
|
|
#pragma mark - QXWalletDateViewDelegate
|
|
-(void)didSelectedStartDate:(NSString *)startDateString startDate:(NSDate *)startDate endDateString:(NSString *)endDateString endDate:(NSDate *)endDate{
|
|
QXLOG(@"开始时间-%@ 结束时间-%@",startDateString,endDateString);
|
|
self.startTime = startDateString;
|
|
self.endTime = endDateString;
|
|
self.page = 1;
|
|
[self getList];
|
|
}
|
|
|
|
|
|
-(QXWalletDateView *)dateView{
|
|
if (!_dateView) {
|
|
_dateView = [[QXWalletDateView alloc] initWithFrame:CGRectMake(12, 12, SCREEN_WIDTH-32-24, 38)];
|
|
_dateView.delegate = self;
|
|
}
|
|
return _dateView;
|
|
}
|
|
-(UITableView *)tableView{
|
|
if (!_tableView) {
|
|
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.dateView.bottom+10, SCREEN_WIDTH-32, self.contentView.height - self.dateView.bottom-10) style:(UITableViewStylePlain)];
|
|
_tableView.dataSource = self;
|
|
_tableView.delegate = self;
|
|
_tableView.backgroundColor = [UIColor whiteColor];
|
|
_tableView.tableFooterView = [UIView new];
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
_tableView.rowHeight = 107;
|
|
MJWeakSelf
|
|
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
|
weakSelf.page = 1;
|
|
[weakSelf getList];
|
|
}];
|
|
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
|
weakSelf.page++;
|
|
[weakSelf getList];
|
|
}];
|
|
}
|
|
return _tableView;
|
|
}
|
|
@end
|