// // OrderdetailCell.m // jitao // // Created by 罗云飞 on 2017/12/24. // Copyright © 2017年 罗云飞. All rights reserved. // #import "OrderdetailCell.h" @implementation OrderdetailCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UILabel *line = [UILabel new]; line.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line]; line.sd_layout .leftEqualToView(self.contentView) .heightIs(10) .rightEqualToView(self.contentView) .topEqualToView(self.contentView); UILabel *line1 = [UILabel new]; line1.backgroundColor = NewButtonColor; ViewRadius(line1, 1); [self.contentView addSubview:line1]; line1.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(line, 15) .heightIs(fitScreenWidth(18)) .widthIs(3); _title = [UILabel new]; _title.font = NewFont(fitScreenWidth(14)); _title.lineBreakMode = NSLineBreakByTruncatingTail; _title.numberOfLines = 1; [self.contentView addSubview:_title]; _title.sd_layout .leftSpaceToView(line1, 10) .heightIs(fitScreenWidth(44)) .topSpaceToView(line, 0) .rightSpaceToView(self.contentView, 15); UILabel *line2 = [UILabel new]; line2.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line2]; line2.sd_layout .leftEqualToView(self.contentView) .heightIs(0.8) .rightEqualToView(self.contentView) .topSpaceToView(line, fitScreenWidth(44)); _state = [UILabel new]; _state.font = NewFont(fitScreenWidth(12)); _state.textColor = [UIColor colorWithString:@"#FF8523"]; ViewBorderRadius(_state, 5, 1, [UIColor colorWithString:@"#FF8523"]); _state.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:_state]; _state.sd_layout .leftEqualToView(line1) .topSpaceToView(line2, 15) .heightIs(fitScreenWidth(20)) .widthIs(fitScreenWidth(70)); _ordernumber = [UILabel new]; _ordernumber.font = NewFont(fitScreenWidth(12)); _ordernumber.textColor =[UIColor colorWithString:@"#FF8523"]; [_ordernumber setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_ordernumber]; _ordernumber.sd_layout .leftSpaceToView(_state, fitScreenWidth(20)) .heightIs(fitScreenWidth(14)) .topEqualToView(_state); _number = [UILabel new]; _number.font = NewBFont(fitScreenWidth(12)); _number.textColor = NewButtonColor; [_number setSingleLineAutoResizeWithMaxWidth:0]; // [self.contentView addSubview:_number]; _number.sd_layout .rightSpaceToView(self.contentView, 10) .centerYEqualToView(_ordernumber) .heightIs(fitScreenHeight(12)); UILabel *shuliang = [UILabel new]; shuliang.text = @"数量:"; shuliang.font = NewFont(fitScreenWidth(12)); [shuliang setSingleLineAutoResizeWithMaxWidth:0]; // [self.contentView addSubview:shuliang]; shuliang.sd_layout .rightSpaceToView(_number, 1) .heightIs(fitScreenWidth(12)) .centerYEqualToView(_ordernumber); _soufu = [UILabel new]; _soufu.font = NewFont(fitScreenWidth(12)); [_soufu setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_soufu]; _soufu.sd_layout .leftEqualToView(_state) .heightIs(fitScreenWidth(12)) .topSpaceToView(_state, 15); _weikuan = [UILabel new]; _weikuan.font = NewFont(fitScreenWidth(12)); [_weikuan setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_weikuan]; _weikuan.sd_layout .leftSpaceToView(_soufu, 10) .heightIs(fitScreenWidth(12)) .topSpaceToView(_state, 15); _time = [UILabel new]; _time.font = NewFont(fitScreenWidth(12)); _time.textColor = [UIColor colorWithString:@"#9A9A9A"]; [_time setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_time]; _time.sd_layout .rightSpaceToView(self.contentView, 15) .heightIs(fitScreenWidth(14)) .centerYEqualToView(_state); UILabel *jiage = [UILabel new]; jiage.text = @"输入金额:"; jiage.font = NewFont(fitScreenWidth(14)); [jiage setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:jiage]; jiage.sd_layout .leftEqualToView(_state) .heightIs(44) .bottomEqualToView(self.contentView); _price = [NewControlPackage textFieldInitWithFrame:CGRectMake(0, 0, 0, 0) backgroundImage:nil backgroundColor:NewClearColor textColor:[UIColor colorWithString:@"#FF8523"] placeholder:@"" hidden:NO tag:100 font:NewBFont(fitScreenWidth(14)) textAlignment:NSTextAlignmentLeft clearButtonMode:UITextFieldViewModeAlways clearsOnBeginEditing:NO adjustsFontSizeToFitWidth:NO secureTextEntry:NO keyboardType:UIKeyboardTypeNumberPad returnKeyType:UIReturnKeyDefault userInteractionEnabled:YES]; [self.contentView addSubview:_price]; _price.sd_layout .leftSpaceToView(jiage, 1) .heightIs(44) .widthIs(200) .bottomEqualToView(self.contentView); _zongjia = [UILabel new]; [_zongjia setSingleLineAutoResizeWithMaxWidth:0]; _zongjia.font = NewFont(fitScreenWidth(14)); [self.contentView addSubview:_zongjia]; _zongjia.sd_layout .centerYEqualToView(jiage) .heightIs(44) .rightSpaceToView(self.contentView, 15); } return self; } - (void)assignment:(OrderdetailModel*)model { // _title.text = model.commodityName; _state.text = model.orderStatus; _title.text = [NSString stringWithFormat:@"订单编号:%@",model.orderNo]; _time.text = [NSString stringWithFormat:@"%@",model.createTime]; _price.placeholder = model.orderAmount; // _number.text = @"一份"; _soufu.text = [NSString stringWithFormat:@"首付款:%@",model.firstPayment]; _weikuan.text = [NSString stringWithFormat:@"订单金额:%@",model.orderAmount]; NSDictionary *dic = model.operatorActive; NSString *a = [NSString stringWithFormat:@"%@",dic[@"payForFirst"]]; NSString *a1 = [NSString stringWithFormat:@"%@",dic[@"payForLast"]]; if ([a isEqualToString:@"1"]||[a1 isEqualToString:@"1"]) { _price.enabled = YES; }else{ _price.enabled = NO; } _zongjia.text = [NSString stringWithFormat:@"总额:%@",model.orderAmount]; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end