Aucune description

FKPersonOrderStatusCell.m 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // FKPersonOrderStatusCell.m
  3. // FirstLink
  4. //
  5. // Created by ascii on 16/2/23.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKPersonOrderStatusCell.h"
  9. #import "FKPersonOrderViewModel.h"
  10. #import "FKOrderPaymentItem.h"
  11. @interface FKPersonOrderStatusCell ()
  12. @property (nonatomic, strong) UILabel *timeLabel;
  13. @property (nonatomic, strong) UILabel *statusLabel;
  14. @end
  15. @implementation FKPersonOrderStatusCell
  16. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  17. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  18. if (self) {
  19. [self addAllSubviews];
  20. }
  21. return self;
  22. }
  23. #pragma mark - Layout
  24. - (void)addAllSubviews {
  25. [self.contentView addSubview:self.timeLabel];
  26. [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  27. make.left.equalTo(self.contentView).with.offset(15);
  28. make.centerY.equalTo(self.contentView).with.offset(0);
  29. }];
  30. [self.contentView addSubview:self.statusLabel];
  31. [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.right.equalTo(self.contentView).with.offset(-20);
  33. make.centerY.equalTo(self.timeLabel);
  34. }];
  35. }
  36. #pragma mark - FKPersonOrderCellDelegate
  37. - (void)configPersonOrderCell:(NSIndexPath *)indexPath classify:(FKPersonOrderClassify)classify viewModel:(FKPersonOrderViewModel *)viewModel {
  38. FKOrderPaymentItem *paymentItem = [viewModel paymentItemAtIndex:indexPath.section classify:classify];
  39. self.timeLabel.text = [paymentItem timeStartFromMinute];
  40. self.statusLabel.text = [FKPersonOrderViewModel getPaymentStatusText:(FKOrderStatus)(paymentItem.status.intValue)];
  41. }
  42. #pragma mark - Property
  43. - (UILabel *)timeLabel {
  44. if (!_timeLabel) {
  45. _timeLabel = [UILabel new];
  46. _timeLabel.textColor = UIColorFromRGB(0x666666);
  47. _timeLabel.font = [UIFont systemFontOfSize:14.0];
  48. }
  49. return _timeLabel;
  50. }
  51. - (UILabel *)statusLabel {
  52. if (!_statusLabel) {
  53. _statusLabel = [UILabel new];
  54. _statusLabel.textColor = UIColorFromRGB(0x333333);
  55. _statusLabel.textAlignment = NSTextAlignmentRight;
  56. _statusLabel.font = [UIFont systemFontOfSize:14];
  57. }
  58. return _statusLabel;
  59. }
  60. @end