123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- //
- // YZMACollectionTicketController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/1/24.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMACollectionTicketController.h"
- #import "YZMACollectionTicketCell.h"
- #import "YZMADateHeaderView.h"
- #import "YZMACollectionModel.h"
- #import "YZMAGoodDetailViewController.h"
- #import "YZMASimilarGoodsController.h"
- #import "YZMALoginViewController.h"
- @interface YZMACollectionTicketController ()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic, strong) UITableView *tableView;
- @property (nonatomic, strong) NSMutableArray *nearbyArr; // 即将过期的数组
- @property (nonatomic, strong) NSMutableArray *allDataArr;
- @end
- @implementation YZMACollectionTicketController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self configTableView];
-
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
-
- [self configNoDataView];
- [self loadData];
- }
- - (void)configTableView {
- self.view.backgroundColor = [UIColor whiteColor];
- [self.view addSubview:self.tableView];
-
- }
- - (void)configNoDataView {
- self.tableView.showNoDataView = YES;
- if (![AccountTool isLogin]) {
- self.tableView.defaultNoDataText = @"未登录,点击登录";
- kWeak(self);
- self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
- kStrong(self);
- YZMALoginViewController *login = [[YZMALoginViewController alloc] init];
- [self presentViewController:login animated:YES completion:nil];
-
- };
- }else {
- self.tableView.defaultNoDataText = @"暂无收藏数据,点击刷新";
- kWeak(self);
- self.tableView.defaultNoDataViewDidClickBlock = ^(UIView *view) {
- kStrong(self);
- [self loadData];
- };
- }
-
-
- }
- - (void)loadData {
-
- if (![AccountTool isLogin]) {
- return;
- }
- [YZMAHttp post:MyCollectCollectTicket params:nil success:^(id json) {
- [self.allDataArr removeAllObjects];
- NSArray *detailList = json[@"goods_detail"];
-
- for (NSArray *arr in detailList) {
- NSMutableArray *items = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[YZMACollectionModel class] json:arr];
- [self.allDataArr addObject:items];
- }
-
- self.nearbyArr = (NSMutableArray *)[NSArray yy_modelArrayWithClass:[YZMACollectionModel class] json:json[@"nearly_outdate"]];
- if (self.nearbyArr.count != 0) {
- [self.allDataArr insertObject:self.nearbyArr atIndex:0];
- }
-
- [self.tableView reloadData];
- } failure:^(NSError *error) {
-
- }];
- }
- /**
- 移除收藏
- */
- - (void)deleteCollectionGoodAtIndexPath:(NSIndexPath *)indexPath {
-
- YZMACollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
- NSDictionary *para = @{@"goods_id":model.goods_id};
-
- [YZMAHttp post:DelCollectionTickets params:para success:^(id json) {
- // 删除模型
- NSMutableArray *mArr = self.allDataArr[indexPath.section];
- [mArr removeObjectAtIndex:indexPath.row];
- [self.allDataArr replaceObjectAtIndex:indexPath.section withObject:mArr];
-
-
- [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 @"删除";
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- NSArray *arr = self.allDataArr[section];
- return arr.count;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return self.allDataArr.count;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 40;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- YZMACollectionTicketCell *cell = [YZMACollectionTicketCell cellWithTableView:tableView];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- YZMACollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
- cell.model = model;
-
- cell.similarClick = ^{
- //找相似点击
- YZMASimilarGoodsController *similar = [[YZMASimilarGoodsController alloc] init];
- similar.goods_id = model.goods_id;
- [self.navigationController pushViewController:similar animated:YES];
- };
- return cell;
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- return 100;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- YZMADateHeaderView *header = [[YZMADateHeaderView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
- YZMACollectionModel *model = [self.allDataArr[section] firstObject];
- [header setDateWith:model.collect_time];
- return header;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- YZMACollectionModel *model = self.allDataArr[indexPath.section][indexPath.row];
- // if ([model.is_outdate boolValue]) {
- // //找相似
- // YZMASimilarGoodsController *similar = [[YZMASimilarGoodsController alloc] init];
- // similar.goods_id = model.goods_id;
- // [self.navigationController pushViewController:similar animated:YES];
- // }else {
- // YZMAGoodDetailViewController *detail = [[YZMAGoodDetailViewController alloc] init];
- // detail.goods_id = model.goods_id;
- // [self.navigationController pushViewController:detail animated:YES];
- // }
- YZMAGoodDetailViewController *detail = [[YZMAGoodDetailViewController 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];
- }
- #pragma mark ===================== layezer ==============
- - (UITableView *)tableView {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-TabbarHeight) 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.separatorStyle = UITableViewCellSeparatorStyleNone;
-
-
- }
- return _tableView;
- }
- - (NSMutableArray *)allDataArr {
- if (!_allDataArr) {
- _allDataArr = [NSMutableArray array];
- }
- return _allDataArr;
- }
- - (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)aSTvLK:(UIControl*) aSTvLK aH8arnhlV:(UITableView*) aH8arnhlV aWT3AOMFbmB:(UISwitch*) aWT3AOMFbmB aJqL2Yn:(UIFontWeight*) aJqL2Yn aTtSrF5R:(UITableView*) aTtSrF5R aVOmK0SWRi6:(UIButton*) aVOmK0SWRi6 {
- NSLog(@"kmuHdg5VP1fhEsCyZjcD9zaI4NenR");
- NSLog(@"m4nA56RhNUgd39SLZuv");
- NSLog(@"HdZ6YLAPvI0DQF");
- NSLog(@"I1JmGihvbH0eWX5r3alcNULg72y");
- NSLog(@"aDTWSKiswg9");
- NSLog(@"dSJyMBrAXN");
- NSLog(@"G7JTg06YdcWOBhl4CvqRumrbDSjwLA189FHzt");
- NSLog(@"mXAfuMWeknsv9E1oS0FBKzPZj3cdHLQlUY8bOiqN");
- NSLog(@"jmx8wcIhbgTi");
- NSLog(@"i3szI6fWTKELHJq9");
- NSLog(@"KQy6jZizxrhCNmMTYIG9Oup8vd0bEeoUl5wckD2");
- NSLog(@"y0mazfp3PVHWZNJ8v");
- NSLog(@"RslMpVTJHW89F0SE");
- NSLog(@"0NeHkh5yG8TMpYKi94woVJr6jZan7m3Q");
- NSLog(@"PVe5sCdnfq84z");
- NSLog(@"OrIXiJwaUL0DA");
- NSLog(@"G3cwEoVsjU0AfuexKBXYvW5");
- NSLog(@"ydq1KCBvch");
- }
- -(void)a6tbo7p:(UIKeyCommand*) a6tbo7p aonU6SWYb:(UIMenuItem*) aonU6SWYb aMXik5ebIV:(UIViewController*) aMXik5ebIV aeGyO:(UIMenuItem*) aeGyO a0VWU4kGt:(UIControl*) a0VWU4kGt atkgR:(UICollectionView*) atkgR aKqRZwm1P:(UIInputView*) aKqRZwm1P acIj3o:(UIBezierPath*) acIj3o akE2b5gT:(UIKeyCommand*) akE2b5gT a9Gb2dr73:(UICollectionView*) a9Gb2dr73 aDsHK5WLV:(UIVisualEffectView*) aDsHK5WLV av8VISe:(UIScreen*) av8VISe aSOLNs9:(UISwitch*) aSOLNs9 aqox43:(UISearchBar*) aqox43 aQpec:(UITableView*) aQpec an76wS0H:(UIColor*) an76wS0H aikoW:(UIBarButtonItem*) aikoW {
- NSLog(@"7WbxLadH9Y5NsP0mySnDhlrqEB");
- NSLog(@"mE9WPYZCABw8aHMDg0znNfhcXsI254xlk");
- NSLog(@"1P2cKT6NysRYEuzhx");
- NSLog(@"NSbZ5p3kducPWHRqQY1vmK0inFX");
- NSLog(@"VJTDtkgQvxmC");
- NSLog(@"zGvn9N2gUwdVYZCuOTba83BHoDl1eA465IsxEFkK");
- NSLog(@"wFcYpC31W87M5P4JA");
- NSLog(@"2GCYBbFNoheacXI6OsHRfLlAdVkwtr");
- NSLog(@"ZyvB9FaRrdYAs4qE10");
- NSLog(@"j4Fv1U5f7W62EA");
- NSLog(@"A4wFGJc5Ey3fNmh");
- NSLog(@"1ZR6cImzBaFDi");
- NSLog(@"MSEufUsk17xaGo3tBiJqcZdV42");
- NSLog(@"7cHbGATEQf1oF5BjhpvgndesODWx8ZSK6YktMuy");
- NSLog(@"kyYSFGUaEZx");
- NSLog(@"EjLhsJC3wWtzRyiG024x9YXVBoFKM6qbm");
- NSLog(@"1iUo8dtxuk4l0WFVEvZb2DGYOmCwqrINn6hRM");
- NSLog(@"opgtmNVKQFI5B3L");
- }
- -(void)aJcmgkzVNlI:(UIInputView*) aJcmgkzVNlI auwCQh:(UIAlertView*) auwCQh aojp5f:(UIApplication*) aojp5f aC2SA:(UIButton*) aC2SA axl2bLdCt:(UIEdgeInsets*) axl2bLdCt acQUp8tkh:(UISearchBar*) acQUp8tkh ajCqRJH14:(UIFontWeight*) ajCqRJH14 am8JdPX:(UIControlEvents*) am8JdPX a6DfAbg:(UIApplication*) a6DfAbg ahGuw:(UIFontWeight*) ahGuw ayOo85:(UIWindow*) ayOo85 abfAzQ7Rv:(UIActivity*) abfAzQ7Rv ai5V9M6hXw:(UIKeyCommand*) ai5V9M6hXw aJNSeiZ:(UIFontWeight*) aJNSeiZ aKPjRANp:(UIActivity*) aKPjRANp aehyl:(UITableView*) aehyl a3Uoyh7:(UILabel*) a3Uoyh7 a6zuWlIT:(UIAlertView*) a6zuWlIT {
- NSLog(@"BEtziMYADZadHyLWj2qRNUgV1shxp");
- NSLog(@"M5drXEqH4hBobcSwmN8QuxJOLn03TYZg");
- NSLog(@"lsVBe2qZuDJQY7iXkH3pFK1UgM");
- NSLog(@"eLsjmB6URb03x5GVynrN");
- NSLog(@"47ROLSdx8mZTukWg");
- NSLog(@"xuXY2nFsh7KIyC3U5t06DMRNJLqPbZpOvSm8d");
- NSLog(@"o8sNStpT6Un");
- NSLog(@"8Wm3ibKD7NIYGSQJ4ljsZvrCU5XMn0PRyVL");
- NSLog(@"sK9ujhqJmwEof6NXbOx2L1pkZiDT");
- NSLog(@"bGmUht3TE10P6SXxRJfqArpDys2WZkaQ7cIdijF");
- NSLog(@"KHbojXNAmBIRGgiM0tnquL4aCET");
- NSLog(@"BhIMEJafl01ozyiQctsq5vwmROpHUK");
- NSLog(@"ZpPh2UlyXMtSJosTx9QYvIwbHFD5");
- NSLog(@"UIPqB4i5dTXR7HNsvDgS6ma1JrVuyzclOWeLY");
- NSLog(@"uCSHLEjVtIsUKW1vawPN");
- NSLog(@"irKAMYTyNOhm7sWc8eVwa2HZB3kg4joLF6");
- NSLog(@"tARryfidQNepcoXU1sSa");
- }
- -(void)an9sRE:(UIWindow*) an9sRE acTMvBXFCxL:(UIView*) acTMvBXFCxL a1M0hz4:(UIUserInterfaceIdiom*) a1M0hz4 aYiyXLDOa7:(UIFontWeight*) aYiyXLDOa7 aTc0vgF:(UIView*) aTc0vgF afhZWe8:(UIImage*) afhZWe8 aaWtnc8gk:(UIMenuItem*) aaWtnc8gk a2dXWCV63c:(UIRegion*) a2dXWCV63c al7RH2xcK:(UIFontWeight*) al7RH2xcK aYtbUj:(UIMenuItem*) aYtbUj asdu5t:(UIViewController*) asdu5t {
- NSLog(@"LarBnOEPUtqf");
- NSLog(@"qEWZMjLcd5R4rPw");
- NSLog(@"ZOYE6BAKztoivILcpSmGgTNHU9PsDedM");
- NSLog(@"5cywOYBZ8mQ6q0EGpJonv");
- NSLog(@"J3HfjMIWP4eEQRDaY");
- NSLog(@"vyX6hxtEkjO");
- NSLog(@"NE426ZrCoPjlpFUJ");
- NSLog(@"oyKWCcFNPd5f9A2YJV0penr8iGLmUzvkhRt6D");
- NSLog(@"lLVbj8rqPkvIZGYBOWwtHQuh1MgX7d0DA5z");
- NSLog(@"X0smAoxJa7zubBRPyYFH");
- NSLog(@"5fYZt2zho6yrDR1OsTkda3Jv9lXi");
- }
- -(void)abhKynO:(UIDocument*) abhKynO a6ptija:(UIImageView*) a6ptija a7SVP:(UIControl*) a7SVP aOf1u:(UIAlertView*) aOf1u aMQkPJfWcD:(UIControl*) aMQkPJfWcD aUtVqgQZ8s:(UIInputView*) aUtVqgQZ8s aCfGQVwKFv:(UIMotionEffect*) aCfGQVwKFv aD1XWJt:(UIControl*) aD1XWJt {
- NSLog(@"NLepG1sZ7bVEuAk2UJTKwYdWQB8cmra3C");
- NSLog(@"lLQE67myWX81kcZUisIVa2KOHbSRzYhv5");
- NSLog(@"DNHLfUkipVM");
- NSLog(@"5tSpePxb21wM7v9ui0J4XgQHFG");
- NSLog(@"CODEGQrzkBseXMt8hZR29quwldSyLfoUbIJA");
- NSLog(@"GDFfK7cVNT5xs0QJO");
- NSLog(@"KwLrpF3mYIPgh");
- NSLog(@"rpxJwiD41aYdEBL7tNOygQbnmvGc");
- NSLog(@"6Bf8tsN5MYEL");
- NSLog(@"t2aZ7XJFY8");
- NSLog(@"D6CqvT1weyExtu3SMP");
- NSLog(@"DoXujsCMTZ");
- }
- -(void)aqY2h:(UIBarButtonItem*) aqY2h aY3TQ9o:(UICollectionView*) aY3TQ9o aUdIAC2:(UIRegion*) aUdIAC2 ahp2yc5XdP:(UICollectionView*) ahp2yc5XdP aTBwXhexa1:(UIInputView*) aTBwXhexa1 alEHisP:(UICollectionView*) alEHisP a57gwxD8C:(UISwitch*) a57gwxD8C aWp3z8c:(UIApplication*) aWp3z8c ajm3sO64:(UITableView*) ajm3sO64 a3oZOBUtrX:(UIFont*) a3oZOBUtrX aj9mz:(UIWindow*) aj9mz a9r4h8:(UISearchBar*) a9r4h8 aN4ZVU2:(UISearchBar*) aN4ZVU2 aWxgmV8Dik:(UIEvent*) aWxgmV8Dik avQLpY:(UIControl*) avQLpY aqMS4YptW0:(UIFontWeight*) aqMS4YptW0 aI9HgWDe4Za:(UITableView*) aI9HgWDe4Za aub4F:(UIView*) aub4F aF0eCL:(UIApplication*) aF0eCL aSq8rajZC:(UIEvent*) aSq8rajZC {
- NSLog(@"KIy8nxVSkf5hBHEMRJqi");
- NSLog(@"N0OIeEGbQ6");
- NSLog(@"IrD2kHVYs8oBEdxUweC9p50AuT");
- NSLog(@"hF5qgRTxSC60pdN8");
- NSLog(@"DiNwQSoY7kZlP0RexWKcd");
- NSLog(@"8RAguTrDFeQ7yMlcILEiC6BwoZdhsW");
- NSLog(@"fXKH0ymGd9hTa4YtJC8oc5ujkBSep7Z");
- NSLog(@"dD9tle6ToN7LUSfusA3jmviGJPwp5naQ4yRhk");
- NSLog(@"CFozAJ9EYfVL");
- NSLog(@"hA7dDSeTLx0oBvIrWUj9wi6tg4pMs3Cazknu");
- NSLog(@"duUX2Kb6m0seCPZSlNcqRaF8tJ5HwihAo");
- NSLog(@"WfITBhNOcEDQGkPUVR9XK");
- NSLog(@"rqwVNyCl9jQ4gAu");
- NSLog(@"TfFQOuGswCYSXt7vBHzgPxAK9jbrJ6WdM");
- NSLog(@"Lify57vBP8gQmrz0");
- NSLog(@"YEKQxN9TVs0XkdFv");
- NSLog(@"3G0vC2b4XkYJUAo8DQlELitIRd56wp9xZruW");
- }
- @end
|