1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// 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
}
#pragma mark 赋值
- (void)setModel:(ShopcarModel *)model
{
_model = model;
NSArray *images = [_model.goods.pictures componentsSeparatedByString:@","];
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:[images firstObject]] placeholderImage:REPLACEIMAGE];
self.goodsName.text = _model.goods.name;
self.specifications.text = _model.goods.size;
self.goodsCode.text = _model.goods.code;
self.goodsNumber.text = [NSString stringWithFormat:@"数量 X%d",_model.goodsNum];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%.2f",[_model.costPrice floatValue]];
//计算总价格
NSInteger number = _model.goodsNum;
CGFloat price = [_model.costPrice floatValue];
CGFloat allPrice = number*price;
self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",allPrice];
}
#pragma mark -订单详情页赋值
- (void)setOrderDetailslist:(TOOrderdetailEntity *)orderDetailslist
{
_orderDetailslist = orderDetailslist;
self.goodsName.text = _orderDetailslist.goodsName;
self.goodsCode.text = _orderDetailslist.goodsCode;
self.goodsSize.text = _orderDetailslist.remark;
NSArray *goodsHeader = [_orderDetailslist.goodsCover componentsSeparatedByString:@","];
[self.goodsHeader sd_setImageWithURL:[NSURL URLWithString:[goodsHeader firstObject]] placeholderImage:REPLACEIMAGE];
self.goodsNumber.text = [NSString stringWithFormat:@"数量 X%@",_orderDetailslist.goodsNum];
self.clinchPrice.text = [NSString stringWithFormat:@"成交价 ¥%.2f",[_orderDetailslist.goodsPrice floatValue]];
//小计
CGFloat totalPrice = [_orderDetailslist.goodsNum integerValue] * [_orderDetailslist.goodsPrice floatValue];
self.totalPrice.text = [NSString stringWithFormat:@"¥%.2f",totalPrice];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end