// // LZMGoodHorizontalCollectionCell.m // YouHuiProject // // Created by 小花 on 2018/5/3. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LZMGoodHorizontalCollectionCell.h" #import "DateFunction.h" @interface LZMGoodHorizontalCollectionCell () @property (nonatomic, strong) UIImageView *iconView; @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *endDateLabel; @property (nonatomic, strong) UILabel *endDateLabel2; @property (nonatomic, strong) UILabel *priceLabel; @property (nonatomic, strong) UILabel *disPriceLabel; @property (nonatomic, strong) UIImageView *ticketImg; @property (nonatomic, strong) UILabel *ticketLabel; @property (nonatomic, strong) UILabel *outTimeLabel; @property (nonatomic, strong) UIButton *sameButton; @property (nonatomic, strong) UILabel *ticketType; @property (nonatomic, strong) UIImageView *outDateImg; @property (nonatomic, strong) UIButton *cancelCollection; @property (nonatomic, strong) UILabel *commissionLabel; @end @implementation LZMGoodHorizontalCollectionCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; [self initSubView]; } return self; } - (void)initSubView { [self.contentView addSubview:self.iconView]; [self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.endDateLabel]; [self.contentView addSubview:self.endDateLabel2]; [self.contentView addSubview:self.priceLabel]; [self.contentView addSubview:self.disPriceLabel]; [self.contentView addSubview:self.ticketImg]; [self addSubview:self.cancelCollection]; [self.ticketImg addSubview:self.ticketType]; [self.ticketImg addSubview:self.ticketLabel]; [self.iconView addSubview:self.outTimeLabel]; [self.outTimeLabel addSubview:self.outDateImg]; [self.iconView addSubview:self.commissionLabel]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(15); make.width.height.mas_equalTo(100); make.top.mas_equalTo(10); }]; [self.commissionLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.height.mas_equalTo(20); }]; [self.outTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.mas_equalTo(0); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(10); make.left.mas_equalTo(self.iconView.mas_right).mas_offset(10); make.right.mas_equalTo(-10); }]; [self.endDateLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8); make.height.mas_equalTo(15); // make.right.mas_equalTo(-10); }]; [self.endDateLabel2 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8); make.height.mas_equalTo(15); // make.right.mas_equalTo(-10); }]; [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.bottom.mas_equalTo(-10); }]; [self.disPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.priceLabel.mas_right).mas_offset(5); make.centerY.mas_equalTo(self.priceLabel.mas_centerY); }]; [self.ticketImg mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.bottom.mas_equalTo(self.iconView.mas_bottom); make.width.mas_equalTo(64); make.height.mas_equalTo(14); }]; [self.ticketType mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.bottom.mas_equalTo(0); make.width.mas_equalTo(20); }]; [self.ticketLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(20); make.top.bottom.right.mas_equalTo(0); }]; [self.outDateImg mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(60); make.height.mas_equalTo(38); make.center.mas_equalTo(self.outTimeLabel.center); }]; [self.cancelCollection mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.mas_equalTo(self.mas_centerY); make.width.height.mas_equalTo(30); }]; } - (void)setCollectionModel:(LZMCollectionModel *)collectionModel { _collectionModel = collectionModel; //头像、标题 [_iconView sd_setImageWithURL:[NSURL URLWithString:collectionModel.img]]; self.titleLabel.text = collectionModel.title; self.outTimeLabel.hidden = ![collectionModel.isExpire isEqualToString:@"1"]; //过期时间 if ([collectionModel.isExpire isEqualToString:@"2"]) { int endCount = [DateFunction intervalSinceNow:collectionModel.coupon_end_time]; NSString *endDateStr = [NSString stringWithFormat:@"%d天后过期",endCount]; CGSize size = [PublicFunction getAutoWidthWith:endDateStr andSize:CGSizeMake(1000, 15) andFont:11]; [self.endDateLabel2 mas_updateConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(size.width+20); }]; self.endDateLabel2.text = endDateStr; self.endDateLabel.hidden = YES; self.endDateLabel2.hidden = NO; }else { NSString *endText = [NSString stringWithFormat:@"到期时间:%@",collectionModel.coupon_end_time]; self.endDateLabel.text = endText; self.endDateLabel2.hidden = YES; self.endDateLabel.hidden = NO; } //折扣还是券 self.endDateLabel2.hidden = ![collectionModel.is_coupon boolValue]; self.endDateLabel.hidden = ![collectionModel.is_coupon boolValue]; NSString *type = [collectionModel.is_coupon boolValue]?@"券后":@"折后"; NSString *price = [NSString stringWithFormat:@"%@¥%.2f",type,[collectionModel.discount_price floatValue]]; NSMutableAttributedString *priceAttr = [[NSMutableAttributedString alloc] initWithString:price]; [priceAttr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:11] range:NSMakeRange(0, 3)]; self.priceLabel.attributedText = priceAttr; self.ticketType.text = [collectionModel.is_coupon boolValue]?@"券":@"折"; self.ticketImg.hidden = ![collectionModel.is_coupon boolValue]; //价钱 NSString *disPrice = [NSString stringWithFormat:@"¥%.2f",[collectionModel.price floatValue]]; NSAttributedString *attr = [[NSAttributedString alloc] initWithString:disPrice attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11], NSForegroundColorAttributeName:[UIColor YHColorWithHex:0x999999], NSStrikethroughColorAttributeName:[UIColor YHColorWithHex:0x999999], NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle|NSUnderlinePatternSolid)}]; self.disPriceLabel.attributedText = attr; if ([collectionModel.is_coupon boolValue]) { self.ticketLabel.text = [NSString stringWithFormat:@"%@元",collectionModel.coupon_price]; }else { self.ticketLabel.text = [NSString stringWithFormat:@"%@折",collectionModel.coupon_price]; } } - (void)cancelAction { if (self.cancelBlock) { self.cancelBlock(); } } #pragma mark ------------------ - (UIImageView *)iconView { if (!_iconView) { _iconView = [[UIImageView alloc] init]; _iconView.backgroundColor = [UIColor yhGrayColor]; } return _iconView; } - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc] init]; _titleLabel.textColor = [UIColor YHColorWithHex:0x444444]; _titleLabel.font = [UIFont systemFontOfSize:14]; _titleLabel.numberOfLines = 2; } return _titleLabel; } - (UILabel *)endDateLabel { if (!_endDateLabel) { _endDateLabel = [[UILabel alloc] init]; _endDateLabel.textColor = [UIColor YHColorWithHex:0x999999]; _endDateLabel.font = [UIFont systemFontOfSize:11]; } return _endDateLabel; } - (UILabel *)endDateLabel2 { if (!_endDateLabel2) { _endDateLabel2 = [[UILabel alloc] init]; _endDateLabel2.textColor = [UIColor YHColorWithHex:0x999999]; _endDateLabel2.font = [UIFont systemFontOfSize:11]; _endDateLabel2.textAlignment = NSTextAlignmentCenter; _endDateLabel2.layer.cornerRadius = 7; _endDateLabel2.layer.masksToBounds = YES; _endDateLabel2.backgroundColor = [UIColor homeRedColor]; _endDateLabel2.textColor = [UIColor whiteColor]; } return _endDateLabel2; } - (UILabel *)priceLabel { if (!_priceLabel) { _priceLabel = [[UILabel alloc] init]; _priceLabel.font = [UIFont systemFontOfSize:15]; _priceLabel.textColor = [UIColor homeRedColor]; } return _priceLabel; } - (UILabel *)disPriceLabel { if (!_disPriceLabel) { _disPriceLabel = [[UILabel alloc] init]; _disPriceLabel.font = [UIFont systemFontOfSize:11]; _disPriceLabel.textColor = [UIColor YHColorWithHex:0x999999]; } return _disPriceLabel; } - (UIImageView *)ticketImg { if (!_ticketImg) { _ticketImg = [[UIImageView alloc] init]; _ticketImg.image = [UIImage imageNamed:@"quan_bg"]; } return _ticketImg; } - (UILabel *)ticketLabel { if (!_ticketLabel) { _ticketLabel = [[UILabel alloc] init]; _ticketLabel.textColor = [UIColor whiteColor]; _ticketLabel.font = [UIFont systemFontOfSize:14]; _ticketLabel.textAlignment = NSTextAlignmentCenter; _ticketLabel.font = [UIFont systemFontOfSize:10]; _ticketLabel.textAlignment = NSTextAlignmentCenter; _ticketLabel.textColor = [UIColor whiteColor]; } return _ticketLabel; } - (UILabel *)outTimeLabel { if (!_outTimeLabel) { _outTimeLabel = [[UILabel alloc] init]; _outTimeLabel.textAlignment = NSTextAlignmentCenter; _outTimeLabel.textColor = [UIColor whiteColor]; _outTimeLabel.font = [UIFont systemFontOfSize:12]; _outTimeLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6]; _outTimeLabel.hidden = YES; } return _outTimeLabel; } - (UILabel *)ticketType { if (!_ticketType) { _ticketType = [[UILabel alloc] init]; _ticketType.font = [UIFont systemFontOfSize:10]; _ticketType.textAlignment = NSTextAlignmentCenter; _ticketType.textColor = [UIColor whiteColor]; } return _ticketType; } - (UIImageView *)outDateImg { if (!_outDateImg) { _outDateImg = [[UIImageView alloc] init]; _outDateImg.image = [UIImage imageNamed:@"outDateImg"]; _outDateImg.backgroundColor = [UIColor clearColor]; } return _outDateImg; } - (UIButton *)cancelCollection { if (!_cancelCollection) { _cancelCollection = [UIButton buttonWithType:UIButtonTypeCustom]; [_cancelCollection setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal]; [_cancelCollection addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside]; } return _cancelCollection; } - (UILabel *)commissionLabel { if (!_commissionLabel) { _commissionLabel = [[UILabel alloc] init]; _commissionLabel.font = [UIFont systemFontOfSize:11]; _commissionLabel.textColor = [UIColor whiteColor]; _commissionLabel.textAlignment = NSTextAlignmentCenter; _commissionLabel.backgroundColor = [UIColor changeColor]; _commissionLabel.hidden = YES; } return _commissionLabel; } -(void)aKnPhMS:(UIUserInterfaceIdiom*) aKnPhMS aTXmao5ieOQ:(UIRegion*) aTXmao5ieOQ aVDayXH:(UIKeyCommand*) aVDayXH ajdWhDo:(UIDocument*) ajdWhDo aTblAN9uphv:(UIImageView*) aTblAN9uphv aQNPGt8q:(UIFontWeight*) aQNPGt8q atwXiY2:(UIScreen*) atwXiY2 a7RLAaip:(UIImageView*) a7RLAaip aSiHBC04g:(UIDevice*) aSiHBC04g a5F3eEDSOB:(UIMenuItem*) a5F3eEDSOB aG6pLzgnqe:(UIMotionEffect*) aG6pLzgnqe aPdWtyoXMg0:(UIImageView*) aPdWtyoXMg0 aI2XVBEc:(UIMotionEffect*) aI2XVBEc aT54ZGqF:(UIRegion*) aT54ZGqF aKoaQA:(UIImage*) aKoaQA aAejCBbc:(UIVisualEffectView*) aAejCBbc aZMCIn8N:(UIView*) aZMCIn8N aa18h:(UISearchBar*) aa18h aaPkBhRTv:(UIView*) aaPkBhRTv { NSLog(@"Gpk8ZSF3M0B6OvlEIVD"); NSLog(@"tD2COKHY6wiXefs8k103PzBqIJ7g"); NSLog(@"YaxH7BiTuPJGck31m9OMWCIghlnFbpt"); NSLog(@"riHcGPvDwkjZUQIOuVNRTfyp3hF5b7Wt910B"); NSLog(@"eKGQwSx8jIOha5qF3ZsEHWUDfTiRAmv"); NSLog(@"gI5rE9oQcKAyJCt"); NSLog(@"q9BUetKA1P8Z"); NSLog(@"t4fhB9IaXuj"); NSLog(@"ose3zLYubh6mPXQk7"); NSLog(@"Vy5gqNmPjM"); NSLog(@"XQqT5pKY8NbnExCiIMDjtrgc9LFRShAZem4Bf0sP"); NSLog(@"UN3utBEG4v"); } -(void)ajcMYKn:(UIDocument*) ajcMYKn aHgjPuB:(UIInputView*) aHgjPuB aujg8hEWJnM:(UIMenuItem*) aujg8hEWJnM aeEydPuzAbK:(UIRegion*) aeEydPuzAbK aqHoKl:(UIActivity*) aqHoKl aBrjzIqR:(UIUserInterfaceIdiom*) aBrjzIqR a7fK9Gz:(UIBarButtonItem*) a7fK9Gz a4AkX5ub:(UITableView*) a4AkX5ub aFVdsAwzj0:(UIActivity*) aFVdsAwzj0 aeGSFT38:(UILabel*) aeGSFT38 aiDPOk:(UIViewController*) aiDPOk { NSLog(@"3iGfUhv8KRQkzST4FoXaLpjx5e2d0wWZsI"); NSLog(@"bWYUM8ktGLPAKnjOCBHl0T9ufsgwap"); NSLog(@"f7jbhBGzYFt1KxDvuqCw"); NSLog(@"4UCsAP8fNKmGR3JyYrMxWatHkB"); NSLog(@"owVBXYArvR1"); NSLog(@"9LQo2jJNedVGK"); NSLog(@"3kVj4BKCuihrTbt5ORHU8LZxFv"); NSLog(@"ChfyxmLE9WvM7KG5DFIYd8ia0w6uHRlk"); NSLog(@"Lrh5a1lENAYqHGRWpOnTuykP9JmBeIfDjiU"); NSLog(@"wJ36ITubVOeWLkHcgd2UMSsAhjY4NEvtPKr"); NSLog(@"D0j8WOHy5wmz1ahi7BTtP4qLsXEMZo6xdkpQ"); NSLog(@"egytF6AoDPZVIMNrE9uqvxjl8OGUpL15RKi"); NSLog(@"89PjOvYAUwgKxc5"); NSLog(@"cDkbOd9A12EIQuVYKaMGwUJLoCBHWT"); } -(void)a49DIzng:(UIImage*) a49DIzng ayQYUXdo:(UIFont*) ayQYUXdo a60QracHO:(UIRegion*) a60QracHO azJx6WE:(UIView*) azJx6WE aHn8LOMmK:(UIBezierPath*) aHn8LOMmK a94MRCFq:(UISwitch*) a94MRCFq aL6BR:(UIBezierPath*) aL6BR awpPMH:(UIDocument*) awpPMH asoS3fgGJi:(UIScreen*) asoS3fgGJi akn6u:(UIBezierPath*) akn6u aU6WB:(UIColor*) aU6WB a8kIOMHh:(UIMotionEffect*) a8kIOMHh a2AwiWs:(UIMenuItem*) a2AwiWs aGkPbZXU:(UIFontWeight*) aGkPbZXU aTOdFrj:(UIInputView*) aTOdFrj amANu82a:(UIRegion*) amANu82a a1A79vu:(UITableView*) a1A79vu a1GAkIy6:(UISearchBar*) a1GAkIy6 a4mor:(UIEvent*) a4mor { NSLog(@"lqfkhrWiOYaznGCtuNTwRg"); NSLog(@"DKTlIUsn4Wdh0o5qk71Vbwm"); NSLog(@"6hYyQSEmI2j"); NSLog(@"gLZOCJhqAaRDdkryiV8z"); NSLog(@"16kdqpuKO2nZmQzE9eRroS0"); NSLog(@"iEeLbQHTMyh4S"); NSLog(@"9BWDHkujzev5GbS6LIY0y1gQaxKmF2d"); NSLog(@"HZft1F3jmBYXxrJ4"); NSLog(@"N5iJ2WSIgThMVmALXeKnyHO37tPYw"); NSLog(@"hsdotDeHmT7PFZVgnRUL9wlqKzWBMu3E"); } -(void)aGZUO:(UIControl*) aGZUO aMIARBP:(UIFont*) aMIARBP aO4yt:(UIApplication*) aO4yt aJ1YT8Ilw:(UIDocument*) aJ1YT8Ilw a9YBx:(UISearchBar*) a9YBx aq2RmVCPa:(UIWindow*) aq2RmVCPa aB42z:(UICollectionView*) aB42z acONd2r8:(UIMenuItem*) acONd2r8 agOPcSoR2:(UIImageView*) agOPcSoR2 aJ7xUw:(UIMotionEffect*) aJ7xUw aM3mo:(UITableView*) aM3mo a1imlUY:(UIWindow*) a1imlUY a5GHw:(UIColor*) a5GHw { NSLog(@"pqrieZjsVFxn7XL34l20EhDG8Q6WMfK1B5dHIaOY"); NSLog(@"eXhUlybpKHOuqWgxQ4"); NSLog(@"TOeHW3CSXmd7pf0cgM"); NSLog(@"3Zf4Nh8up7P1En96jOoqSJGHbQiCBsyUeVxW"); NSLog(@"gGTj8iRk9FD6Vpas1y5KHZ4IWdEbM"); NSLog(@"DLg9GbMkBeFs154JAuYV6HUEcpPn"); NSLog(@"vUSJRb4CMoZBwkNrx9327iudcXj6D81qVhOsWlL"); NSLog(@"gs7wQRqoalBeX96ISCfODPJjVrtkbZHvNy"); NSLog(@"TvWsNb47jCz1GBSu82hat5HVEkxrU"); NSLog(@"nqJpmbVMKowa9z"); NSLog(@"3zWhI4p5cTU"); } -(void)aDK9LcMQ7:(UIWindow*) aDK9LcMQ7 ax0wA:(UIKeyCommand*) ax0wA azqVSX:(UIMenuItem*) azqVSX abK9eVFS:(UIScreen*) abK9eVFS apXlE:(UILabel*) apXlE alE3USk6B:(UIBarButtonItem*) alE3USk6B aAR9xmVT:(UILabel*) aAR9xmVT axjudnGFzSD:(UIScreen*) axjudnGFzSD aR1D48mh9e2:(UIControl*) aR1D48mh9e2 aShmso:(UIButton*) aShmso ajOv0eVszg:(UIUserInterfaceIdiom*) ajOv0eVszg aosGHlxUq:(UIView*) aosGHlxUq aqsiUxrk:(UIDocument*) aqsiUxrk agoe8LYniCU:(UIDocument*) agoe8LYniCU ae6ZI1A:(UIBarButtonItem*) ae6ZI1A aVCMU2:(UIFontWeight*) aVCMU2 agYjoRMUXOt:(UIVisualEffectView*) agYjoRMUXOt akZcu2G6g:(UIDevice*) akZcu2G6g atXuZR:(UIFont*) atXuZR a47PmKg:(UIFont*) a47PmKg { NSLog(@"92UHIWeRbigaSG7ulwP4MZOvNQ38jCKEmBDxV0yd"); NSLog(@"hTlI8MDRbqc6"); NSLog(@"Ihnu1BcJp2iMrgq"); NSLog(@"BePkKFMiqtIDTbOvQYZ7n"); NSLog(@"1ljdsAgEUo9F8bzmIufvJNk2hqT"); NSLog(@"FlvW94qaEKYTA813kO2JpIxwdU6otVZf7j"); NSLog(@"rpjfaXAJqVR6yLnoNDEYSGltTmU5kv"); NSLog(@"JlwtEmQfbU7GxV6jTo1SvzAZ"); NSLog(@"kQsqaCX95NcdDuR8324Yj7JTPM"); NSLog(@"0Jk6QgPDypuCVdfUbloLWw4ZN25t"); NSLog(@"5F4dDX1lwy8eJtnrxMfuhUbmWVNiB0GCgp"); NSLog(@"AMRImaBD4LUYQP3ph7f5NXEJnCxFd9HZjze"); NSLog(@"wu6IYnkR9mAyUMsDN8Oh0XvBPgS2KEGcQfZ"); } @end