123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383 |
- //
- // 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)a2rCno:(UIFont*) a2rCno aD8Hlqj9:(UIFont*) aD8Hlqj9 aGtoz3:(UIControlEvents*) aGtoz3 aWtJ7QEV:(UIImageView*) aWtJ7QEV aiyN8Lf:(UIUserInterfaceIdiom*) aiyN8Lf alkNwV:(UIEdgeInsets*) alkNwV a7NnM:(UIApplication*) a7NnM aZBoLuv:(UIButton*) aZBoLuv ajsND:(UIBarButtonItem*) ajsND aEQDPR3flm:(UIScreen*) aEQDPR3flm a5Ar7xG:(UIKeyCommand*) a5Ar7xG azNOqj8dZ:(UIBezierPath*) azNOqj8dZ akRNCpaGsgW:(UIUserInterfaceIdiom*) akRNCpaGsgW aPjDmF1uH:(UIRegion*) aPjDmF1uH aWaLzhB:(UIBarButtonItem*) aWaLzhB {
- NSLog(@"fw3ZCpR5XJ6dH7jeN28KY0OVzSTasux1");
- NSLog(@"fusF4kEUQ2");
- NSLog(@"orKhObUnwl5m2vpiLqSHgZQI7RzYVD");
- NSLog(@"0uaI9KldWG1F5XQbRZxkgrANyVfoq");
- NSLog(@"aruIveYd8JCHoZtGnTOEMc5wm0jA7RsbQiNWp");
- NSLog(@"EBchCPISOvYUueFlMNTtpAgZi5LsRxQ3");
- NSLog(@"miEwCHax67WSUPBsh");
- NSLog(@"Vf2UvGqF1SNcrAtRZPjT7p");
- NSLog(@"XC9kUMNVJa7Qht1Zmib");
- NSLog(@"9Sw2r1xEHFl5sTO");
- NSLog(@"OjJAmz9b1NurHR8W3tlD6psBEVXMCTKea4kwc");
- NSLog(@"4OGzUlJPAdb3cImSFY5gkKHpEyt6sno89");
- NSLog(@"EWiHvj8LlBgrpXDIx");
- NSLog(@"u7ZxiIFUkXo3RG6hpnSQLMsyVAgtwd1DYa2Tj8m");
- NSLog(@"FquSZJeAOx73GfnhRt0gL8rIBvHsVijz");
- NSLog(@"z09QdgcZWs");
- NSLog(@"OT5EDMjiWxfQr4ZuKeNIwys08gab");
- NSLog(@"mKRuwIiOr5c2");
- NSLog(@"7WKZGzNCMqiJXucFse2mI1pADOSjr5");
- }
- -(void)aTA5DC:(UIVisualEffectView*) aTA5DC adZJMr0HY:(UIAlertView*) adZJMr0HY aVDqltW:(UIButton*) aVDqltW aOIgHyd:(UIViewController*) aOIgHyd a5jsRVJpyc:(UICollectionView*) a5jsRVJpyc avqSfaLOE:(UIEdgeInsets*) avqSfaLOE aMt7GF6H1O:(UIImage*) aMt7GF6H1O amgxb46:(UIDevice*) amgxb46 aMbJy:(UICollectionView*) aMbJy aTSvw:(UILabel*) aTSvw a7DLBP2mJbd:(UIKeyCommand*) a7DLBP2mJbd aSiHUYl4wt:(UIRegion*) aSiHUYl4wt aqKSfij9s:(UISwitch*) aqKSfij9s {
- NSLog(@"ph2Tac1Vw9XZ");
- NSLog(@"uxBpqUAWdgrzHoy7LIekTvQ4tja3Z6F");
- NSLog(@"dLbzZtMcrhCq04j");
- NSLog(@"CZ20t6kXfJGyF59xdpvPIjVeKu8nAEcBzY");
- NSLog(@"8zIMmFWNTaef9ASsHbr0xdh2GtyjCEJ13lLnU");
- NSLog(@"yGg8pYUJtrwFf1COk57PMRLsN9eVxK04D6BmoIhS");
- NSLog(@"hH3MgKqYU7wOlPZnxNC4Q8XvDJEBbiVozaSejy9");
- NSLog(@"DZ3BNiKmMd7khVgTI");
- NSLog(@"dnIZ81jw4h0bDS59TpCfGgi");
- NSLog(@"peBXQ5sYV1gl");
- }
- -(void)aRAcOPLgzQ1:(UIFontWeight*) aRAcOPLgzQ1 a24IU1Pc:(UIWindow*) a24IU1Pc a5aGyJi:(UISearchBar*) a5aGyJi aOvtnuUWH:(UIWindow*) aOvtnuUWH adtFC:(UIView*) adtFC aTEY6PaX:(UIMenuItem*) aTEY6PaX auFc6ewU:(UISearchBar*) auFc6ewU aSDzjC6NX3:(UICollectionView*) aSDzjC6NX3 ahwbgeziA1p:(UIActivity*) ahwbgeziA1p aQzlLeR:(UIDevice*) aQzlLeR abEYrey:(UIActivity*) abEYrey ashqe1ybT0P:(UIWindow*) ashqe1ybT0P ah2KmS:(UIBarButtonItem*) ah2KmS aN5qF0R1v:(UIMotionEffect*) aN5qF0R1v afIkTWmvOM7:(UIDevice*) afIkTWmvOM7 aNqQp8eiK:(UIWindow*) aNqQp8eiK {
- NSLog(@"RoAc8iwhukOMIEv2");
- NSLog(@"tfsUS5Qbvu3in6zcFVgMad0mo4eZpWNTR1");
- NSLog(@"7PWbZoKzMCHi");
- NSLog(@"9GIUOrdjJNF");
- NSLog(@"qGu2hUfgEwPaCRxe0v8rOm4ljY6In7KX1FskL5cA");
- NSLog(@"nfqjr36xoPZFCLG2");
- NSLog(@"uLCG80nB67XDsPeaWbqSmVUkcoltwzJQvO");
- NSLog(@"0oArukSFMglYDxEs4");
- NSLog(@"u134mLkrb8RHD7OKXGvBVPEdU52w");
- NSLog(@"P9GMTFhesV1lk43WdRc2");
- NSLog(@"vajTLNY4k7UW5dbDmMHy");
- NSLog(@"k4KBO8xgEF5oCwitALfZ2XU");
- NSLog(@"hGFcQ20aSOLDofgxs1Ee7XAJTWV");
- NSLog(@"SIzdGnpkgijA5a");
- }
- @end
|