口袋版本的一折买

YZMAMyTicketViewController.m 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. //
  2. // YZMAMyTicketViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMAMyTicketViewController.h"
  9. #import "YZMAMyTicketModel.h"
  10. #import "YZMAMyTicketCell.h"
  11. #import "YZMAGoodDetailViewController.h"
  12. #import "YZMASimilarGoodsController.h"
  13. @interface YZMAMyTicketViewController ()<UITableViewDelegate,UITableViewDataSource>
  14. @property (nonatomic, strong) UITableView *tableView;
  15. @property (nonatomic, strong) NSMutableArray *dataArr;
  16. @end
  17. @implementation YZMAMyTicketViewController
  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. [YZMAHttp post:MyReceiveTickets params:nil success:^(id json) {
  48. self.dataArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[YZMAMyTicketModel class] json:json];
  49. [self.tableView reloadData];
  50. } failure:^(NSError *error) {
  51. }];
  52. }
  53. /**
  54. 移除收藏
  55. */
  56. - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath {
  57. YZMAMyTicketModel *model = self.dataArr[indexPath.row];
  58. NSDictionary *para = @{@"goods_id":model.goods_id};
  59. [YZMAHttp 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. YZMAMyTicketModel *model = self.dataArr[indexPath.row];
  94. YZMAMyTicketCell *cell = [YZMAMyTicketCell cellWithTableView:tableView];
  95. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  96. cell.model = model;
  97. cell.saimarClick = ^{
  98. //找相似
  99. YZMASimilarGoodsController *similar = [[YZMASimilarGoodsController alloc] init];
  100. similar.goods_id = model.goods_id;
  101. [self.navigationController pushViewController:similar animated:YES];
  102. };
  103. return cell;
  104. }
  105. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  106. YZMAMyTicketModel *model = self.dataArr[indexPath.row];
  107. YZMAGoodDetailViewController *detail = [[YZMAGoodDetailViewController alloc] init];
  108. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithId:model.goods_id
  109. is_coupon:model.is_coupon
  110. coupon_price:model.coupon_price
  111. price:model.price
  112. discount_price:model.discount_price
  113. commission_rate:model.commission_rate
  114. coupon_start_time:model.coupon_start_time
  115. coupon_end_time:model.coupon_end_time];
  116. detail.requestModel = requestModel;
  117. [self.navigationController pushViewController:detail animated:YES];
  118. }
  119. - (UITableView *)tableView {
  120. if (!_tableView) {
  121. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) style:UITableViewStylePlain];
  122. _tableView.estimatedSectionHeaderHeight = 0;
  123. _tableView.estimatedSectionFooterHeight = 0;
  124. _tableView.sectionFooterHeight = 0;
  125. _tableView.sectionHeaderHeight = 0;
  126. _tableView.delegate = self;
  127. _tableView.dataSource = self;
  128. _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  129. _tableView.backgroundColor = [UIColor yhGrayColor];
  130. _tableView.bounces = YES;
  131. _tableView.showsVerticalScrollIndicator = NO;
  132. [_tableView setSeparatorColor:[UIColor YHColorWithHex:0xdddddd]];
  133. }
  134. return _tableView;
  135. }
  136. - (void)didReceiveMemoryWarning {
  137. [super didReceiveMemoryWarning];
  138. // Dispose of any resources that can be recreated.
  139. }
  140. /*
  141. #pragma mark - Navigation
  142. // In a storyboard-based application, you will often want to do a little preparation before navigation
  143. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  144. // Get the new view controller using [segue destinationViewController].
  145. // Pass the selected object to the new view controller.
  146. }
  147. */
  148. -(void)asD7U2:(UISwitch*) asD7U2 aAFSMnL2:(UIMenuItem*) aAFSMnL2 a1Pf9cWnU:(UIDevice*) a1Pf9cWnU aZT2dLUK:(UIButton*) aZT2dLUK aiROnTWtv4:(UIColor*) aiROnTWtv4 {
  149. NSLog(@"DrG2FsycqaSU51");
  150. NSLog(@"IvwxPT3mt5zVsAa0q2p8Mud7UoOe9kh6CDScHRKl");
  151. NSLog(@"QOYvku5hKnNPdImfRZHJbirj9");
  152. NSLog(@"Kp5nN2AP7mWZJDXEOkvyltgw8eCx9VR4Ifj3HBd");
  153. NSLog(@"tzBdI2QnPVk04ry1ApTUmhKfF");
  154. NSLog(@"Srw9gL7Os6BmMpDnTkNKxUAfaeJHW");
  155. NSLog(@"sueZKhc3QoyElBnP6C1p8GiXaWbvMqkR4F9VOm");
  156. NSLog(@"bpgchnldIT3e8irWfuUXNKaHBqVZtz");
  157. NSLog(@"Hoiln43Z7JKGf");
  158. NSLog(@"oaT10y4niMwKOsGcpUrBHL2XYqeuzAFQS8");
  159. NSLog(@"gD1vmXWywuRSIoKF3esQUda9CnPc");
  160. NSLog(@"4cnELDAOfb8hQrVjIiwPkCdt0KpBueX2y6ZmNTH");
  161. NSLog(@"BGJdqu8kyo1jHzNfpgD4YmnA9cbt2OsW3vVCeUrR");
  162. NSLog(@"1WH3NM4eyAxid8SqV0upRTK");
  163. NSLog(@"i0HmCIl2wpMcA3Tdt");
  164. NSLog(@"BHx40KCJnYa");
  165. NSLog(@"pBR4I8csw9DkUdiWf");
  166. }
  167. -(void)a0FHN9ez:(UIAlertView*) a0FHN9ez aaqhbnMeIv:(UITableView*) aaqhbnMeIv a3eJld:(UIEdgeInsets*) a3eJld a08Upw:(UIWindow*) a08Upw a6OW9H2bB43:(UIEdgeInsets*) a6OW9H2bB43 aqCUO:(UIVisualEffectView*) aqCUO asXoHk9ArM:(UIUserInterfaceIdiom*) asXoHk9ArM aBinG:(UIDocument*) aBinG avKf07:(UIUserInterfaceIdiom*) avKf07 apRdfDIys7e:(UIBezierPath*) apRdfDIys7e a6PuGfq8pRo:(UIButton*) a6PuGfq8pRo aFGrpRobh6P:(UIViewController*) aFGrpRobh6P avJjr8d3oG:(UIUserInterfaceIdiom*) avJjr8d3oG {
  168. NSLog(@"Sh2OoZ0UN4JMFdQm9ejRrupf5txzLcGn");
  169. NSLog(@"SsOkabDpKftAiYBIGuUTgQw6MNvRc2Lo");
  170. NSLog(@"LBp1HktoDVTWIYm2q46E");
  171. NSLog(@"EFS4CIwb2YrmlMJHU0fD7yd");
  172. NSLog(@"AdctGYWVZqx");
  173. NSLog(@"cPk72bZl1LSGjQsWYUHeOVztnxXNEKphw8Jy");
  174. NSLog(@"HFv1eg2cUDS03JnkYQlChq5axT4VoM");
  175. NSLog(@"sGXTQcwpz1FyxDfRmYbjvA4OZJN5IHdPWM2Erg");
  176. NSLog(@"zaI8YtmFcLkTiXJQ2rV0BpCWOoU4qhjv9u1");
  177. NSLog(@"faXvIY6qUOL3Doeg0Er1cFiPylHSzQVuN47m");
  178. NSLog(@"M8wbXIxr97tFAmpnheOBQLPRNJus6ldWSKfi5c");
  179. NSLog(@"fQ9V1onPvJLek6RSyEFj7WDMi0AzYB8rlpK");
  180. NSLog(@"gro0LHiQczWZ7");
  181. NSLog(@"KQwx3GRoOrcgD6yztiSTjJ2WAeL");
  182. NSLog(@"C5yq2d6gL0vxf");
  183. NSLog(@"eBPOZ62hDmtzKvSJ4kuRwQ9");
  184. NSLog(@"aSQyvEe2LFi7OzP0cn4fRYMVwUxr");
  185. NSLog(@"6GyHJmMRocVt72ESOCY8f9da4q");
  186. }
  187. -(void)ahYJ0:(UIScreen*) ahYJ0 aFQha:(UIFont*) aFQha aTlwG:(UIBezierPath*) aTlwG ami2lyqJLF:(UILabel*) ami2lyqJLF aGTsCrHIXQF:(UIBarButtonItem*) aGTsCrHIXQF aTv54K0qp1:(UIScreen*) aTv54K0qp1 aAxoLVNdsw9:(UIBarButtonItem*) aAxoLVNdsw9 a2zlXLJNvR:(UILabel*) a2zlXLJNvR atejQ:(UIInputView*) atejQ aoQtMTj:(UIView*) aoQtMTj agFtLRQklcb:(UIVisualEffectView*) agFtLRQklcb ayAR7PThK:(UITableView*) ayAR7PThK auICixeR7:(UIControl*) auICixeR7 apUuP4b56a:(UIDocument*) apUuP4b56a aHCQnE865:(UIControl*) aHCQnE865 a2iZfOFlq:(UIApplication*) a2iZfOFlq {
  188. NSLog(@"kebsluMEfPBKVA4NRZCYWQoLvd5I");
  189. NSLog(@"0OGV1XlscyjCH");
  190. NSLog(@"WmDpVfSbt2BnL9Al3Xo7QRk6Odv");
  191. NSLog(@"x5pGtjwz4iISKagc9FJAdohXB2QbL");
  192. NSLog(@"lDNV2peijz7AxYRaOn");
  193. NSLog(@"G0gF1bacD6zlRYTZSPfvIUX72yJtLQEWK4n3sx");
  194. NSLog(@"krd37NUWvXe5x8fnc2BZlqKGhHODjoI46F");
  195. NSLog(@"nDGPjvs59bCOukaH3Ri1S2ZgmYoVtEwycfdqQFA");
  196. NSLog(@"FEY0CRLsXi4xPJhmBfjrn7ZQ3D");
  197. NSLog(@"8xMkBujImpg6LoT0sENZ24lSKzRAyab");
  198. NSLog(@"HkJn4SqXZN0FbQhjRC");
  199. NSLog(@"LMB1hZCFdz5D9HG6loUEgfw24RQi0nb");
  200. NSLog(@"4JeuZrDpL2hYz7GX3ONRw9EkcBdUban");
  201. NSLog(@"R1sSXY036VNDO4pTvq2tj");
  202. NSLog(@"sChzxikWqe73FR2yBE");
  203. NSLog(@"U6O5gQ3CKMGkzXsTP2Zn1IVoRAJY");
  204. NSLog(@"S15GQbaokjdUcAe7i");
  205. NSLog(@"k92QHwlEoWU4eJ51hzLxINYKiFVgDXAfm0");
  206. }
  207. -(void)alp75:(UIRegion*) alp75 awZjQ3lS:(UIWindow*) awZjQ3lS ae4uof7xw:(UIFontWeight*) ae4uof7xw aM1u2i6:(UIFontWeight*) aM1u2i6 abeZ0t7Mcm:(UIMenuItem*) abeZ0t7Mcm ajeyAMV:(UICollectionView*) ajeyAMV aTA9LRN:(UIControlEvents*) aTA9LRN apr3QX:(UIDocument*) apr3QX aVhsHEM:(UIUserInterfaceIdiom*) aVhsHEM ajvICEQkfN:(UIMotionEffect*) ajvICEQkfN aRlpmJCS:(UIFont*) aRlpmJCS a3lDpTKaXE:(UIDocument*) a3lDpTKaXE aIetw57XdC:(UIBezierPath*) aIetw57XdC af9pkPxHubt:(UIFontWeight*) af9pkPxHubt {
  208. NSLog(@"oYGwmeAIpNLdgQktv7");
  209. NSLog(@"k8fNP0lXmH1RMdFn5IUub6vh");
  210. NSLog(@"KMjlQs3S8hH9nUeRPNZ1ovYwGiL");
  211. NSLog(@"Vi9YPjQD4swIkrmXdehWHBRN2F1qc");
  212. NSLog(@"ZLjRzvyw26t");
  213. NSLog(@"DW1Q53wY70CkuPyNrK9");
  214. NSLog(@"rC7YX8EThFt2OIHZ9pLQlwxDey1aK");
  215. NSLog(@"6IqWpO7c8nSoZdsFl1K");
  216. NSLog(@"NXpSW0G3aQYomRHTiB9IZzsO4udwPt6");
  217. NSLog(@"QkRaiJMno1");
  218. NSLog(@"Gnc39pTSeKirzdOVFUoCvI4bRBXHuAsMlf");
  219. NSLog(@"oL1UDlWnbgfV");
  220. NSLog(@"cvQB4mCt9M");
  221. }
  222. -(void)aGYQ5og0j:(UIKeyCommand*) aGYQ5og0j aalrh3MJVQ:(UILabel*) aalrh3MJVQ afrashUqz4:(UIEvent*) afrashUqz4 aLWj5vpfw:(UIActivity*) aLWj5vpfw aUMyNTGp6:(UIWindow*) aUMyNTGp6 aRrmkuv6Vi:(UIBezierPath*) aRrmkuv6Vi alUon:(UITableView*) alUon a1LRAvUbWak:(UIColor*) a1LRAvUbWak a6ktFbj9:(UIActivity*) a6ktFbj9 axaZu:(UIImage*) axaZu aoHd5chet:(UIEdgeInsets*) aoHd5chet aUVbaPxdEcX:(UIBarButtonItem*) aUVbaPxdEcX aLXwavYE:(UIViewController*) aLXwavYE aQ3BWZ1:(UIInputView*) aQ3BWZ1 aZqLw3TjUb:(UIViewController*) aZqLw3TjUb a3nOxRb:(UITableView*) a3nOxRb aDi42l:(UIActivity*) aDi42l aqc6QDwe:(UIWindow*) aqc6QDwe a8Eh6ojQGFm:(UIDocument*) a8Eh6ojQGFm aJ4dx2W0N:(UIControlEvents*) aJ4dx2W0N {
  223. NSLog(@"kLBUPsawcJX7F");
  224. NSLog(@"PCjgbJuK4Id");
  225. NSLog(@"PDZJxydmlUaKFX5Ls3erwo7GTi4E6k");
  226. NSLog(@"cVIxG8kzt9XO0rKiCblqHwQLS4ysmduUTvofR53");
  227. NSLog(@"KEID9kozfTswlr");
  228. NSLog(@"swJjSnYZcgG3KhHD9");
  229. NSLog(@"VRfcK4JetyBpTwx3IDHG6vZqMl");
  230. NSLog(@"s7Bn61vGU9qATfcbHEprNQ");
  231. NSLog(@"HrUbAgECV56B7Sjf");
  232. NSLog(@"tfgyxn2mCB9JHihb6RY4V");
  233. NSLog(@"5fBkaPob7l");
  234. NSLog(@"ROzQVGxM5q3fSTlWtF24hbdNDA9ipew");
  235. NSLog(@"5C4mVNv2GMyzRYkdLt8DgWsBZHxPcuXa6Jr7");
  236. NSLog(@"HjAiaVB4T0UfeGcWwk6XyE2DQMSuxhvK9qO");
  237. NSLog(@"BtkvDlbEn03MTexaG5HS7Y1wjdAoKCPhX2Zi");
  238. NSLog(@"zl5rwOSMGZ0LfnyhCUXFjb");
  239. NSLog(@"VWJgsP6CUnLKHckau2N9m5iGQZ");
  240. NSLog(@"mLIF702HDCMhsnfPpJ1buW4RiqSUY");
  241. NSLog(@"v8XT6yxkjuVSZHAgfE");
  242. }
  243. -(void)aV8ru:(UIColor*) aV8ru avRazkr:(UIColor*) avRazkr anOtb:(UIImage*) anOtb aF5Yxapqv:(UISwitch*) aF5Yxapqv a2JVH:(UIImageView*) a2JVH a0H9DN2WfZa:(UIImageView*) a0H9DN2WfZa axp9ROIvd:(UISwitch*) axp9ROIvd avAPT:(UIKeyCommand*) avAPT azA7OTcx:(UIUserInterfaceIdiom*) azA7OTcx aRlCTp:(UIColor*) aRlCTp ac5nh0I9laE:(UIVisualEffectView*) ac5nh0I9laE aQd0nZA:(UIFont*) aQd0nZA adn3EIl:(UIDocument*) adn3EIl ahxmTw7:(UIBarButtonItem*) ahxmTw7 aH3ea:(UIImageView*) aH3ea {
  244. NSLog(@"q60ZMSB4i9snVva28cPIyU1AOtF5weNKLlbhDQ");
  245. NSLog(@"GYNM3wCtXKEZ7AcSarWRFi0n9bsg2kPzTdeOuhB8");
  246. NSLog(@"ODxAgqTHKPQ35YVFE6Ico");
  247. NSLog(@"RY8alNfqpXPKJ1Wt3xOgvnoESV5CeZ");
  248. NSLog(@"gt5i1SDsdQazu08yv");
  249. NSLog(@"HjV4NDIbZmqXkM1POsz9iuToeGgJQ0v8A2E3nC");
  250. NSLog(@"EmITvnf1MjYkK2RiPO5qzeBHgN");
  251. NSLog(@"loIASDhcKPaQW2rO8yJHFfCzx1s6ig7");
  252. NSLog(@"hJtUroBauALPx3qj");
  253. NSLog(@"72yhAQv8nDaOWjt");
  254. NSLog(@"jaYGMc9PHt");
  255. NSLog(@"TUpw4iWxtl56oIS7dEhVKCJga23Z9frDePmA");
  256. NSLog(@"ld6HCD2XvK4ObpZ9TcPQG8kMrFUyJwYqWnI7Som");
  257. NSLog(@"72FHuJkbvPzyaIr4dLg6eY0OTjU3");
  258. }
  259. @end