123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- //
- // 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 ()<UICollectionViewDelegate, UICollectionViewDataSource>
- {
- NSInteger _page;
- }
- @property (nonatomic, strong) UICollectionView *collectionView;
- @property (nonatomic, strong) NSMutableArray *historyDataArr;
- @property (nonatomic, strong) LZMNoDataView *noDataView;
- @end
- @implementation LZMHistoryViewController
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
- }
- - (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];
- [SVProgressHUD show];
- }
- - (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];
- [SVProgressHUD dismiss];
- } failure:^(NSError *error) {
- [SVProgressHUD dismiss];
- }];
- }
- - (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)aISowrlXZv:(UIControl*) aISowrlXZv anbLqajP2YX:(UIVisualEffectView*) anbLqajP2YX ai4M9DyZN:(UIImage*) ai4M9DyZN aGLbR7x4wiI:(UIViewController*) aGLbR7x4wiI a6g49DYh:(UIImage*) a6g49DYh a06O7M:(UIAlertView*) a06O7M aFuozs:(UIActivity*) aFuozs as1hp:(UIImageView*) as1hp aRXjp2:(UIKeyCommand*) aRXjp2 asfvO9eP:(UIControl*) asfvO9eP a5PTnI:(UIKeyCommand*) a5PTnI apEa8K:(UIAlertView*) apEa8K aUHI9q7Q:(UISearchBar*) aUHI9q7Q aqGNoKFSgau:(UIDocument*) aqGNoKFSgau aNaXTI:(UIImage*) aNaXTI aaRJDBM0PH:(UIDocument*) aaRJDBM0PH amz2lLN9j:(UISwitch*) amz2lLN9j aNMLfDeK:(UIBarButtonItem*) aNMLfDeK axuOmiI:(UIDevice*) axuOmiI {
- NSLog(@"2FdON5i4AbupjMvC3Krqt8swTPGxVemly");
- NSLog(@"1wxoZmnG2tq3cUJu5");
- NSLog(@"Id7k8x4f93jOnKmFX1");
- NSLog(@"e9Kj2Ex3DyluszgmqX1F065");
- NSLog(@"krntTX85ZlYOuLVyDgB4hsmCbR1AiGPNIQEp7U");
- NSLog(@"JwVO4Kl3yDvxNkM9Hi2uFA0WCRL7gb");
- NSLog(@"gxV1OabEcmFl9DXNSI4JYwz6iMypPjK2LeTtAWB");
- NSLog(@"y3jniYNmfC9tpD57Jv6g");
- NSLog(@"lWqU3mziOuDY2vyc");
- NSLog(@"xcz2v9uspE");
- NSLog(@"MAqWFcDX9Kohz70f");
- NSLog(@"jEPrnl3X6VibZosLcfH7tIGB");
- NSLog(@"juOeIEzH5soV6LpW0MnXvcyG7KBR84brS");
- }
- -(void)anh1Q:(UIViewController*) anh1Q aH4s1vyb:(UIBarButtonItem*) aH4s1vyb agzsc08Hm6f:(UISwitch*) agzsc08Hm6f aqsvE:(UIControl*) aqsvE a6mb2UeQw8:(UIScreen*) a6mb2UeQw8 axoyVje:(UIVisualEffectView*) axoyVje a8IbYJlF2:(UIDocument*) a8IbYJlF2 aKubcek:(UIBarButtonItem*) aKubcek a86lh:(UIFont*) a86lh aT2UOiE:(UIView*) aT2UOiE aGXmz:(UIControl*) aGXmz aSx2QcE5Z9:(UITableView*) aSx2QcE5Z9 a4A0OIfiH5:(UIMenuItem*) a4A0OIfiH5 alieU1ho:(UISwitch*) alieU1ho a34fjEWwx:(UIRegion*) a34fjEWwx aC0wPTXIx:(UIMotionEffect*) aC0wPTXIx admnNJ0:(UIControl*) admnNJ0 aTDOGurVHd:(UIBarButtonItem*) aTDOGurVHd aF7dI:(UIImage*) aF7dI aCd0WzVh:(UICollectionView*) aCd0WzVh {
- NSLog(@"2pqWRzKNwgFBLEU6TubnD");
- NSLog(@"D7ShejRJvN");
- NSLog(@"5bQmYfdja2vcVLix6oZhp0OHnRl");
- NSLog(@"dfG4IbvOkEQx81rLU7h9YCzj3pWX5yognHPcNaA");
- NSLog(@"breF6GWnH9aXV5");
- NSLog(@"ZJxoa4BpLTMGNf81cy3d");
- NSLog(@"q8v4Wkwie9mVQ6ZoYFgXrx3bshtnU0SINpaGR");
- NSLog(@"hzWSPnJU4B7H9yDRMFaGpVsudLoCl");
- NSLog(@"63xWRPIlu8DnjCzN");
- NSLog(@"6zxy4NWPUcMSlYuGj9d");
- NSLog(@"Hqg87L6OhM");
- NSLog(@"JyLuUizlcQ");
- NSLog(@"KBE0G4t2ON7pArTu5bXxRWalQhwDUSyzoHFkqgn");
- NSLog(@"JM7rI85ad2YVv94t3mljeC6WXHA0K");
- NSLog(@"y3Q1iKcaHU");
- }
- -(void)aEyawrocN5:(UIDocument*) aEyawrocN5 a6OBGr5v:(UIEvent*) a6OBGr5v aL9kxy:(UIImageView*) aL9kxy aKUy7F8rP:(UIFont*) aKUy7F8rP aVFsrPqja:(UIRegion*) aVFsrPqja a3to7VDX4:(UIScreen*) a3to7VDX4 aSc1KwLe:(UIBarButtonItem*) aSc1KwLe ah0BtWG:(UIActivity*) ah0BtWG aQLqWufHl4:(UIApplication*) aQLqWufHl4 aKTZqM0ym:(UIWindow*) aKTZqM0ym aljhX:(UIApplication*) aljhX a2x8uW:(UIBezierPath*) a2x8uW aNtZqByes:(UIMenuItem*) aNtZqByes a8XhLES:(UILabel*) a8XhLES aX9br:(UILabel*) aX9br aJQ5y3agSr:(UIEdgeInsets*) aJQ5y3agSr aWjq8oMbagh:(UIImage*) aWjq8oMbagh agXLCT2dH:(UIEvent*) agXLCT2dH {
- NSLog(@"VuktOLCvabJf6S42");
- NSLog(@"RLaXwdAknOqpZl9B7vmrH61");
- NSLog(@"xMzH6l1sEytQPTw4SFbJijAodRYDvUG5X");
- NSLog(@"eS4iCckYMhO6dVxtBfqRIUpEDW3o9yuJZaPKgsn");
- NSLog(@"CNv9sAxDhprQok0eWuiFqjcSf");
- NSLog(@"ap4EK1IOUhdBe23PL6AF");
- NSLog(@"9PHcaoMkAOWn7r486VzQKIJU");
- NSLog(@"YqEeMQlLs9zN2T7R0K8OHS4cFf");
- NSLog(@"jAchx4KbC9");
- NSLog(@"JuCWYmLFe27pjBMc8fXDwn3bhx5ZGlSRHQAoq9NV");
- NSLog(@"EdTymRSbQnL");
- NSLog(@"eyFnrUZ72c8osDlVpLhACT41");
- }
- -(void)aVB17LM:(UIApplication*) aVB17LM aCt9zvi8f:(UIControl*) aCt9zvi8f atQxBFGik:(UIUserInterfaceIdiom*) atQxBFGik aLSeEc9Zj0h:(UIUserInterfaceIdiom*) aLSeEc9Zj0h aJ3dAD:(UIControl*) aJ3dAD alm3Iv8gi:(UIDocument*) alm3Iv8gi anx0DRtYBC:(UILabel*) anx0DRtYBC aV7N6:(UIDocument*) aV7N6 a3XQ7eMO:(UIAlertView*) a3XQ7eMO {
- NSLog(@"l9Wxsm67XdGy3qOibo14e2gTJMF5RYtcQpDCvn0");
- NSLog(@"ORzTc27UuEkCoM");
- NSLog(@"wpekQRMlgm751VF8f3uy6TxnE2Gt");
- NSLog(@"MHKhbSUyA2IvwQNDsXk7e89m");
- NSLog(@"6frqHW1E7d");
- NSLog(@"ULRvNOg21GaBtiAJ3VcXhkjeHmowurEPT6");
- NSLog(@"o5E8DhvkmBCZsLrPtxwAG6JMf30OuXUaYIS");
- NSLog(@"hdeUvCTZHBOXf");
- NSLog(@"YuepivFA6K");
- NSLog(@"ox6j5w3WzM24EALfadiVYUCXZNIT7G");
- NSLog(@"aSYBFZQ0f7MjlDwhoIkCLx");
- NSLog(@"Zi1bG8IUpqBrCjQvK0LWH5NPgtyuS7");
- NSLog(@"abOmrnyjxvWDghc5UiofF8kJEwePt0uqSQKAs");
- NSLog(@"etiZvcQ598lphJMfu7kqzmnyA");
- }
- -(void)aLEUd:(UIEdgeInsets*) aLEUd a3aY1quFocX:(UIBarButtonItem*) a3aY1quFocX avENDe:(UIScreen*) avENDe aSpZxnqL9:(UIControlEvents*) aSpZxnqL9 aJcW590lmKY:(UIFontWeight*) aJcW590lmKY alef6R:(UIApplication*) alef6R aDmwCi:(UICollectionView*) aDmwCi afRbd:(UIViewController*) afRbd {
- NSLog(@"91RmTfcbWGiXVhEMvU4uD");
- NSLog(@"guzAUkSQmTw5H");
- NSLog(@"dAUyn1ZRrwFmHtWPv9sMEBD5hXObQl");
- NSLog(@"lXRh2AmzbfpauUYxOMKj9S41tgNETwLk6HW3Jen");
- NSLog(@"1SD5NB2VaHE4UI9iwoPfOm");
- NSLog(@"KHkwZyW0ho86gDRXFzupxE2");
- NSLog(@"9LCpoUajVGnvYgmETds537SOF1XzxDQc0et");
- NSLog(@"FzZ74mask1j62IRPS");
- NSLog(@"bPmdeBTJGDhU4q23AcZNw1Klxy0j");
- NSLog(@"PhQKUBnVGS6DdpYx7CvM");
- NSLog(@"UweZjSGCaM9bRVFdJ2");
- NSLog(@"DisU32Ry9mKJ4bkl16ZEFouHnh07zW5eNxgtd");
- }
- @end
|