JLWithdrawalRecordViewCell.m 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //
  2. // JLWithdrawalRecordViewCell.m
  3. // shiku_im
  4. //
  5. // Created by JayLuo on 2020/1/14.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JLWithdrawalRecordViewCell.h"
  9. @interface JLWithdrawalRecordViewCell()
  10. @property (weak, nonatomic) IBOutlet UILabel *platformNameLabel;
  11. @property (weak, nonatomic) IBOutlet UILabel *amountLabel;
  12. @property (weak, nonatomic) IBOutlet UILabel *reasonLabel;
  13. @property (weak, nonatomic) IBOutlet UILabel *timeLabel;
  14. @property (weak, nonatomic) IBOutlet UILabel *statusLabel;
  15. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *reasonHeight;
  16. @property (weak, nonatomic) IBOutlet UIView *container;
  17. @end
  18. @implementation JLWithdrawalRecordViewCell
  19. - (void)awakeFromNib {
  20. [super awakeFromNib];
  21. // Initialization code
  22. _container.layer.cornerRadius = 15;
  23. _container.layer.masksToBounds = YES;
  24. // _reasonHeight.constant = 0;
  25. }
  26. - (void)setDict:(NSDictionary *)dict {
  27. _dict = dict;
  28. _platformNameLabel.text = [NSString stringWithFormat:@"平台: %@", dict[@"platformName"]];
  29. _amountLabel.text = [NSString stringWithFormat:@"金额: ¥ %@", dict[@"amount"]];
  30. NSString *ds = [NSString stringWithFormat:@"%@", dict[@"createTime"]];
  31. NSDate* d = [NSDate dateWithTimeIntervalSince1970:[ds doubleValue]/1000];
  32. // 实例化NSDateFormatter
  33. NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  34. // 设置日期格式
  35. [formatter setDateFormat:@"yyyy-MM-dd HH:mm"];
  36. // 获取当前日期
  37. NSString *s = [formatter stringFromDate:d];
  38. _timeLabel.text = s;
  39. NSString *status = [NSString stringWithFormat:@"%@", dict[@"status"]];
  40. if([status intValue] == 0) {
  41. _statusLabel.text = @"申请中";
  42. _reasonHeight.constant = 0;
  43. _statusLabel.textColor = HEXCOLOR(0x388db7);
  44. } else if ([status intValue] == 1) {
  45. _statusLabel.text = @"成功";
  46. _reasonHeight.constant = 0;
  47. _statusLabel.textColor = HEXCOLOR(0x388db7);
  48. } else {
  49. _statusLabel.text = @"失败";
  50. _reasonLabel.text = [NSString stringWithFormat:@"失败原因: %@", dict[@"refuseReason"]];
  51. _statusLabel.textColor = [UIColor redColor];
  52. _reasonHeight.constant = 30;
  53. }
  54. }
  55. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  56. [super setSelected:selected animated:animated];
  57. // Configure the view for the selected state
  58. }
  59. @end