Files
mier_ios/SweetParty/主类/RCMic/Room/流水查询/SPRoomLiushuiVC.m

137 lines
4.1 KiB
Mathematica
Raw Permalink Normal View History

2025-08-11 10:43:19 +08:00
//
// SPRoomLiushuiVC.m
// SweetParty
//
// Created by bj_szd on 2022/6/15.
//
#import "SPRoomLiushuiVC.h"
#import "SPRoomLiushuiCell.h"
#import "SPLiushuiTimeAlert.h"
@interface SPRoomLiushuiVC ()
@property (weak, nonatomic) IBOutlet UIView *topBgView;
@property (weak, nonatomic) IBOutlet UILabel *dayLiushuiLab;
@property (weak, nonatomic) IBOutlet UILabel *weekLiushuiLab;
@property (nonatomic, strong) SPLiushuiTimeAlert *timeAlert;
@property (nonatomic, copy) NSString *startTime;
@property (nonatomic, copy) NSString *endTime;
@end
@implementation SPRoomLiushuiVC
- (void)viewDidLoad {
[super viewDidLoad];
[self showNaviBarWithTitle:@"流水查询"];
[self createUI];
[self fetchData];
}
- (void)fetchData {
NSDictionary *params = @{@"rid":C_string(self.roomId), @"page":@(self.page), @"page_limit":@(10), @"start_time":C_string(self.startTime), @"end_time":C_string(self.endTime)};
[AFNetworkRequset.shared postRequestWithParams:params Path:@"api/Suggest/get_room_money_log_list" Loading:YES Hud:NO Success:^(id _Nonnull responseDic) {
self.dayLiushuiLab.text = [responseDic[@"data"] safeStringForKey:@"today_money_log"];
self.weekLiushuiLab.text = [responseDic[@"data"] safeStringForKey:@"week_money_log"];
if (self.page == 1) {
[self.dataArray removeAllObjects];
[self.tableView reloadData];
}
[self endRefresh];
NSArray *arr = [SPRoomLiushuiModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
[self.dataArray addObjectsFromArray:arr];
[self.tableView reloadData];
if (arr.count > 0) {
[self endFooterRefreshWithMore];
}else {
[self endFooterRefreshWithNoMore];
}
if (self.dataArray.count <= 0) {
[self showNoContentView];
} else {
[self hideNoContentView];
}
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)refreshFetchData {
self.page = 1;
[self fetchData];
}
- (void)fetchMoreData {
self.page ++;
[self fetchData];
}
-(void)createUI {
// self.topBgView.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(ScreenWidth-14*2, 94) direction:FXGradientChangeDirectionHorizontal startColor:mainLightColor endColor:mainDeepColor];
[ControlCreator createButton:self.view rect:CGRectMake(ScreenWidth-30-12, yb_StatusBar_H+7, 30, 30) text:@"筛选" font:YBBoldFont(14) color:kWhiteColor backguoundColor:nil imageName:nil target:self action:@selector(onChooseTime)];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view).offset(yb_NavigationBar_H+110);
make.left.right.bottom.equalTo(self.view);
}];
[self.tableView registerNib:[UINib nibWithNibName:@"SPRoomLiushuiCell" bundle:nil] forCellReuseIdentifier:@"SPRoomLiushuiCell"];
self.tableView.rowHeight = 70;
[self showPullToRefresh];
[self showLoadMoreRefresh];
}
- (void)onChooseTime {
[self.view addSubview:self.timeAlert];
WEAK_SELF
self.timeAlert.onChooseTimeBlock = ^(NSString * _Nonnull start, NSString * _Nonnull end) {
weakSelf.startTime = start;
weakSelf.endTime = end;
[weakSelf refreshFetchData];
};
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
SPRoomLiushuiCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SPRoomLiushuiCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
SPRoomLiushuiModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
- (SPLiushuiTimeAlert *)timeAlert {
if (!_timeAlert) {
_timeAlert = [[NSBundle mainBundle] loadNibNamed:@"SPLiushuiTimeAlert" owner:self options:nil].firstObject;
_timeAlert.frame = [UIScreen mainScreen].bounds;
}
return _timeAlert;
}
@end