123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- //
- // ZBEstimatedViewController.m
- // ZBProject
- //
- // Created by 学丽 on 2019/4/9.
- // Copyright © 2019 ZB. All rights reserved.
- //
- #import "ZBEstimatedViewController.h"
- #import "ZBIncomeMonthOrderListCell.h"
- @interface ZBEstimatedViewController ()<UITableViewDelegate,UITableViewDataSource>
- @property(nonatomic,strong)UITableView *tableViews;
- @property(nonatomic,strong)NSMutableArray *listArray;
- @property(nonatomic,strong)UILabel *titleL;
- @end
- @implementation ZBEstimatedViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initTableview];
- [self getMonthWithtype:self.types];
- }
- #pragma mark---每月预估
- -(void)getMonthWithtype:(NSString *)type
- {//预估1,结算2
- if (![AccountTool isLogin]) {
- return;
- }
- NSDictionary *dic =@{@"type":type};
- [LoadingView showInView:self.view];
- [ZBHTTP post:getEarnEveryMonthURL params:dic success:^(id _Nonnull json) {
- [LoadingView dismiss];
- NSArray *array =[NSArray yy_modelArrayWithClass:[ZBEarnModel class] json:json[@"all_month"]];
- [self.listArray removeAllObjects];
- [self.listArray addObjectsFromArray:array];
- if (self.types.integerValue == 1) {
- self.titleL.text=[NSString stringWithFormat:@"预估订单:%@ 收益:%@元",json[@"total_count"],json[@"total_rebate"]];
- }else{
- self.titleL.text=[NSString stringWithFormat:@"结算订单:%@ 收益:%@元",json[@"total_count"],json[@"total_rebate"]];
- }
- [self.tableViews reloadData];
- NSLog(@"%@",json);
- } failure:^(NSError * _Nonnull error) {
- [LoadingView dismiss];
- }];
- }
- -(void)initTableview
- {
- UIView *headV =[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
- headV.backgroundColor=[UIColor whiteColor];
-
- self.titleL =[[UILabel alloc]initWithFrame:CGRectMake(19, 0, 200, 50)];
- self.titleL.font=[UIFont systemFontOfSize:14];
- self.titleL.textColor=[UIColor YHColorWithHex:0x000000];
- self.titleL.text=@"预估订单:- 收益:---元";
- [headV addSubview:self.titleL];
-
-
-
- [self.view addSubview:self.tableViews];
- [self.tableViews mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
-
- make.bottom.mas_equalTo(self.view.mas_bottom);
- make.left.right.mas_equalTo(0);
-
- }];
- self.tableViews.tableHeaderView=headV;
- }
- #pragma mark---TableViewDelegate&&DataSource
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- ZBIncomeMonthOrderListCell *listC =[tableView dequeueReusableCellWithIdentifier:@"list"];
- if (!listC) {
- listC=[[ZBIncomeMonthOrderListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"list"];
- listC.selectionStyle=UITableViewCellSelectionStyleNone;
- }
- listC.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
- if (indexPath.row == self.listArray.count-1) {
- listC.lineV.hidden = YES;
- }else{
- listC.lineV.hidden=NO;
- }
- listC.yearLabel.hidden=NO;
- [listC.timeLabel mas_updateConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(25);
- make.top.mas_equalTo(5);
- }];
- listC.model = self.listArray[indexPath.row];
- return listC;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
-
- return self.listArray.count;
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- return 52;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- ZBIncomeViewController *incomV =[[ZBIncomeViewController alloc]init];
-
- ZBEarnModel *model=self.listArray[indexPath.row];
- incomV.isDay =0;//按月
- incomV.yearMonthDay=model.yearAndMonth;
- incomV.type=self.types;//1:预估收入 2:结算收入
- [self.navigationController pushViewController:incomV animated:YES];
- }
- -(UITableView *)tableViews
- {
- if (!_tableViews) {
- _tableViews =[[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) style:UITableViewStylePlain];
- _tableViews.delegate=self;
- _tableViews.dataSource=self;
- _tableViews.backgroundColor=[UIColor YHColorWithHex:0xF4F4F4];
- _tableViews.separatorStyle=UITableViewCellSeparatorStyleNone;
- _tableViews.sectionHeaderHeight=0;
- _tableViews.showsHorizontalScrollIndicator=NO;
- _tableViews.showsVerticalScrollIndicator=NO;
-
- }
- return _tableViews;
- }
- -(NSMutableArray *)listArray
- {
- if (!_listArray) {
- _listArray=[NSMutableArray array];
-
- }
- return _listArray;
- }
- #pragma mark---常见问题
- -(void)accclickBtn
- {
-
- }
- @end
|