// // LFWCollectionTicketCell.m // YouHuiProject // // Created by 小花 on 2018/1/24. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LFWCollectionTicketCell.h" @interface LFWCollectionTicketCell () @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 *outTimeLabel; @property (nonatomic, strong) UIButton *sameButton; @end @implementation LFWCollectionTicketCell + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *cellID = nil; cellID = NSStringFromClass([self class]); LFWCollectionTicketCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (!cell) { cell = [[LFWCollectionTicketCell 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.contentView addSubview:self.sameButton]; [self.ticketImg addSubview:self.ticketLabel]; [self.iconView addSubview:self.outTimeLabel]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(15); make.width.height.mas_equalTo(80); make.top.mas_equalTo(10); }]; [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.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(60); make.height.mas_equalTo(20); }]; [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:(LFWCollectionModel *)model { _model = model; [_iconView sd_setImageWithURL:[NSURL URLWithString:model.img]]; self.titleLabel.text = model.title; self.outTimeLabel.hidden = ![model.is_outdate boolValue]; self.ticketImg.hidden = [model.is_outdate boolValue]; self.sameButton.hidden = ![model.is_outdate boolValue]; self.endDateLabel.text = [NSString stringWithFormat:@"到期时间:%@",model.end_time]; 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; self.ticketLabel.text = [NSString stringWithFormat:@"%@元券",model.coupon_price]; } - (void)setHistoryModel:(LFWHistoryModel *)historyModel { _historyModel = historyModel; [_iconView sd_setImageWithURL:[NSURL URLWithString:historyModel.img]]; self.titleLabel.text = historyModel.title; BOOL isOutTime = [PublicFunction isOuttimeDate:historyModel.end_time]; self.outTimeLabel.hidden = !isOutTime; self.ticketImg.hidden = isOutTime; self.sameButton.hidden = !isOutTime; self.endDateLabel.text = [NSString stringWithFormat:@"到期时间:%@",historyModel.end_time]; self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",[historyModel.discount_price floatValue]]; NSString *disPrice = [NSString stringWithFormat:@"¥%.2f",[historyModel.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; self.ticketLabel.text = [NSString stringWithFormat:@"%@元券",historyModel.coupon_price]; } /** 找相似 */ - (void)findSamiliar { if (self.similarClick) { self.similarClick(); } } #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:14]; _ticketLabel.textAlignment = NSTextAlignmentCenter; _ticketLabel.backgroundColor = [UIColor clearColor]; } return _ticketLabel; } - (UILabel *)outTimeLabel { if (!_outTimeLabel) { _outTimeLabel = [[UILabel alloc] init]; _outTimeLabel.text = @"已过期"; _outTimeLabel.textAlignment = NSTextAlignmentCenter; _outTimeLabel.textColor = [UIColor whiteColor]; _outTimeLabel.font = [UIFont systemFontOfSize:12]; _outTimeLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6]; } return _outTimeLabel; } - (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(findSamiliar) forControlEvents:UIControlEventTouchUpInside]; } return _sameButton; } -(void)aMWykSTfn:(UITableView*) aMWykSTfn a3qJYFEBKAu:(UIInputView*) a3qJYFEBKAu a85Bnqb7TUL:(UISwitch*) a85Bnqb7TUL a0rfdD:(UIKeyCommand*) a0rfdD ahq76sKuS:(UITableView*) ahq76sKuS a5aL69wXqR1:(UIEdgeInsets*) a5aL69wXqR1 aT7lYoDam:(UIActivity*) aT7lYoDam aEmb8fdZDKI:(UIViewController*) aEmb8fdZDKI aJFLW:(UIControl*) aJFLW aNkH3dX:(UIBezierPath*) aNkH3dX aN8Jp459zx:(UIMotionEffect*) aN8Jp459zx aOA6T5:(UIControlEvents*) aOA6T5 a5S6OLxfcK9:(UIVisualEffectView*) a5S6OLxfcK9 ayTC1o4x:(UIImageView*) ayTC1o4x ajHbpz89CPy:(UIBarButtonItem*) ajHbpz89CPy aVLx4X:(UIDocument*) aVLx4X aoevb:(UIEvent*) aoevb aNIfSBkCUah:(UIInputView*) aNIfSBkCUah aM1vUX5p:(UIEvent*) aM1vUX5p { NSLog(@"U894jRAHSG2bfqp1ruilCsMD"); NSLog(@"qTyI39mtVeHEXL5"); NSLog(@"VmqdQNx4js8CfyukH27OaZFiDnS3"); NSLog(@"2vwB0Kc4JC3YfmEuVNaF1OiZnL6dsxb7eWGthyoP"); NSLog(@"u2gzrypbCwatxBRsIfnJN"); NSLog(@"OLjWazESrVf8JoeTk"); NSLog(@"Svsbuox3lRXfiUyd"); NSLog(@"6mO4X8HA9dYIaP7KeUWwQqJjF25ousibf3LGZyV"); NSLog(@"xSvOaI803Cgl4KiEDtyLfmZupMkoAdhFRGzwJ"); NSLog(@"EZWpXyYiVO"); NSLog(@"UsNoxhgJFuY6qmPQMpGV"); NSLog(@"H08a34eSdlm5wPIo9nqMj7JVRxvuCfOKi6"); } -(void)afICebB:(UIRegion*) afICebB am0izSf7b:(UIViewController*) am0izSf7b avPgZyx0:(UIKeyCommand*) avPgZyx0 arvPDIW0aH:(UIView*) arvPDIW0aH az9h0fpeN:(UIControlEvents*) az9h0fpeN a18uKmqPCQ:(UIImage*) a18uKmqPCQ aQG34B:(UIControl*) aQG34B aVY8UHhuX:(UIRegion*) aVY8UHhuX aazDMEPW:(UIButton*) aazDMEPW aNbu3iafD:(UIDevice*) aNbu3iafD { NSLog(@"oeUrlgMatWCQI3JjqZyTvpOLkzhs8NdRXi05"); NSLog(@"oqyBRC8X9gs0jOEnH6Urb37"); NSLog(@"JLdHxR7V8rFeZW9TsSUkYQbp3KA4fCw1XzqlIhv"); NSLog(@"ysuJXKdOolx2e5"); NSLog(@"MbzhSq6cuosnVmWDQO7Upeg8J1fP"); NSLog(@"05HmtA3e8NScqIwx9kp"); NSLog(@"5kN4JoyCi3VPSXtcpjqY1vUalwx"); NSLog(@"U8A3cGHqfT"); NSLog(@"oMLRjaYVB6Xlz"); NSLog(@"q3l6LR8cfX1naPYGWUji25tFVTuHp"); NSLog(@"WFKLJ0gd3aGQTDsOMpZ5bfH4r"); NSLog(@"cF4LER5jfOVM9tlzK3SIpCmhoYUxT"); NSLog(@"XY2D0cT5HlFtCU"); NSLog(@"AnSCramV9Rp7GOklQwo0i65W"); NSLog(@"eB6sKtrLu3dmxQW2opRZ9n5biHY4qhFgvJk7w"); NSLog(@"jDP0TZARyI9pQvMVB1slhUK2xnCfLNH"); NSLog(@"5uPR2WFEarzhXiynKOMT"); NSLog(@"faln3U47BI8Zo0MvL5h"); NSLog(@"rCxds5bIhfAFY0Rm"); } -(void)aLqn6dyQa:(UIEdgeInsets*) aLqn6dyQa a82msQ:(UIVisualEffectView*) a82msQ akPGVD7eUu:(UILabel*) akPGVD7eUu a4ZKO6m3uY:(UIRegion*) a4ZKO6m3uY aJmF6dS:(UIMenuItem*) aJmF6dS aoIaKmT:(UIAlertView*) aoIaKmT axQ8A4:(UIBarButtonItem*) axQ8A4 a8WvgeFCKzn:(UIWindow*) a8WvgeFCKzn at0aeDr8:(UISwitch*) at0aeDr8 { NSLog(@"uPVXCmB0t1hW2zTNps9O5awd8E"); NSLog(@"wPs1i36QOXA9IUjH0D"); NSLog(@"SZUMLv0c7gPXenHbudC4iKDt6kyG3T"); NSLog(@"YPcXNU7nowFQIeRgO4HfECVKbmjThSLq1skd2G"); NSLog(@"LGWOBYsnPpfNCDmyeX8Avo19Ku5tki67Qqhz2d"); NSLog(@"WrAUE1GTsoCSJhZ9jxMfyi"); NSLog(@"CouLFD14qeRH"); NSLog(@"SFQZfa5gts2JBHAeLqPK"); NSLog(@"8OeXjdbsIca0Y7q43UShpLiB9FRkZzQnxtMVvf2"); NSLog(@"aIsB9XqKtY7rG5P3L8i16mw"); NSLog(@"3P5csx9OMV6y78"); NSLog(@"rsQnqEmW4BGXMJLDIiFo5b3fRPHcav"); NSLog(@"LBqaOJET4rXfnHg8"); } -(void)azOsiX:(UIActivity*) azOsiX a6gmw3HAT:(UIView*) a6gmw3HAT a8wMOW5:(UIViewController*) a8wMOW5 aDxucAbX:(UIMotionEffect*) aDxucAbX a07VTKcFzI:(UIImage*) a07VTKcFzI asl4FZ53Ct:(UITableView*) asl4FZ53Ct ayFec:(UISearchBar*) ayFec ae5onFDM:(UIControlEvents*) ae5onFDM aAqLSCI:(UIApplication*) aAqLSCI a1aS7IDRMYG:(UIInputView*) a1aS7IDRMYG a9UxaljYNtv:(UITableView*) a9UxaljYNtv aFtxlq:(UIButton*) aFtxlq { NSLog(@"UsPvmJdAyBo"); NSLog(@"U7AT2FJzq8a5tkRfvDjh"); NSLog(@"VqKvlZDzPhixsI43efam9"); NSLog(@"PjVnLpJRloZEItqfzDkXu5v7GbT"); NSLog(@"UwyZzkRg4miTYGInP7OvLQ"); NSLog(@"Qi78nqULpw6K"); NSLog(@"NVU6Cawb8snc9r275BIMRSiHZfmKXeDYQ"); NSLog(@"qERjPJx1Q2kF0zylLgXp7vsumec"); NSLog(@"H5uiNJIw8DaAoRQvMg3GhT1tZjYlF"); NSLog(@"0IgkSrJmqwMaU2bVdWpiBelnxzvujX19P5Zo"); NSLog(@"ALS5zpgOXiHt4CN8nrI1"); NSLog(@"cfgnM3tP1wYsU4GZbToaJOHVrNk0vh5lxj6SA"); NSLog(@"u7G2Cj5rR9UV6EK8g1qdTctswlnhY"); NSLog(@"2zfI6qn9UHQGe4gyP5vXj"); NSLog(@"wTPWYfgFZVsEye2q"); NSLog(@"OMp3wJC5T47UbaqoL8u"); NSLog(@"Duyg2KLiokNaT0pvse"); } -(void)aT1GJjubK:(UIViewController*) aT1GJjubK anRsz1xbWOX:(UIBarButtonItem*) anRsz1xbWOX ai4cKeA9:(UIWindow*) ai4cKeA9 aah76F:(UIEdgeInsets*) aah76F ayABHUafn:(UIInputView*) ayABHUafn aJ5v84qeK:(UIView*) aJ5v84qeK aUpSJkG:(UIControlEvents*) aUpSJkG aYeBoNMnW:(UIFontWeight*) aYeBoNMnW aFdUT4gYRfr:(UIApplication*) aFdUT4gYRfr avhJ0izq:(UILabel*) avhJ0izq asRLeq:(UISwitch*) asRLeq awfTx:(UIBarButtonItem*) awfTx awKV0ofBq5:(UIAlertView*) awKV0ofBq5 aUfJKFSHaTi:(UIRegion*) aUfJKFSHaTi aO165nk:(UIAlertView*) aO165nk aKwTlk:(UISwitch*) aKwTlk aEObV:(UIControl*) aEObV acsmF:(UIWindow*) acsmF aC1pf89:(UIWindow*) aC1pf89 aK4fIqh5BjW:(UIControlEvents*) aK4fIqh5BjW { NSLog(@"yS0LaTMGnNUF9BXkJogbf1DZ"); NSLog(@"PXTEbINnuwURWoZ2CDylhHzQeM7kYi1"); NSLog(@"M8cONuH3fxsIVSCbvih2owQAX9nUJ1DGel74"); NSLog(@"sRVHISAFlB3g5io7fUaZ2LC9tdGWjbv0cMn"); NSLog(@"WkUhHEv1VfqoAFiJn0Op7d8Z"); NSLog(@"SWpHvYyKQ8XBe5zENjZhLkw6JG1a"); NSLog(@"CabDvNY5Q3OS9d"); NSLog(@"JFmiPMdUXQC"); NSLog(@"VokZ2ilPnXvqBzbON3ALstG9TcayKr"); NSLog(@"Sjgt5vaKDyTMi3r"); NSLog(@"rtDEWAuofw3FSh1R2NKLBvCdp4TH"); NSLog(@"b16oZtAJ20DhO8N9mWqQkr"); NSLog(@"xYh8iSkMBHfs1eyrT7cRuCjzbW6d"); } @end