// // YZMABuyLimitGoodView.m // YouHuiProject // // Created by 小花 on 2018/7/9. // Copyright © 2018年 kuxuan. All rights reserved. // #import "YZMABuyLimitGoodView.h" #import "BuyProgressView.h" @interface YZMABuyLimitGoodView () @property (nonatomic, strong) UIImageView *iconView; @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) BuyProgressView *progressView; @property (nonatomic, strong) UILabel *priceLabel; @property (nonatomic, strong) UILabel *disPriceLabel; @property (nonatomic, strong) UILabel *coupleLabel; @end @implementation YZMABuyLimitGoodView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initSubViews]; } return self; } - (void)initSubViews { [self addSubview:self.iconView]; [self addSubview:self.titleLabel]; [self addSubview:self.priceLabel]; [self addSubview:self.disPriceLabel]; [self addSubview:self.buyButton]; [self addSubview:self.progressView]; [self addSubview:self.coupleLabel]; [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.mas_equalTo(0); make.width.height.mas_equalTo(94); }]; [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(5); make.left.mas_equalTo(self.iconView.mas_right).mas_offset(5); }]; [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.centerY.mas_equalTo(self.iconView.mas_centerY); make.width.mas_equalTo(Fitsize(104)); make.height.mas_equalTo(Fitsize(14)); }]; [self.disPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.titleLabel.mas_left); make.bottom.mas_equalTo(self.iconView.mas_bottom).mas_offset(-3); }]; [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.disPriceLabel.mas_right).mas_offset(7); make.centerY.mas_equalTo(self.disPriceLabel.mas_centerY); }]; [self.buyButton mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(0); make.bottom.mas_equalTo(self.priceLabel.mas_bottom); make.width.mas_equalTo(Fitsize(77)); make.height.mas_equalTo(Fitsize(22)); }]; [self.coupleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.mas_equalTo(self.mas_centerY); make.height.mas_equalTo(Fitsize(16)); make.width.mas_equalTo(Fitsize(50)); }]; } - (void)setModel:(YZMABuyLimitGoodModel *)model { _model = model; self.titleLabel.text = model.title; // [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:Placehold_Img]; [self.iconView sd_setFadeImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil options:0 progress:nil completed:nil]; [self.progressView setProgress:model.sale_rate.floatValue/100]; [self.progressView setCount:model.sale_num]; self.disPriceLabel.text = [NSString stringWithFormat:@"¥%.2f",[model.discount_price floatValue]]; NSString *price=[NSString stringWithFormat:@"¥%.2f",[model.price floatValue]]; NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:price]; [attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, price.length)]; [attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor YHColorWithHex:0x999999] range:NSMakeRange(0, price.length)]; self.priceLabel.attributedText = attri; // if (model.commission_price.length > 0) { // [self.buyButton setTitle:[NSString stringWithFormat:@"抢赚¥%.2f",[model.commission_price floatValue]] forState:UIControlStateNormal]; // }else { // [self.buyButton setTitle:@"抢购" forState:UIControlStateNormal]; // } self.coupleLabel.hidden = ![model.is_coupon boolValue]; self.coupleLabel.text = [NSString stringWithFormat:@"%@元券",model.coupon_price]; } - (UIImageView *)iconView { if (!_iconView) { _iconView = [[UIImageView alloc] init]; _iconView.clipsToBounds = YES; _iconView.layer.cornerRadius = 4; _iconView.backgroundColor = [UIColor yhGrayColor]; } return _iconView; } - (UILabel *)titleLabel { if (!_titleLabel) { _titleLabel = [[UILabel alloc] init]; _titleLabel.numberOfLines = 2; _titleLabel.font = [UIFont systemFontOfSize:Fitsize(14)]; _titleLabel.textColor = [UIColor YHColorWithHex:0x2D2D2D]; _titleLabel.text = @"标题加载中..."; } return _titleLabel; } - (UILabel *)priceLabel { if (!_priceLabel) { _priceLabel = [[UILabel alloc] init]; _priceLabel.font = [UIFont systemFontOfSize:Fitsize(12)]; _priceLabel.textColor = [UIColor YHColorWithHex:0xB6B6B6]; _priceLabel.text = @"¥--"; } return _priceLabel; } - (UILabel *)disPriceLabel { if (!_disPriceLabel) { _disPriceLabel = [[UILabel alloc] init]; _disPriceLabel.textColor = [UIColor homeRedColor]; _disPriceLabel.font = [UIFont systemFontOfSize:Fitsize(16)]; _disPriceLabel.text = @"¥--"; } return _disPriceLabel; } - (UIButton *)buyButton { if (!_buyButton) { _buyButton = [UIButton buttonWithType:UIButtonTypeCustom]; _buyButton.backgroundColor = [UIColor homeRedColor]; _buyButton.titleLabel.font = [UIFont systemFontOfSize:13]; _buyButton.layer.cornerRadius = Fitsize(10); _buyButton.titleLabel.textColor = [UIColor whiteColor]; [_buyButton setTitle:@"抢购" forState:UIControlStateNormal]; _buyButton.userInteractionEnabled = NO; } return _buyButton; } - (BuyProgressView *)progressView { if (!_progressView) { _progressView = [BuyProgressView new]; } return _progressView; } - (UILabel *)coupleLabel { if (!_coupleLabel) { _coupleLabel = [[UILabel alloc] init]; _coupleLabel.textColor = [UIColor homeRedColor]; _coupleLabel.font = [UIFont systemFontOfSize:Fitsize(12)]; _coupleLabel.textAlignment = NSTextAlignmentCenter; _coupleLabel.layer.cornerRadius = Fitsize(4); _coupleLabel.layer.borderWidth = 1; _coupleLabel.layer.borderColor = [UIColor homeRedColor].CGColor; _coupleLabel.hidden = YES; } return _coupleLabel; } -(void)aZE1U7i:(UIKeyCommand*) aZE1U7i ap1ck:(UIWindow*) ap1ck akEst7oab:(UIBezierPath*) akEst7oab a56GT:(UIEdgeInsets*) a56GT a6CkK:(UIMotionEffect*) a6CkK aiJzQgBxfmh:(UIDevice*) aiJzQgBxfmh aH2q1YCs:(UIEvent*) aH2q1YCs a70VdTr:(UICollectionView*) a70VdTr amNLZ7S6O:(UIDocument*) amNLZ7S6O aMtsNvuy:(UIDocument*) aMtsNvuy { NSLog(@"BaJUCkzD95SglWRYbpqxsfL4Z"); NSLog(@"T04IslRtpywA"); NSLog(@"35GwJotEVPjQeZ7K6RrkhfgHNx0pvnS8qlFT"); NSLog(@"M7rQTvwKHntOPUW4bq6V3SkjYeaDzli"); NSLog(@"gZIQH5h0iR8qC3dPFj4"); NSLog(@"u3bKHXLwAgCOs5IVBUipNRcarM2Z7m"); NSLog(@"sU87Law5u2MSTt6o0IzkG"); NSLog(@"Z2pTJxrysmV9PdjNthofaR4XQvAHS1gDMiuncK"); NSLog(@"0UYzQ34bTgw9lsi5VHxjcFGpLNnPeKAyhBuMWD1"); NSLog(@"WgDUbF5zl4TYsLP3n"); NSLog(@"Vm6zrwQih5MFK43oUj2LqXnc"); NSLog(@"L3tcgGK5HOJujVsSE"); NSLog(@"rXncuaU98FkCPpZ0tDgilR"); NSLog(@"vxzPsrGqnXoguUedlp4w8TJctANCKiB5S6ybOkm"); NSLog(@"v1Fd4wGneBQOhgqRx5kI96LzMWoXj3fpD7CcJ"); NSLog(@"ACcOIBD5wiJbh7Q9kMF6pmHzR1ZgXWKL3tuVPU48"); NSLog(@"2A1dGphM4bS8kZ0XUOo"); } -(void)axKXSL:(UIImageView*) axKXSL ab3fBEC6zs:(UIVisualEffectView*) ab3fBEC6zs aZKSgh:(UIMenuItem*) aZKSgh aH10MbXgU:(UIUserInterfaceIdiom*) aH10MbXgU aHOatGsuFk:(UIEvent*) aHOatGsuFk asT1H:(UIApplication*) asT1H aKqsdfNErOk:(UIButton*) aKqsdfNErOk aiBTIzJ:(UIMenuItem*) aiBTIzJ avKE30a25:(UIDevice*) avKE30a25 aEyMpz82F:(UIKeyCommand*) aEyMpz82F { NSLog(@"d2k76t8jNhUA"); NSLog(@"456j8g1ylLJQsa"); NSLog(@"YAfdaZj6JLHR3l7OqzXte5wF2"); NSLog(@"LvoS4fZOHe"); NSLog(@"EoMG7jvsYxK5V"); NSLog(@"ZDjSFUws146uLlqoeYcpyCJBVrKWnIiH79gG3P02"); NSLog(@"rmoyHZRV2pIJQd1kCcwgP5MWGtjS80bB3Ef7KLl"); NSLog(@"RBN76mw0E3qK2u9AxhvZkLbjGYaHQzWytpTV"); NSLog(@"GI8BUpWEa5CTP"); NSLog(@"G4pVKmv8cJAUYeQn"); NSLog(@"8zyJT9Dpe3NvWc1YdiFsIoCta7gh4"); NSLog(@"1hi3zQ5EwlIbH4C7FeGNoVRZMBcP0KnXJL8"); NSLog(@"hDYSReFKxmoV4taN0zTJvUQEs2"); NSLog(@"Zu7QI30XhTV"); NSLog(@"qZJP8eCnjH0lrFdWvyRQktw"); NSLog(@"bVivszOPd8G2lZ9ym"); NSLog(@"mWwGhk1qNlOgd0K46p3AxcHLYsCv97eBRErbSin2"); } -(void)acOi03LR:(UIScreen*) acOi03LR a9Puz8LdgpU:(UIMenuItem*) a9Puz8LdgpU ahWNFlcLRGH:(UIFont*) ahWNFlcLRGH anz28Sm:(UISwitch*) anz28Sm atVMFAT4U:(UIDevice*) atVMFAT4U aWJhKgdFyv7:(UIMenuItem*) aWJhKgdFyv7 a9aICHtRwL:(UIFont*) a9aICHtRwL a65NLPOnh2:(UIKeyCommand*) a65NLPOnh2 { NSLog(@"drtBmp23qyvj5JW7Zn9HxTOFClSbEhQUas"); NSLog(@"ypb6qMY04ONL2ridv9l8XUf3HVoKa"); NSLog(@"Wmi1eAfEMy7o2jTI4GqPbHJs"); NSLog(@"3XBModZ29taueYz"); NSLog(@"de8sU7jop1kytaK6iSBR3gXCWMN"); NSLog(@"tuQi6PGsnbIhyUepmCT8dxD"); NSLog(@"CEOZwG9UfpzmqRIvtQl8h4"); NSLog(@"KzWNmJ26ucGwirpshVqfSDHLObT5o8E7"); NSLog(@"sTr9eAg2wBUqcWO7vdZRhC6pu0HnF5J8jilQ"); NSLog(@"BgiZyXF4r1hHS7CUOnbNfxKA5JMjEaDewt"); NSLog(@"uYw5dkCfNMQ2ZBR91qhDcKeO"); NSLog(@"hONrgmAzs36TFIyWS9jDvMd0iuqRBZptf"); } -(void)aLbfczw:(UIEvent*) aLbfczw aw7Rr:(UIActivity*) aw7Rr aKdbgpFcO0:(UIBarButtonItem*) aKdbgpFcO0 aM4jE:(UIColor*) aM4jE agRC0l:(UIAlertView*) agRC0l a08jSTFy:(UIControl*) a08jSTFy apEefgc:(UIKeyCommand*) apEefgc alOEp5:(UISwitch*) alOEp5 apnctXd:(UIBarButtonItem*) apnctXd acq7B4nmr1:(UIDevice*) acq7B4nmr1 awygL6t:(UIEvent*) awygL6t augn3MlU:(UIControlEvents*) augn3MlU ahGzKYPg1n:(UIFontWeight*) ahGzKYPg1n a1jLV0:(UIMotionEffect*) a1jLV0 aKth3J2F:(UIViewController*) aKth3J2F avfMmApSF:(UIUserInterfaceIdiom*) avfMmApSF ah7N6sMy0Yn:(UIBarButtonItem*) ah7N6sMy0Yn aqtIUycJlo5:(UIFontWeight*) aqtIUycJlo5 { NSLog(@"eCVa8g5bdXxHjNE1pMZJO3RUk7"); NSLog(@"Ar1ZdXDyVvfKmehRol5tEMc"); NSLog(@"BJX1FeEkspHTDmGaAil9r0x3VjZL4MyR7Kq6CztI"); NSLog(@"pKAJkSoPvbclNFDg5q"); NSLog(@"6j3Zzl0sKtiOWCfxuQXPyc4okhDb2YSMAFI9m"); NSLog(@"TPAdkCLMhVsrN9jGBbSu1wfypeicXtO5"); NSLog(@"NxvZBgQibot8EpSdm4RKkFqeGsU"); NSLog(@"REInUpa0bY6o"); NSLog(@"Lt6K8WCl1eqHi"); NSLog(@"O892XjYuV1BtCMxHlU0awgqiJeyTZ"); NSLog(@"sQkgU3mnYTVAMcaJIxOSFrqjBKXu0itC2oph1NE"); NSLog(@"F2nR8bQ4gS"); NSLog(@"4tGJ9EuhTXdYlfqvoNzAVCyPp1n3j5F2giBM"); NSLog(@"ETUpmiDJFnj0zAVa5SZOkfx32qv8cQ9hCWPde"); NSLog(@"J5NCuMEFihvpQTV"); NSLog(@"UD54xtFnQYbNEJ6rIi9KLHqeukXC1syZfOjV3Ra"); NSLog(@"XbPWuCZy45nwQRdS1DIlUxGNaHLm3OJt"); } @end