SkillsOrderCell.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. //
  2. // SkillsOrderCell.m
  3. // model
  4. //
  5. // Created by zuxiukuan on 2018/7/16.
  6. // Copyright © 2018年 Mine. All rights reserved.
  7. // 技能 订单 cell
  8. #import "SkillsOrderCell.h"
  9. @implementation SkillsOrderCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. //
  14. self.selectionStyle = UITableViewCellSelectionStyleNone;
  15. [self creatCellSubViews];
  16. }
  17. return self;
  18. }
  19. - (void)creatCellSubViews {
  20. //
  21. self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 18, 80, 80)];
  22. [self.contentView addSubview:self.iconImageView];
  23. //
  24. self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, 25, ScreenWidth / 2 - 60, 16)];
  25. self.titleLabel.textAlignment = NSTextAlignmentLeft;
  26. self.titleLabel.textColor = RGBValueColor(0x333333, 1.0);
  27. self.titleLabel.font = [UIFont systemFontOfSize:16]; // 15
  28. [self.contentView addSubview:self.titleLabel];
  29. //
  30. self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, CGRectGetMaxY(self.titleLabel.frame) + 13, ScreenWidth / 2, 13)];
  31. self.subTitleLabel.textAlignment = NSTextAlignmentLeft;
  32. self.subTitleLabel.textColor = RGBValueColor(0x999999, 1.0); //333333
  33. self.subTitleLabel.font = [UIFont systemFontOfSize:13];
  34. [self.contentView addSubview:self.subTitleLabel];
  35. //
  36. self.childTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.iconImageView.frame) + 15, CGRectGetMaxY(self.subTitleLabel.frame) + 10, ScreenWidth / 2, 13)];
  37. self.childTitleLabel.textAlignment = NSTextAlignmentLeft;
  38. self.childTitleLabel.textColor = RGBValueColor(0x999999, 1.0); //333333
  39. self.childTitleLabel.font = [UIFont systemFontOfSize:13];
  40. [self.contentView addSubview:self.childTitleLabel];
  41. //
  42. self.smallLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth - 150, 21, 130, 13)];
  43. self.smallLabel.textAlignment = NSTextAlignmentRight;
  44. self.smallLabel.textColor = RGBValueColor(0x333333, 1.0);
  45. self.smallLabel.font = [UIFont systemFontOfSize:13]; // 15
  46. [self.contentView addSubview:self.smallLabel];
  47. //
  48. self.lineView = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.iconImageView.frame) + 18, ScreenWidth, 0.5)];
  49. self.lineView.backgroundColor = RGBValueColor(0xdfdfdf, 1.0);
  50. [self.contentView addSubview:self.lineView];
  51. //
  52. self.arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenWidth - 28, 54, 8, 14)];
  53. self.arrowView.image = [UIImage imageNamed:@"youjiantou"];
  54. [self.contentView addSubview:self.arrowView];
  55. //
  56. UIButton *completeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  57. completeBtn.frame = CGRectMake(ScreenWidth - 95, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27);
  58. [completeBtn setBackgroundImage:[UIImage imageNamed:@"hongkuang"] forState:UIControlStateNormal];
  59. [completeBtn setTitle:@"完成" forState:UIControlStateNormal];
  60. [completeBtn setTitleColor:RGBValueColor(0x333333, 1.0) forState:UIControlStateNormal];
  61. completeBtn.titleLabel.font = [UIFont systemFontOfSize:12.0];
  62. completeBtn.hidden = YES;
  63. [self.contentView addSubview:completeBtn];
  64. self.completeBtn = completeBtn;
  65. //
  66. UIButton *receiveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  67. receiveBtn.frame = CGRectMake(ScreenWidth - 95, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27);
  68. [receiveBtn setBackgroundImage:[UIImage imageNamed:@"hongkuang"] forState:UIControlStateNormal];
  69. [receiveBtn setTitle:@"接单" forState:UIControlStateNormal];
  70. [receiveBtn setTitleColor:RGBValueColor(0xfe4086, 1.0) forState:UIControlStateNormal];
  71. receiveBtn.titleLabel.font = [UIFont systemFontOfSize:12.0];
  72. receiveBtn.hidden = YES;
  73. [self.contentView addSubview:receiveBtn];
  74. self.receiveBtn = receiveBtn;
  75. //
  76. UIButton *cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  77. cancelBtn.frame = CGRectMake(ScreenWidth - 185, CGRectGetMaxY(self.lineView.frame) + 6, 75, 27);
  78. [cancelBtn setBackgroundImage:[UIImage imageNamed:@"heikuang"] forState:UIControlStateNormal];
  79. [cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
  80. [cancelBtn setTitleColor:RGBValueColor(0x333333, 1.0) forState:UIControlStateNormal];
  81. cancelBtn.titleLabel.font = [UIFont systemFontOfSize:12.0];
  82. cancelBtn.hidden = YES;
  83. [self.contentView addSubview:cancelBtn];
  84. self.cancelBtn = cancelBtn;
  85. }
  86. - (void)setSkillsOrderCellValueWithDic:(NSDictionary *)dic{
  87. [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", PublicUrl, dic[@"memberhphoto"]]] placeholderImage:[UIImage imageNamed:@"morentouxiang"]];
  88. self.titleLabel.text = dic[@"sname"];
  89. if ([dic[@"sdate"] containsString:@" "]) {
  90. NSArray *timeArr = [dic[@"sdate"] componentsSeparatedByString:@" "];
  91. NSArray *dateArr = [timeArr[0] componentsSeparatedByString:@"-"];
  92. self.subTitleLabel.text = [NSString stringWithFormat:@"时间:%@.%@.%@",dateArr[0], dateArr[1], dateArr[2]];
  93. }
  94. self.childTitleLabel.text = [NSString stringWithFormat:@"地点:%@", dic[@"addr"]];
  95. NSString *price = dic[@"coin"];
  96. NSString *scount = dic[@"scount"];
  97. NSString *priceStr = [NSString stringWithFormat:@"%@元/%@小时", price,scount];
  98. if (priceStr.length > 2) {
  99. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:priceStr];
  100. [attributedString addAttribute:NSForegroundColorAttributeName value:RGBValueColor(0xfe4086, 1.0) range:NSMakeRange(0,price.length + 1)];
  101. [attributedString addAttribute:NSForegroundColorAttributeName value:RGBValueColor(0x333333, 1.0) range:NSMakeRange(price.length + 1,scount.length + 3)];
  102. self.smallLabel.attributedText = attributedString;
  103. }
  104. NSString *orderstate = dic[@"orderstate"];
  105. //0:客户未付款 1:客户已付款 2:客户取消 3:模特接单 4:模特取消 5:订单结算 6:超时对消
  106. if ([orderstate isEqualToString:@"1"]) {
  107. self.completeBtn.hidden = YES;
  108. self.cancelBtn.hidden = NO;
  109. self.receiveBtn.hidden = NO;
  110. } else if ([orderstate isEqualToString:@"3"]) {
  111. self.completeBtn.hidden = NO;
  112. self.cancelBtn.hidden = NO;
  113. self.receiveBtn.hidden = YES;
  114. } else if ([orderstate isEqualToString:@"4"]) {
  115. self.completeBtn.hidden = YES;
  116. self.cancelBtn.hidden = YES;
  117. self.receiveBtn.hidden = YES;
  118. } else if ([orderstate isEqualToString:@"5"]) {
  119. self.completeBtn.hidden = YES;
  120. self.cancelBtn.hidden = YES;
  121. self.receiveBtn.hidden = YES;
  122. }
  123. }
  124. @end