// // FKPersonOrderStatusCell.m // FirstLink // // Created by ascii on 16/2/23. // Copyright © 2016年 FirstLink. All rights reserved. // #import "FKPersonOrderStatusCell.h" #import "FKPersonOrderViewModel.h" #import "FKOrderPaymentItem.h" @interface FKPersonOrderStatusCell () @property (nonatomic, strong) UILabel *timeLabel; @property (nonatomic, strong) UILabel *statusLabel; @end @implementation FKPersonOrderStatusCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self addAllSubviews]; } return self; } #pragma mark - Layout - (void)addAllSubviews { [self.contentView addSubview:self.timeLabel]; [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).with.offset(15); make.centerY.equalTo(self.contentView).with.offset(0); }]; [self.contentView addSubview:self.statusLabel]; [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView).with.offset(-20); make.centerY.equalTo(self.timeLabel); }]; } #pragma mark - FKPersonOrderCellDelegate - (void)configPersonOrderCell:(NSIndexPath *)indexPath classify:(FKPersonOrderClassify)classify viewModel:(FKPersonOrderViewModel *)viewModel { FKOrderPaymentItem *paymentItem = [viewModel paymentItemAtIndex:indexPath.section classify:classify]; self.timeLabel.text = [paymentItem timeStartFromMinute]; self.statusLabel.text = [FKPersonOrderViewModel getPaymentStatusText:(FKOrderStatus)(paymentItem.status.intValue)]; } #pragma mark - Property - (UILabel *)timeLabel { if (!_timeLabel) { _timeLabel = [UILabel new]; _timeLabel.textColor = UIColorFromRGB(0x666666); _timeLabel.font = [UIFont systemFontOfSize:14.0]; } return _timeLabel; } - (UILabel *)statusLabel { if (!_statusLabel) { _statusLabel = [UILabel new]; _statusLabel.textColor = UIColorFromRGB(0x333333); _statusLabel.textAlignment = NSTextAlignmentRight; _statusLabel.font = [UIFont systemFontOfSize:14]; } return _statusLabel; } @end