// // LFWGoodCollectionCell.m // YouHuiProject // // Created by 小花 on 2018/1/18. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LFWGoodCollectionCell.h" @interface LFWGoodCollectionCell () @property (nonatomic, strong) UIImageView *imgView; //大图 @property (nonatomic, strong) UILabel *titleLabel; //标题 @property (nonatomic, strong) UILabel *priceLabel; //原价 @property (nonatomic, strong) UILabel *saleCount; // 月销量 @property (nonatomic, strong) UILabel *disPriceL; // 优惠后价格 @property (nonatomic, strong) UIImageView *ticketNumber; // @property (nonatomic, strong) UILabel *totalCount; // 总件数 //@property (nonatomic, strong) UILabel *ticketCount; // @property (nonatomic, strong) UILabel *zheKou; // 几折,或者几元券 @end @implementation LFWGoodCollectionCell - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.contentView.backgroundColor = [UIColor whiteColor]; [self initSubViews]; } return self; } - (void)initSubViews { [self.contentView addSubview:self.imgView]; [self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.priceLabel]; [self.contentView addSubview:self.saleCount]; [self.contentView addSubview:self.disPriceL]; [self.contentView addSubview:self.ticketNumber]; [self.imgView addSubview:self.totalCount]; // [self.imgView addSubview:self.ticketCount]; [self.ticketNumber addSubview:self.zheKou]; [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.top.mas_equalTo(0); make.height.mas_equalTo((SCREEN_WIDTH-5)/2.f); }]; // [self.ticketCount mas_makeConstraints:^(MASConstraintMaker *make) { // make.size.equalTo(self.imgView); // }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-10); make.top.mas_equalTo(self.imgView.mas_bottom).mas_offset(7); }]; [self.disPriceL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.bottom.mas_equalTo(-10); }]; [self.ticketNumber mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.disPriceL.mas_centerY); make.right.mas_equalTo(self.titleLabel.mas_right); make.width.mas_equalTo(64*0.7); make.height.mas_equalTo(22*0.7); }]; [self.zheKou mas_makeConstraints:^(MASConstraintMaker *make) { make.top.bottom.left.right.mas_equalTo(0); }]; [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.bottom.mas_equalTo(self.disPriceL.mas_top).mas_offset(-5); }]; [self.saleCount mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(self.titleLabel.mas_right); make.centerY.mas_equalTo(self.priceLabel.mas_centerY); }]; [self.totalCount mas_makeConstraints:^(MASConstraintMaker *make) { make.right.top.mas_equalTo(0); make.height.mas_equalTo(20); }]; } - (void)setModel:(LFWChildGoodModel *)model { //标题 NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:model.title]; NSTextAttachment *attach = [[NSTextAttachment alloc] init]; if ([model.freeShipping boolValue]) { attach.image = [UIImage imageNamed:@"Rectangle"]; attach.bounds = CGRectMake(0, -1, 26, 13); [attStr insertAttributedString:[NSAttributedString attributedStringWithAttachment:attach] atIndex:0]; } self.titleLabel.attributedText = attStr; // [self.imgView yy_setImageWithURL:[NSURL URLWithString:model.img] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation]; self.priceLabel.text = [NSString stringWithFormat:@"淘宝价 ¥%.2f",[model.price floatValue]]; self.saleCount.text = [NSString stringWithFormat:@"月销%@",model.volume]; if ([model.type boolValue]) { self.totalCount.hidden = NO; self.totalCount.text = [NSString stringWithFormat:@" 共%@件 ",model.coupon_surplus]; }else { self.totalCount.hidden = YES; } //折后价 NSString *disStr; if (model.is_coupon) { disStr = [NSString stringWithFormat:@"券后¥%.2f",[model.discount_price floatValue]]; self.zheKou.text = [NSString stringWithFormat:@"%@元券",model.coupon_price]; }else { disStr = [NSString stringWithFormat:@"折后¥%.2f",[model.discount_price floatValue]]; self.zheKou.text = [NSString stringWithFormat:@"%@折",model.coupon_price]; } NSMutableAttributedString *disAttr = [[NSMutableAttributedString alloc] initWithString:disStr]; [disAttr addAttributes:@{NSForegroundColorAttributeName:[UIColor homeRedColor]} range:NSMakeRange(0, disAttr.length)]; [disAttr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} range:NSMakeRange(0, 2)]; self.disPriceL.attributedText = disAttr; self.disPriceL.text = disStr; } - (UIImageView *)imgView { if (!_imgView) { _imgView = [[UIImageView alloc] init]; _imgView.backgroundColor = [UIColor YHColorWithHex:0xf0f0f0]; } return _imgView; } - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc] init]; _titleLabel.font = [UIFont systemFontOfSize:14]; _titleLabel.textColor = [UIColor YHColorWithHex:0x444444]; _titleLabel.numberOfLines = 2; } return _titleLabel; } - (UILabel *)priceLabel { if (!_priceLabel) { _priceLabel = [[UILabel alloc] init]; _priceLabel.font = [UIFont systemFontOfSize:11]; _priceLabel.textColor = [UIColor YHColorWithHex:0x999999]; } return _priceLabel; } - (UILabel *)saleCount { if (!_saleCount) { _saleCount = [[UILabel alloc] init]; _saleCount.font = [UIFont systemFontOfSize:11]; _saleCount.textColor = [UIColor YHColorWithHex:0x999999]; _saleCount.textAlignment = NSTextAlignmentRight; } return _saleCount; } - (UILabel *)disPriceL { if (!_disPriceL) { _disPriceL = [[UILabel alloc] init]; _disPriceL.font = [UIFont systemFontOfSize:18]; _disPriceL.textColor = [UIColor homeRedColor]; } return _disPriceL; } - (UIImageView *)ticketNumber { if (!_ticketNumber) { _ticketNumber = [[UIImageView alloc] init]; _ticketNumber.image = [UIImage imageNamed:@"discount"]; } return _ticketNumber; } - (UILabel *)totalCount { if (!_totalCount) { _totalCount = [[UILabel alloc] init]; _totalCount.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6]; _totalCount.layer.cornerRadius = 3; _totalCount.font = [UIFont systemFontOfSize:10]; _totalCount.textAlignment = NSTextAlignmentCenter; _totalCount.textColor = [UIColor YHColorWithHex:0xffffff]; } return _totalCount; } //- (UILabel *)ticketCount { // if (!_ticketCount) { // _ticketCount = [[UILabel alloc] init]; // _ticketCount.textColor = [UIColor whiteColor]; // _ticketCount.font = [UIFont systemFontOfSize:9]; // } // return _ticketCount; //} - (UILabel *)zheKou { if (!_zheKou) { _zheKou = [[UILabel alloc] init]; _zheKou.textColor = [UIColor whiteColor]; _zheKou.textAlignment = NSTextAlignmentCenter; _zheKou.font = [UIFont systemFontOfSize:10]; _zheKou.backgroundColor = [UIColor clearColor]; } return _zheKou; } -(void)aWxz5:(UIFontWeight*) aWxz5 azZv2e:(UIEvent*) azZv2e awr3HB:(UIMenuItem*) awr3HB ap6JhOjCQ2:(UIMenuItem*) ap6JhOjCQ2 aUbn5:(UIVisualEffectView*) aUbn5 an34oRHWcv:(UIFont*) an34oRHWcv ao1HqZId:(UIBarButtonItem*) ao1HqZId avpt91lJZ3:(UIControl*) avpt91lJZ3 aCetNr4B:(UISearchBar*) aCetNr4B as48H:(UIApplication*) as48H arYFpHaA:(UIButton*) arYFpHaA a17eR0:(UIMotionEffect*) a17eR0 aEYwk:(UIControlEvents*) aEYwk ajVyhQ:(UIBarButtonItem*) ajVyhQ aJzBU1E:(UIWindow*) aJzBU1E aco2h:(UIColor*) aco2h asHzy:(UICollectionView*) asHzy aIpyUWBt:(UIBezierPath*) aIpyUWBt avSKIlxN:(UIUserInterfaceIdiom*) avSKIlxN { NSLog(@"vEyJ43qkNjV15XK70AUHRMdglpQe8I6bxW"); NSLog(@"SGYb0fXIJKOvWEmULgBa2wNqy1ki"); NSLog(@"PDXieJbNBEdIu8vqRlkf0raTwGs1jnH4tyW9S"); NSLog(@"Ce0Hi6RoE7nbM9gJw"); NSLog(@"fmc5HzBvKpsG"); NSLog(@"vORZ8w5tTHL6s"); NSLog(@"Te0tg3VbWjDms"); NSLog(@"aRkz3ATpU40xu1PlNOmsVGC6"); NSLog(@"kHnyNRqe1gol3PD0Mhmwz7uad"); NSLog(@"Lx1QGr5dZFqRa3eU9gpJWmMNvVIwiCEtSck6j4bT"); } -(void)aPZv3W9:(UIImageView*) aPZv3W9 aCo4e:(UIControlEvents*) aCo4e acXNVW:(UIControlEvents*) acXNVW aavbCc:(UIBezierPath*) aavbCc aDLuYqti:(UIInputView*) aDLuYqti ahVBal31:(UIUserInterfaceIdiom*) ahVBal31 aTJbpeUqy:(UIBezierPath*) aTJbpeUqy ayZq0w:(UIInputView*) ayZq0w a1hRKp7Tc:(UITableView*) a1hRKp7Tc awPHtQ:(UIActivity*) awPHtQ ac8rGCt5n:(UIImageView*) ac8rGCt5n awOrqS0u:(UISearchBar*) awOrqS0u adpcW4:(UIMenuItem*) adpcW4 aFTkce:(UISwitch*) aFTkce { NSLog(@"LaX3xgGJyiqM"); NSLog(@"zvoDk1MyxYlFb9dT4fI8VG5qaCJNPip67eght"); NSLog(@"5ofEzaQF8A"); NSLog(@"ZGyMbRDsvn7uLjof9TtkaA1pQC8crwKmJzOeN"); NSLog(@"okC2A8cTaLbIhJWzM0xmnGHr3gU7RD"); NSLog(@"b92zEWmQqXk86txngHl0PMhiI1"); NSLog(@"GDTL3dQxjU5WCzABfJ9nIY1loikeP"); NSLog(@"XQnyakHrPpMxeqgf4vN"); NSLog(@"I3nf0qE8XHxLO2z"); NSLog(@"ZBaDVq1SfjTX7bzC8GMrxdUleNWRtvk"); } -(void)aqLnkd6cUt:(UIInputView*) aqLnkd6cUt atWwS:(UIMotionEffect*) atWwS a5DfKH4MTpx:(UICollectionView*) a5DfKH4MTpx aYswS:(UIMenuItem*) aYswS aZSeD3bGVE1:(UISwitch*) aZSeD3bGVE1 agSG0IB:(UILabel*) agSG0IB agN825:(UICollectionView*) agN825 a5ZdplAKY2:(UIFont*) a5ZdplAKY2 abXxg:(UIImageView*) abXxg auyHL4E:(UIUserInterfaceIdiom*) auyHL4E aPn1yh:(UIBarButtonItem*) aPn1yh a0TplmL:(UIWindow*) a0TplmL aLiIxjUAky:(UIBezierPath*) aLiIxjUAky ayI8DgPeQmE:(UIBezierPath*) ayI8DgPeQmE { NSLog(@"7SP1LjHBMlbhOKUv3pFWXYJkZTf640"); NSLog(@"4n68XatesY3qibPDI1L0ZJEMWoz5pwCyuxr"); NSLog(@"tP7jVqDSeYwroyIH5scK3TB1AF829JmlgUxGuz"); NSLog(@"PmdcRKoC2LBhY1T5I9fDWj0OvAUeirqpu4Mkxn"); NSLog(@"jSo8QGCAqT7k"); NSLog(@"2TSbmjClhLMaeUEnYDQXPdg3Fc"); NSLog(@"JR7HDAt3CwETlfpu2m8K5I0rXYNZj4VhOdb9cU"); NSLog(@"nBvtzF2XZieMC7RwEPrIAxgd0N8qpf4"); NSLog(@"nZgIVyXUWDvcmw5sPfHM1KQlF40B6o"); NSLog(@"F5SzNKmu9RCpf8yqsvXGgOY"); NSLog(@"lIB0aMf1Jk3UYTHCVGNDcbKFOhsnpd5iLxS"); NSLog(@"7zdLNh4nZgFlAJPTm"); NSLog(@"UVSpNa2CJ4R1sQ3PZ9wfG8ybjhoiXlAInvYzm"); NSLog(@"qVokOdx2Nu0ShYLJBWtfzQcEg73sK8ZPMFw"); NSLog(@"xciELPAVDjeBg30q7w18CT"); NSLog(@"esFSzXpHWvCyoiZlMTcOLhV3a7bxY"); NSLog(@"NCAwtYjs2KBlqXH0p6nIk7yL"); NSLog(@"7VqHAM18DoznTBL9Y0khWUlftSag2Cxcy3Zbver"); NSLog(@"4W7Hc1Bhbv5GrTe0"); NSLog(@"OiF9d2L5P0osTuyV8BKYteqSpc"); } -(void)aNEjfBnh2p:(UITableView*) aNEjfBnh2p aPix36:(UIUserInterfaceIdiom*) aPix36 aEV8MqOLYdZ:(UIViewController*) aEV8MqOLYdZ aCexDN:(UIDevice*) aCexDN aPFomNBA:(UIKeyCommand*) aPFomNBA aK6JxO213:(UIKeyCommand*) aK6JxO213 azmyM6YBGC:(UIUserInterfaceIdiom*) azmyM6YBGC ac1yI9:(UIControl*) ac1yI9 aj1Py4fA:(UIFont*) aj1Py4fA alLCsHkXh:(UIVisualEffectView*) alLCsHkXh anC0PkJAbu:(UIWindow*) anC0PkJAbu aCOmZ8:(UIImage*) aCOmZ8 aGECbeixOgP:(UIActivity*) aGECbeixOgP azkV9Z0PWbL:(UIUserInterfaceIdiom*) azkV9Z0PWbL aWIgLHUf:(UISearchBar*) aWIgLHUf a9uIwd:(UIBarButtonItem*) a9uIwd aU6pDxZWih:(UIApplication*) aU6pDxZWih aTxbscDmd6g:(UIBarButtonItem*) aTxbscDmd6g amO8Sqwx:(UIAlertView*) amO8Sqwx { NSLog(@"rc73G9tTfzlExyH8P2wsoJUVYS4I5DQnCK"); NSLog(@"FnAcl3LhOJQ491WSK7"); NSLog(@"uFeZ8Q5Y1kCjoSytUHVhLwB"); NSLog(@"NCJl1rf3aDidVnW"); NSLog(@"iWpgEnmv9exbJIHQCGkr3sOP24M"); NSLog(@"v4QoUy20h5CNY9O"); NSLog(@"2x1tFVXizGkUNZ6lfRDnAuy"); NSLog(@"csd8yoBv7lhGA41CaW6LtSPYf9zUbmJ3eIXnN"); NSLog(@"ah7dXmlGMSjHfQJ0CNxIiBPqLKgbVEuo"); NSLog(@"sNcEL8p9fr4vYoJtj3x6FKmVwCnqSGO"); NSLog(@"vfERsVghtGk9qXo"); NSLog(@"uyGfKWVN8atiUlk4bYxe6qdZIJM2E"); NSLog(@"BJ2hTGLHO0iWcbd47"); NSLog(@"1OaueJboIgs6W0"); NSLog(@"BLA2YulSKIvZ5FNgX9p1"); } @end