123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- //
- // HSQCommissionMainViewController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/18.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "HSQCommissionMainViewController.h"
- #import "MLMSegmentHead.h"
- #import "MLMSegmentManager.h"
- #import "HSQOrderTableView.h"
- #import "HSQChildCommissionController.h"
- #import "HSQCommissionHeaderView.h"
- #import "HSQChildCommissionController.h"
- #import "HSQCalendarView.h"
- #import "CCAlertShowView.h"
- #import "TopTypeHeader.h"
- #import "TopTypeSegmentManager.h"
- #import "HSQCommissionHeaderModel.h"
- #import "HSQCommissionMainViewController.h"
- #import "HSQPrivilegeReferralViewController.h"
- @interface HSQCommissionMainViewController ()
- @property (nonatomic, strong) HSQOrderTableView *tableView;
- @property (nonatomic, strong) HSQCommissionHeaderView *headerView;
- @property (nonatomic, strong) TopTypeHeader *titleView;
- @property (nonatomic, strong) MLMSegmentScroll *segScroll;
- @property (nonatomic, strong) NSMutableArray *vcList;
- @property (nonatomic, assign) BOOL canScroll;
- @property (nonatomic, strong) HSQCalendarView *calendarView ;
- @property (nonatomic, strong) CCAlertShowView *alertShowView;
- @end
- @implementation HSQCommissionMainViewController
- - (void)dealloc {
-
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- [LoadingView dismiss];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self configNavigationBar];
- [self loadTitleData];
- }
- -(void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
- }
- - (void)configNavigationBar {
- [self.navigationBar setNavTitle:@"订单明细"];
- self.navigationBar.backgroundColor = [UIColor changeColor];
- self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
- UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
- [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- [self.navigationBar setCustomLeftButtons:@[leftBtn]];
-
- UIButton *calendar = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [calendar setImage:[UIImage imageNamed:@"white_canlendar"] forState:UIControlStateNormal];
- [calendar addTarget:self action:@selector(showCalendar) forControlEvents:UIControlEventTouchUpInside];
- [self.navigationBar setCustomRightButtons:@[calendar]];
-
- self.view.backgroundColor = [UIColor backgroudColor];
- }
- - (void)backAction {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)showCalendar {
- if (self.alertShowView) {
- [self.alertShowView show];
- return;
- }
- CCAlertShowView *showView = [CCAlertShowView showAlertViewWithView:self.calendarView backgroundDismissEnable:YES];
- self.alertShowView = showView;
- [self.alertShowView show];
- }
- - (void)loadTitleData {
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/getOrderTop",BaseURL];
- [LoadingView show];
- [HSQHttp post:url params:nil success:^(id json) {
- [LoadingView dismiss];
- NSArray *arr = [NSArray yy_modelArrayWithClass:[HSQCommissionHeaderModel class] json:json[@"data"]];
- [self creatHeaderViewAndFooterView:arr];
-
- } failure:^(NSError *error) {
-
- }];
- }
- - (void)creatHeaderViewAndFooterView:(NSArray *)modelArr {
-
- NSMutableArray *titleArr = [NSMutableArray array];
- NSMutableArray *subTitles = [NSMutableArray array];
- for (int i = 0; i < modelArr.count; i++) {
-
- HSQCommissionHeaderModel *model = modelArr[i];
- HSQChildCommissionController *child = [[HSQChildCommissionController alloc] init];
- child.type = [model.type integerValue];
- [titleArr addObject:model.title];
- [subTitles addObject:model.count];
- [self.vcList addObject:child];
- }
-
-
-
- self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+70, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-70) vcOrViews:self.vcList];
- self.segScroll.bounces = NO;
- self.segScroll.loadAll = YES;
- self.titleView = [[TopTypeHeader alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 70) titles:titleArr headStyle:TopTypeHeadStyleDefault layoutStyle:TopTypeLayoutDefault];
- self.titleView.headColor = [UIColor whiteColor];
- self.titleView.bottomLineHeight = 1;
- self.titleView.subTitles = subTitles;
- self.titleView.bottomLineColor = [UIColor yhGrayColor];
- self.titleView.fontScale = 1;
- self.titleView.fontSize = 14;
- self.titleView.equalSize = YES;
- self.titleView.showIndex = _showIndex;
- self.titleView.selectColor = [UIColor homeRedColor];
- self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666];
- [TopTypeSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
- [self.view addSubview:self.titleView];
- [self.view addSubview:self.segScroll];
- }];
-
- //取值(key值同名的时候会覆盖的)
- NSDictionary * userinfoDic =[HSQUserInfoManager shareManager].userInfoDic;
- if ([userinfoDic[@"user_level"] integerValue ] == 1) {//会员
- UIButton *accountBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, FITSIZE(5)+NavBarHeight, SCREEN_WIDTH, FITSIZE(30))];
- [accountBtn setImage:[UIImage imageNamed:@"goto_detail"] forState:UIControlStateNormal];
- [accountBtn setImageEdgeInsets:UIEdgeInsetsMake(FITSIZE(7.5), SCREEN_WIDTH-FITSIZE(30), FITSIZE(7.5), FITSIZE(15))];
- accountBtn.backgroundColor =[UIColor whiteColor];
- [self.view addSubview:accountBtn];
- [accountBtn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
- UIImageView *imgv =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(15), FITSIZE(7.5), FITSIZE(15), FITSIZE(15))];
- imgv.image =[UIImage imageNamed:@"order_notice"];
- [accountBtn addSubview:imgv];
-
- UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(40), 0, FITSIZE(300), FITSIZE(30))];
- label.text=@"你还不是超级会员,成为超级会员就能购物有收益啦";
- label.textColor=[UIColor YHColorWithHex:0xFB6526];
- label.font=[UIFont systemFontOfSize:FITSIZE(12)];
- [accountBtn addSubview:label];
- label.tag = 1234;
- [self.view addSubview:accountBtn];
- self.segScroll.frame=CGRectMake(0, NavBarHeight+70+FITSIZE(40), SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-70-FITSIZE(40));
- self.titleView.frame=CGRectMake(0, NavBarHeight+FITSIZE(40), SCREEN_WIDTH, 70);
- }
-
- }
- -(void)clickBtn
- {
- HSQPrivilegeReferralViewController *Privilege = [[HSQPrivilegeReferralViewController alloc] init];
- [self.navigationController pushViewController:Privilege animated:YES];
- }
- #pragma mark ----- nofi -----
- //- (void)changeScrollStatus {
- // self.canScroll = YES;
- // for (HSQChildCommissionController *childVc in self.vcList) {
- // childVc.childCanScroll = NO;
- // }
- //}
- - (NSMutableArray *)vcList {
- if (!_vcList) {
- _vcList = [NSMutableArray array];
- }
- return _vcList;
- }
- - (HSQCalendarView *)calendarView {
- if (!_calendarView) {
- __weak typeof(self) weakSelf = self;
- _calendarView = [[HSQCalendarView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-40, 0)];
- _calendarView.cancelBlock = ^{
- [weakSelf.alertShowView dismiss];
- };
- _calendarView.makeSureBlock = ^(NSString *dateStr) {
-
- for (HSQChildCommissionController *child in weakSelf.vcList) {
- [child refreshWithDate:dateStr];
- }
-
- [weakSelf.alertShowView dismiss];
- };
- }
- return _calendarView;
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|