线上所有马甲包模板,与《猎豆》同UI。域名zhuadd

HSQCommissionMainViewController.m 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. //
  2. // HSQCommissionMainViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "HSQCommissionMainViewController.h"
  9. #import "MLMSegmentHead.h"
  10. #import "MLMSegmentManager.h"
  11. #import "HSQOrderTableView.h"
  12. #import "HSQChildCommissionController.h"
  13. #import "HSQCommissionHeaderView.h"
  14. #import "HSQChildCommissionController.h"
  15. #import "HSQCalendarView.h"
  16. #import "CCAlertShowView.h"
  17. #import "TopTypeHeader.h"
  18. #import "TopTypeSegmentManager.h"
  19. #import "HSQCommissionHeaderModel.h"
  20. #import "HSQCommissionMainViewController.h"
  21. #import "HSQPrivilegeReferralViewController.h"
  22. @interface HSQCommissionMainViewController ()
  23. @property (nonatomic, strong) HSQOrderTableView *tableView;
  24. @property (nonatomic, strong) HSQCommissionHeaderView *headerView;
  25. @property (nonatomic, strong) TopTypeHeader *titleView;
  26. @property (nonatomic, strong) MLMSegmentScroll *segScroll;
  27. @property (nonatomic, strong) NSMutableArray *vcList;
  28. @property (nonatomic, assign) BOOL canScroll;
  29. @property (nonatomic, strong) HSQCalendarView *calendarView ;
  30. @property (nonatomic, strong) CCAlertShowView *alertShowView;
  31. @end
  32. @implementation HSQCommissionMainViewController
  33. - (void)dealloc {
  34. }
  35. - (void)viewWillDisappear:(BOOL)animated {
  36. [super viewWillDisappear:animated];
  37. [LoadingView dismiss];
  38. }
  39. - (void)viewDidLoad {
  40. [super viewDidLoad];
  41. [self configNavigationBar];
  42. [self loadTitleData];
  43. }
  44. -(void)viewWillAppear:(BOOL)animated{
  45. [super viewWillAppear:animated];
  46. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  47. }
  48. - (void)configNavigationBar {
  49. [self.navigationBar setNavTitle:@"订单明细"];
  50. self.navigationBar.backgroundColor = [UIColor changeColor];
  51. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  52. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  53. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  54. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  55. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  56. UIButton *calendar = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  57. [calendar setImage:[UIImage imageNamed:@"white_canlendar"] forState:UIControlStateNormal];
  58. [calendar addTarget:self action:@selector(showCalendar) forControlEvents:UIControlEventTouchUpInside];
  59. [self.navigationBar setCustomRightButtons:@[calendar]];
  60. self.view.backgroundColor = [UIColor backgroudColor];
  61. }
  62. - (void)backAction {
  63. [self.navigationController popViewControllerAnimated:YES];
  64. }
  65. - (void)showCalendar {
  66. if (self.alertShowView) {
  67. [self.alertShowView show];
  68. return;
  69. }
  70. CCAlertShowView *showView = [CCAlertShowView showAlertViewWithView:self.calendarView backgroundDismissEnable:YES];
  71. self.alertShowView = showView;
  72. [self.alertShowView show];
  73. }
  74. - (void)loadTitleData {
  75. NSString *url = [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/getOrderTop",BaseURL];
  76. [LoadingView show];
  77. [HSQHttp post:url params:nil success:^(id json) {
  78. [LoadingView dismiss];
  79. NSArray *arr = [NSArray yy_modelArrayWithClass:[HSQCommissionHeaderModel class] json:json[@"data"]];
  80. [self creatHeaderViewAndFooterView:arr];
  81. } failure:^(NSError *error) {
  82. }];
  83. }
  84. - (void)creatHeaderViewAndFooterView:(NSArray *)modelArr {
  85. NSMutableArray *titleArr = [NSMutableArray array];
  86. NSMutableArray *subTitles = [NSMutableArray array];
  87. for (int i = 0; i < modelArr.count; i++) {
  88. HSQCommissionHeaderModel *model = modelArr[i];
  89. HSQChildCommissionController *child = [[HSQChildCommissionController alloc] init];
  90. child.type = [model.type integerValue];
  91. [titleArr addObject:model.title];
  92. [subTitles addObject:model.count];
  93. [self.vcList addObject:child];
  94. }
  95. self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, NavBarHeight+70, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-70) vcOrViews:self.vcList];
  96. self.segScroll.bounces = NO;
  97. self.segScroll.loadAll = YES;
  98. self.titleView = [[TopTypeHeader alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, 70) titles:titleArr headStyle:TopTypeHeadStyleDefault layoutStyle:TopTypeLayoutDefault];
  99. self.titleView.headColor = [UIColor whiteColor];
  100. self.titleView.bottomLineHeight = 1;
  101. self.titleView.subTitles = subTitles;
  102. self.titleView.bottomLineColor = [UIColor yhGrayColor];
  103. self.titleView.fontScale = 1;
  104. self.titleView.fontSize = 14;
  105. self.titleView.equalSize = YES;
  106. self.titleView.showIndex = _showIndex;
  107. self.titleView.selectColor = [UIColor homeRedColor];
  108. self.titleView.deSelectColor = [UIColor YHColorWithHex:0x666666];
  109. [TopTypeSegmentManager associateHead:self.titleView withScroll:self.segScroll completion:^{
  110. [self.view addSubview:self.titleView];
  111. [self.view addSubview:self.segScroll];
  112. }];
  113. //取值(key值同名的时候会覆盖的)
  114. NSDictionary * userinfoDic =[HSQUserInfoManager shareManager].userInfoDic;
  115. if ([userinfoDic[@"user_level"] integerValue ] == 1) {//会员
  116. UIButton *accountBtn =[[UIButton alloc]initWithFrame:CGRectMake(0, FITSIZE(5)+NavBarHeight, SCREEN_WIDTH, FITSIZE(30))];
  117. [accountBtn setImage:[UIImage imageNamed:@"goto_detail"] forState:UIControlStateNormal];
  118. [accountBtn setImageEdgeInsets:UIEdgeInsetsMake(FITSIZE(7.5), SCREEN_WIDTH-FITSIZE(30), FITSIZE(7.5), FITSIZE(15))];
  119. accountBtn.backgroundColor =[UIColor whiteColor];
  120. [self.view addSubview:accountBtn];
  121. [accountBtn addTarget:self action:@selector(clickBtn) forControlEvents:UIControlEventTouchUpInside];
  122. UIImageView *imgv =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(15), FITSIZE(7.5), FITSIZE(15), FITSIZE(15))];
  123. imgv.image =[UIImage imageNamed:@"order_notice"];
  124. [accountBtn addSubview:imgv];
  125. UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(40), 0, FITSIZE(300), FITSIZE(30))];
  126. label.text=@"你还不是超级会员,成为超级会员就能购物有收益啦";
  127. label.textColor=[UIColor YHColorWithHex:0xFB6526];
  128. label.font=[UIFont systemFontOfSize:FITSIZE(12)];
  129. [accountBtn addSubview:label];
  130. label.tag = 1234;
  131. [self.view addSubview:accountBtn];
  132. self.segScroll.frame=CGRectMake(0, NavBarHeight+70+FITSIZE(40), SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-70-FITSIZE(40));
  133. self.titleView.frame=CGRectMake(0, NavBarHeight+FITSIZE(40), SCREEN_WIDTH, 70);
  134. }
  135. }
  136. -(void)clickBtn
  137. {
  138. HSQPrivilegeReferralViewController *Privilege = [[HSQPrivilegeReferralViewController alloc] init];
  139. [self.navigationController pushViewController:Privilege animated:YES];
  140. }
  141. #pragma mark ----- nofi -----
  142. //- (void)changeScrollStatus {
  143. // self.canScroll = YES;
  144. // for (HSQChildCommissionController *childVc in self.vcList) {
  145. // childVc.childCanScroll = NO;
  146. // }
  147. //}
  148. - (NSMutableArray *)vcList {
  149. if (!_vcList) {
  150. _vcList = [NSMutableArray array];
  151. }
  152. return _vcList;
  153. }
  154. - (HSQCalendarView *)calendarView {
  155. if (!_calendarView) {
  156. __weak typeof(self) weakSelf = self;
  157. _calendarView = [[HSQCalendarView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH-40, 0)];
  158. _calendarView.cancelBlock = ^{
  159. [weakSelf.alertShowView dismiss];
  160. };
  161. _calendarView.makeSureBlock = ^(NSString *dateStr) {
  162. for (HSQChildCommissionController *child in weakSelf.vcList) {
  163. [child refreshWithDate:dateStr];
  164. }
  165. [weakSelf.alertShowView dismiss];
  166. };
  167. }
  168. return _calendarView;
  169. }
  170. - (void)didReceiveMemoryWarning {
  171. [super didReceiveMemoryWarning];
  172. // Dispose of any resources that can be recreated.
  173. }
  174. /*
  175. #pragma mark - Navigation
  176. // In a storyboard-based application, you will often want to do a little preparation before navigation
  177. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  178. // Get the new view controller using [segue destinationViewController].
  179. // Pass the selected object to the new view controller.
  180. }
  181. */
  182. @end