//
//  CommodityListCollectionViewCell.m
//  ALand
//
//  Created by Z on 16/3/23.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "CommodityListCollectionViewCell.h"
#import "NSDate+FormatterAdditions.h"
#import "addCommodityRequestModel.h"
#import "MBLabelWithFontAdapter.h"
@interface CommodityListCollectionViewCell ()
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelTitle;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelOriginalPrice;
@property (nonatomic, strong) CommotityListModel *model;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelBrokerageRate; //佣金
@property (weak, nonatomic) IBOutlet UILabel *labelSalesVolume; //销量


@end

@implementation CommodityListCollectionViewCell

- (void)cellWithModel:(CommotityListModel *)model {
    self.labelPrice.text = [NSString stringWithFormat:@"%.0f",model.price];
    [self.imageViewTop sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:kPlaceHolderImage];
    self.labelOriginalPrice.text = [NSString stringWithFormat:@"￥%.0f", model.originalPrice];
    self.labelBrokerageRate.text = [NSString stringWithFormat:@"￥%.2f", model.commission];
    self.labelSalesVolume.text = [NSString stringWithFormat:@"销量：%.0f", model.salesVolume];

    self.labelTitle.text = model.name;
    self.model = model;
}


- (IBAction)shareAction:(id)sender {
    UserInfo *userInfo = [UserInfo shareInstance];
    [[ShareInstance shareInstace] showWithTitle:@"Aland" content:self.model.name url:[NSString stringWithFormat:@"%@Wap/detail/shop_id/%@/id/%@/hastbar/0/.html", userInfo.webShopBaseUrl, userInfo.shop.uuid, self.model.uuid] image:self.imageViewTop.image];
}


- (void)awakeFromNib {
    // Initialization code
}

@end
