// // DRIncomeTopView.m // YouHuiProject // // Created by 小花 on 2018/8/7. // Copyright © 2018年 kuxuan. All rights reserved. // #import "DRIncomeTopView.h" @interface DRIncomeTopView () @property (nonatomic, strong) UILabel *dateLb; @property (nonatomic, strong) UILabel *orderLabel; @property (nonatomic, strong) UIButton *dateSeleteBtn; @end @implementation DRIncomeTopView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self initSubViews]; } return self; } - (void)initSubViews { [self addSubview:self.dateLb]; [self addSubview:self.orderLabel]; [self addSubview:self.dateSeleteBtn]; [self.dateLb mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(Fitsize(17)); make.top.mas_equalTo(0); make.height.mas_equalTo(Fitsize(40)); }]; [self.orderLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(self.dateLb.mas_right).mas_offset(Fitsize(17)); make.top.mas_equalTo(0); make.height.mas_equalTo(Fitsize(40)); }]; [self.dateSeleteBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-Fitsize(15)); make.height.mas_equalTo(Fitsize(40)); make.top.mas_equalTo(0); make.width.mas_equalTo(Fitsize(50)); }]; } - (void)clickAction { if (self.calendarClick) { self.calendarClick(); } } - (void)setTitleStr:(NSString *)titleStr { self.dateLb.text = titleStr; } - (void)setOrderNum:(NSInteger)num allCommission:(CGFloat)allCommission { self.orderLabel.text = [NSString stringWithFormat:@"订单:%ld 佣金:%.2f元",num,allCommission]; } - (UILabel *)dateLb { if (!_dateLb) { _dateLb = [[UILabel alloc] init]; _dateLb.font = [UIFont systemFontOfSize:Fitsize(16)]; _dateLb.textColor = [UIColor homeRedColor]; _dateLb.textAlignment = NSTextAlignmentCenter; _dateLb.text = @"--"; } return _dateLb; } - (UILabel *)orderLabel { if (!_orderLabel) { _orderLabel = [[UILabel alloc] init]; _orderLabel.textColor = [UIColor YHColorWithHex:0x4A4A4A]; _orderLabel.font = [UIFont systemFontOfSize:Fitsize(14)]; _orderLabel.text = @"订单:-笔 佣金:--元"; } return _orderLabel; } - (UIButton *)dateSeleteBtn { if (!_dateSeleteBtn) { _dateSeleteBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_dateSeleteBtn setImage:[UIImage imageNamed:@"calendar"] forState:UIControlStateNormal]; [_dateSeleteBtn addTarget:self action:@selector(clickAction) forControlEvents:UIControlEventTouchUpInside]; } return _dateSeleteBtn; } @end