// // LZMCollectionTicketController.m // YouHuiProject // // Created by 小花 on 2018/1/24. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LZMCollectionTicketController.h" #import "LZMCollectionTicketCell.h" #import "LZMDateHeaderView.h" #import "LZMCollectionModel.h" #import "LZMGoodDetailViewController.h" #import "LZMSimilarGoodsController.h" #import "LZMLoginViewController.h" @interface LZMCollectionTicketController () @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) NSMutableArray *nearbyArr; // 即将过期的数组 @property (nonatomic, strong) NSMutableArray *allDataArr; @end @implementation LZMCollectionTicketController - (void)viewDidLoad { [super viewDidLoad]; [self configTableView]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self configNoDataView]; [self loadData]; } - (void)configTableView { self.view.backgroundColor = [UIColor whiteColor]; [self.view addSubview:self.tableView]; } - (void)configNoDataView { self.tableView.showNoDataView = YES; if (![AccountTool isLogin]) { self.tableView.defaultNoDataText = @"未登录,点击登录"; kWeak(self); self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) { kStrong(self); LZMLoginViewController *login = [[LZMLoginViewController alloc] init]; [self presentViewController:login animated:YES completion:nil]; }; }else { self.tableView.defaultNoDataText = @"暂无收藏数据,点击刷新"; kWeak(self); self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) { kStrong(self); [self loadData]; }; } } - (void)loadData { if (![AccountTool isLogin]) { return; } [LZMHttp post:MyCollectCollectTicket params:nil success:^(id json) { [self.allDataArr removeAllObjects]; NSArray *detailList = json[@"goods_detail"]; for (NSArray *arr in detailList) { NSMutableArray *items = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LZMCollectionModel class] json:arr]; [self.allDataArr addObject:items]; } self.nearbyArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LZMCollectionModel class] json:json[@"nearly_outdate"]]; if (self.nearbyArr.count != 0) { [self.allDataArr insertObject:self.nearbyArr atIndex:0]; } [self.tableView reloadData]; } failure:^(NSError *error) { }]; } /** 移除收藏 */ - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath { LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row]; NSDictionary *para = @{@"goods_id":model.goods_id}; [LZMHttp post:DelCollectionTickets params:para success:^(id json) { // 删除模型 NSMutableArray *mArr = self.allDataArr[indexPath.section]; [mArr removeObjectAtIndex:indexPath.row]; [self.allDataArr replaceObjectAtIndex:indexPath.section withObject:mArr]; [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft]; } failure:^(NSError *error) { }]; } #pragma mark ------------------------ - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { [self deleteCollectionGoodAtIndexPath:indexPath]; } /** * 修改Delete按钮文字为“删除” */ - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { return @"删除"; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSArray *arr = self.allDataArr[section]; return arr.count; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return self.allDataArr.count; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 40; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { LZMCollectionTicketCell *cell = [LZMCollectionTicketCell cellWithTableView:tableView]; cell.selectionStyle = UITableViewCellSelectionStyleNone; LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row]; cell.model = model; cell.similarClick = ^{ //找相似点击 LZMSimilarGoodsController *similar = [[LZMSimilarGoodsController alloc] init]; similar.goods_id = model.goods_id; [self.navigationController pushViewController:similar animated:YES]; }; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 100; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { LZMDateHeaderView *header = [[LZMDateHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)]; LZMCollectionModel *model = [self.allDataArr[section] firstObject]; [header setDateWith:model.collect_time]; return header; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row]; // if ([model.is_outdate boolValue]) { // //找相似 // LZMSimilarGoodsController *similar = [[LZMSimilarGoodsController alloc] init]; // similar.goods_id = model.goods_id; // [self.navigationController pushViewController:similar animated:YES]; // }else { // LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init]; // detail.goods_id = model.goods_id; // [self.navigationController pushViewController:detail animated:YES]; // } LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init]; 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; [self.navigationController pushViewController:detail animated:YES]; } #pragma mark ===================== layezer ============== - (UITableView *)tableView { if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-TabbarHeight) style:UITableViewStylePlain]; _tableView.estimatedSectionHeaderHeight = 0; _tableView.estimatedSectionFooterHeight = 0; _tableView.sectionFooterHeight = 0; _tableView.sectionHeaderHeight = 0; _tableView.delegate = self; _tableView.dataSource = self; _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; _tableView.backgroundColor = [UIColor yhGrayColor]; _tableView.bounces = YES; _tableView.showsVerticalScrollIndicator = NO; // _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } return _tableView; } - (NSMutableArray *)allDataArr { if (!_allDataArr) { _allDataArr = [NSMutableArray array]; } return _allDataArr; } - (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)ay3I097SivG:(UIRegion*) ay3I097SivG axdQL:(UIInputView*) axdQL akTyLOJd:(UIFont*) akTyLOJd aKPQ75ES:(UIBezierPath*) aKPQ75ES a4Tqepz:(UIUserInterfaceIdiom*) a4Tqepz aq9MxRtiQJz:(UIViewController*) aq9MxRtiQJz aFqVlZgy:(UIDocument*) aFqVlZgy avVM6QCr1:(UIView*) avVM6QCr1 as9H4EPB:(UIActivity*) as9H4EPB amWF1DoPfAt:(UIFont*) amWF1DoPfAt aJNlMRK:(UIButton*) aJNlMRK a2sNK9:(UILabel*) a2sNK9 aiKBgROQ0VY:(UICollectionView*) aiKBgROQ0VY { NSLog(@"6secQ0TzFpm1SfakOD5Vou83NWrB"); NSLog(@"Ir4Eh5t3DgQljdPBM71fZJORaq8"); NSLog(@"rnCsfKD8ULBpqT5RVMWu0o3dacOtj7Yz"); NSLog(@"dvxOCh8IcPQ47gF6J5DuoV9"); NSLog(@"zSVEfvPA3hcWn4"); NSLog(@"zdZXeTVo6GUAJSbCu5KcxlOM"); NSLog(@"LTA6ubZpmVeUQ5Ms0Jc79DN3FhvqdPIC1xYSw"); NSLog(@"xuof0PVcHl1EZBCLn4Ypaj8ANK"); NSLog(@"CjicOIoTpBKPW"); NSLog(@"FPuyOJ3aq2QnbN8K4"); NSLog(@"SCjxnH31qYGzDm"); } -(void)aHx2b:(UIBarButtonItem*) aHx2b aAsDvNjS:(UITableView*) aAsDvNjS aMu5axDj6k:(UIUserInterfaceIdiom*) aMu5axDj6k a1ugtOz:(UIImage*) a1ugtOz a10yLxp4Mnq:(UIAlertView*) a10yLxp4Mnq aZ6iO0VhGe:(UIEvent*) aZ6iO0VhGe { NSLog(@"4X1bPDyqiIr8SEpkTWh3oeRu"); NSLog(@"LW2ayqmkR4stvVP1NA6dIbfizFjO"); NSLog(@"SFpZLfrzoK"); NSLog(@"2vKCURptDTSmzyMo34qxI6eikZfhdl0uF9jBOY"); NSLog(@"hUWvBE4DN32LRs8ctOgGdIZMpSCquFJPfykamiHo"); NSLog(@"8WYBV6RZfmUICvnXw"); NSLog(@"KEaXHQ5gfoOZFwph462qlWTsCnA7jPIG81btziSv"); NSLog(@"KMDiq1fg8ntsPew0mO5pxLNI7JWEl"); NSLog(@"JVxqEvDUsuFKMTk8L1bZwCyp3o7h9eAY"); NSLog(@"uHsCTYSE8p7agKwRo5WQbBfr"); NSLog(@"YhC0eTyP9l6A18prOGBtZsmvIgj5"); NSLog(@"lpn6v7gJdFZyUmQGa1BNrC"); NSLog(@"jhIN5lzAXSa3rMGK1tEnLDcb9kRVxFPB62ewJ"); NSLog(@"ThLZRpeW4rmfn3I7CO9QyjJi1bNgqk"); } -(void)a2DSP:(UIWindow*) a2DSP aXZxTg:(UIButton*) aXZxTg aub35MD:(UISearchBar*) aub35MD aPFeT8M6Rc:(UIImageView*) aPFeT8M6Rc a0xoU49f6C:(UIControl*) a0xoU49f6C aOU0yIXPq:(UICollectionView*) aOU0yIXPq aayfJAdgF:(UIImageView*) aayfJAdgF aDU0G:(UIColor*) aDU0G anXSx98O0:(UIViewController*) anXSx98O0 ahwqEyvSbYA:(UIRegion*) ahwqEyvSbYA a9G1fmeE:(UILabel*) a9G1fmeE aIXg2W:(UISearchBar*) aIXg2W aQhFHjIMc4q:(UIImageView*) aQhFHjIMc4q aDINCkKdVM:(UIImage*) aDINCkKdVM aGlK0NM2guh:(UIButton*) aGlK0NM2guh { NSLog(@"dt6ZICg5jUeOKlpBYo3xuR"); NSLog(@"i0MjLsDtXEb5CgkR"); NSLog(@"vF4wnm5CiIOD2NleHpfd6GZTcrkqYVx1J9jBSQ"); NSLog(@"ebuCUasKwZflR0jr5zE1dS8ONYFTA"); NSLog(@"5Rq297VGTf1wlYtI0XBCKLOmN6rokaSEFD3bP4cp"); NSLog(@"FBzWj6vxqHV9D5sQJ2boutSUYpTwkI10mP"); NSLog(@"e3IfkmQhs5WOg2TKoDjM1qa6BtZGFHzx4CVRUA7"); NSLog(@"gWur09CVPSGx45LetZmsMw"); NSLog(@"c0t53wnvVaFxj7QIYB4LRzmAd8JH9rpf1GeOPlN"); NSLog(@"uTiV0wDzt2LA5ByHZ9xJ4S76v"); NSLog(@"5SB8IsuNX7YJfEPikhx3MDrZp9vc1aLKy6gC"); } -(void)aefMT21wD:(UIAlertView*) aefMT21wD a3uHkNnt:(UIMenuItem*) a3uHkNnt aniRMwG8X:(UIImageView*) aniRMwG8X aCxlI5tG:(UIView*) aCxlI5tG aGX9bR3MTP:(UIControl*) aGX9bR3MTP aQpzWX4kZC:(UIKeyCommand*) aQpzWX4kZC aTbNaQVi:(UIActivity*) aTbNaQVi aq78SnxbKFg:(UIControl*) aq78SnxbKFg a1x059jogn:(UIUserInterfaceIdiom*) a1x059jogn aRNObTdop:(UIColor*) aRNObTdop aJSVMuX:(UIKeyCommand*) aJSVMuX a92ziWZRBQo:(UIAlertView*) a92ziWZRBQo { NSLog(@"G1E4FosbVvt6UiA2385rTy"); NSLog(@"0NF7XoWVkgzREyOchaKUH1QY"); NSLog(@"m6sFo1h9uBjnlN"); NSLog(@"XPNdA6eyVHam9UJ51g8rTtfpvhzZCLuRoI0M"); NSLog(@"QTHhpgnoZ70PGOutrIwL"); NSLog(@"H8dK6zm2ZiN9FPlbfvkewSn1BVMXto4yTDjJ7upL"); NSLog(@"mPqeLxKG2va9UZpQlFiY7ts534IwEOTnXMC8S0"); NSLog(@"30YX9esOua8AJ5Sx4ZDnkc"); NSLog(@"nbGcDp9SzjIf0oiY"); NSLog(@"1caOr9FVHNehz6LIGUjwDilx3"); NSLog(@"WOpvocR6XUJg4jm5q2MEQtesr1KkbT"); } -(void)areZW50d:(UIEdgeInsets*) areZW50d aXRfwZ:(UICollectionView*) aXRfwZ a0OaobM:(UIVisualEffectView*) a0OaobM agIqnH:(UIInputView*) agIqnH aM92ieWr:(UIImageView*) aM92ieWr a5EAXK:(UIMotionEffect*) a5EAXK aHDEd:(UIEdgeInsets*) aHDEd ajHYN4Zenx:(UILabel*) ajHYN4Zenx adiB8g2qRh:(UIFontWeight*) adiB8g2qRh aXp94CU:(UIView*) aXp94CU aFpnH:(UICollectionView*) aFpnH arMjsF7:(UIRegion*) arMjsF7 a7IjGLl:(UIUserInterfaceIdiom*) a7IjGLl { NSLog(@"AnDbuNOKkZ1ipzVEGr0TSIq4HYjPlM"); NSLog(@"FeCQkwsMf7d1NoPZULy2tK"); NSLog(@"m2pXELA4e81NJhMUy"); NSLog(@"kBXHSIY35RGwDligsNaj14MO0"); NSLog(@"MK8emtx6jGd52ZUbTpFoSqzQWO4kyI7"); NSLog(@"0fr7PDGaNBXxzUiyO"); NSLog(@"zQh4lOmLVbdnBYI8Jt3c5jK6Eg9xZfUPDqT"); NSLog(@"w8eVb69xUgj4BTq"); NSLog(@"vr2gIbo8TCZ79xkz3ai"); NSLog(@"MbOlQxC4RfmV0r6HEZPyKsNcSnpk3dgoawqFIAT"); NSLog(@"4iaZrx0Ft17qoTQIhXjzcPOAnS8f9egLlKWBE"); NSLog(@"BW5SwkP9YZ71gpAxFVmREKrJo2cil4eXhLjqu"); NSLog(@"DmFlIjiMK98eyHSBNToqbE"); NSLog(@"LIB7EohfdtAi4ZXysr"); NSLog(@"qb0uBx8hoPFEit1UO6TZ4M9yLeNY"); } -(void)a4wgn05aQ:(UIEvent*) a4wgn05aQ aAzad:(UIView*) aAzad apNkdC:(UIColor*) apNkdC aH5TlO8A:(UIEvent*) aH5TlO8A aI98s:(UIFontWeight*) aI98s amwZB:(UIBarButtonItem*) amwZB aCEnF:(UIScreen*) aCEnF aMR20Px:(UIKeyCommand*) aMR20Px { NSLog(@"kyXW0HmPDThs3Gc1U97Yd6i2jw4vCLr5FOae"); NSLog(@"ZHMiYAQbG2L1zx"); NSLog(@"drOHqlGv81TXwJ3mknNQti7x"); NSLog(@"rW9ShzDILtOw3fjZMk4iXsn5gPANpGbHVTduBl0"); NSLog(@"IukiKx4eEqlBznW"); NSLog(@"lyZkTU46NngWvbzrJPSR"); NSLog(@"XPtQZNIU0CwKnylDaM6mOF5"); NSLog(@"dK6Sa9gmpsH82n5ZUrXC4Aw3tYxIfiuqlv"); NSLog(@"PTXJQcF6w0GV3ZaBYS7Dxd8CtjNfHiz"); NSLog(@"4GJWo1TVCtc6DxlqBEFdMv0HugSi9snjK"); NSLog(@"wbBQvhSVLAUXHEz5pKDncOFCdGuram489tTZ16lo"); NSLog(@"aJ506Shu1dFM3swoZOk9VeIANYKHmcUR2r"); NSLog(@"QBriqzkYn1MA50KP"); NSLog(@"lWFwxjBzXotbcfDN19ZdyQU7"); NSLog(@"PLjl2Jb1ORdI8"); } -(void)aouFTqs:(UICollectionView*) aouFTqs aKkRnN:(UIFontWeight*) aKkRnN aJMmLnqvT4t:(UIBarButtonItem*) aJMmLnqvT4t afuTaVm:(UIEdgeInsets*) afuTaVm aiTfe:(UIFont*) aiTfe ai8Ah:(UIWindow*) ai8Ah arcK0SAngNT:(UIColor*) arcK0SAngNT aM9DbnHSm:(UIButton*) aM9DbnHSm acaJBe:(UIBezierPath*) acaJBe aElzoJR1:(UIControlEvents*) aElzoJR1 a5vF1P:(UIApplication*) a5vF1P aXamo:(UIControlEvents*) aXamo aODnSB:(UIWindow*) aODnSB aIbGvRzCYE:(UIAlertView*) aIbGvRzCYE aA7uQvY:(UIEdgeInsets*) aA7uQvY a5RhA:(UIBarButtonItem*) a5RhA azKMQ:(UIWindow*) azKMQ afVct:(UIVisualEffectView*) afVct ax9s1Qr:(UIDevice*) ax9s1Qr a4RO6:(UIVisualEffectView*) a4RO6 { NSLog(@"c94wxeB8YQO"); NSLog(@"zyT8lPWCF2EKXqLOcpRw"); NSLog(@"2b4lYXkoO0UNmdqAs3p5"); NSLog(@"W7823GKsgQFX0AVOHybwonpN"); NSLog(@"9SBOtFhH1Wn50wpGDLbxKZ2Jc4veQ3MCPd7aVf"); NSLog(@"W3kQo7TgY05hMp4AvNacZzPuRHBJfUmw"); NSLog(@"qDwkoxt9TiphYK4NVWd7S0C6UErsHvlg81f"); NSLog(@"2TihIGPrKlDkpZm5xL9EaftQNM31"); NSLog(@"ijOoIQJlhSPfy0NB3WC4GpUYR"); NSLog(@"WSJR5L4ljw8o3UHEszqMZQkpDyBXr"); NSLog(@"UaQb7TyX8zOJMsZLiW5mB61pVD"); NSLog(@"aSigumI7KQ2h3q0nt8ywbsOR6vWxJFLXYUr4C"); NSLog(@"RkhSEiWKPt1q63M8JDT9xvdACznQoG0V5s7B"); NSLog(@"R6eoDkCITSstxEA518gMZldwQWPGKvzLVbH9NJy"); NSLog(@"kv0wjQSdhIo3ilZg6s5MGaA7WFq"); NSLog(@"IG4SOPKtogQ5ufeWN78cJ3DU"); NSLog(@"RWXhnmbcQ9guK6D5F3MJl4yv"); NSLog(@"Qpkn1mDTJiu39LlEWbgR5UzYrO2"); } -(void)az8AOF7vci:(UIKeyCommand*) az8AOF7vci anAfveo:(UISearchBar*) anAfveo aWoeUZdBhvc:(UIControl*) aWoeUZdBhvc azrj0:(UIView*) azrj0 ax7DftMlHBQ:(UIScreen*) ax7DftMlHBQ a4efsTc6BS:(UIActivity*) a4efsTc6BS ajNZ4:(UIActivity*) ajNZ4 { NSLog(@"Uu8M9vmDH0SJNgoXxPEjeIiqK52clYhk"); NSLog(@"4ayheb8HvTXZOux1lG0itYLWR"); NSLog(@"1MXISzDpHytU9nFrBKGgJbfa"); NSLog(@"mk58U6SMQB1RvfXViduaZhNtAWJ"); NSLog(@"2AJ9OmZBW3DqeSXsjMTbIfkLa7Nor4"); NSLog(@"akyQq70ibc3SPMoRz9XZ6lN8H4wfFuh"); NSLog(@"6HfmBhyRcPxlsr"); NSLog(@"P6UOylh5MY"); NSLog(@"4G9yWuJPiZcz2MVLBNx5v7wl"); NSLog(@"gn6ZMeTCRK0oqWFrs48DQjVEy9NaHpAP5d23vJk"); NSLog(@"en62rE9CGyiYOx81q"); NSLog(@"YnO4evp85zIcsdNl6BELowuXjqtSGCy0xWQ"); NSLog(@"HLrAZa2dx9v7ESYegybDFqQkmRhBKp36Gf4"); NSLog(@"18tx753UeFCcVhQ6GSubzkOR"); NSLog(@"v2knwGzYhDUy1gs95IdZCeVEQjptc6FXMuKoJLT"); NSLog(@"JBUYOCaL6Nz10rS"); NSLog(@"42MbOaXvwBzeSEYJpjkG0KDQmTuRhCH75Fy"); } @end