// // KWMSuitCell.m // iCemarose // // Created by HouWeiBin on 2017/6/5. // Copyright © 2017年 kollway. All rights reserved. // #import "KWMClothingSetsCell.h" #import "KWMStringUtil.h" #import "KWMImageUtil.h" #import "UIImageView+WebCache.h" #import "BUYProductVariant+Currency.h" #import "UIView+Prettify.h" #import "UIColor+SAMAdditions.h" @interface KWMClothingSetsCell() @property(nonatomic,weak) IBOutlet UILabel *lbName; @property(nonatomic,weak) IBOutlet UILabel *lbPrice; @property(nonatomic,weak) IBOutlet UILabel *lbComparePrice; @property(nonatomic,weak) IBOutlet UIImageView *ivProduct; @property(nonatomic,weak) IBOutlet UIView *vMore; @property(nonatomic,weak) IBOutlet UIView *vContent; @end @implementation KWMClothingSetsCell - (void)awakeFromNib { [super awakeFromNib]; [self.vMore setBorder:0.5 cornerRadius:0 borderColor:[UIColor sam_colorWithHex:@"D8DBDE"]]; } -(void)setProduct:(BUYProduct *)product{ _product = product; if(product){ NSString *imageUrl = [KWMImageUtil getProductImageUrl:product ImageSize:SmallImage]; NSURL *imageURL = [NSURL URLWithString:imageUrl]; [self.ivProduct sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]]; self.lbName.text = product.title; if(product.variantsArray.count>0){ BUYProductVariant *variant = product.variantsArray.firstObject; self.lbPrice.text = variant.price.priceValueFormatted; if(variant.compareAtPrice){ self.lbComparePrice.hidden = NO; NSString *priceString = variant.compareAtPriceFormatted; NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic]; self.lbComparePrice.attributedText = attribtStr; }else{ self.lbComparePrice.hidden = YES; } } } } -(void)setIsMore:(BOOL)isMore{ _isMore = isMore; self.vMore.hidden = !isMore; self.vContent.hidden = isMore; } @end