123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- //
- // KDPForecastOrderListVC.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/8.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPForecastOrderListVC.h"
- #import "KDPForecastOrderCell.h"
- @interface KDPForecastOrderListVC ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetDelegate,DZNEmptyDataSetSource>
- {
- UILabel *_orderLabel;
-
- NSInteger page_num;
- }
- @property(nonatomic,strong)UITableView *forecastView;
- @property(nonatomic,strong)NSMutableArray *dataArray;
- @end
- @implementation KDPForecastOrderListVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self setNavUI];
- page_num = 1;
- }
- -(void)setNavUI
- {
- self.view.backgroundColor=[UIColor whiteColor];
- [self.navBar addleftReturnButton:self selector:@selector(returnClickBtn)];
- self.navBar.navTitleLabel.text=[NSString stringWithFormat:@"%@月预估收益",self.yearMonthDay];
-
- [self.view addSubview:self.forecastView];
- [self getMonthOrderList];
- }
- -(void)getMonthOrderList
- {
- [LoadingView show];
- NSDictionary *param=@{@"page":@(page_num),@"yearMonthDay":self.yearMonthDay,@"type":@"1",@"isDay":self.isDay};
- [KDPNetworkRequestHTTP postURL:foreastDetailURL params:param success:^(id _Nonnull json) {
- NSArray *array=[NSArray yy_modelArrayWithClass:[KDPOrderModel class] json:json[@"data"]];
- if (page_num == 1) {
- self.dataArray=[NSMutableArray array];
-
- }
-
- [self.forecastView.mj_header endRefreshing];
- [self.forecastView.mj_footer endRefreshing];
- if (array.count == 0) {
- [self.forecastView.mj_footer endRefreshingWithNoMoreData];
- }
- _orderLabel.text=[NSString stringWithFormat:@"%@ 订单:%@ 收益:%@",self.yearMonthDay,json[@"num"],json[@"allRebate"]];
- [self.dataArray addObjectsFromArray:array];
- [self.forecastView reloadData];
- [LoadingView dismiss];
- } failure:^(NSError * _Nonnull error) {
- [LoadingView dismiss];
- }];
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- KDPForecastOrderCell *listC=[tableView dequeueReusableCellWithIdentifier:@"foreorder"];
- if (!listC) {
- listC=[[KDPForecastOrderCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"foreorder"];
- listC.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- listC.model=self.dataArray[indexPath.row];
- return listC;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return self.dataArray.count;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 110;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView{
- return [UIImage imageNamed:@"no_order"];
- }
- - (BOOL)emptyDataSetShouldAllowScroll:(UIScrollView *)scrollView{
- return YES;
- }
- - (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView{
- return [[NSAttributedString alloc] initWithString:@"还没有记录" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:0x333333],NSFontAttributeName:FONT_SYS(12)}];
- }
- - (CGFloat )spaceHeightForEmptyDataSet:(UIScrollView *)scrollView{
- return 30;
- }
- -(void)returnClickBtn
- {
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- self.navigationController.navigationBar.hidden=YES;
- self.tabBarController.tabBar.hidden=YES;
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- self.tabBarController.tabBar.hidden=NO;
- }
- -(UITableView *)forecastView
- {
- if (!_forecastView) {
- _forecastView=[[UITableView alloc]initWithFrame:CGRectMake(0, KDNavBarHeight, SCREEN_WIDTH, self.view.height-KDNavBarHeight)];
- _forecastView.backgroundColor=[UIColor clearColor];
- _forecastView.separatorStyle=UITableViewCellSeparatorStyleNone;
- _forecastView.delegate=self;
- _forecastView.dataSource=self;
- _forecastView.showsVerticalScrollIndicator=NO;
- _forecastView.mj_header=[MJRefreshNormalHeader headerWithRefreshingBlock:^{
- page_num = 1;
- [self getMonthOrderList];
- }];
- if (@available(iOS 11.0, *)) {
- _forecastView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- } else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- _forecastView.emptyDataSetDelegate = self;
- _forecastView.emptyDataSetSource = self;
- _forecastView.mj_footer=[MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
- page_num++;
- [self getMonthOrderList];
- }];
- [self addtabheader];
- }
- return _forecastView;
- }
- -(void)addtabheader
- {
- UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 46)];
- backV.backgroundColor=[UIColor clearColor];
- self.forecastView.tableHeaderView=backV;
-
- _orderLabel=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, SCREEN_WIDTH-30, 41)];
- _orderLabel.text=@"----- 订单:-- 收益:---元";
- _orderLabel.font=[UIFont systemFontOfSize:14];
- _orderLabel.textColor=[UIColor blackColor];
- [backV addSubview:_orderLabel];
-
- UIView *lineV=[[UIView alloc]initWithFrame:CGRectMake(10, 41, SCREEN_WIDTH-20, 5)];
- lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
- [backV addSubview:lineV];
- }
- -(NSMutableArray *)dataArray
- {
- if (!_dataArray) {
- _dataArray=[NSMutableArray array];
- }
- return _dataArray;
- }
- @end
|