// // SkillsOrderCell.m // model // // Created by zuxiukuan on 2018/7/16. // Copyright © 2018年 Mine. All rights reserved. // 技能 订单 cell #import "SkillsOrderCell.h" @implementation SkillsOrderCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // self.selectionStyle = UITableViewCellSelectionStyleNone; [self creatCellSubViews]; } return self; } - (void)creatCellSubViews { // self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 18, 80, 80)]; [self.contentView addSubview:self.iconImageView]; // self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, 25, ScreenWidth / 2 - 60, 16)]; self.titleLabel.textAlignment = NSTextAlignmentLeft; self.titleLabel.textColor = RGBValueColor(0x333333, 1.0); self.titleLabel.font = [UIFont systemFontOfSize:16]; // 15 [self.contentView addSubview:self.titleLabel]; // self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, CGRectGetMaxY(self.titleLabel.frame) + 13, ScreenWidth / 2, 13)]; self.subTitleLabel.textAlignment = NSTextAlignmentLeft; self.subTitleLabel.textColor = RGBValueColor(0x999999, 1.0); //333333 self.subTitleLabel.font = [UIFont systemFontOfSize:13]; [self.contentView addSubview:self.subTitleLabel]; // self.childTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, CGRectGetMaxY(self.subTitleLabel.frame) + 10, ScreenWidth / 2, 13)]; self.childTitleLabel.textAlignment = NSTextAlignmentLeft; self.childTitleLabel.textColor = RGBValueColor(0x999999, 1.0); //333333 self.childTitleLabel.font = [UIFont systemFontOfSize:13]; [self.contentView addSubview:self.childTitleLabel]; // self.smallLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth - 150, 21, 130, 13)]; self.smallLabel.textAlignment = NSTextAlignmentRight; self.smallLabel.textColor = RGBValueColor(0x333333, 1.0); self.smallLabel.font = [UIFont systemFontOfSize:13]; // 15 [self.contentView addSubview:self.smallLabel]; // self.lineView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.iconImageView.frame) + 18, ScreenWidth, 0.5)]; self.lineView.backgroundColor = RGBValueColor(0xdfdfdf, 1.0); [self.contentView addSubview:self.lineView]; // self.arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 28, 54, 8, 14)]; self.arrowView.image = [UIImage imageNamed:@"youjiantou"]; [self.contentView addSubview:self.arrowView]; // UIButton *completeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; completeBtn.frame = CGRectMake(ScreenWidth - 95, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27); [completeBtn setBackgroundImage:[UIImage imageNamed:@"hongkuang"] forState:UIControlStateNormal]; [completeBtn setTitle:@"完成" forState:UIControlStateNormal]; [completeBtn setTitleColor:RGBValueColor(0x333333, 1.0) forState:UIControlStateNormal]; completeBtn.titleLabel.font = [UIFont systemFontOfSize:12.0]; completeBtn.hidden = YES; [self.contentView addSubview:completeBtn]; self.completeBtn = completeBtn; // UIButton *receiveBtn = [UIButton buttonWithType:UIButtonTypeCustom]; receiveBtn.frame = CGRectMake(ScreenWidth - 95, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27); [receiveBtn setBackgroundImage:[UIImage imageNamed:@"hongkuang"] forState:UIControlStateNormal]; [receiveBtn setTitle:@"接单" forState:UIControlStateNormal]; [receiveBtn setTitleColor:RGBValueColor(0xfe4086, 1.0) forState:UIControlStateNormal]; receiveBtn.titleLabel.font = [UIFont systemFontOfSize:12.0]; receiveBtn.hidden = YES; [self.contentView addSubview:receiveBtn]; self.receiveBtn = receiveBtn; // UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; cancelBtn.frame = CGRectMake(ScreenWidth - 185, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27); [cancelBtn setBackgroundImage:[UIImage imageNamed:@"heikuang"] forState:UIControlStateNormal]; [cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; [cancelBtn setTitleColor:RGBValueColor(0x333333, 1.0) forState:UIControlStateNormal]; cancelBtn.titleLabel.font = [UIFont systemFontOfSize:12.0]; cancelBtn.hidden = YES; [self.contentView addSubview:cancelBtn]; self.cancelBtn = cancelBtn; } - (void)setSkillsOrderCellValueWithDic:(NSDictionary *)dic{ [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", PublicUrl, dic[@"memberhphoto"]]] placeholderImage:[UIImage imageNamed:@"morentouxiang"]]; self.titleLabel.text = dic[@"sname"]; if ([dic[@"sdate"] containsString:@" "]) { NSArray *timeArr = [dic[@"sdate"] componentsSeparatedByString:@" "]; NSArray *dateArr = [timeArr[0] componentsSeparatedByString:@"-"]; self.subTitleLabel.text = [NSString stringWithFormat:@"时间:%@.%@.%@",dateArr[0], dateArr[1], dateArr[2]]; } self.childTitleLabel.text = [NSString stringWithFormat:@"地点:%@", dic[@"addr"]]; NSString *price = dic[@"coin"]; NSString *scount = dic[@"scount"]; NSString *priceStr = [NSString stringWithFormat:@"%@元/%@小时", price,scount]; if (priceStr.length > 2) { NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:priceStr]; [attributedString addAttribute:NSForegroundColorAttributeName value:RGBValueColor(0xfe4086, 1.0) range:NSMakeRange(0,price.length + 1)]; [attributedString addAttribute:NSForegroundColorAttributeName value:RGBValueColor(0x333333, 1.0) range:NSMakeRange(price.length + 1,scount.length + 3)]; self.smallLabel.attributedText = attributedString; } NSString *orderstate = dic[@"orderstate"]; //0:客户未付款 1:客户已付款 2:客户取消 3:模特接单 4:模特取消 5:订单结算 6:超时对消 if ([orderstate isEqualToString:@"1"]) { self.completeBtn.hidden = YES; self.cancelBtn.hidden = NO; self.receiveBtn.hidden = NO; } else if ([orderstate isEqualToString:@"3"]) { self.completeBtn.hidden = NO; self.cancelBtn.hidden = NO; self.receiveBtn.hidden = YES; } else if ([orderstate isEqualToString:@"4"]) { self.completeBtn.hidden = YES; self.cancelBtn.hidden = YES; self.receiveBtn.hidden = YES; } else if ([orderstate isEqualToString:@"5"]) { self.completeBtn.hidden = YES; self.cancelBtn.hidden = YES; self.receiveBtn.hidden = YES; } } @end