CommodityListTableViewCell.m 2.26 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//
//  CommodityListTableViewCell.m
//  Lighting
//
//  Created by 曹云霄 on 16/5/4.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "CommodityListTableViewCell.h"

@implementation CommodityListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

勾芒's avatar
勾芒 committed
18 19 20 21
#pragma mark 赋值
- (void)setModel:(ShopcarModel *)model
{
    _model = model;
勾芒's avatar
勾芒 committed
22 23
    NSArray *images = [_model.goods.pictures componentsSeparatedByString:@","];
    [self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:[images firstObject]] placeholderImage:REPLACEIMAGE];
勾芒's avatar
勾芒 committed
24
    self.goodsName.text = _model.goods.name;
25
    self.specifications.text = _model.goods.spec;
polo2013's avatar
polo2013 committed
26
    self.goodsCode.text = _model.goods.code;
曹云霄's avatar
曹云霄 committed
27
    self.goodsNumber.text = [NSString stringWithFormat:@"数量   X%ld",(long)_model.goodsNum];
勾芒's avatar
勾芒 committed
28
    self.clinchPrice.text = [NSString stringWithFormat:@"成交价   ¥%.2f",[_model.costPrice floatValue]];
勾芒's avatar
勾芒 committed
29
    //计算总价格
勾芒's avatar
勾芒 committed
30
    NSInteger number = _model.goodsNum;
勾芒's avatar
勾芒 committed
31
    CGFloat price = [_model.costPrice floatValue];
勾芒's avatar
勾芒 committed
32 33
    CGFloat allPrice = number*price;
    self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
勾芒's avatar
勾芒 committed
34 35 36 37
}



勾芒's avatar
勾芒 committed
38 39 40
#pragma mark -订单详情页赋值
- (void)setOrderDetailslist:(TOOrderdetailEntity *)orderDetailslist
{
polo2013's avatar
polo2013 committed
41
    
勾芒's avatar
勾芒 committed
42
    _orderDetailslist = orderDetailslist;
polo2013's avatar
polo2013 committed
43
    self.goodsName.text = _orderDetailslist.goodsName;
44 45
    self.goodsCode.text = _orderDetailslist.goodsSpec;
    self.goodsSize.text = _orderDetailslist.goodsCode;
勾芒's avatar
勾芒 committed
46 47
    NSArray *goodsHeader = [_orderDetailslist.goodsCover componentsSeparatedByString:@","];
    [self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:[goodsHeader firstObject]] placeholderImage:REPLACEIMAGE];
勾芒's avatar
勾芒 committed
48
    self.goodsNumber.text = [NSString stringWithFormat:@"数量   X%@",_orderDetailslist.goodsNum];
勾芒's avatar
勾芒 committed
49
    self.clinchPrice.text = [NSString stringWithFormat:@"成交价  ¥%.2f",[_orderDetailslist.goodsPrice floatValue]];
勾芒's avatar
勾芒 committed
50
    //小计
勾芒's avatar
勾芒 committed
51 52
    CGFloat totalPrice = [_orderDetailslist.goodsNum integerValue] * [_orderDetailslist.goodsPrice floatValue];
    self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",totalPrice];
勾芒's avatar
勾芒 committed
53 54 55 56 57
}




58 59 60 61 62 63 64
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end