// // PurchaseintentionCell.m // jitao // // Created by 罗云飞 on 2017/12/9. // Copyright © 2017年 罗云飞. All rights reserved. // #import "PurchaseintentionCell.h" @implementation PurchaseintentionCell{ } - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UILabel *headline = [UILabel new]; headline.backgroundColor = NewGroupTableViewBackgroundColor; [self.contentView addSubview:headline]; headline.sd_layout .widthIs(SCREEN_WIDTH) .topEqualToView(self.contentView) .heightIs(10); UIImageView *image = [UIImageView new]; [image setImage:[UIImage imageNamed:@"dd1"]]; [image setBackgroundColor:NewClearColor]; [self.contentView addSubview:image]; image.sd_layout .leftSpaceToView(self.contentView, 18) .topSpaceToView(headline, 13) .heightIs(19) .widthIs(14); _title = [UILabel new]; _title.textColor = NewBlackColor; _title.font = NewFont(fitScreenWidth(14)); _title.lineBreakMode = NSLineBreakByTruncatingTail; _title.numberOfLines = 1; // [self.contentView addSubview:_title]; // _title.sd_layout // .leftSpaceToView(image, fitScreenWidth(7)) // .topSpaceToView(headline, 15) // .heightIs(fitScreenWidth(14)) // .rightSpaceToView(self.contentView, 35); UILabel *line = [UILabel new]; line.backgroundColor = NewLineGrayColor; [self.contentView addSubview:line]; line.sd_layout .leftEqualToView(self.contentView) .heightIs(0.8) .rightEqualToView(self.contentView) .topSpaceToView(headline, fitScreenHeight(44)); _state = [UILabel new]; _state.textColor = [UIColor colorWithString:@"#FF8523"]; ViewBorderRadius(_state, 3, 1, [UIColor colorWithString:@"#FF8523"]); _state.font = NewFont(fitScreenWidth(11)); _state.textAlignment = NSTextAlignmentCenter; [self.contentView addSubview:_state]; _state.sd_layout .leftSpaceToView(self.contentView, 15) .widthIs(fitScreenWidth(75)) .heightIs(fitScreenWidth(20)) .bottomSpaceToView(self.contentView, 10+30+5); _jiage = [UILabel new]; _jiage.textColor = [UIColor colorWithString:@"#FF8523"]; _jiage.font = NewFont(fitScreenWidth(13)); [_jiage setSingleLineAutoResizeWithMaxWidth:0]; [self.contentView addSubview:_jiage]; _jiage.sd_layout .centerYEqualToView(_state) .rightSpaceToView(self.contentView, 15) .heightIs(15); _ordernumber = [UILabel new]; _ordernumber.textColor = [UIColor colorWithString:@"#FF8523"]; _ordernumber.font = NewFont(fitScreenWidth(14)); _ordernumber.lineBreakMode = NSLineBreakByTruncatingTail; _ordernumber.numberOfLines = 1; [self.contentView addSubview:_ordernumber]; _ordernumber.sd_layout .leftSpaceToView(image, fitScreenWidth(7)) .topSpaceToView(headline, 15) .heightIs(fitScreenWidth(14)) .rightSpaceToView(self.contentView, 35); _time = [UILabel new]; _time.font = NewFont(fitScreenWidth(11)); [_time setSingleLineAutoResizeWithMaxWidth:0]; _time.textColor = [UIColor colorWithString:@"#9A9A9A"]; [self.contentView addSubview:_time]; _time.sd_layout .leftSpaceToView(self.contentView, 15) .heightIs(10) .topSpaceToView(line, 10); _content = [UILabel new]; _content.font = NewFont(fitScreenWidth(13)); _content.textColor = [UIColor colorWithString:@"#9A9A9A"]; _content.lineBreakMode = NSLineBreakByTruncatingTail; _content.numberOfLines = 1; [self.contentView addSubview:_content]; _content.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(_time, 10) .rightSpaceToView(self.contentView, 15) .heightIs(15); _content1 = [UILabel new]; _content1.font = NewFont(fitScreenWidth(13)); _content1.textColor = [UIColor colorWithString:@"#9A9A9A"]; _content1.lineBreakMode = NSLineBreakByTruncatingTail; _content1.numberOfLines = 1; [self.contentView addSubview:_content1]; _content1.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(_content, 5) .rightSpaceToView(self.contentView, 15) .heightIs(15); _content2 = [UILabel new]; _content2.font = NewFont(fitScreenWidth(13)); _content2.textColor = [UIColor colorWithString:@"#9A9A9A"]; _content2.lineBreakMode = NSLineBreakByTruncatingTail; _content2.numberOfLines = 1; [self.contentView addSubview:_content2]; _content2.sd_layout .leftSpaceToView(self.contentView, 15) .topSpaceToView(_content1, 5) .rightSpaceToView(self.contentView, 15) .heightIs(15); _cancelintention = [UIButton new]; [_cancelintention setTitleColor:NewWhiteColor forState:UIControlStateNormal]; _cancelintention.titleLabel.font = NewFont(fitScreenWidth(12)); [_cancelintention setBackgroundColor:NewButtonColor]; NewTouchUpInside(_cancelintention, _cancelintentionclick:); ViewRadius(_cancelintention, 3); [_cancelintention setHidden:YES]; [self.contentView addSubview:_cancelintention]; _cancelintention.sd_layout .rightSpaceToView(self.contentView, 15) .bottomSpaceToView(self.contentView, 10) .heightIs(30) .widthIs(100); _cancelintention1111= [UIButton new]; [_cancelintention1111 setTitleColor:NewWhiteColor forState:UIControlStateNormal]; _cancelintention1111.titleLabel.font = NewFont(fitScreenWidth(12)); [_cancelintention1111 setBackgroundColor:NewButtonColor]; ViewRadius(_cancelintention1111, 3); NewTouchUpInside(_cancelintention1111, _cancelintentionclick:); [_cancelintention1111 setHidden:YES]; [self.contentView addSubview:_cancelintention1111]; _cancelintention1111.sd_layout .rightSpaceToView(_cancelintention, 20) .bottomSpaceToView(self.contentView, 10) .heightIs(30) .widthIs(100); } return self; } - (void)assignment:(PurchaseintentionModel *)model commoditysModel:(NSArray *)arr{ _jiage.text = [NSString stringWithFormat:@"总额:%@",model.orderAmount]; _title.text = model.commodityName; _state.text = model.orderStatus; _ordernumber.text = [NSString stringWithFormat:@"订单编号:%@",model.orderNo]; [_time setText:model.createTime]; if (arr.count>0) { if (arr.count == 1) { _content.text = [NSString stringWithFormat:@"%@",arr[0][@"commodityName"]]; }else if (arr.count == 2){ _content1.text = [NSString stringWithFormat:@"%@",arr[1][@"commodityName"]]; }else if (arr.count == 3){ _content2.text = [NSString stringWithFormat:@"%@",arr[2][@"commodityName"]]; } } NSDictionary *dic = model.operatorActive; NSString *a = [NSString stringWithFormat:@"%@",dic[@"refuseIntention"]]; NSString *a1 = [NSString stringWithFormat:@"%@",dic[@"applyForCancel"]]; NSString *a2 = [NSString stringWithFormat:@"%@",dic[@"payForFirst"]]; NSString *a3 = [NSString stringWithFormat:@"%@",dic[@"payForLast"]]; NSString *a4 = [NSString stringWithFormat:@"%@",dic[@"applyForWithdraw"]]; NSString *a5 = [NSString stringWithFormat:@"%@",dic[@"confirmPayForLast"]]; NSString *a6 = [NSString stringWithFormat:@"%@",dic[@"confirmRefund"]]; NSString *a7 = [NSString stringWithFormat:@"%@",dic[@"confirmWithdraw"]]; NSString *a8 = [NSString stringWithFormat:@"%@",dic[@"confirmIntention"]]; NSString *a9 = [NSString stringWithFormat:@"%@",dic[@"confirmPayForFirst"]]; NSString *a10 = [NSString stringWithFormat:@"%@",dic[@"applyForRefund"]]; NSString *a11 = [NSString stringWithFormat:@"%@",dic[@"agreeRefund"]]; NSString *a12 = [NSString stringWithFormat:@"%@",dic[@"refuseRefund"]]; NSArray *array = @[a.length>0?a:@"0", a1.length>0?a1:@"0", a2.length>0?a2:@"0", a3.length>0?a3:@"0", a4.length>0?a4:@"0", a5.length>0?a5:@"0", a6.length>0?a6:@"0", a7.length>0?a7:@"0", a8.length>0?a8:@"0", a9.length>0?a9:@"0", a10.length>0?a10:@"0", a11.length>0?a11:@"0", a12.length>0?a12:@"0"]; NSMutableArray *dataArray = [NSMutableArray array]; for (int i=0; i2) { _cancelintention.hidden = YES; _cancelintention1111.hidden = YES; }else if (dataArray.count==1) { [_cancelintention setTitle:dataArray[0][@"title"] forState:UIControlStateNormal]; _cancelintention.hidden = NO; _cancelintention1111.hidden = YES; }else if (dataArray.count==2) { [_cancelintention setTitle:dataArray[0][@"title"] forState:UIControlStateNormal]; [_cancelintention1111 setTitle:dataArray[1][@"title"] forState:UIControlStateNormal]; _cancelintention.hidden = NO; _cancelintention1111.hidden = NO; } } - (void)_cancelintentionclick:(UIButton *)sender { if (self.delegate && [self.delegate respondsToSelector:@selector(transButIndex:)]) { [self.delegate transButIndex:sender]; } } - (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