// // YOUPAIHRGuildDetailVC.m // VQU // // Created by xiaohaoran on 2021/11/5. // Copyright © 2021 MS. All rights reserved. // #import "YOUPAIHRGuildDetailVC.h" #import "JXCategoryView.h" #import "JXPagerView.h" #import "YOUPAIHRSubGuildDetailVC.h" #import "PGDatePickManager.h" #import "BRPickerView.h" #import "UIViewController+TFPresent.h" #import "YOUPAIHRDatePickerView.h" #define LZCategoryViewHeight 44.0f #define LZCategoryViewItemWidth 12.0f @interface YOUPAIHRGuildDetailVC () @property (nonatomic, weak) JXCategoryListContainerView *youpaippagerView; @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView; @property (strong, nonatomic) NSArray *youpaiptitlesArr; @property (nonatomic, strong) NSMutableArray *youpaipdotStates; @property(nonatomic,strong)NSString *youpaipdate; @property(nonatomic,copy)NSString *youpaipstarDate; @property(nonatomic,copy)NSString *youpaipendDate; @end @implementation YOUPAIHRGuildDetailVC - (void)viewDidLoad { [super viewDidLoad]; self.title = @"公会明细"; self.youpaiptitlesArr = @[@"全部",LCStr(word32),LCStr(word33)];//房间分成 公会分成 [self youpaifsetupUI]; } - (void)datePicker:(PGDatePicker *)datePicker didSelectDate:(NSDateComponents *)dateComponents{ NSLog(@"dateComponents = %@", dateComponents); NSInteger year=[dateComponents year]; NSInteger month=[dateComponents month]; self.youpaipdate = [NSString stringWithFormat:@"%ld-%ld",year,month]; [[NSNotificationCenter defaultCenter]postNotificationName:@"changSelectDate" object:nil userInfo:@{@"date":self.youpaipdate}]; } -(void)youpaiffilterAction{ YOUPAIHRDatePickerView *vc = [YOUPAIHRDatePickerView new]; vc.isTouchDismiss = YES; [self TFPresentVC:vc completion:^{ }]; @weakify(self); [vc setYoupaipselectDayDate:^(NSString * _Nonnull starTime, NSString * _Nonnull endTime) { @strongify(self); self.youpaipstarDate = [NSString stringWithFormat:@"%@ 00:00:00",starTime]; self.youpaipendDate = [NSString stringWithFormat:@"%@ 23:59:59",endTime]; NSLog(@"%@%@",self.youpaipstarDate,self.youpaipendDate); [[NSNotificationCenter defaultCenter]postNotificationName:@"changSelectDate" object:nil userInfo:@{@"starDate":self.youpaipstarDate,@"endDate":self.youpaipendDate,@"timeType":@"1"}]; }]; [vc setYoupaipselectMonthDate:^(NSString * _Nonnull date) { @strongify(self); self.youpaipstarDate = [LCTools getMonthFirstDayWithDate:[LCTools stringToDate:date :NO] format:@"YYYY-MM-dd HH:mm:ss"]; self.youpaipendDate = [LCTools getMonthLastDayWithDate:[LCTools stringToDate:date :NO] format:@"YYYY-MM-dd HH:mm:ss"]; NSLog(@"%@%@",self.youpaipstarDate,self.youpaipendDate); [[NSNotificationCenter defaultCenter]postNotificationName:@"changSelectDate" object:nil userInfo:@{@"starDate":self.youpaipstarDate,@"endDate":self.youpaipendDate,@"timeType":@"2"}]; }]; } -(void)youpaifsetupUI{ self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaiffilterAction) title:@"筛选" font:LCFont14 titleColor:HexColorFromRGB(0xffffff) highlightedColor:HexColorFromRGB(0xffffff) titleEdgeInsets:UIEdgeInsetsZero]; JXCategoryTitleView *youpaipcategoryView = [[JXCategoryTitleView alloc] init]; [self.view addSubview:youpaipcategoryView]; [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(NavBarHeight); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.height.mas_equalTo(LZCategoryViewHeight); }]; youpaipcategoryView.backgroundColor = LCBkgColor; youpaipcategoryView.titles = self.youpaiptitlesArr; youpaipcategoryView.delegate = self; youpaipcategoryView.titleSelectedColor = HexColorFromRGB(0xffffff); youpaipcategoryView.titleColor = HexColorFromRGB(0x9F9DA5); youpaipcategoryView.titleColorGradientEnabled = YES; youpaipcategoryView.titleFont = LCFont(14.0f); youpaipcategoryView.titleSelectedFont = LCBoldFont(14.0f); // youpaipcategoryView.cellWidth = 60; youpaipcategoryView.cellSpacing = 28.0f; youpaipcategoryView.contentEdgeInsetLeft = 105; youpaipcategoryView.contentEdgeInsetRight = 75; youpaipcategoryView.averageCellSpacingEnabled = YES; self.youpaipcategoryView = youpaipcategoryView; JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; lineView.verticalMargin = 4.0f; lineView.indicatorHeight = 2.5f; lineView.indicatorWidth = 8; lineView.layer.cornerRadius = 1.25; lineView.layer.masksToBounds = YES; [lineView.layer addSublayer:[LCTools getGradientLayerWithSize:CGSizeMake(lineView.indicatorWidth, lineView.indicatorHeight) twoColors:@[HexColorFromRGB(0xFF0084),HexColorFromRGB(0xFF3A00)] gradientType:GradientLeftToRight]]; youpaipcategoryView.indicators = @[lineView]; JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self]; pagerView.listCellBackgroundColor = LCBkgColor; [self.view addSubview:pagerView]; [pagerView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(youpaipcategoryView.mas_bottom).offset(0); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(-SafeHeight); }]; self.youpaippagerView = pagerView; self.youpaipcategoryView.listContainer = self.youpaippagerView; } // 返回列表的数量 - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView { return self.youpaiptitlesArr.count; } // 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例 - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { // 0:全部 1:收益 2:支出 3:其他 //收支:1=收入,2=支出,默认全部 NSArray *typeArr = @[@"0",@"1",@"2"]; YOUPAIHRSubGuildDetailVC *vc = [YOUPAIHRSubGuildDetailVC new]; vc.youpaiptype = [typeArr[index] integerValue]; return vc; } @end