// // LDChildOrderCell.m // YouHuiProject // // Created by 小花 on 2018/5/18. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LDChildOrderCell.h" #import "CCCopyLabel.h" @interface LDChildOrderCell () @property (nonatomic, strong) UIImageView *icon; @property (nonatomic, strong) CCCopyLabel *orderTitle; @property (nonatomic, strong) UILabel *orderDate; @property (nonatomic, strong) UILabel *orderPrice; @property (nonatomic, strong) UILabel *orderType; @end @implementation LDChildOrderCell + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *cellID = nil; cellID = NSStringFromClass([self class]); LDChildOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (!cell) { cell = [[LDChildOrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; } return cell; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self initSubView]; } return self; } - (void)initSubView { [self.contentView addSubview:self.icon]; [self.contentView addSubview:self.orderTitle]; [self.contentView addSubview:self.orderDate]; [self.contentView addSubview:self.orderPrice]; [self.contentView addSubview:self.orderType]; [self.icon mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(FITSIZE(15)); make.centerY.mas_equalTo(self.mas_centerY); make.width.height.mas_equalTo(FITSIZE(42)); }]; [self.orderTitle mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.icon.mas_right).mas_offset(FITSIZE(13)); make.top.mas_equalTo(FITSIZE(18)); make.height.mas_equalTo(FITSIZE(22)); }]; [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.orderTitle); make.top.mas_equalTo(self.orderTitle.mas_bottom).mas_offset(FITSIZE(4)); }]; [self.orderPrice mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-FITSIZE(14)); make.top.mas_equalTo(FITSIZE(18)); make.height.mas_equalTo(FITSIZE(25)); }]; [self.orderType mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-FITSIZE(14)); make.top.mas_equalTo(self.orderTitle.mas_bottom); make.height.mas_equalTo(FITSIZE(17)); }]; } - (UILabel *)orderTitle { if (!_orderTitle) { _orderTitle = [[CCCopyLabel alloc] init]; _orderTitle.font = [UIFont systemFontOfSize:16]; _orderTitle.text = @"佣金收入"; _orderTitle.textColor = [UIColor YHColorWithHex:0x353535]; } return _orderTitle; } - (UILabel *)orderDate { if (!_orderDate) { _orderDate = [[UILabel alloc] init]; _orderDate.textColor = [UIColor YHColorWithHex:0x999999]; _orderDate.font = [UIFont systemFontOfSize:12]; _orderDate.text = @"日期:--"; } return _orderDate; } - (UILabel *)orderPrice { if (!_orderPrice) { _orderPrice = [[UILabel alloc] init]; _orderPrice.font = [UIFont fontWithName:@"Helvetica-Bold" size:18]; _orderPrice.textAlignment = NSTextAlignmentRight; _orderPrice.text = @"+0.00"; } return _orderPrice; } -(UILabel *)orderType{ if (!_orderType) { _orderType=[[UILabel alloc]init]; _orderType.textColor = [UIColor YHColorWithHex:0xE04A4A]; _orderType.font = [UIFont systemFontOfSize:12]; _orderType.text = @"申请状态"; } return _orderType; } - (UIImageView *)icon { if (!_icon) { _icon = [[UIImageView alloc] init]; _icon.image = [UIImage imageNamed:@"comission_left"]; _icon.layer.cornerRadius = 14; } return _icon; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } -(void)setModel:(LDChildOrderModel *)model{ _model=model; [self.icon sd_setImageWithURL:[NSURL URLWithString:model.img]]; self.orderTitle.text=model.title; self.orderDate.text=[NSString stringWithFormat:@"%@",model.create_time]; if (model.mode.integerValue == 1) {//佣金收入 self.orderPrice.textColor=[UIColor YHColorWithHex:0xFF8712]; self.orderPrice.text=[NSString stringWithFormat:@"+%@",model.rebate]; }else if (model.mode.integerValue == 2){//提现 self.orderPrice.textColor=[UIColor YHColorWithHex:0x343434]; self.orderPrice.text=[NSString stringWithFormat:@"%@",model.rebate]; } self.orderType.text=model.message; } @end