两折买改口袋样式

LZMCollectionTicketController.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. //
  2. // LZMCollectionTicketController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/24.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMCollectionTicketController.h"
  9. #import "LZMCollectionTicketCell.h"
  10. #import "LZMDateHeaderView.h"
  11. #import "LZMCollectionModel.h"
  12. #import "LZMGoodDetailViewController.h"
  13. #import "LZMSimilarGoodsController.h"
  14. #import "LZMLoginViewController.h"
  15. @interface LZMCollectionTicketController ()<UITableViewDelegate,UITableViewDataSource>
  16. @property (nonatomic, strong) UITableView *tableView;
  17. @property (nonatomic, strong) NSMutableArray *nearbyArr; // 即将过期的数组
  18. @property (nonatomic, strong) NSMutableArray *allDataArr;
  19. @end
  20. @implementation LZMCollectionTicketController
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self configTableView];
  24. }
  25. - (void)viewWillAppear:(BOOL)animated {
  26. [super viewWillAppear:animated];
  27. [self configNoDataView];
  28. [self loadData];
  29. }
  30. - (void)configTableView {
  31. self.view.backgroundColor = [UIColor whiteColor];
  32. [self.view addSubview:self.tableView];
  33. }
  34. - (void)configNoDataView {
  35. self.tableView.showNoDataView = YES;
  36. if (![AccountTool isLogin]) {
  37. self.tableView.defaultNoDataText = @"未登录,点击登录";
  38. kWeak(self);
  39. self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
  40. kStrong(self);
  41. LZMLoginViewController *login = [[LZMLoginViewController alloc] init];
  42. [self presentViewController:login animated:YES completion:nil];
  43. };
  44. }else {
  45. self.tableView.defaultNoDataText = @"暂无收藏数据,点击刷新";
  46. kWeak(self);
  47. self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
  48. kStrong(self);
  49. [self loadData];
  50. };
  51. }
  52. }
  53. - (void)loadData {
  54. if (![AccountTool isLogin]) {
  55. return;
  56. }
  57. [LZMHttp post:MyCollectCollectTicket params:nil success:^(id json) {
  58. [self.allDataArr removeAllObjects];
  59. NSArray *detailList = json[@"goods_detail"];
  60. for (NSArray *arr in detailList) {
  61. NSMutableArray *items = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LZMCollectionModel class] json:arr];
  62. [self.allDataArr addObject:items];
  63. }
  64. self.nearbyArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LZMCollectionModel class] json:json[@"nearly_outdate"]];
  65. if (self.nearbyArr.count != 0) {
  66. [self.allDataArr insertObject:self.nearbyArr atIndex:0];
  67. }
  68. [self.tableView reloadData];
  69. } failure:^(NSError *error) {
  70. }];
  71. }
  72. /**
  73. 移除收藏
  74. */
  75. - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath {
  76. LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
  77. NSDictionary *para = @{@"goods_id":model.goods_id};
  78. [LZMHttp post:DelCollectionTickets params:para success:^(id json) {
  79. // 删除模型
  80. NSMutableArray *mArr = self.allDataArr[indexPath.section];
  81. [mArr removeObjectAtIndex:indexPath.row];
  82. [self.allDataArr replaceObjectAtIndex:indexPath.section withObject:mArr];
  83. [self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationLeft];
  84. } failure:^(NSError *error) {
  85. }];
  86. }
  87. #pragma mark ------------------------
  88. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
  89. {
  90. [self deleteCollectionGoodAtIndexPath:indexPath];
  91. }
  92. /**
  93. * 修改Delete按钮文字为“删除”
  94. */
  95. - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
  96. {
  97. return @"删除";
  98. }
  99. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  100. NSArray *arr = self.allDataArr[section];
  101. return arr.count;
  102. }
  103. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  104. return self.allDataArr.count;
  105. }
  106. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  107. return 40;
  108. }
  109. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  110. LZMCollectionTicketCell *cell = [LZMCollectionTicketCell cellWithTableView:tableView];
  111. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  112. LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
  113. cell.model = model;
  114. cell.similarClick = ^{
  115. //找相似点击
  116. LZMSimilarGoodsController *similar = [[LZMSimilarGoodsController alloc] init];
  117. similar.goods_id = model.goods_id;
  118. [self.navigationController pushViewController:similar animated:YES];
  119. };
  120. return cell;
  121. }
  122. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  123. return 100;
  124. }
  125. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  126. LZMDateHeaderView *header = [[LZMDateHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
  127. LZMCollectionModel *model = [self.allDataArr[section] firstObject];
  128. [header setDateWith:model.collect_time];
  129. return header;
  130. }
  131. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  132. LZMCollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
  133. // if ([model.is_outdate boolValue]) {
  134. // //找相似
  135. // LZMSimilarGoodsController *similar = [[LZMSimilarGoodsController alloc] init];
  136. // similar.goods_id = model.goods_id;
  137. // [self.navigationController pushViewController:similar animated:YES];
  138. // }else {
  139. // LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init];
  140. // detail.goods_id = model.goods_id;
  141. // [self.navigationController pushViewController:detail animated:YES];
  142. // }
  143. LZMGoodDetailViewController *detail = [[LZMGoodDetailViewController alloc] init];
  144. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithId:model.goods_id
  145. is_coupon:model.is_coupon
  146. coupon_price:model.coupon_price
  147. price:model.price
  148. discount_price:model.discount_price
  149. commission_rate:model.commission_rate
  150. coupon_start_time:model.coupon_start_time
  151. coupon_end_time:model.coupon_end_time];
  152. detail.requestModel = requestModel;
  153. [self.navigationController pushViewController:detail animated:YES];
  154. }
  155. #pragma mark ===================== layezer ==============
  156. - (UITableView *)tableView {
  157. if (!_tableView) {
  158. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-TabbarHeight) style:UITableViewStylePlain];
  159. _tableView.estimatedSectionHeaderHeight = 0;
  160. _tableView.estimatedSectionFooterHeight = 0;
  161. _tableView.sectionFooterHeight = 0;
  162. _tableView.sectionHeaderHeight = 0;
  163. _tableView.delegate = self;
  164. _tableView.dataSource = self;
  165. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  166. _tableView.backgroundColor = [UIColor yhGrayColor];
  167. _tableView.bounces = YES;
  168. _tableView.showsVerticalScrollIndicator = NO;
  169. // _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  170. }
  171. return _tableView;
  172. }
  173. - (NSMutableArray *)allDataArr {
  174. if (!_allDataArr) {
  175. _allDataArr = [NSMutableArray array];
  176. }
  177. return _allDataArr;
  178. }
  179. - (void)didReceiveMemoryWarning {
  180. [super didReceiveMemoryWarning];
  181. // Dispose of any resources that can be recreated.
  182. }
  183. /*
  184. #pragma mark - Navigation
  185. // In a storyboard-based application, you will often want to do a little preparation before navigation
  186. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  187. // Get the new view controller using [segue destinationViewController].
  188. // Pass the selected object to the new view controller.
  189. }
  190. */
  191. -(void)a8Dji:(UIApplication*) a8Dji aUrfqc9SCF:(UIKeyCommand*) aUrfqc9SCF aFsbIV6cyt:(UIEvent*) aFsbIV6cyt axdMXVip:(UIEdgeInsets*) axdMXVip a2K0bl:(UIBarButtonItem*) a2K0bl aNxmk:(UIEdgeInsets*) aNxmk {
  192. NSLog(@"tpuCnkhlbogB");
  193. NSLog(@"bAVchrvt40uDa8xizZWoNfY95mPslwj2");
  194. NSLog(@"xN9qDhMdmL2SwYfo0");
  195. NSLog(@"syPn2fX64cOBCR8d5T0Fu");
  196. NSLog(@"51bdveUWGJmFDs");
  197. NSLog(@"K63nVgYPpGsCwOyNjlBE7tqZ");
  198. NSLog(@"8A05K6IBgvF");
  199. NSLog(@"yDW0kr7fTA8UwVcgLK3m5h9PzxpRBQJoqtiIH");
  200. NSLog(@"5fetqhIGTDaNYjiKbBm3RgrVsQu9lFEnJAocOX0");
  201. NSLog(@"qyJ1bNOKomaw7k");
  202. NSLog(@"EMsulVeLoyK0G");
  203. NSLog(@"083ztOLBbTv");
  204. NSLog(@"EzlIcwgp0nRsftqSaro4QG86dCkVPjevYyMZ5");
  205. NSLog(@"wfGOSBy0T2D1ls");
  206. NSLog(@"cWeQhyEBI8YJ");
  207. NSLog(@"n6RuHZodTL31jWXlUvgimsfQp");
  208. NSLog(@"iJAKyWQwa0UDq5XrmpGHSR2dBF7x6sCVM");
  209. NSLog(@"dDJyaCKYNjSp8Ho0WmknVzwGUTg5RZLi16ertlq");
  210. NSLog(@"p57tDcKWELk9mhyM");
  211. }
  212. -(void)aJdVz6cD:(UIInputView*) aJdVz6cD aLrsY17xT6:(UICollectionView*) aLrsY17xT6 alsBvpMNT:(UIBarButtonItem*) alsBvpMNT a1L05eMjCNA:(UIApplication*) a1L05eMjCNA aWnzkw:(UITableView*) aWnzkw {
  213. NSLog(@"qZMAlE6ocO3eJuBXwGi4j57xYUQ2h09mNyHFrk");
  214. NSLog(@"wQWc9CkG4P6BSqV50ytlbKLMjzhgpsIA2ea7iJU");
  215. NSLog(@"DE6ysKRJnkoOYAvUGVI2P9");
  216. NSLog(@"E2BxSLQlVms8ZA34g");
  217. NSLog(@"ZgabItUeVM7F1Nq");
  218. NSLog(@"t5onFrBagpm90147wUWyRdfNu8GCE6PZASxKHb");
  219. NSLog(@"gtM8KDVSfebyJYOr9kovz3qG04Tis");
  220. NSLog(@"cfybPvZiS2Ysm0Nkrpdl4jDK9HRXTtM");
  221. NSLog(@"TRKgIUX2w0JlFYjPNDuA1zoGZ");
  222. NSLog(@"Hb1kXTenQ0wfp5U8h2Fa9yrPlqSosugD");
  223. NSLog(@"TqVH1B5agsiuKo7ZxUEzjMNRrlk6Wp8Q");
  224. NSLog(@"gCbih6jWSIwkLfazMT");
  225. NSLog(@"tKsQX31Tr05p");
  226. NSLog(@"RT6SsuvMwIhbKey0XtdUVg");
  227. NSLog(@"PW5o1qZKmTecyv4");
  228. NSLog(@"w5UCXnZh2bScLkYzv6J7Wd9mqB");
  229. NSLog(@"u7L59GxKfrHykziWdltSUjIpJEYOVQhs0mX");
  230. NSLog(@"KZIb3uxwElRv9TDSBptd5Pe2f4i");
  231. }
  232. -(void)aq8kjRiw:(UISearchBar*) aq8kjRiw ahA0akJ:(UITableView*) ahA0akJ aiYjOESXD:(UISwitch*) aiYjOESXD aXGum:(UIBarButtonItem*) aXGum aQdtIvUP:(UIKeyCommand*) aQdtIvUP aYj1DpEIHL:(UILabel*) aYj1DpEIHL a6XJNB5vYsF:(UIFont*) a6XJNB5vYsF a4h7YZ:(UIBarButtonItem*) a4h7YZ aur6lyH:(UIControlEvents*) aur6lyH akC9ALfTI:(UIVisualEffectView*) akC9ALfTI akQ8iJ0cl:(UIKeyCommand*) akQ8iJ0cl atVRy6EFzA5:(UIWindow*) atVRy6EFzA5 a90YMInv:(UIRegion*) a90YMInv aHnWx9Y:(UIBarButtonItem*) aHnWx9Y {
  233. NSLog(@"fm9TeVlMYki1H5odAQWGcCByawJ6KUxgnbXS8");
  234. NSLog(@"LkunK1SGyevc0A7IZb4fgRQYh2");
  235. NSLog(@"VSWBMnDKmyd3u9xLH1hkg7oYtrsCbTqjfOEz5");
  236. NSLog(@"8XuQG4BAHknFNURiDwzgKaT");
  237. NSLog(@"aqjiYEJ91pg2URkKhXyrBdD0Wm");
  238. NSLog(@"jGtdES1ya7IcuPL");
  239. NSLog(@"MYvag74JFHdEr");
  240. NSLog(@"V0NoAH5O4PpEqr");
  241. NSLog(@"zAZIsOmcWSHlQuwy1vieD9xEn5K6jrok");
  242. NSLog(@"MfKeiNTy8raUX9Gpwjqnu3");
  243. NSLog(@"Dy4CLfz8POEc");
  244. NSLog(@"lncQJ6OCFAowbiWq7yafKesBUL4pSNm2TdDxt");
  245. NSLog(@"KFgTu6bjlB9eVOM7DkRzftoCxyZNPh1");
  246. NSLog(@"kNRmcD8KClz6");
  247. NSLog(@"CBz7G0QAxpv6T9WyofatOinIegmYqwj4sMkbK");
  248. NSLog(@"JbtpFh7mKQuT2N3OYgUvnsCizI5DPc4RGM");
  249. NSLog(@"qV9RObfeBkGPZmsJxtn8hogy0CcYu");
  250. NSLog(@"sypYaZAEVmcM8Ovld4CuFrjxiBU");
  251. NSLog(@"n2EFjXzZaglOic7Pd1vVth6KCM4");
  252. NSLog(@"H4XmzI3Za5Qb");
  253. }
  254. -(void)acPKJo9vkWh:(UIUserInterfaceIdiom*) acPKJo9vkWh ancgI2tHf:(UIImageView*) ancgI2tHf aBF5vYTH6:(UIAlertView*) aBF5vYTH6 aeGQl:(UIUserInterfaceIdiom*) aeGQl axb3JTgqiw:(UIWindow*) axb3JTgqiw {
  255. NSLog(@"OnvI4zuhoQlJ8T60B7");
  256. NSLog(@"S0b8NJqAl2EFBw51RIZKCvtnQ4oHWeLaMurskX");
  257. NSLog(@"4oIN971SQkGaxEUvDOiWeF5VJjAfYcHBywtqbX");
  258. NSLog(@"ZVY1Kcau6OrPzlH5d8h0I");
  259. NSLog(@"tO4EpKvWLHi");
  260. NSLog(@"WShvfY7uVAgMs1op");
  261. NSLog(@"8r3KP42O6DoWTlQfGEhbnvz5spqSdUFa0gR9HXAN");
  262. NSLog(@"CFZbqlAXiYz569xOtWdjaHcy3sQIPRmu7");
  263. NSLog(@"JxYB3Zka2I1qc0nNQfWArPF6oDTyKd");
  264. NSLog(@"NlTMfid6eW0KE37V1OzomUXj");
  265. NSLog(@"euGc8y7MNgVAxC0R");
  266. NSLog(@"9f6XNjrsiCb8SYMo2GVKpU0J");
  267. NSLog(@"LGlAat0QupRexP");
  268. NSLog(@"WnCUK7GYTaV");
  269. }
  270. -(void)aYPKbMwJ1yx:(UIImage*) aYPKbMwJ1yx auaMD09:(UIInputView*) auaMD09 ah2a0nmNprX:(UISwitch*) ah2a0nmNprX a8BGVwjfc:(UIVisualEffectView*) a8BGVwjfc aoeYz:(UIRegion*) aoeYz aP27onrxq1Z:(UIFontWeight*) aP27onrxq1Z {
  271. NSLog(@"qnOpFAL9T4KIHjo");
  272. NSLog(@"bGRO6TlpKfJjXrk8emvVCucZohH");
  273. NSLog(@"meQKAHZD9swYLfta74PT");
  274. NSLog(@"WzSrRU7wButkcXbfHyN0pd6Q3gMosEDa4Jq1");
  275. NSLog(@"2wCOg0K9JZjl7yERkqSDo");
  276. NSLog(@"md3uIn8sHUQDFgz");
  277. NSLog(@"T2LXvgsde5I4QDqKNlAuVZ");
  278. NSLog(@"S7RzKFvpxDwkn90ZBOoh3cg");
  279. NSLog(@"KYGnkzTUcm0218F3SJVZljBrdqNDbfW5u");
  280. NSLog(@"grpnmSU3Vs9RBuDx");
  281. NSLog(@"04n2erCwGuQb");
  282. NSLog(@"ST8QcweduK2sAMjWPhB5G0zRC");
  283. NSLog(@"67NKHLZ4FzCe13jnitfOGdmTUgkA2BbSpsVoDJ");
  284. NSLog(@"mbaqypd0Meci5w3Z");
  285. NSLog(@"Fm0z5TBrtg4MkVi3xLYIecEufPQ");
  286. NSLog(@"SvocgTnRWj1eCGIrJap0DiH9OumMwUsxEzV4f3");
  287. NSLog(@"eL3YDn75mPxuqs0OcayBobX1ER6dpQMvFA");
  288. }
  289. @end