BusinesswaterDetailCell.m 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. //
  2. // BusinesswaterDetailCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/28.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "BusinesswaterDetailCell.h"
  9. @implementation BusinesswaterDetailCell
  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 = NewLineGrayColor;
  15. [self.contentView addSubview:line];
  16. line.sd_layout
  17. .leftEqualToView(self.contentView)
  18. .heightIs(10)
  19. .rightEqualToView(self.contentView)
  20. .topEqualToView(self.contentView);
  21. UIImageView *image = [UIImageView new];
  22. [image setImage:NewImageNamed(@"dd")];
  23. [self.contentView addSubview:image];
  24. image.sd_layout
  25. .widthIs(18)
  26. .heightIs(14)
  27. .leftSpaceToView(self.contentView, 15)
  28. .topSpaceToView(line, 15);
  29. _title = [UILabel new];
  30. _title.font = NewFont(fitScreenWidth(14));
  31. [_title setSingleLineAutoResizeWithMaxWidth:SCREEN_WIDTH-fitScreenWidth(40+155)];
  32. [self.contentView addSubview:_title];
  33. _title.sd_layout
  34. .leftSpaceToView(image, 5)
  35. .centerYEqualToView(image)
  36. .heightIs(fitScreenWidth(15));
  37. _time = [UILabel new];
  38. _time.font = NewFont(fitScreenWidth(12));
  39. [_time setSingleLineAutoResizeWithMaxWidth:0];
  40. _time.textColor = [UIColor colorWithString:@"#9A9A9A"];
  41. [self.contentView addSubview:_time];
  42. _time.sd_layout
  43. .rightSpaceToView(self.contentView, 15)
  44. .centerYEqualToView(image)
  45. .heightIs(fitScreenWidth(12));
  46. UILabel *line1 = [UILabel new];
  47. line1.backgroundColor = NewLineGrayColor;
  48. [self.contentView addSubview:line1];
  49. line1.sd_layout
  50. .leftEqualToView(self.contentView)
  51. .heightIs(0.8)
  52. .rightSpaceToView(self.contentView, 0)
  53. .topSpaceToView(line, 44);
  54. UIImageView *image1 = [UIImageView new];
  55. [image1 setImage:NewImageNamed(@"Check")];
  56. [self.contentView addSubview:image1];
  57. image1.sd_layout
  58. .leftEqualToView(image)
  59. .heightIs(16)
  60. .widthIs(16)
  61. .topSpaceToView(line1, 15);
  62. _state = [UILabel new];
  63. [_state setSingleLineAutoResizeWithMaxWidth:0];
  64. _state.font = NewFont(fitScreenWidth(12));
  65. [self.contentView addSubview:_state];
  66. _state.sd_layout
  67. .leftSpaceToView(image1, 5)
  68. .centerYEqualToView(image1)
  69. .heightIs(fitScreenWidth(12));
  70. _ordernumber = [UILabel new];
  71. _ordernumber.textColor = [UIColor colorWithString:@"#9A9A9A"];
  72. _ordernumber.font = NewFont(fitScreenWidth(12));
  73. [_ordernumber setSingleLineAutoResizeWithMaxWidth:0];
  74. [self.contentView addSubview:_ordernumber];
  75. _ordernumber.sd_layout
  76. .centerYEqualToView(image1)
  77. .heightIs(fitScreenWidth(12))
  78. .centerXEqualToView(self.contentView);
  79. _businessDesc = [UILabel new];
  80. _businessDesc.textColor = NewButtonColor;
  81. _businessDesc.font = NewFont(fitScreenWidth(12));
  82. [_businessDesc setSingleLineAutoResizeWithMaxWidth:0];
  83. [self.contentView addSubview:_businessDesc];
  84. _businessDesc.sd_layout
  85. .centerYEqualToView(image1)
  86. .heightIs(fitScreenWidth(12))
  87. .rightSpaceToView(self.contentView, 15);
  88. }
  89. return self;
  90. }
  91. - (void)assignment:(BusinesswaterModel*)model {
  92. _title.text = model.commodityName;
  93. _time.text = model.createTime;
  94. // 0-待确认 1-已确认 2-已拒绝
  95. if ([model.confirmSign isEqualToString:@"0"]) {
  96. _state.text = @"待确认";
  97. }else if ([model.confirmSign isEqualToString:@"1"]){
  98. _state.text = @"已确认";
  99. }else if ([model.confirmSign isEqualToString:@"2"]){
  100. _state.text = @"已拒绝";
  101. }
  102. _ordernumber.text = [NSString stringWithFormat:@"订单编号:%@",model.orderNo];
  103. _businessDesc.text = model.businessDesc;
  104. }
  105. - (void)awakeFromNib {
  106. [super awakeFromNib];
  107. // Initialization code
  108. }
  109. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  110. [super setSelected:selected animated:animated];
  111. // Configure the view for the selected state
  112. }
  113. @end