AccountDetailCell.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // AccountDetailCell.m
  3. // jiaPei
  4. //
  5. // Created by apple on 16/8/23.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "AccountDetailCell.h"
  9. @implementation AccountDetailCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. }
  13. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  14. {
  15. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  16. if (self) {
  17. CGFloat x,y,w,h;
  18. x = 20;
  19. y = 0;
  20. w = kSize.width - 120;
  21. h = 30;
  22. _titleLabel = [[UILabel alloc] setxywh];
  23. [_titleLabel setText:@"" Font:FontLarger TextColor:kTitleColor Alignment:NSTextAlignmentLeft];
  24. [self.contentView addSubview:_titleLabel];
  25. y += h;
  26. _dateLabel = [[UILabel alloc] setxywh];
  27. [_dateLabel setText:@"" Font:Font17 TextColor:contentTextColor Alignment:NSTextAlignmentLeft];
  28. [self.contentView addSubview:_dateLabel];
  29. y -= h - 2;
  30. x = 120;
  31. w = 100;
  32. h -= 2;
  33. _stateLabel = [[UILabel alloc] setxywh];
  34. [_stateLabel setText:@"" Font:FontTitle TextColor:contentTextColor Alignment:NSTextAlignmentCenter];
  35. [self.contentView addSubview:_stateLabel];
  36. x = kSize.width - 170;
  37. y = 0;
  38. w = 150;
  39. h = 60;
  40. _moneyLabel = [[UILabel alloc] setxywh];
  41. [_moneyLabel setText:@"" Font:FontLarger TextColor:kTitleColor Alignment:NSTextAlignmentRight];
  42. [self.contentView addSubview:_moneyLabel];
  43. }
  44. return self;
  45. }
  46. -(void)setDataDic:(NSDictionary *)dataDic
  47. {
  48. //NSLog(@"%@",dataDic);
  49. // MSA_STATUS = 1,
  50. // MAD_ID = 6,
  51. // MSA_TYPE = 1,
  52. // MSA_CAN_USE = 0,
  53. // MSA_REASON = 交易保证金,
  54. // MSA_SOURCE = 1,
  55. // MSA_MONEY = 20,
  56. // MSA_CRDATE = 2016-08-22 17:54:20,
  57. // MSA_ID = 1
  58. // STATUS = 0,//0进行中 1成功 2失败
  59. // NSLog(@"--->%@",dataDic);
  60. _dataDic = dataDic;
  61. NSString *stateString = @"交易成功";
  62. if ([dataDic[@"STATUS"] isEqualToString:@"0"]) {
  63. stateString = @"交易中";
  64. }
  65. if ([dataDic[@"STATUS"] isEqualToString:@"2"]) {
  66. stateString = @"交易失败";
  67. }
  68. _stateLabel.text = stateString;
  69. [_titleLabel setText:dataDic[@"MSA_SOURCE"]];
  70. CGFloat wid = [dataDic[@"MSA_SOURCE"] sizeForFont:FontLarger].width;
  71. _stateLabel.x = wid + 30;//设置状态显示位置
  72. [_dateLabel setText:dataDic[@"MSA_CRDATE"]];
  73. NSString *typeString = [dataDic[@"MSA_TYPE"] integerValue] == 1 ? @"+":@"-";
  74. [_moneyLabel setText:[NSString stringWithFormat:@"%@%@",typeString,dataDic[@"MSA_MONEY"]]];
  75. }
  76. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  77. [super setSelected:selected animated:animated];
  78. }
  79. @end