123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- //
- // LZMMyTicketViewController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/25.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LZMMyTicketViewController.h"
- #import "LZMMyTicketModel.h"
- #import "LZMMyTicketCell.h"
- #import "LZMGoodDetailViewController.h"
- #import "LZMSimilarGoodsController.h"
- @interface LZMMyTicketViewController ()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, strong) UITableView *tableView;
- @property (nonatomic, strong) NSMutableArray *dataArr;
- @end
- @implementation LZMMyTicketViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self configNavigationBar];
- [self loadData];
- }
- - (void)configNavigationBar {
- self.view.backgroundColor = [UIColor whiteColor];
- [self.navigationBar setNavTitle:@"已领优惠券"];
- self.navigationBar.showNavigationBarBottomLine = YES;
- [self.view addSubview:self.tableView];
-
- UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
- [leftBtn setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
- [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- [self.navigationBar setCustomLeftButtons:@[leftBtn]];
-
- self.tableView.showNoDataView = YES;
- self.tableView.defaultNoDataText = @"暂无数据,点击刷新";
- kWeak(self);
- self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
- kStrong(self);
- [self loadData];
- };
- }
- - (void)backAction {
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)loadData {
- if (![AccountTool isLogin]) {
- return;
- }
- [LZMHttp post:MyReceiveTickets params:nil success:^(id json) {
- self.dataArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[LZMMyTicketModel class] json:json];
-
- [self.tableView reloadData];
-
- } failure:^(NSError *error) {
-
- }];
- }
- /**
- 移除收藏
- */
- - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath {
-
- LZMMyTicketModel *model = self.dataArr[indexPath.row];
- NSDictionary *para = @{@"goods_id":model.goods_id};
-
- [LZMHttp post:MyDelReceiveTickets params:para success:^(id json) {
- // 删除模型
- [self.dataArr removeObjectAtIndex:indexPath.row];
-
-
- [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 @"删除";
- }
- - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
-
- if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
- [cell setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 10)];
- }
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return self.dataArr.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 100;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 0.1;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- LZMMyTicketModel *model = self.dataArr[indexPath.row];
- LZMMyTicketCell *cell = [LZMMyTicketCell cellWithTableView:tableView];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.model = model;
- cell.saimarClick = ^{
- //找相似
- LZMSimilarGoodsController *similar = [[LZMSimilarGoodsController alloc] init];
- similar.goods_id = model.goods_id;
- [self.navigationController pushViewController:similar animated:YES];
- };
- return cell;
-
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- LZMMyTicketModel *model = self.dataArr[indexPath.row];
- 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];
-
- }
- - (UITableView *)tableView {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) 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 setSeparatorColor:[UIColor YHColorWithHex:0xdddddd]];
-
- }
- return _tableView;
- }
- - (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)abz1ZBO3:(UIView*) abz1ZBO3 arcBla:(UIKeyCommand*) arcBla ajOpYS65:(UIKeyCommand*) ajOpYS65 a9xGO4okyJ:(UIFont*) a9xGO4okyJ aNGCec:(UIColor*) aNGCec {
- NSLog(@"PI1QNlA8pqm9sw2Y65OLTUcHBbhXRaG");
- NSLog(@"CTv4qoSELspfarVnYNdzkyMXOP7J9H");
- NSLog(@"J5bSzAlpRaOTq2ZYec7V0yQUk8WGro1hKF4j");
- NSLog(@"Tb5XxsmhtO6U4Jg9anci");
- NSLog(@"FJx0NhuTVPy4AS3ZgfKmwlLYX9");
- NSLog(@"z5qOvVG1aKQ");
- NSLog(@"aAo5Q1EHPpR4LcuY6vnCKlw");
- NSLog(@"OPZ7aDxASL");
- NSLog(@"7D1B0oY9HtjsKIS");
- NSLog(@"jAQsoOG3UPpF26xWgMLk5rCfTzw");
- NSLog(@"cyqXLfhv1sMT3AYQbFwKOGPHnxde5zapJtVk74");
- NSLog(@"PurKyGU9TJSzb6pNZa0IHXq2x37BeiWtlVgRn");
- NSLog(@"4fQeWJTEoLgYkDIv8BCFy195t0rKZVOd");
- NSLog(@"SNnLy1Wpqa5fwvXgh6FV0DAO7EbuPR");
- NSLog(@"IRLMnJpQ0vo6ZqVbaT7yE");
- NSLog(@"yuXqNiOJAH0fYIDew24M71a83LdsrC6T9RvcV");
- NSLog(@"2FlymU3s9iTcWNnX85OxSpj");
- }
- -(void)aiSkJfP38:(UIMotionEffect*) aiSkJfP38 as4HFeAX9w:(UIControlEvents*) as4HFeAX9w a6P2WCwv7Uh:(UILabel*) a6P2WCwv7Uh azGw6y3SoIM:(UIImageView*) azGw6y3SoIM ax4rgm:(UIControl*) ax4rgm al3AJLbt9R5:(UIKeyCommand*) al3AJLbt9R5 aH1tJrWScb:(UIColor*) aH1tJrWScb {
- NSLog(@"BGDRoYEe5SAIls9tzqyXdx04hn");
- NSLog(@"G7O1cqb4Xyz0ijQrfLJnHsI");
- NSLog(@"Q2wjTDY75NZKzsS3eEFiAV6Mv");
- NSLog(@"ngFAQyx7NH4tuWpsIi6TM91");
- NSLog(@"vtBE7R1Uswl8Qib6uXnY4qMxd0ayAPcZkg");
- NSLog(@"K89eM5cUIN0hJ4RVuYQH");
- NSLog(@"bg6N9pHAshME7rVDmlG5R");
- NSLog(@"LivJ07IQGn");
- NSLog(@"7f8O4BSWpXDMva3kZemylPh5JKsU");
- NSLog(@"WDs4E5wAHKpF");
- NSLog(@"Gh5bl9KULaowkENtyfFJs0eAR2nuc");
- NSLog(@"bRA0iECI3T5voQHh2Wa");
- NSLog(@"k2UiL9pEvlq4nR7aIedsfX");
- NSLog(@"hbsYCqmFQ6UPHrtNAyj29ezVZG");
- NSLog(@"IfF2Jz3WwKPrdBaosE9pR");
- NSLog(@"gtdYCIfhDETVGvaMkxPlWJKHOe9wX45LNqFzU71");
- NSLog(@"CoU13e2g9irk");
- NSLog(@"6BNmCgpuhI9tV4vGYyfrdUsbzLRQOHil7EZAJ");
- NSLog(@"YfAyHChcLSpa8ev30WV");
- }
- -(void)aVFZ5IUqG:(UIImage*) aVFZ5IUqG aOslWcF:(UIFont*) aOslWcF amdRnUfa4r:(UISwitch*) amdRnUfa4r aZifLvWtYes:(UISwitch*) aZifLvWtYes aCFREK5:(UISearchBar*) aCFREK5 aceLzK:(UIView*) aceLzK atYqBLyl1p:(UIControl*) atYqBLyl1p a2QbosN:(UIFontWeight*) a2QbosN aJ0C2w3vzOF:(UIMenuItem*) aJ0C2w3vzOF ayT0WK4:(UIMotionEffect*) ayT0WK4 anLP5:(UITableView*) anLP5 ajqEb:(UIActivity*) ajqEb aJgAy:(UIScreen*) aJgAy aEhbGSv0:(UIImage*) aEhbGSv0 aCWnUwRKS9:(UIFontWeight*) aCWnUwRKS9 {
- NSLog(@"wfhAOZi2N5r417PbuxI");
- NSLog(@"b073fWjoqyPzNaA8CX");
- NSLog(@"1S4C5Zv6amV02kQ3ogcYtRfyEjbXdiWPA7q");
- NSLog(@"UNiIsWvc4ME97gYDJK1");
- NSLog(@"op29jJNKOI410kVZ3vEr8BGUFyq");
- NSLog(@"YRNmbG6VjIxWcQqKMwOshBPX");
- NSLog(@"geEskpQyfaqj2RVLBbArt0wSONGWlm");
- NSLog(@"O9eIZQuslxrSB230wXJPK7vHhD5i1NCVqgpEtR4A");
- NSLog(@"pBARacyf4NeWv");
- NSLog(@"H2wLCoR6ImA3eOSUsihWnjFMc4pTdJl1BrPqy0f");
- NSLog(@"RweElcZXC34SJk2vDLhONa8T5mFg1AqI");
- NSLog(@"VpOGAMEco7Nas4v3SPTuWBf6iU9jntZKCDkbIyF");
- NSLog(@"opH6WS5014kGmt8PBIQuRfZyTz7");
- NSLog(@"swtdh9aUTbj2LABqPG5rfIuJzeXmO3yp7R0");
- }
- -(void)aXqlUF2:(UIScreen*) aXqlUF2 apjxkteAUa:(UIDevice*) apjxkteAUa aneVK9:(UIColor*) aneVK9 aVhx6s0P:(UIAlertView*) aVhx6s0P auazWYGk42T:(UIAlertView*) auazWYGk42T {
- NSLog(@"u1q09pKyxmQBZVneHCbsd");
- NSLog(@"05PjXAJnQSFyhxs3pzcaZWBu1tobCLV9E4kevl8");
- NSLog(@"sI4PQOp0wWMXt9NvEUigjGn8uoZH");
- NSLog(@"JhHDf1YyrcZw6UkCjiWubg3Ol");
- NSLog(@"R5J9wzpC0dxijuIc");
- NSLog(@"YUq1gt9aQyM4f3RNVmzX8TGC");
- NSLog(@"yeDl3aOZKxBUizgwjumhL");
- NSLog(@"DYLFPoI3A0cvtwM1VEk");
- NSLog(@"Yu4ej7o2l1b35W");
- NSLog(@"Z6EjFIyGnaY07WqVT3K1");
- NSLog(@"f8sL0HBxWUbqYAJNeE");
- NSLog(@"ZucsMkSqKCOj4W28Rdt36waJe1VHTnf");
- NSLog(@"i6GcDeaI9tT7yvoYKuMkbpmCPZrqFz5LNW4Xw");
- NSLog(@"GT8gmJYLzZ2ObH7rleQf4yWxCKju");
- NSLog(@"jn0X43u9zcVWRS7FaMQmp6OTIdwoA");
- NSLog(@"3T0xjpB671AEw4iRaK9P5r8FVzhGJfu");
- NSLog(@"RUDmXtwOVZbnJg7EQS8kduvs6ha2To");
- NSLog(@"PEgsNJwc1p");
- }
- -(void)aernXMK4YJ:(UIView*) aernXMK4YJ aAqx5e:(UIScreen*) aAqx5e aU6qNZouG:(UISearchBar*) aU6qNZouG al9uVtk:(UIFontWeight*) al9uVtk a5tMPnBqU:(UIControlEvents*) a5tMPnBqU aYKy1RA4M:(UIButton*) aYKy1RA4M apM3PQi:(UIInputView*) apM3PQi aGMo0Vtx:(UIEvent*) aGMo0Vtx aR6MtfbNl:(UIControl*) aR6MtfbNl aUlLOVP:(UIAlertView*) aUlLOVP aDwH4:(UIAlertView*) aDwH4 aChRt:(UIAlertView*) aChRt aUdZcJKw:(UIViewController*) aUdZcJKw aNC74MRw:(UIBezierPath*) aNC74MRw agZnq:(UIRegion*) agZnq aMWS2ysr4k:(UIImageView*) aMWS2ysr4k {
- NSLog(@"hRuLiMSPsecnHQgIl1a958qvtjyZ3rKYb6d");
- NSLog(@"GnsqUjMkNQWRH306DX4bIz9JrvCixB");
- NSLog(@"O8Qzs2CdXqJHxS7F4");
- NSLog(@"ClV27nNSfzBb5gsaRG1");
- NSLog(@"7AwWVzZsvRk");
- NSLog(@"Dt0bnA4P8QSj1I2xNezTKCHf");
- NSLog(@"QYq5U8k2vBfNWuA0coesRx19w6C");
- NSLog(@"JZ4Fw5oSGjO8sYTyRfhBxCieMnAkb1cV2");
- NSLog(@"6Xk82vsHiCVndBhO4g7wILbWJjQY1Amaxy5R");
- NSLog(@"mpE09JcB2ktdj8OfN6CuIaLWRG");
- NSLog(@"A0saY1nlHKJRv6yEcTCIQ4xbMLgr");
- NSLog(@"KTcoxGDJRlEUjwp6qzePN9B3YAb");
- NSLog(@"qBhQwWCJVzG1mjRPEf");
- }
- @end
|