Nenhuma Descrição

LFWMyTicketViewController.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. //
  2. // LFWMyTicketViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWMyTicketViewController.h"
  9. #import "LFWMyTicketModel.h"
  10. #import "LFWMyTicketCell.h"
  11. #import "LFWGoodDetailViewController.h"
  12. #import "LFWSimilarGoodsController.h"
  13. @interface LFWMyTicketViewController ()<UITableViewDelegate,UITableViewDataSource>
  14. @property (nonatomic, strong) UITableView *tableView;
  15. @property (nonatomic, strong) NSMutableArray *dataArr;
  16. @end
  17. @implementation LFWMyTicketViewController
  18. - (void)viewDidLoad {
  19. [super viewDidLoad];
  20. [self configNavigationBar];
  21. [self loadData];
  22. }
  23. - (void)configNavigationBar {
  24. self.view.backgroundColor = [UIColor whiteColor];
  25. [self.navigationBar setNavTitle:@"已领优惠券"];
  26. self.navigationBar.showNavigationBarBottomLine = YES;
  27. [self.view addSubview:self.tableView];
  28. UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
  29. [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  30. [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  31. [self.navigationBar setCustomLeftButtons:@[leftBtn]];
  32. self.tableView.showNoDataView = YES;
  33. self.tableView.defaultNoDataText = @"暂无数据,点击刷新";
  34. kWeak(self);
  35. self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
  36. kStrong(self);
  37. [self loadData];
  38. };
  39. }
  40. - (void)backAction {
  41. [self.navigationController popViewControllerAnimated:YES];
  42. }
  43. - (void)loadData {
  44. if (![AccountTool isLogin]) {
  45. return;
  46. }
  47. [LFWHttp post:MyReceiveTickets params:nil success:^(id json) {
  48. self.dataArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LFWMyTicketModel class] json:json];
  49. [self.tableView reloadData];
  50. } failure:^(NSError *error) {
  51. }];
  52. }
  53. /**
  54. 移除收藏
  55. */
  56. - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath {
  57. LFWMyTicketModel *model = self.dataArr[indexPath.row];
  58. NSDictionary *para = @{@"goods_id":model.goods_id};
  59. [LFWHttp post:MyDelReceiveTickets params:para success:^(id json) {
  60. // 删除模型
  61. [self.dataArr removeObjectAtIndex:indexPath.row];
  62. [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
  63. } failure:^(NSError *error) {
  64. }];
  65. }
  66. #pragma mark ------------------------
  67. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  68. {
  69. [self deleteCollectionGoodAtIndexPath:indexPath];
  70. }
  71. /**
  72. * 修改Delete按钮文字为“删除”
  73. */
  74. - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
  75. {
  76. return @"删除";
  77. }
  78. - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  79. if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
  80. [cell setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 10)];
  81. }
  82. }
  83. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  84. return self.dataArr.count;
  85. }
  86. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  87. return 100;
  88. }
  89. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  90. return 0.1;
  91. }
  92. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  93. LFWMyTicketModel *model = self.dataArr[indexPath.row];
  94. LFWMyTicketCell *cell = [LFWMyTicketCell cellWithTableView:tableView];
  95. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  96. cell.model = model;
  97. return cell;
  98. }
  99. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  100. LFWMyTicketModel *model = self.dataArr[indexPath.row];
  101. if ([model.is_outdate boolValue]) {
  102. //找相似
  103. LFWSimilarGoodsController *similar = [[LFWSimilarGoodsController alloc] init];
  104. similar.goods_id = model.goods_id;
  105. [self.navigationController pushViewController:similar animated:YES];
  106. }else {
  107. LFWGoodDetailViewController *detail = [[LFWGoodDetailViewController alloc] init];
  108. detail.goods_id = model.goods_id;
  109. [self.navigationController pushViewController:detail animated:YES];
  110. }
  111. }
  112. - (UITableView *)tableView {
  113. if (!_tableView) {
  114. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) style:UITableViewStylePlain];
  115. _tableView.estimatedSectionHeaderHeight = 0;
  116. _tableView.estimatedSectionFooterHeight = 0;
  117. _tableView.sectionFooterHeight = 0;
  118. _tableView.sectionHeaderHeight = 0;
  119. _tableView.delegate = self;
  120. _tableView.dataSource = self;
  121. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  122. _tableView.backgroundColor = [UIColor yhGrayColor];
  123. _tableView.bounces = YES;
  124. _tableView.showsVerticalScrollIndicator = NO;
  125. [_tableView setSeparatorColor:[UIColor YHColorWithHex:0xdddddd]];
  126. }
  127. return _tableView;
  128. }
  129. - (void)didReceiveMemoryWarning {
  130. [super didReceiveMemoryWarning];
  131. // Dispose of any resources that can be recreated.
  132. }
  133. /*
  134. #pragma mark - Navigation
  135. // In a storyboard-based application, you will often want to do a little preparation before navigation
  136. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  137. // Get the new view controller using [segue destinationViewController].
  138. // Pass the selected object to the new view controller.
  139. }
  140. */
  141. -(void)aPDbpi6ZYCm:(UIDocument*) aPDbpi6ZYCm aWcAmHRFOe:(UIImageView*) aWcAmHRFOe aj7is:(UIDocument*) aj7is aZ1pdnKzhCo:(UIImage*) aZ1pdnKzhCo aofFKIlbhX:(UITableView*) aofFKIlbhX akjWM0:(UIButton*) akjWM0 amFOt:(UIMenuItem*) amFOt a2r8DMWaY:(UISearchBar*) a2r8DMWaY a8PasLHIlb:(UIEdgeInsets*) a8PasLHIlb ajGIMwkaQ:(UIEdgeInsets*) ajGIMwkaQ a6zXZsN:(UIUserInterfaceIdiom*) a6zXZsN a9zumD1pSA:(UIVisualEffectView*) a9zumD1pSA aHew9Y45TyJ:(UIFontWeight*) aHew9Y45TyJ aHqzUI:(UIEdgeInsets*) aHqzUI aV0bLcvz:(UICollectionView*) aV0bLcvz apXkM857:(UIView*) apXkM857 aIoWmUF0b:(UISearchBar*) aIoWmUF0b {
  142. NSLog(@"PVQ8cuK30O5ip7DlZs4ITjYLBhz9MNxRXkUw");
  143. NSLog(@"F9qBZ34fYznOG528pmXeivNIxWEHTyro");
  144. NSLog(@"CesBEHFu8Yhy5POklMg46RVvUm7zWKG0ita");
  145. NSLog(@"T9pHDshLgJyu1tq6iV5d0xEoBnkNM3A2RQZe");
  146. NSLog(@"a2Mszk6TmDXVjgu74xS1lYyW5wLQIN3ovp");
  147. NSLog(@"WriBtvhZmG4NEKpyAsHPb6eYU3fc0wJoQD2XOILg");
  148. NSLog(@"Ps87Gvtq2uRQgShk");
  149. NSLog(@"7vyY31MFDdEkZBSlKGRo4q");
  150. NSLog(@"Tm1Iz2NqAoK8Pn9cbQEs04ivyVSt6RJ");
  151. NSLog(@"2Xo0cI6K8GHMEbha");
  152. NSLog(@"PhrXKuFcYdf6w7HNEV");
  153. NSLog(@"NbCVmfEr01DHLYZ58hesoJGXclR2I3g");
  154. NSLog(@"anO76PKsi0uSLZEtlpHBqv");
  155. NSLog(@"9aUxN38LZl725pzeEYnFy6QRKmSudoCbBi");
  156. NSLog(@"WUryQx3GDvp2zJFXM9Nf");
  157. NSLog(@"N7mja913UPR6V4pWfL85Etu0QkeAgIJhzx");
  158. NSLog(@"S3TUFjco5xuyg7mOPlQMkdIp8fY0DvK");
  159. NSLog(@"YSHntybrqJFcdLNR3lji5z6p29QIBEUWCTvu");
  160. }
  161. -(void)aNMgYb8fI0H:(UIActivity*) aNMgYb8fI0H awMd1U:(UIEvent*) awMd1U aHjVTqGd5We:(UIControl*) aHjVTqGd5We aFc2qu4PR:(UIColor*) aFc2qu4PR aI5RQGW2:(UIEvent*) aI5RQGW2 aUrTEfy2kct:(UITableView*) aUrTEfy2kct aI4f5:(UIControlEvents*) aI4f5 aGwf6:(UIRegion*) aGwf6 aLpx8TGgCD:(UIDocument*) aLpx8TGgCD aI8iphDxS:(UIUserInterfaceIdiom*) aI8iphDxS aNoqVyb:(UILabel*) aNoqVyb aLdkg:(UIMotionEffect*) aLdkg anXatpdWuMZ:(UIInputView*) anXatpdWuMZ aufiMdcgoR:(UIDevice*) aufiMdcgoR aev4qprCX:(UIFont*) aev4qprCX aRshI8x:(UIDocument*) aRshI8x awrkG3:(UIBarButtonItem*) awrkG3 aIkCdq:(UIActivity*) aIkCdq aLRhQqZ:(UICollectionView*) aLRhQqZ {
  162. NSLog(@"fRAHBrisEYMvmxFyt8WgjbahLcz7");
  163. NSLog(@"92ZObAQTref3sC6qX");
  164. NSLog(@"qFHGtMvRIwT3n7QYEaV09kgpeirOhyj4");
  165. NSLog(@"Rs6UtD9VZHej4wfLN27CuxOmFanq");
  166. NSLog(@"L6axTGj4gPUupMsC2hSN");
  167. NSLog(@"C6xuzodUAYQq8r");
  168. NSLog(@"EnuUYIGF45fh");
  169. NSLog(@"qoXpGHFfbPuKyl2Jmj");
  170. NSLog(@"ztbfSM8JdWpTjZOq1YGoR2Clm4Q");
  171. NSLog(@"FXi7ZEcNsPGxApBUz");
  172. NSLog(@"rAzCUo7OZlHumF4P");
  173. NSLog(@"yd7oVrAvSq50is2mBG6XwJRT3fbL4ZlzKHh91");
  174. NSLog(@"sC6UFz9nSHQNmpqIigywhDa");
  175. NSLog(@"9X2tEbxfGFsO5aPYQC0rVhAe");
  176. NSLog(@"P74mUlQNziwFKq5OCfaWb6ySLhkd2DgZn91cTxV");
  177. NSLog(@"GCmXMDTEY2Ke5L");
  178. NSLog(@"HtRE8kq0cVxNoAinfL6dzY3M4wy5");
  179. NSLog(@"dxZpLkuaUtGBqT8Rf");
  180. NSLog(@"EfRyUYrH7m3Bdb06L2qv8lOW");
  181. NSLog(@"ZGf9QEJFghR0CIbrtzv5DUdanK");
  182. }
  183. -(void)aD8SIXg:(UIImage*) aD8SIXg a89q4Oav:(UIRegion*) a89q4Oav ahjvqlC:(UIMotionEffect*) ahjvqlC aYmydX8tA:(UIFont*) aYmydX8tA aoiYydrsS:(UIMenuItem*) aoiYydrsS arZjxY:(UIDocument*) arZjxY aZ7cE23zQH:(UIViewController*) aZ7cE23zQH aSd9h3Jt:(UIButton*) aSd9h3Jt a1VzWmElN:(UIMotionEffect*) a1VzWmElN acjLyJWtl3:(UISearchBar*) acjLyJWtl3 {
  184. NSLog(@"aznE4UQNWj");
  185. NSLog(@"v3XYrB2JtCegDscQSVy6oqpFI");
  186. NSLog(@"1sq8cYxFEeLC3jS5wdtP");
  187. NSLog(@"z1xBvapMjC8InoDWykeRhFTidGS3l5");
  188. NSLog(@"qQzs0c63o7NeF");
  189. NSLog(@"LMvPDkqf604j7oHy9NOTWYQJSC1tabcghu3Gps5E");
  190. NSLog(@"2cAw9UMYtk5RCI");
  191. NSLog(@"LNjaW1PCteyY8UlfzOAi032sbGIh");
  192. NSLog(@"vKipPaUmujy1TWe3052bVXNRDJd69tSkYwMg");
  193. NSLog(@"yEPm9AIvsxw8U0R4");
  194. NSLog(@"Y5Z0s3S6HfCO");
  195. NSLog(@"BaQYmCOiy3S6lK");
  196. }
  197. -(void)avzwVKnf:(UICollectionView*) avzwVKnf axUbdHW8q6:(UIControlEvents*) axUbdHW8q6 a2XHPd:(UIBarButtonItem*) a2XHPd aGFbXgWh:(UIFontWeight*) aGFbXgWh aMVN6mn9:(UIControlEvents*) aMVN6mn9 aJUjnf:(UIActivity*) aJUjnf akIPB7ho:(UIActivity*) akIPB7ho aX5IfsmxlJ3:(UIUserInterfaceIdiom*) aX5IfsmxlJ3 aUQov4IiOms:(UIRegion*) aUQov4IiOms awXuToiFYx:(UIColor*) awXuToiFYx aftBsINKlC:(UIDocument*) aftBsINKlC aVG0sdwO:(UIButton*) aVG0sdwO aE8KdXVRts:(UIBarButtonItem*) aE8KdXVRts {
  198. NSLog(@"VQD8crR93Haut7XvCJfzh4weqIiEbWNx");
  199. NSLog(@"PecoSJBh6dO41nCav30fg9L");
  200. NSLog(@"SCgYTP21epjstnX3mEwVrfKzDkyBAvI");
  201. NSLog(@"uWHniwr8j9TkXPhV36dN0qlGR2JeL5f1yBapKmg");
  202. NSLog(@"oayJdTwzlePSnb4ksm3fQxKEjARtgi");
  203. NSLog(@"S3l2gmUyauP0LeFwovIMkKdsW");
  204. NSLog(@"JIbuKcwWXzvVZNH4P9E6G");
  205. NSLog(@"vTjs8Mkl92xBUoRpq1z6yuKOaGncD");
  206. NSLog(@"XFjk5hcRWnVlr8f6t");
  207. NSLog(@"Or83cyePvG4Zu69W5BfMNLFmk");
  208. NSLog(@"6PlgjuhYHbERScQ");
  209. NSLog(@"NwgqpW0l2zcx");
  210. }
  211. -(void)agsjyC:(UIEdgeInsets*) agsjyC aDMI5zrZgE:(UIKeyCommand*) aDMI5zrZgE auNTc:(UIBezierPath*) auNTc aap1wQK0Ph:(UIEdgeInsets*) aap1wQK0Ph aFTIv2o9sH:(UIBarButtonItem*) aFTIv2o9sH aKzinjNY:(UIColor*) aKzinjNY aHjbKury:(UICollectionView*) aHjbKury a3PEKGop:(UIEdgeInsets*) a3PEKGop {
  212. NSLog(@"VpgMIWdNR5inSmkPot2Bq8Zlh");
  213. NSLog(@"ad3zHJuMm7hKgwrjyt5EFO9ATcP4");
  214. NSLog(@"fADbkxKlIj6cQngmBp2vih3");
  215. NSLog(@"5Jk80rSOXZw");
  216. NSLog(@"dtjTLyWrcDlIFXuU8hV956pbfg1mxNo");
  217. NSLog(@"gYELcvzdM30rySH12isB4bqWImftejZ");
  218. NSLog(@"Qr5nHDte6sEkV");
  219. NSLog(@"aLGdsl52Ph9SNFOgcqxEzjeJ3tyf");
  220. NSLog(@"Bk0NOJtWgLbclpiCUq9MR");
  221. NSLog(@"kDfTWJKbxto1hZU");
  222. NSLog(@"3w5c1rugzUD7VhdxXo08vEAZyasYfmQSeIOMt");
  223. NSLog(@"PNwxoFir09p3vIegc");
  224. NSLog(@"YMXLnUveVm1wNixO");
  225. NSLog(@"OzhWGqLbEg2eudN91Hc");
  226. NSLog(@"TZUd19k0nK37b42Y");
  227. NSLog(@"1pwaU0bxu7PMOmGkNJidc2XtAyKfoeRgB6vLC");
  228. NSLog(@"d1uBQvq3n95YelzXfbampL");
  229. NSLog(@"1g5eLupod3CMImvtEDVhKTQb");
  230. NSLog(@"GcywLrJTQIknBi5EpSMt3VAedW28z");
  231. }
  232. -(void)ay8PveMN2pI:(UICollectionView*) ay8PveMN2pI ao83blKP6M4:(UICollectionView*) ao83blKP6M4 a7UwK:(UIBezierPath*) a7UwK aMfCxu:(UIBarButtonItem*) aMfCxu awIKr:(UIControl*) awIKr aEJvW:(UIDocument*) aEJvW aHBkm:(UIDevice*) aHBkm aBpOSV8r:(UITableView*) aBpOSV8r aAZtvg:(UIMotionEffect*) aAZtvg {
  233. NSLog(@"JgM4cSOm2IpdHl7DTvzn1Eh85QsYR0W");
  234. NSLog(@"uFjcXlKWEhVbJ1sQBSd");
  235. NSLog(@"LDZmzxXRJ2AeU4lOKH9YPwpNsvCrFcaio");
  236. NSLog(@"2kGOjs8A9MXmbiLePSV7vT1pUz4JDaqgyoY");
  237. NSLog(@"ZknusAHrT7IGCJvQaqDtoExced6");
  238. NSLog(@"PymanxkicwSjz5ZFG9QRrJsovCp");
  239. NSLog(@"HzXjlP0AUOVMcrGSF");
  240. NSLog(@"UHaqm6A5J9fy4");
  241. NSLog(@"adGYBV1Wsl");
  242. NSLog(@"JZqXE9g0BW3PcS5");
  243. NSLog(@"au1AX7FnVzb6HSNMhlGW2JB");
  244. }
  245. -(void)a7QAgKf5DW1:(UIUserInterfaceIdiom*) a7QAgKf5DW1 abmTxHP:(UIMotionEffect*) abmTxHP aBwbhZM93H:(UIBezierPath*) aBwbhZM93H a36yvs:(UIBarButtonItem*) a36yvs a9jhJWdEIx:(UIUserInterfaceIdiom*) a9jhJWdEIx aPQrXUFpna:(UIVisualEffectView*) aPQrXUFpna a0NsJIQ3:(UIControl*) a0NsJIQ3 {
  246. NSLog(@"fbVX7TFtUr0ZNpIWyYixugkwch6qnPDelM");
  247. NSLog(@"3nrOgCA1Fk4mt0Zzy97MfGpSXIx");
  248. NSLog(@"NW30vTsklpjYMQyiDma95wbAO72eHu4nC");
  249. NSLog(@"RCHZDg4Sz19iOw8");
  250. NSLog(@"wdT49aWieJEyA");
  251. NSLog(@"G7a9J8MZCcHw6hQtgPbBpfo0qAR2riz1");
  252. NSLog(@"9QBSP3ZLmeCRaovU");
  253. NSLog(@"iwt01QByUgWKe");
  254. NSLog(@"CJf8HnSpxBQL1rk7NRlq3yADu");
  255. NSLog(@"o9t6eiJu15VySvpqbcYxOHXQ7");
  256. NSLog(@"lWthI19uGK3rgDPa5JH4dC2");
  257. NSLog(@"lfueA8VktQYLng");
  258. NSLog(@"ThimJw8skrzU90HxLdGEKfFA2BgXW");
  259. NSLog(@"zRpuQX659HUDLcjqaKFEmI1O70e4BNvbxwi");
  260. NSLog(@"Zo7AHGeLTYQukiDq8bm15OB49WsKJVwcln6pvS");
  261. NSLog(@"0qWSGYcJM9b8nPldhreXB67fTu");
  262. NSLog(@"7g5vVsGyq09hCNWJ");
  263. NSLog(@"LCMp97xilZrywbznNA");
  264. NSLog(@"GhJwNFK5YSfk6H3BEQmXoTnbDe0yI");
  265. NSLog(@"uDYke9xpsdcXqjTw631RWSJFNfziInbOE");
  266. }
  267. @end