KWMClothingSetsCell.m 2.16 KB
Newer Older
houweibin committed
1 2 3 4 5 6 7 8 9
//
//  KWMSuitCell.m
//  iCemarose
//
//  Created by HouWeiBin on 2017/6/5.
//  Copyright © 2017年 kollway. All rights reserved.
//

#import "KWMClothingSetsCell.h"
houweibin committed
10 11 12
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"
#import "UIImageView+WebCache.h"
houweibin committed
13 14 15
#import "BUYProductVariant+Currency.h"
#import "UIView+Prettify.h"
#import "UIColor+SAMAdditions.h"
houweibin committed
16 17 18 19 20 21 22 23


@interface KWMClothingSetsCell()

@property(nonatomic,weak) IBOutlet UILabel *lbName;

@property(nonatomic,weak) IBOutlet UILabel *lbPrice;

houweibin committed
24 25
@property(nonatomic,weak) IBOutlet UILabel *lbComparePrice;

houweibin committed
26 27
@property(nonatomic,weak) IBOutlet UIImageView *ivProduct;

houweibin committed
28 29 30 31 32
@property(nonatomic,weak) IBOutlet UIView *vMore;

@property(nonatomic,weak) IBOutlet UIView *vContent;


houweibin committed
33
@end
houweibin committed
34 35 36 37 38

@implementation KWMClothingSetsCell

- (void)awakeFromNib {
    [super awakeFromNib];
houweibin committed
39
    [self.vMore setBorder:0.5 cornerRadius:0 borderColor:[UIColor sam_colorWithHex:@"D8DBDE"]];
houweibin committed
40 41
}

houweibin committed
42 43 44 45 46 47 48 49 50
-(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;
houweibin committed
51 52 53 54 55 56 57 58 59 60
            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;
            }
houweibin committed
61 62 63 64
        }
    }
}

houweibin committed
65 66 67 68 69 70
-(void)setIsMore:(BOOL)isMore{
    _isMore = isMore;
    self.vMore.hidden = !isMore;
    self.vContent.hidden = isMore;
}

houweibin committed
71
@end