两折买改口袋样式

LZMHistoryViewController.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. //
  2. // LZMHistoryViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/6/11.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMHistoryViewController.h"
  9. #import "LZMGoodHorzitolCollectionCell.h"
  10. #import "LZMGoodDetailViewController.h"
  11. #import "LZMChildGoodModel.h"
  12. #import "LZMHistoryHeaderView.h"
  13. #import "LZMNoDataView.h"
  14. static NSString *KHorizontalCellId = @"KHorizontalCellId";
  15. static NSString *KHeaderId = @"KHeaderId";
  16. @interface LZMHistoryViewController ()<UICollectionViewDelegate, UICollectionViewDataSource>
  17. {
  18. NSInteger _page;
  19. }
  20. @property (nonatomic, strong) UICollectionView *collectionView;
  21. @property (nonatomic, strong) NSMutableArray *historyDataArr;
  22. @property (nonatomic, strong) LZMNoDataView *noDataView;
  23. @end
  24. @implementation LZMHistoryViewController
  25. - (void)viewWillAppear:(BOOL)animated {
  26. [super viewWillAppear:animated];
  27. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  28. }
  29. - (void)viewDidLoad {
  30. [super viewDidLoad];
  31. [self configNavigationBar];
  32. [self configCollectionView];
  33. [self requestData];
  34. }
  35. - (void)configNavigationBar {
  36. _page = 1;
  37. [self.navigationBar setNavTitle:@"浏览历史"];
  38. self.navigationBar.backgroundColor = [UIColor changeColor];
  39. self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor];
  40. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  41. [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal];
  42. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  43. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  44. }
  45. - (void)backAction {
  46. [self.navigationController popViewControllerAnimated:YES];
  47. }
  48. - (void)configCollectionView {
  49. _page = 1;
  50. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
  51. self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) collectionViewLayout:flowLayout];
  52. flowLayout.minimumInteritemSpacing = 2;
  53. [self.collectionView registerClass:[LZMGoodHorzitolCollectionCell class] forCellWithReuseIdentifier:KHorizontalCellId];
  54. [self.collectionView registerClass:[LZMHistoryHeaderView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KHeaderId];
  55. self.collectionView.backgroundColor = [UIColor whiteColor];
  56. self.collectionView.showsVerticalScrollIndicator = NO;
  57. self.collectionView.delegate = self;
  58. self.collectionView.dataSource = self;
  59. self.collectionView.bounces = YES;
  60. // self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  61. //
  62. // }];
  63. [self.view addSubview:self.collectionView];
  64. [self.collectionView addSubview:self.noDataView];
  65. [SVProgressHUD show];
  66. }
  67. - (void)requestData {
  68. NSString *url = [NSString stringWithFormat:@"%@/api/v2/brower/recordList",BaseURL];
  69. [LZMHttp post:url params:nil success:^(id json) {
  70. NSArray *array = json[@"data"];
  71. for (NSArray *childArr in array) {
  72. NSArray *list = [NSArray yy_modelArrayWithClass:[LZMChildGoodModel class] json:childArr];
  73. [self.historyDataArr addObject:list];
  74. }
  75. [self setNoDataView];
  76. [self.collectionView reloadData];
  77. [SVProgressHUD dismiss];
  78. } failure:^(NSError *error) {
  79. [SVProgressHUD dismiss];
  80. }];
  81. }
  82. - (void)setNoDataView {
  83. if (self.historyDataArr.count > 0) {
  84. NSArray *list = self.historyDataArr.firstObject;
  85. self.noDataView.hidden = list.count > 0;
  86. }else {
  87. self.noDataView.hidden = NO;
  88. }
  89. }
  90. #pragma mark ============ UICollectionView Delegate && DataSource ==========
  91. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
  92. {
  93. NSArray *arr = self.historyDataArr[section];
  94. return arr.count;
  95. }
  96. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  97. return self.historyDataArr.count;
  98. }
  99. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  100. return CGSizeMake(SCREEN_WIDTH, 140);
  101. }
  102. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
  103. return 1;
  104. }
  105. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section
  106. {
  107. return CGSizeMake(SCREEN_WIDTH, 40);
  108. }
  109. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section
  110. {
  111. return CGSizeMake(0, 0);
  112. }
  113. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  114. {
  115. LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row];
  116. LZMGoodHorzitolCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:KHorizontalCellId forIndexPath:indexPath];
  117. cell.model = model;
  118. return cell;
  119. }
  120. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{
  121. LZMHistoryHeaderView *header = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KHeaderId forIndexPath:indexPath];
  122. LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row];
  123. [header setDateWith:model.add_time];
  124. return header;
  125. }
  126. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  127. LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init];
  128. LZMChildGoodModel *model = self.historyDataArr[indexPath.section][indexPath.row];
  129. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithId:model.goods_id
  130. is_coupon:model.is_coupon
  131. coupon_price:model.coupon_price
  132. price:model.price
  133. discount_price:model.discount_price
  134. commission_rate:model.commission_rate
  135. coupon_start_time:model.coupon_start_time
  136. coupon_end_time:model.coupon_end_time];
  137. detail.requestModel = requestModel;
  138. LZMEventModel *evevtModel = [[LZMEventModel alloc] initWithOrigin:@"0" category_id:@"0" source:collectAction];
  139. detail.eventModel = evevtModel;
  140. [self.navigationController pushViewController:detail animated:YES];
  141. }
  142. - (NSMutableArray *)historyDataArr {
  143. if (!_historyDataArr) {
  144. _historyDataArr = [NSMutableArray array];
  145. }
  146. return _historyDataArr;
  147. }
  148. - (LZMNoDataView *)noDataView {
  149. if (!_noDataView) {
  150. _noDataView = [[LZMNoDataView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 264)];
  151. _noDataView.hidden = YES;
  152. _noDataView.center = self.collectionView.center;
  153. }
  154. return _noDataView;
  155. }
  156. - (void)didReceiveMemoryWarning {
  157. [super didReceiveMemoryWarning];
  158. // Dispose of any resources that can be recreated.
  159. }
  160. /*
  161. #pragma mark - Navigation
  162. // In a storyboard-based application, you will often want to do a little preparation before navigation
  163. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  164. // Get the new view controller using [segue destinationViewController].
  165. // Pass the selected object to the new view controller.
  166. }
  167. */
  168. -(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 {
  169. NSLog(@"2FdON5i4AbupjMvC3Krqt8swTPGxVemly");
  170. NSLog(@"1wxoZmnG2tq3cUJu5");
  171. NSLog(@"Id7k8x4f93jOnKmFX1");
  172. NSLog(@"e9Kj2Ex3DyluszgmqX1F065");
  173. NSLog(@"krntTX85ZlYOuLVyDgB4hsmCbR1AiGPNIQEp7U");
  174. NSLog(@"JwVO4Kl3yDvxNkM9Hi2uFA0WCRL7gb");
  175. NSLog(@"gxV1OabEcmFl9DXNSI4JYwz6iMypPjK2LeTtAWB");
  176. NSLog(@"y3jniYNmfC9tpD57Jv6g");
  177. NSLog(@"lWqU3mziOuDY2vyc");
  178. NSLog(@"xcz2v9uspE");
  179. NSLog(@"MAqWFcDX9Kohz70f");
  180. NSLog(@"jEPrnl3X6VibZosLcfH7tIGB");
  181. NSLog(@"juOeIEzH5soV6LpW0MnXvcyG7KBR84brS");
  182. }
  183. -(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 {
  184. NSLog(@"2pqWRzKNwgFBLEU6TubnD");
  185. NSLog(@"D7ShejRJvN");
  186. NSLog(@"5bQmYfdja2vcVLix6oZhp0OHnRl");
  187. NSLog(@"dfG4IbvOkEQx81rLU7h9YCzj3pWX5yognHPcNaA");
  188. NSLog(@"breF6GWnH9aXV5");
  189. NSLog(@"ZJxoa4BpLTMGNf81cy3d");
  190. NSLog(@"q8v4Wkwie9mVQ6ZoYFgXrx3bshtnU0SINpaGR");
  191. NSLog(@"hzWSPnJU4B7H9yDRMFaGpVsudLoCl");
  192. NSLog(@"63xWRPIlu8DnjCzN");
  193. NSLog(@"6zxy4NWPUcMSlYuGj9d");
  194. NSLog(@"Hqg87L6OhM");
  195. NSLog(@"JyLuUizlcQ");
  196. NSLog(@"KBE0G4t2ON7pArTu5bXxRWalQhwDUSyzoHFkqgn");
  197. NSLog(@"JM7rI85ad2YVv94t3mljeC6WXHA0K");
  198. NSLog(@"y3Q1iKcaHU");
  199. }
  200. -(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 {
  201. NSLog(@"VuktOLCvabJf6S42");
  202. NSLog(@"RLaXwdAknOqpZl9B7vmrH61");
  203. NSLog(@"xMzH6l1sEytQPTw4SFbJijAodRYDvUG5X");
  204. NSLog(@"eS4iCckYMhO6dVxtBfqRIUpEDW3o9yuJZaPKgsn");
  205. NSLog(@"CNv9sAxDhprQok0eWuiFqjcSf");
  206. NSLog(@"ap4EK1IOUhdBe23PL6AF");
  207. NSLog(@"9PHcaoMkAOWn7r486VzQKIJU");
  208. NSLog(@"YqEeMQlLs9zN2T7R0K8OHS4cFf");
  209. NSLog(@"jAchx4KbC9");
  210. NSLog(@"JuCWYmLFe27pjBMc8fXDwn3bhx5ZGlSRHQAoq9NV");
  211. NSLog(@"EdTymRSbQnL");
  212. NSLog(@"eyFnrUZ72c8osDlVpLhACT41");
  213. }
  214. -(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 {
  215. NSLog(@"l9Wxsm67XdGy3qOibo14e2gTJMF5RYtcQpDCvn0");
  216. NSLog(@"ORzTc27UuEkCoM");
  217. NSLog(@"wpekQRMlgm751VF8f3uy6TxnE2Gt");
  218. NSLog(@"MHKhbSUyA2IvwQNDsXk7e89m");
  219. NSLog(@"6frqHW1E7d");
  220. NSLog(@"ULRvNOg21GaBtiAJ3VcXhkjeHmowurEPT6");
  221. NSLog(@"o5E8DhvkmBCZsLrPtxwAG6JMf30OuXUaYIS");
  222. NSLog(@"hdeUvCTZHBOXf");
  223. NSLog(@"YuepivFA6K");
  224. NSLog(@"ox6j5w3WzM24EALfadiVYUCXZNIT7G");
  225. NSLog(@"aSYBFZQ0f7MjlDwhoIkCLx");
  226. NSLog(@"Zi1bG8IUpqBrCjQvK0LWH5NPgtyuS7");
  227. NSLog(@"abOmrnyjxvWDghc5UiofF8kJEwePt0uqSQKAs");
  228. NSLog(@"etiZvcQ598lphJMfu7kqzmnyA");
  229. }
  230. -(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 {
  231. NSLog(@"91RmTfcbWGiXVhEMvU4uD");
  232. NSLog(@"guzAUkSQmTw5H");
  233. NSLog(@"dAUyn1ZRrwFmHtWPv9sMEBD5hXObQl");
  234. NSLog(@"lXRh2AmzbfpauUYxOMKj9S41tgNETwLk6HW3Jen");
  235. NSLog(@"1SD5NB2VaHE4UI9iwoPfOm");
  236. NSLog(@"KHkwZyW0ho86gDRXFzupxE2");
  237. NSLog(@"9LCpoUajVGnvYgmETds537SOF1XzxDQc0et");
  238. NSLog(@"FzZ74mask1j62IRPS");
  239. NSLog(@"bPmdeBTJGDhU4q23AcZNw1Klxy0j");
  240. NSLog(@"PhQKUBnVGS6DdpYx7CvM");
  241. NSLog(@"UweZjSGCaM9bRVFdJ2");
  242. NSLog(@"DisU32Ry9mKJ4bkl16ZEFouHnh07zW5eNxgtd");
  243. }
  244. @end