猎豆优选

LDChildOrderCell.m 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // LDChildOrderCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LDChildOrderCell.h"
  9. #import "CCCopyLabel.h"
  10. @interface LDChildOrderCell ()
  11. @property (nonatomic, strong) UIImageView *icon;
  12. @property (nonatomic, strong) CCCopyLabel *orderTitle;
  13. @property (nonatomic, strong) UILabel *orderDate;
  14. @property (nonatomic, strong) UILabel *orderPrice;
  15. @property (nonatomic, strong) UILabel *orderType;
  16. @end
  17. @implementation LDChildOrderCell
  18. + (instancetype)cellWithTableView:(UITableView *)tableView {
  19. static NSString *cellID = nil;
  20. cellID = NSStringFromClass([self class]);
  21. LDChildOrderCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  22. if (!cell) {
  23. cell = [[LDChildOrderCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  24. }
  25. return cell;
  26. }
  27. - (void)awakeFromNib {
  28. [super awakeFromNib];
  29. // Initialization code
  30. }
  31. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  32. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  33. if (self) {
  34. [self initSubView];
  35. }
  36. return self;
  37. }
  38. - (void)initSubView {
  39. [self.contentView addSubview:self.icon];
  40. [self.contentView addSubview:self.orderTitle];
  41. [self.contentView addSubview:self.orderDate];
  42. [self.contentView addSubview:self.orderPrice];
  43. [self.contentView addSubview:self.orderType];
  44. [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.mas_equalTo(FITSIZE(15));
  46. make.centerY.mas_equalTo(self.mas_centerY);
  47. make.width.height.mas_equalTo(FITSIZE(42));
  48. }];
  49. [self.orderTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.mas_equalTo(self.icon.mas_right).mas_offset(FITSIZE(13));
  51. make.top.mas_equalTo(FITSIZE(18));
  52. make.height.mas_equalTo(FITSIZE(22));
  53. }];
  54. [self.orderDate mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.mas_equalTo(self.orderTitle);
  56. make.top.mas_equalTo(self.orderTitle.mas_bottom).mas_offset(FITSIZE(4));
  57. }];
  58. [self.orderPrice mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.right.mas_equalTo(-FITSIZE(14));
  60. make.top.mas_equalTo(FITSIZE(18));
  61. make.height.mas_equalTo(FITSIZE(25));
  62. }];
  63. [self.orderType mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.right.mas_equalTo(-FITSIZE(14));
  65. make.top.mas_equalTo(self.orderTitle.mas_bottom);
  66. make.height.mas_equalTo(FITSIZE(17));
  67. }];
  68. }
  69. - (UILabel *)orderTitle {
  70. if (!_orderTitle) {
  71. _orderTitle = [[CCCopyLabel alloc] init];
  72. _orderTitle.font = [UIFont systemFontOfSize:16];
  73. _orderTitle.text = @"佣金收入";
  74. _orderTitle.textColor = [UIColor YHColorWithHex:0x353535];
  75. }
  76. return _orderTitle;
  77. }
  78. - (UILabel *)orderDate {
  79. if (!_orderDate) {
  80. _orderDate = [[UILabel alloc] init];
  81. _orderDate.textColor = [UIColor YHColorWithHex:0x999999];
  82. _orderDate.font = [UIFont systemFontOfSize:12];
  83. _orderDate.text = @"日期:--";
  84. }
  85. return _orderDate;
  86. }
  87. - (UILabel *)orderPrice {
  88. if (!_orderPrice) {
  89. _orderPrice = [[UILabel alloc] init];
  90. _orderPrice.font = [UIFont fontWithName:@"Helvetica-Bold" size:18];
  91. _orderPrice.textAlignment = NSTextAlignmentRight;
  92. _orderPrice.text = @"+0.00";
  93. }
  94. return _orderPrice;
  95. }
  96. -(UILabel *)orderType{
  97. if (!_orderType) {
  98. _orderType=[[UILabel alloc]init];
  99. _orderType.textColor = [UIColor YHColorWithHex:0xE04A4A];
  100. _orderType.font = [UIFont systemFontOfSize:12];
  101. _orderType.text = @"申请状态";
  102. }
  103. return _orderType;
  104. }
  105. - (UIImageView *)icon {
  106. if (!_icon) {
  107. _icon = [[UIImageView alloc] init];
  108. _icon.image = [UIImage imageNamed:@"comission_left"];
  109. _icon.layer.cornerRadius = 14;
  110. }
  111. return _icon;
  112. }
  113. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  114. [super setSelected:selected animated:animated];
  115. // Configure the view for the selected state
  116. }
  117. -(void)setModel:(LDChildOrderModel *)model{
  118. _model=model;
  119. [self.icon sd_setImageWithURL:[NSURL URLWithString:model.img]];
  120. self.orderTitle.text=model.title;
  121. self.orderDate.text=[NSString stringWithFormat:@"%@",model.create_time];
  122. if (model.mode.integerValue == 1) {//佣金收入
  123. self.orderPrice.textColor=[UIColor YHColorWithHex:0xFF8712];
  124. self.orderPrice.text=[NSString stringWithFormat:@"+%@",model.rebate];
  125. }else if (model.mode.integerValue == 2){//提现
  126. self.orderPrice.textColor=[UIColor YHColorWithHex:0x343434];
  127. self.orderPrice.text=[NSString stringWithFormat:@"%@",model.rebate];
  128. }
  129. self.orderType.text=model.message;
  130. }
  131. @end