《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRIncomeTopView.m 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // DRIncomeTopView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/8/7.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRIncomeTopView.h"
  9. @interface DRIncomeTopView ()
  10. @property (nonatomic, strong) UILabel *dateLb;
  11. @property (nonatomic, strong) UILabel *orderLabel;
  12. @property (nonatomic, strong) UIButton *dateSeleteBtn;
  13. @end
  14. @implementation DRIncomeTopView
  15. - (instancetype)initWithFrame:(CGRect)frame {
  16. self = [super initWithFrame:frame];
  17. if (self) {
  18. [self initSubViews];
  19. }
  20. return self;
  21. }
  22. - (void)initSubViews {
  23. [self addSubview:self.dateLb];
  24. [self addSubview:self.orderLabel];
  25. [self addSubview:self.dateSeleteBtn];
  26. [self.dateLb mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.left.mas_equalTo(Fitsize(17));
  28. make.top.mas_equalTo(0);
  29. make.height.mas_equalTo(Fitsize(40));
  30. }];
  31. [self.orderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.mas_equalTo(self.dateLb.mas_right).mas_offset(Fitsize(17));
  33. make.top.mas_equalTo(0);
  34. make.height.mas_equalTo(Fitsize(40));
  35. }];
  36. [self.dateSeleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.mas_equalTo(-Fitsize(15));
  38. make.height.mas_equalTo(Fitsize(40));
  39. make.top.mas_equalTo(0);
  40. make.width.mas_equalTo(Fitsize(50));
  41. }];
  42. }
  43. - (void)clickAction {
  44. if (self.calendarClick) {
  45. self.calendarClick();
  46. }
  47. }
  48. - (void)setTitleStr:(NSString *)titleStr {
  49. self.dateLb.text = titleStr;
  50. }
  51. - (void)setOrderNum:(NSInteger)num allCommission:(CGFloat)allCommission {
  52. self.orderLabel.text = [NSString stringWithFormat:@"订单:%ld 佣金:%.2f元",num,allCommission];
  53. }
  54. - (UILabel *)dateLb {
  55. if (!_dateLb) {
  56. _dateLb = [[UILabel alloc] init];
  57. _dateLb.font = [UIFont systemFontOfSize:Fitsize(16)];
  58. _dateLb.textColor = [UIColor homeRedColor];
  59. _dateLb.textAlignment = NSTextAlignmentCenter;
  60. _dateLb.text = @"--";
  61. }
  62. return _dateLb;
  63. }
  64. - (UILabel *)orderLabel {
  65. if (!_orderLabel) {
  66. _orderLabel = [[UILabel alloc] init];
  67. _orderLabel.textColor = [UIColor YHColorWithHex:0x4A4A4A];
  68. _orderLabel.font = [UIFont systemFontOfSize:Fitsize(14)];
  69. _orderLabel.text = @"订单:-笔 佣金:--元";
  70. }
  71. return _orderLabel;
  72. }
  73. - (UIButton *)dateSeleteBtn {
  74. if (!_dateSeleteBtn) {
  75. _dateSeleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  76. [_dateSeleteBtn setImage:[UIImage imageNamed:@"calendar"] forState:UIControlStateNormal];
  77. [_dateSeleteBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside];
  78. }
  79. return _dateSeleteBtn;
  80. }
  81. @end