// // LZMHistoryViewController.m // YouHuiProject // // Created by 小花 on 2018/6/11. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LZMHistoryViewController.h" #import "LZMGoodHorzitolCollectionCell.h" #import "LZMGoodDetailViewController.h" #import "LZMChildGoodModel.h" #import "LZMHistoryHeaderView.h" #import "LZMNoDataView.h" static NSString *KHorizontalCellId = @"KHorizontalCellId"; static NSString *KHeaderId = @"KHeaderId"; @interface LZMHistoryViewController () { NSInteger _page; } @property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) NSMutableArray *historyDataArr; @property (nonatomic, strong) LZMNoDataView *noDataView; @end @implementation LZMHistoryViewController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self configCollectionView]; [self requestData]; } - (void)configNavigationBar { _page = 1; [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]]; } - (void)backAction { [self.navigationController popViewControllerAnimated:YES]; } - (void)configCollectionView { _page = 1; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init]; self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) collectionViewLayout:flowLayout]; flowLayout.minimumInteritemSpacing = 2; [self.collectionView registerClass:[LZMGoodHorzitolCollectionCell class] forCellWithReuseIdentifier:KHorizontalCellId]; [self.collectionView registerClass:[LZMHistoryHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KHeaderId]; self.collectionView.backgroundColor = [UIColor whiteColor]; self.collectionView.showsVerticalScrollIndicator = NO; self.collectionView.delegate = self; self.collectionView.dataSource = self; self.collectionView.bounces = YES; // self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ // // }]; [self.view addSubview:self.collectionView]; [self.collectionView addSubview:self.noDataView]; } - (void)requestData { NSString *url = [NSString stringWithFormat:@"%@/api/v2/brower/recordList",BaseURL]; [LZMHttp post:url params:nil success:^(id json) { NSArray *array = json[@"data"]; for (NSArray *childArr in array) { NSArray *list = [NSArray yy_modelArrayWithClass:[LZMChildGoodModel class] json:childArr]; [self.historyDataArr addObject:list]; } [self setNoDataView]; [self.collectionView reloadData]; } failure:^(NSError *error) { }]; } - (void)setNoDataView { if (self.historyDataArr.count > 0) { NSArray *list = self.historyDataArr.firstObject; self.noDataView.hidden = list.count > 0; }else { self.noDataView.hidden = NO; } } #pragma mark ============ UICollectionView Delegate && DataSource ========== - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { NSArray *arr = self.historyDataArr[section]; return arr.count; } - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return self.historyDataArr.count; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(SCREEN_WIDTH, 140); } - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section { return 1; } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section { return CGSizeMake(SCREEN_WIDTH, 40); } - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section { return CGSizeMake(0, 0); } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row]; LZMGoodHorzitolCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KHorizontalCellId forIndexPath:indexPath]; cell.model = model; return cell; } - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ LZMHistoryHeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KHeaderId forIndexPath:indexPath]; LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row]; [header setDateWith:model.add_time]; return header; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init]; LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row]; DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithId:model.goods_id is_coupon:model.is_coupon coupon_price:model.coupon_price price:model.price discount_price:model.discount_price commission_rate:model.commission_rate coupon_start_time:model.coupon_start_time coupon_end_time:model.coupon_end_time]; detail.requestModel = requestModel; LZMEventModel *evevtModel = [[LZMEventModel alloc] initWithOrigin:@"0" category_id:@"0" source:collectAction]; detail.eventModel = evevtModel; [self.navigationController pushViewController:detail animated:YES]; } - (NSMutableArray *)historyDataArr { if (!_historyDataArr) { _historyDataArr = [NSMutableArray array]; } return _historyDataArr; } - (LZMNoDataView *)noDataView { if (!_noDataView) { _noDataView = [[LZMNoDataView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 264)]; _noDataView.hidden = YES; _noDataView.center = self.collectionView.center; } return _noDataView; } - (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. } */ -(void)a4cYwWX:(UIDevice*) a4cYwWX arnhKfOHL:(UIVisualEffectView*) arnhKfOHL a9JNkW:(UIBezierPath*) a9JNkW anip06GJT:(UIView*) anip06GJT a0p2jnZ9:(UIFont*) a0p2jnZ9 azHDjWQrP:(UIMotionEffect*) azHDjWQrP a80Wc5L4:(UIBarButtonItem*) a80Wc5L4 ayB4bos:(UIAlertView*) ayB4bos aM6Zj:(UIFont*) aM6Zj aYx9rC:(UILabel*) aYx9rC a2ws4YCj:(UIDevice*) a2ws4YCj aKRv3:(UIInputView*) aKRv3 { NSLog(@"Ez2Jc7hk48tDPpj5AoevnwHClsWYiTFrfG"); NSLog(@"YEWnxRKMSlHCiXI92Nfr7jB3t4VTmLdzAPFOU8G"); NSLog(@"bwzMnCiPTKYDJuc2sSeXQhgq1G"); NSLog(@"uICYFy1WPUJDMpgHGaBZ0L"); NSLog(@"0Jk4GHmaSMLA5ojf1QuZx9tsvpN"); NSLog(@"aLly1svZcpU"); NSLog(@"rQLBS0gtuvbOHP6eEAp9wKUWIJ4z8Vl1Nnd3Y"); NSLog(@"PqsSOLwuafH43zW7j5"); NSLog(@"QUDF3emPCycwE7hHdOvaxJAjSL2qWKYuRN"); NSLog(@"VIZ3dM7LAX12Yomhk94rcKWbBqR"); NSLog(@"NFdjbqm1lZueCU4BxgRry"); NSLog(@"hWyrEPBM62xGC8Yk5IAKZRlQ1izduVcDqs03f"); NSLog(@"a8U9RPbADznfKVBMqHWsFLmZJT1twGuxQ56"); NSLog(@"3ywLrN564vUBISCs0FEH"); NSLog(@"iLmlIKcWstEduHGpZ4gnz1vJBbTSqYNQFjM3R26"); NSLog(@"5VUgLMlsJAOd2th"); NSLog(@"093wvI6Fpagf5qlbYJWPiQy4LEoCUzhKHRuVTdM"); NSLog(@"dhoUgGxJk0QXL"); NSLog(@"YgxcowbZArFi3Vy8MPDuvQezTaHSJ2C95K"); NSLog(@"X7gznh1yPuj"); } -(void)am21ESrGR:(UIDevice*) am21ESrGR aPWOYNy:(UIViewController*) aPWOYNy a5QA7S1N:(UIViewController*) a5QA7S1N aBCuE:(UIEdgeInsets*) aBCuE ae76n9wCPL:(UILabel*) ae76n9wCPL aiV6Pk9rHEc:(UIButton*) aiV6Pk9rHEc aKeyN:(UIVisualEffectView*) aKeyN a9DMiaA2:(UICollectionView*) a9DMiaA2 aZNOgPMsYqE:(UIColor*) aZNOgPMsYqE aM9oyELS:(UIRegion*) aM9oyELS { NSLog(@"UlJLKORVcY"); NSLog(@"jCaQbW5TDtmIkS"); NSLog(@"0T1jmpyGURYKcN23BswlzbogCnF6AkvfueM"); NSLog(@"C9SpHFktNr"); NSLog(@"wKmhWdVsvAZf1GIuHSeoE4gqzyR5l0PCLrXcY"); NSLog(@"fnTD7Lkw2BXQ1F6voxeIYGcK"); NSLog(@"qA0KLId9cWeJyjCrxEVS"); NSLog(@"JyTU81jBAkVR3EKWuGm2f"); NSLog(@"OIYp5N41z3"); NSLog(@"DIVbAsSTG9wn5oQX"); NSLog(@"nqEXWkjAaRG2doe3YVPhw40JQsbugcyS"); NSLog(@"3bC4mWch5ae"); NSLog(@"KADrge6TfYuMPmcG8h5OECJxtRI2jUQoX"); NSLog(@"jGbwmH2uygfWEe5zrD9T6pvkJ0YiscBKd3"); NSLog(@"p6OLsj094HFRyzQTbZDwku7ae1r"); NSLog(@"BkIhe2r3iX6JKDqPYs0"); } -(void)afyA7Tj0:(UIWindow*) afyA7Tj0 a8wEFBeX6:(UIAlertView*) a8wEFBeX6 aPWRbByf:(UIMotionEffect*) aPWRbByf aSLbtJ:(UIControl*) aSLbtJ apeGlT:(UIEvent*) apeGlT apjRS:(UIActivity*) apjRS aFBkTrZOn:(UIApplication*) aFBkTrZOn aLWZVCnOtcv:(UIControlEvents*) aLWZVCnOtcv asd91:(UIControl*) asd91 aULt6MKEV:(UIColor*) aULt6MKEV aBSYMfJ9Amj:(UIMotionEffect*) aBSYMfJ9Amj ah504wn9:(UIWindow*) ah504wn9 agy3O9e4aN:(UIControlEvents*) agy3O9e4aN { NSLog(@"bkEjwCtXoB7fyYP15dK4Jia3gz9"); NSLog(@"HNsmaOlr2Yb7oAjyK3UzX4pP5ZWT"); NSLog(@"icD8UFBn61ueIRk0hLmqbgz3ywSCPs"); NSLog(@"UsHZGtgBSd"); NSLog(@"oiB7zuTjrSKO4cHXtW"); NSLog(@"ku2FSRetmGT7yrfhbJZBLdcCYDI3n8Ux6Xs"); NSLog(@"kiChwQa6dREVqJIfy2nvTWsxL95c8DjHbtON7"); NSLog(@"BQHUFrnPG5t6gp8wevuAEzoIfxZ73dChDLakM"); NSLog(@"vZFMQiV16j7KeJN5RG"); NSLog(@"dPxb9eRvz0UDiSVgknh3Mpw6FXJYI"); NSLog(@"PTYC4y0zruNvOHm8Us"); NSLog(@"QnDzSRox10a"); NSLog(@"30ZnbDugXEVwl1kBUmGLp85dRsovxTHChJiQzW"); NSLog(@"IdeuVOh8jkQ"); NSLog(@"3DRjhKNu4ZUYdBQAnJ"); NSLog(@"Ec71CVP63wOr4Qj"); } -(void)a5zFd7lEhU4:(UIFontWeight*) a5zFd7lEhU4 am16qVDTn:(UISwitch*) am16qVDTn aP80N5H:(UILabel*) aP80N5H akY9c5:(UIMenuItem*) akY9c5 arlVbxTnkd:(UIBezierPath*) arlVbxTnkd a5d9mUaVnSP:(UIBarButtonItem*) a5d9mUaVnSP a69LvJtcyOl:(UIControl*) a69LvJtcyOl an0cHZO:(UIBarButtonItem*) an0cHZO a9pK7nR:(UISearchBar*) a9pK7nR an21KDALTd:(UIInputView*) an21KDALTd aygXT2YZ:(UIEdgeInsets*) aygXT2YZ aF1Qr:(UIEdgeInsets*) aF1Qr alpI80RfGba:(UICollectionView*) alpI80RfGba a2wIi5:(UIColor*) a2wIi5 { NSLog(@"FcCUGb0rst3ZIg6mAQfqauXBoRL9pkMT"); NSLog(@"25RbVctgCKP3v6iZeFmI0hLjNJ"); NSLog(@"qT7Bwsl8xfeHgC9QD54LuIrbyht"); NSLog(@"09wcRVGNd4bvi"); NSLog(@"dP5u2ebFrAMQSn68RtKT7UGz"); NSLog(@"lkHELOK7VBmvu0iXqz2t9f"); NSLog(@"WX4NtjlickSqf538ILoFnD6QR"); NSLog(@"7fDIgsAVwCy8u"); NSLog(@"co3RkwuWDjMzHyaFEnGxsSrNKv8UL7hp0lmAXTY"); NSLog(@"ObE8xLh6v327X4peKJ"); NSLog(@"JPF9r4M1GLuqmwONtAdT3oc7VHs"); NSLog(@"iMtj2l7dGCKzFJa"); NSLog(@"BGMZXrTwRSyYJfLPHbvQFs"); NSLog(@"MJ2W4HjINR8kvFKuz"); NSLog(@"2NuqIzvoAs"); NSLog(@"Dod1sPVuBlAkhiw6YzZ"); NSLog(@"xTEK1c5MIdXWFvBmfYbS"); NSLog(@"hpEiMeyx5kQFDlctXSToH98CLdJzZB"); NSLog(@"wipaRqlhkKPDdtO6uXv8noBs4bcQFeGULA"); NSLog(@"F59ptNHkdP2SzDrWZso"); } -(void)aP03ySYQkm9:(UIImageView*) aP03ySYQkm9 atWyaRGpb:(UIScreen*) atWyaRGpb aNxiDq:(UIBezierPath*) aNxiDq aEQxWXfAN:(UIScreen*) aEQxWXfAN aRhB7nqoP:(UITableView*) aRhB7nqoP av4y50J8if:(UIVisualEffectView*) av4y50J8if aQpx3UDt:(UIBarButtonItem*) aQpx3UDt a9xVgR:(UIWindow*) a9xVgR abjRK58p:(UIScreen*) abjRK58p a5SlCb8c:(UIDevice*) a5SlCb8c { NSLog(@"5ol8YSEmXaCu2wVAWs3f1c0dBeR7NMkigrZFKI"); NSLog(@"WzRLmXCfGaEKqFcxynMh8D"); NSLog(@"cWjVNL9QeC5"); NSLog(@"ZHnywteXlSBd4E0"); NSLog(@"Msq2U1fWtyDoGgHiPBLIdYVvX"); NSLog(@"jF7aHq2bWm0ZRxDuA"); NSLog(@"CY75t9ly4n6MXi8OHcQW0kjpA"); NSLog(@"LaDb2p7oYFhP"); NSLog(@"IGYriJezVabpvUmOHhx"); NSLog(@"tZvUePNaqFIArJ"); NSLog(@"rWAHZ1GM9xLig7NJYl"); NSLog(@"CQKh5JgGX1jIEy30VPD4829AukYpU6SqiexN"); NSLog(@"iyZP2VHO5ocl1R"); NSLog(@"mz9AVe2xbcd3H6oLYy"); NSLog(@"tcphZsY1PnvUCy3j6rxAk9MWaB"); } -(void)ayRfWEkYv:(UIRegion*) ayRfWEkYv au2MjhU:(UIMenuItem*) au2MjhU aqNzMU8tyd2:(UIControl*) aqNzMU8tyd2 aWwgP1lyR:(UIWindow*) aWwgP1lyR a812mVv:(UIColor*) a812mVv a3x0Ar:(UIVisualEffectView*) a3x0Ar asc1nOK:(UIRegion*) asc1nOK acDiOFU:(UIView*) acDiOFU aTsnl1HPkbY:(UIUserInterfaceIdiom*) aTsnl1HPkbY aT5iH8e:(UIRegion*) aT5iH8e a7ZsH:(UIBarButtonItem*) a7ZsH akn8BN:(UIWindow*) akn8BN av0HjGIPnB2:(UIInputView*) av0HjGIPnB2 a2TcH6h:(UILabel*) a2TcH6h adFh9n73:(UIInputView*) adFh9n73 aS37Pkp:(UIViewController*) aS37Pkp { NSLog(@"CyaQKjdEcTGnbLMfp"); NSLog(@"nHxwfUN7d2ZoGyeamcOjv9LCS6JgRQziThlAM4"); NSLog(@"QShp2wBlv37Fqbj5E0JPHzfr1CWVTuZ4UR9cyNK8"); NSLog(@"Aq9xUbcRwXMNjPCHThF"); NSLog(@"mIeq97i0gZkyHdW8NjK3buTL"); NSLog(@"wg0ijGCfaLcMzNB7d"); NSLog(@"AS784hUaQl9PCVD3gefwJYcq"); NSLog(@"wGmLRa2ohX"); NSLog(@"ZIdXnmFBSriqYTjKUMg"); NSLog(@"IDfZhYUARX7Eret"); NSLog(@"D62fRu7Nenj5ZXyTmiW89S"); NSLog(@"6qV52MaPf3wjLHnm4pUhCIdDBxsRWGZ"); NSLog(@"QncLNrGoEmJdFhSTUR2zHeBiZxCI"); NSLog(@"XhyIL0N9gernTaJzo6GUCFWk7wpYP4EAMRmqx"); } -(void)aYBdhAG:(UIViewController*) aYBdhAG adwx0oV:(UIVisualEffectView*) adwx0oV afhpxZ6w3:(UIBarButtonItem*) afhpxZ6w3 aF0ijMr:(UISearchBar*) aF0ijMr aZ6Shzl:(UIBarButtonItem*) aZ6Shzl ajqM3Gor:(UIBezierPath*) ajqM3Gor { NSLog(@"ztqAnl4oFJXQcBID6eTu7UMdRyLZ9CO"); NSLog(@"PFKXHoLySUr3RIQA4l02qWnw8bDV6TtZ15Jxe"); NSLog(@"EiKu5oqVbmfj9gv68GeUwLMZrHPzksAnY0aSl"); NSLog(@"ZKrGftBecOanjqPVwbSTyQk42"); NSLog(@"8TtoUuOFqmsxJzMHWifkb1p6PQE3GBrje"); NSLog(@"RAGgHdNhr2ewLpublsDXqc8OBK9"); NSLog(@"4ShQGDnVyA85C"); NSLog(@"yjG1Ya4Ou8KoEJisTPQXcMR2HAp"); NSLog(@"ejItmLbfCHxkNZ"); NSLog(@"Xd3kQtPviZfxF12yNIL0ATpwJrqcEKolCaRn5zB"); } -(void)aUl182JikW:(UIDocument*) aUl182JikW aioJvBW:(UIDocument*) aioJvBW ab9K0j7ZaH:(UIMotionEffect*) ab9K0j7ZaH azvZAf4Y3:(UIFont*) azvZAf4Y3 aKC8lTQSo:(UIFont*) aKC8lTQSo adwjQz4:(UIBarButtonItem*) adwjQz4 aZfQ92:(UICollectionView*) aZfQ92 aHKc1:(UIBarButtonItem*) aHKc1 aFBYV:(UIWindow*) aFBYV aFdgZ0qRu2:(UIBarButtonItem*) aFdgZ0qRu2 aLYOVm1I:(UIBezierPath*) aLYOVm1I aMSoDq:(UICollectionView*) aMSoDq aB4IXidCo:(UISwitch*) aB4IXidCo { NSLog(@"F5ItO3KnaWGrx7RpUXM10YTwZfu"); NSLog(@"72DTrV1MpbmcIgK8ydkvwJ4AuEC"); NSLog(@"vQ3F02Wed8UGxoO7iuzawnXN"); NSLog(@"Fgy0jCMOhQrKWuU"); NSLog(@"zRuNxGWKoUi8SA0jsPhltL4M9FB1XO"); NSLog(@"jNOLkQF7WYM"); NSLog(@"IhEUWR6OkuTgSXCbDx7cdFwl"); NSLog(@"8EezPSchwogVnIlx5j"); NSLog(@"q4vPusUDVz3rpEA6HKS"); NSLog(@"VgfDu6KJRYylxir"); NSLog(@"42tjFUKV91plaqdgExvBJ7AmL"); NSLog(@"5PQV1EbJF0YtkNITx6GZzwLfg"); } @end