// // KDPEarnViewController.m // KuDianProject // // Created by 学丽 on 2019/7/4. // Copyright © 2019 KDP. All rights reserved. // #import "KDPEarnViewController.h" #import "KDPEarningHeadView.h" #import "KDPEarnTableHeadView.h" #import "KDPAccountVC.h" #import "KDPForecastVC.h" @interface KDPEarnViewController () @property(nonatomic,strong)NSDictionary *incomeDic; @property(nonatomic,strong)KDPEarningHeadView *headView; @property(nonatomic,strong)UITableView *tableView; @end @implementation KDPEarnViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor=[UIColor colorWithHexString:LineColor]; self.navBar.hidden=YES; [self.view addSubview:self.headView]; [self.headView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.right.left.mas_equalTo(0); make.height.mas_equalTo(196+KDStatusHeight); }]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.headView.mas_bottom).offset(-50); make.left.right.mas_equalTo(0); make.bottom.mas_equalTo(self.view.mas_bottom); }]; KDPEarnTableHeadView*headViews=[[KDPEarnTableHeadView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 390)]; headViews.accountBlock = ^{ KDPAccountVC *accountV=[[KDPAccountVC alloc]init]; [self.navigationController pushViewController:accountV animated:YES]; }; headViews.orderBlock = ^{ KDPOderDetailListVC *listV=[[KDPOderDetailListVC alloc]init]; [self.navigationController pushViewController:listV animated:YES]; }; self.tableView.tableHeaderView=headViews; [self IncomeAndOrderNumber]; } #pragma mark---IncomeData -(void)IncomeAndOrderNumber { [LoadingView show]; [KDPNetworkRequestHTTP postURL:IncomeDataURL params:nil success:^(id _Nonnull json) { NSLog(@"%@",json); _headView.orderNumgL.text=[NSString stringWithFormat:@"%ld",[json[@"order_num"]integerValue]]; _headView.Forecastlabel.text=[NSString stringWithFormat:@"%@",json[@"total_rebate"]];; } failure:^(NSError * _Nonnull error) { }]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"cell"]; if (!cell) { cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; } return cell; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 0; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 0; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 0; } #pragma mark---侧滑 -(void)drawerClickButton { KDPDrawerVC *vcFrame =[[KDPDrawerVC alloc]init]; CWLateralSlideConfiguration *con =[CWLateralSlideConfiguration defaultConfiguration]; con.distance=SCREEN_WIDTH/3*2; [self cw_showDrawerViewController:vcFrame animationType:0 configuration:con]; } -(KDPEarningHeadView *)headView { if (!_headView) { _headView=[[KDPEarningHeadView alloc]init]; _headView.userInteractionEnabled=YES; __weak KDPEarnViewController *weakself=self; _headView.forecastBlock = ^{ KDPForecastVC *foreV=[[KDPForecastVC alloc]init]; [weakself.navigationController pushViewController:foreV animated:YES]; }; _headView.drawcBlock = ^{ [self drawerClickButton]; }; } return _headView; } -(UITableView *)tableView { if (!_tableView ) { _tableView =[[UITableView alloc]init]; _tableView.delegate =self; _tableView.dataSource=self; _tableView.separatorStyle=UITableViewCellSeparatorStyleNone; _tableView.backgroundColor=[UIColor clearColor]; } return _tableView; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.tabBarController.tabBar.hidden=NO; } @end