YOUPAILZBillDetailCell.m 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // YOUPAILZBillDetailCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/7/30.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. //
  9. // YOUPAILZBillDetailCell.m
  10. // LiveChat
  11. //
  12. // Created by 张灿 on 2018/10/10.
  13. // Copyright © 2018年 caicai. All rights reserved.
  14. //
  15. #import "YOUPAILZBillDetailCell.h"
  16. @interface YOUPAILZBillDetailCell()
  17. @property(nonatomic,strong)UIImageView* youpaipavatarImgV;
  18. @property(nonatomic,strong)UILabel *youpaipnicknameL;
  19. @property(nonatomic,strong)UILabel* youpaipdescLab;
  20. @property(nonatomic,strong)UILabel* youpaiptimeLab;
  21. @property(nonatomic,strong)UILabel* youpaipvalueLab;
  22. @end
  23. @implementation YOUPAILZBillDetailCell
  24. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  25. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  26. self.selectionStyle = UITableViewCellSelectionStyleNone;
  27. self.backgroundColor = [UIColor clearColor];
  28. [self youpaifinitUI];
  29. }
  30. return self;
  31. }
  32. - (void)youpaifinitUI{
  33. UIView *bgV = [[UIView alloc] init];
  34. bgV.layer.cornerRadius = 5.0f;
  35. bgV.clipsToBounds = YES;
  36. bgV.backgroundColor = LZFAFAFCColor;
  37. [self.contentView addSubview:bgV];
  38. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.left.offset(14.0f);
  40. make.top.offset(0.0f);
  41. make.right.offset(-14.0f);
  42. make.bottom.offset(-5.0f);
  43. }];
  44. self.youpaipavatarImgV = [[UIImageView alloc]init];
  45. self.youpaipavatarImgV.contentMode = UIViewContentModeScaleAspectFill;
  46. self.youpaipavatarImgV.layer.masksToBounds = YES;
  47. self.youpaipavatarImgV.layer.cornerRadius = 20;
  48. [bgV addSubview:self.youpaipavatarImgV];
  49. [self.youpaipavatarImgV makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.equalTo(@12);
  51. make.centerY.equalTo(bgV);
  52. make.size.mas_equalTo(CGSizeMake(40, 40));
  53. }];
  54. UILabel* nicknameL = [[UILabel alloc]init];
  55. nicknameL.textColor = LZ273145Color;
  56. nicknameL.font = LCBoldFont(14);
  57. [bgV addSubview:nicknameL];
  58. self.youpaipnicknameL = nicknameL;
  59. [nicknameL makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(@6);
  61. make.top.equalTo(self.youpaipavatarImgV.mas_top).offset(@2);
  62. make.height.offset(14.0f);
  63. make.right.equalTo(bgV.mas_centerX);
  64. }];
  65. UILabel* descLab = [[UILabel alloc]init];
  66. descLab.textColor = LZ273145Color;
  67. descLab.textAlignment = NSTextAlignmentRight;
  68. descLab.font = LCFont12;
  69. [bgV addSubview:descLab];
  70. self.youpaipdescLab = descLab;
  71. [descLab makeConstraints:^(MASConstraintMaker *make) {
  72. make.right.offset(-14.0f);
  73. make.top.equalTo(self.youpaipavatarImgV.mas_top).offset(0.0f);
  74. make.left.equalTo(bgV.mas_centerX);
  75. }];
  76. UILabel* timeLab = [[UILabel alloc]init];
  77. timeLab.textColor = LZA3AABEColor;
  78. timeLab.font = LCFont12;
  79. [bgV addSubview:timeLab];
  80. self.youpaiptimeLab = timeLab;
  81. [timeLab makeConstraints:^(MASConstraintMaker *make) {
  82. make.left.equalTo(self.youpaipavatarImgV.mas_right).offset(@4);
  83. make.top.equalTo(self.youpaipnicknameL.mas_bottom).offset(@6);
  84. }];
  85. UILabel* valueLab = [[UILabel alloc]init];
  86. valueLab.textColor = LZ273145Color;
  87. valueLab.font = LCFont12;
  88. [bgV addSubview:valueLab];
  89. self.youpaipvalueLab = valueLab;
  90. [valueLab makeConstraints:^(MASConstraintMaker *make) {
  91. make.right.offset(-14);
  92. make.bottom.equalTo(self.youpaipavatarImgV.mas_bottom).offset(-2.0f);
  93. }];
  94. }
  95. - (void)setYoupaipbillModel:(YOUPAILCBillDetailModel *)billModel{
  96. self.youpaipnicknameL.text = billModel.youpaipfrom_username.length == 0 ? @"系统" : billModel.youpaipfrom_username;
  97. _youpaipbillModel = billModel;
  98. self.youpaiptimeLab.text = billModel.youpaipcreate_time;
  99. //头像 type //1充值 2提现 3视频 4礼物 5系统 6兑换 7私信
  100. // if (billModel.youpaiptype==5||billModel.youpaiptype==9||billModel.youpaiptype==10) {
  101. // self.youpaipavatarImgV.layer.cornerRadius = 0.0f;
  102. // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_appLogo"];
  103. // }else if (billModel.youpaiptype==1 || billModel.youpaiptype==2 || billModel.youpaiptype==6 ){
  104. // self.youpaipavatarImgV.layer.cornerRadius = 0.0f;
  105. // self.youpaipavatarImgV.image = [UIImage imageNamed:@"vqu_images_P_wallet"];
  106. // }else{
  107. // self.youpaipavatarImgV.layer.cornerRadius = 20.0f;
  108. [self.youpaipavatarImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:billModel.youpaipicon]];
  109. // }
  110. //账户变动值
  111. if ([billModel.newtype isEqual:@"1"]) { //new_type 1 钻石 2收益
  112. self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%@",billModel.youpaipchange_value] subTitle:@"钻石" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  113. }else{
  114. self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%@",billModel.youpaipchange_value_new] subTitle:@"元" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  115. }
  116. // if (billModel.youpaipchange_value>0) {
  117. // if (billModel.youpaipaccount_type==1||billModel.youpaipaccount_type==2) {
  118. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.2f",billModel.youpaipchange_value] subTitle:@"元" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  119. // }else{
  120. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"+%.0f",billModel.youpaipchange_value] subTitle:@"钻石" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  121. // }
  122. // }else{
  123. // if (billModel.youpaipaccount_type==1||billModel.youpaipaccount_type==2) {
  124. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.2f",billModel.youpaipchange_value] subTitle:@"元" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  125. // }else{
  126. // self.youpaipvalueLab.attributedText = [LCTools setRichTextWithTitle:[NSString stringWithFormat:@"%.0f",billModel.youpaipchange_value] subTitle:@"钻石" titleColor:LZ7C69FEColor subTitleColor:LZ273145Color titleFontSize:18.0f subTitleFontSize:12.0f];
  127. // }
  128. // }
  129. self.youpaipdescLab.text = billModel.youpaipsystem_str;
  130. }
  131. @end