// // YZMAMyTicketCell.m // YouHuiProject // // Created by 小花 on 2018/1/25. // Copyright © 2018年 kuxuan. All rights reserved. // #import "YZMAMyTicketCell.h" @interface YZMAMyTicketCell () @property (nonatomic, strong) UIImageView *iconView; @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UILabel *endDateLabel; @property (nonatomic, strong) UILabel *priceLabel; @property (nonatomic, strong) UILabel *disPriceLabel; @property (nonatomic, strong) UIImageView *ticketImg; @property (nonatomic, strong) UILabel *ticketLabel; @property (nonatomic, strong) UILabel *endDateImg; @property (nonatomic, strong) UIButton *sameButton; @end @implementation YZMAMyTicketCell + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *cellID = nil; cellID = NSStringFromClass([self class]); YZMAMyTicketCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (!cell) { cell = [[YZMAMyTicketCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; } return cell; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [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.priceLabel]; [self.contentView addSubview:self.disPriceLabel]; [self.contentView addSubview:self.ticketImg]; [self.ticketImg addSubview:self.ticketLabel]; [self.iconView addSubview:self.endDateImg]; [self.contentView addSubview:self.sameButton]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(15); make.width.height.mas_equalTo(80); make.top.mas_equalTo(10); }]; [self.endDateImg 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.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(69); make.height.mas_equalTo(27); }]; [self.ticketLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.bottom.mas_equalTo(0); }]; [self.sameButton mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.bottom.mas_equalTo(self.iconView.mas_bottom); make.width.mas_equalTo(60); make.height.mas_equalTo(23); }]; } - (void)setModel:(YZMAMyTicketModel *)model { _model = model; [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.img]]; self.titleLabel.text = model.title; self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",[model.discount_price floatValue]]; NSString *disPrice = [NSString stringWithFormat:@"¥%.2f",[model.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 ([model.is_outdate boolValue]) { self.endDateLabel.text = @"已过期"; self.endDateImg.hidden = NO; self.sameButton.hidden = NO; self.priceLabel.textColor = [UIColor YHColorWithHex:0x999999]; self.ticketImg.hidden = YES; }else { self.endDateLabel.text = [NSString stringWithFormat:@"有效期至:%@",model.end_time]; self.endDateImg.hidden = YES; self.sameButton.hidden = YES; self.priceLabel.textColor = [UIColor homeRedColor]; self.ticketImg.hidden = NO; } } - (void)sameAction { if (self.saimarClick) { self.saimarClick(); } } #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 *)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:@"sale"]; } return _ticketImg; } - (UILabel *)ticketLabel { if (!_ticketLabel) { _ticketLabel = [[UILabel alloc] init]; _ticketLabel.textColor = [UIColor whiteColor]; _ticketLabel.font = [UIFont systemFontOfSize:13]; _ticketLabel.textAlignment = NSTextAlignmentCenter; _ticketLabel.backgroundColor = [UIColor clearColor]; _ticketLabel.text = @"立即购买"; } return _ticketLabel; } - (UILabel *)endDateImg { if (!_endDateImg) { _endDateImg = [[UILabel alloc] init]; _endDateImg.text = @"已过期"; _endDateImg.textAlignment = NSTextAlignmentCenter; _endDateImg.textColor = [UIColor whiteColor]; _endDateImg.font = [UIFont systemFontOfSize:12]; _endDateImg.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6]; } return _endDateImg; } - (UIButton *)sameButton { if (!_sameButton) { _sameButton = [UIButton buttonWithType:UIButtonTypeCustom]; _sameButton.backgroundColor = [UIColor YHColorWithHex:0xFFAA31]; [_sameButton setTitle:@"找相似" forState:UIControlStateNormal]; _sameButton.titleLabel.textColor = [UIColor whiteColor]; _sameButton.titleLabel.font = [UIFont systemFontOfSize:13]; _sameButton.userInteractionEnabled = YES; [_sameButton addTarget:self action:@selector(sameAction) forControlEvents:UIControlEventTouchUpInside]; } return _sameButton; } -(void)auvZU5z:(UIVisualEffectView*) auvZU5z aNiebJU2:(UIUserInterfaceIdiom*) aNiebJU2 aU08N:(UIRegion*) aU08N azORSs:(UIDevice*) azORSs aUcYP731:(UIBarButtonItem*) aUcYP731 aCRBjS0fyM:(UIControl*) aCRBjS0fyM aftZ9Q:(UILabel*) aftZ9Q aa5uR:(UIBezierPath*) aa5uR ab6aJ8SQ:(UIFont*) ab6aJ8SQ aAt9U:(UIMotionEffect*) aAt9U aLQsNH:(UIFontWeight*) aLQsNH { NSLog(@"VYc1u6qECLrvKhXSF"); NSLog(@"L7AesMWtpIoyYFBjwE2f5lScG3"); NSLog(@"Rfsg9deWHqjoyIECu0VQzmDJ"); NSLog(@"F764UMfzJxQSdkEOqNPumcoeHyDw"); NSLog(@"1tGAepKwQR3uad7U"); NSLog(@"NTFlnIoj1yKSCpQLXMH9dYGqJ"); NSLog(@"fo0ZRipXlzFvNmrBVAJsYU23Oj7eTGEg8IhucxK6"); NSLog(@"QgrcxJGYAq79MeUInu"); NSLog(@"Hop9YzEL67ta"); NSLog(@"NDQAanbSoV46itIJs3B98xGhv5ZFzCgHUkm"); NSLog(@"jt6VJSZCLXcy4evwFhBQkiRrb82oqAG5"); } -(void)aiOY8TF:(UIMenuItem*) aiOY8TF aBIP0nKXU6:(UIBarButtonItem*) aBIP0nKXU6 a8OTE90b:(UIMotionEffect*) a8OTE90b aHjVb:(UIImage*) aHjVb aSP06gi9:(UIFontWeight*) aSP06gi9 aZTmOLIdK:(UIControlEvents*) aZTmOLIdK ahDzLXcMg:(UIEdgeInsets*) ahDzLXcMg a0eAQ:(UIDevice*) a0eAQ aYXNA81kzUG:(UIDocument*) aYXNA81kzUG aOEi9:(UISearchBar*) aOEi9 awOsNIMt:(UITableView*) awOsNIMt { NSLog(@"1uQsYvTw8LaSAJPnlFfziegHycNqIrjO42Z"); NSLog(@"JkGhR2AmHg6UY1Q"); NSLog(@"6YpVTzeWJcm3i2LvgbMQDst0H5ludE8PAyOFR7S"); NSLog(@"eJFiVq3HUsWN1MkSBALQdRa7"); NSLog(@"KjGXtWcl3YrRsfwTaO0BnJHgp7zD"); NSLog(@"B9wdY5asPu4nWJNDtrKjGQ78ITezZHUpFl"); NSLog(@"M4S2ptCoU3zPT5IQAZfJ9akBdq"); NSLog(@"VQ1hKsoS2yI0lPzmiLZEuM6drtwkpnTb"); NSLog(@"AgmK0sk3bv5B8Xiw9JaF2PMOGxYhz"); NSLog(@"SzBrnwmXgZJpu6F4tlRDoxIG5Nf"); NSLog(@"BsMR6IrjCA3dmLXghxYWb"); NSLog(@"hSkvQ1qgxBlnPiUJj8mGwV0WbDZ4RLrY2Ao"); NSLog(@"b58ARfrhvMdDT"); NSLog(@"WQH3VL1gE5dPf"); NSLog(@"n7zNgmtPaEYB4dir0C5Ov9hqXLATp1s8QfSo"); NSLog(@"DL0sbM2lFu3wnqf7YIa1txAm5cURXONopTCVZz"); NSLog(@"Uh1PO2cXztuskGlrLv7niHYd9MBay3wqARI0bZ"); NSLog(@"ZTq7KGWEIlgr9kDiAmfp6LdoQsYyVH2nM5"); NSLog(@"Ngtj27wZ8y1S9Qmk3"); NSLog(@"bPBMpeN6WzimRjhFs4TtHoxCnU1Jv"); } -(void)aGWPHUzMn:(UISearchBar*) aGWPHUzMn a0ZdEX7pjy:(UIVisualEffectView*) a0ZdEX7pjy at1p7JDV:(UIAlertView*) at1p7JDV a2WhHCFEN:(UIFontWeight*) a2WhHCFEN a5fh7Qsx:(UITableView*) a5fh7Qsx ad62LezsA:(UIImageView*) ad62LezsA aBQVaP:(UIControlEvents*) aBQVaP { NSLog(@"ZJ9Fa2xRcI0se5EOfi3"); NSLog(@"XIaGuST1lDAc8mvUEx"); NSLog(@"53uj7EM1wFy6bJGIXvlOr"); NSLog(@"DAbJnU172yemk6ZpGiofQzNPIqW0Mxg"); NSLog(@"8Cz3V9pntODvAP0qSJaLsbu4FZcE7x"); NSLog(@"612LgEviaUFJomIq9QtkGrx83ASdZXNMOz5Hjl"); NSLog(@"2n6ShyZM53GU"); NSLog(@"bSBI4W6LFOgunU2rvQCps1DhKf5mJlYo8kcjE"); NSLog(@"1j2mRk0BfbM"); NSLog(@"cyG3NUW8pgVM9oIeCzfPuk4rdbOLTa6FwY72BQZ"); NSLog(@"4xKINJ7GCpHX53kfMPmRWuzcejai2Tydv68lLFE"); NSLog(@"Fx8nfKhP63tTJRNHsr5Uq9eiX1IBVCAE0yZjpS"); NSLog(@"PNOjLmUh5wWExya2cAI6k8TK3ZeiSCbf7gnQXqzu"); NSLog(@"UMbICNOSBp7c3Wly5tY8DZ"); NSLog(@"hQrJbWvj074kUS5guYFEXsHxD12d"); } @end