MyneedsCell.m 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. //
  2. // MyneedsCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/8.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "MyneedsCell.h"
  9. @implementation MyneedsCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. UILabel *line = [UILabel new];
  14. line.backgroundColor = NewNavigationColor;
  15. [self.contentView addSubview:line];
  16. line.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .topEqualToView(self.contentView)
  19. .rightEqualToView(self.contentView)
  20. .heightIs(10);
  21. _title = [UILabel new];
  22. _title.font = NewFont(14);
  23. _title.textColor = [UIColor colorWithString:@"#3C3C3C"];
  24. //设置 label的换行模式
  25. _title.lineBreakMode = NSLineBreakByTruncatingTail; //根据单词进行换行
  26. //设置label显示几行 可以有无限行
  27. _title.numberOfLines = 1;
  28. [self.contentView addSubview:_title];
  29. _title.sd_layout
  30. .leftSpaceToView(self.contentView, 15)
  31. .rightSpaceToView(self.contentView, 15)
  32. .topSpaceToView(line, 0)
  33. .heightIs(fitScreenWidth(44));
  34. UILabel *line1 = [UILabel new];
  35. line1.backgroundColor = NewLineGrayColor;
  36. [self.contentView addSubview:line1];
  37. line1.sd_layout
  38. .leftEqualToView(self.contentView)
  39. .topSpaceToView(_title, 1)
  40. .rightEqualToView(self.contentView)
  41. .heightIs(0.8);
  42. _resultscategory = [UIButton new];
  43. [_resultscategory setTitleColor:[UIColor colorWithString:@"#FF8523"] forState:UIControlStateNormal];
  44. _resultscategory.titleLabel.font = NewFont(12);
  45. ViewBorderRadius(_resultscategory, 3, 1, [UIColor colorWithString:@"#FF8523"]);
  46. [self.contentView addSubview:_resultscategory];
  47. _resultscategory.sd_layout
  48. .leftSpaceToView(self.contentView, 15)
  49. .topSpaceToView(line1, 15)
  50. .heightIs(fitScreenWidth(26))
  51. .widthIs(fitScreenWidth(100));
  52. UILabel *negotiate = [UILabel new];
  53. negotiate.text = @"接单数:";
  54. negotiate.font = NewFont(12);
  55. negotiate.textColor = NewBlackColor;
  56. [negotiate setSingleLineAutoResizeWithMaxWidth:0];
  57. [self.contentView addSubview:negotiate];
  58. negotiate.sd_layout
  59. .centerYEqualToView(_resultscategory)
  60. .rightSpaceToView(self.contentView, SCREEN_WIDTH/2)
  61. .heightIs(fitScreenWidth(12));
  62. _negotiatenumber = [UILabel new];
  63. _negotiatenumber.textColor = [UIColor colorWithString:@"#F46A6A"];
  64. _negotiatenumber.font = NewBFont(15);
  65. [_negotiatenumber setSingleLineAutoResizeWithMaxWidth:0];
  66. [self.contentView addSubview:_negotiatenumber];
  67. _negotiatenumber.sd_layout
  68. .leftSpaceToView(self.contentView, SCREEN_WIDTH/2)
  69. .centerYEqualToView(negotiate)
  70. .heightIs(fitScreenWidth(15));
  71. _time = [UILabel new];
  72. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  73. _time.font = NewFont(10);
  74. [_time setSingleLineAutoResizeWithMaxWidth:0];
  75. [self.contentView addSubview:_time];
  76. _time.sd_layout
  77. .leftSpaceToView(self.contentView, 15)
  78. .bottomSpaceToView(self.contentView, fitScreenWidth(17))
  79. .heightIs(fitScreenWidth(10));
  80. UIImageView *followimge = [UIImageView new];
  81. [followimge setImage:[UIImage imageNamed:@"关注"]];
  82. [self.contentView addSubview:followimge];
  83. followimge.sd_layout
  84. .rightSpaceToView(self.contentView, 15)
  85. .centerYEqualToView(_time)
  86. .widthIs(fitScreenWidth(16))
  87. .heightIs(fitScreenWidth(16));
  88. _follownumber = [UILabel new];
  89. _follownumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  90. _follownumber.font = NewFont(11);
  91. [_follownumber setSingleLineAutoResizeWithMaxWidth:0];
  92. [self.contentView addSubview:_follownumber];
  93. _follownumber.sd_layout
  94. .rightSpaceToView(followimge, 5)
  95. .centerYEqualToView(followimge)
  96. .heightIs(fitScreenWidth(11));
  97. }
  98. return self;
  99. }
  100. - (void)assignment:(MyneedsModel *)model{
  101. _title.text = model.name;
  102. _negotiatenumber.text = [NSString stringWithFormat:@"%@次",model.orderCount];
  103. _time.text = model.createTimeFormattedDate;
  104. if (model.countInterest == NULL) {
  105. _follownumber.text = [NSString stringWithFormat:@"关注 %@",@""];
  106. }else{
  107. _follownumber.text = [NSString stringWithFormat:@"关注 %@",model.countInterest];
  108. }
  109. // 我的需求 audit_status 审核状态(0--未提交审核草稿,1,--提交审核,2--审核中,3--审核通过,4--审核未通过)
  110. //0-未提交审核 1-审核中 2-审核通过 3审核未通过
  111. if ([model.auditStatus isEqualToString:@"0"]) {
  112. [_resultscategory setTitle:@"未提交审核" forState:UIControlStateNormal];
  113. }else if ([model.auditStatus isEqualToString:@"1"]){
  114. [_resultscategory setTitle:@"提交审核中" forState:UIControlStateNormal];
  115. }else if ([model.auditStatus isEqualToString:@"2"]){
  116. [_resultscategory setTitle:@"审核中" forState:UIControlStateNormal];
  117. }else if ([model.auditStatus isEqualToString:@"3"]){
  118. [_resultscategory setTitle:@"审核通过" forState:UIControlStateNormal];
  119. }else if ([model.auditStatus isEqualToString:@"4"]){
  120. [_resultscategory setTitle:@"审核未通过" forState:UIControlStateNormal];
  121. }
  122. }
  123. - (void)awakeFromNib {
  124. [super awakeFromNib];
  125. // Initialization code
  126. }
  127. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  128. [super setSelected:selected animated:animated];
  129. // Configure the view for the selected state
  130. }
  131. @end