//
//  KWMShopCarCell.m
//  iCemarose
//
//  Created by HouWeiBin on 16/8/31.
//  Copyright © 2016年 kollway. All rights reserved.
//

#import "KWMShopCarCell.h"
#import "UIImageView+WebCache.h"
#import "KWMStringUtil.h"
#import "KWMImageUtil.h"


@implementation KWMShopCarCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (void)setShopCartModel:(KWMShopCartModel *)shopCartModel{
    _shopCartModel = shopCartModel;
    if (shopCartModel != nil) {
        _lbName.text = shopCartModel.name;
        _lbBrand.text = shopCartModel.brand;
        _lbSize.text = shopCartModel.size;
        _lbCount.text = [NSString stringWithFormat:@"%ld",(long)shopCartModel.quantity];
//        NSInteger totalPrice = shopCartModel.price*shopCartModel.quantity;
//        _lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:@(totalPrice)]];
        _lbPrice.text = shopCartModel.totalPrice;
        NSURL *imageURL = [NSURL URLWithString: shopCartModel.imageStr];
        [_ivImage sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
    }
}

-(void)onClickEdit:(id)sender{
    if(self.delegate !=nil){
        [self.delegate kwm_onClickEdit:_shopCartModel];
    }
}

-(void)onClickDelete:(id)sender{
    if(self.delegate !=nil){
        [self.delegate kwm_onClickDelete:_shopCartModel];
    }
}



@end