YOUPAILZVipRenewItemCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // YOUPAILZVipRenewItemCell.m
  3. // VQU
  4. //
  5. // Created by CY on 2021/8/25.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZVipRenewItemCell.h"
  9. @interface YOUPAILZVipRenewItemCell ()
  10. @property (nonatomic,weak) UIImageView *youpaipiconImgV;
  11. @property (nonatomic,weak) UILabel *youpaipnameL;
  12. @property (nonatomic,weak) UILabel *youpaipmoneyL;
  13. @property (nonatomic,weak)UIImageView *youpaipselectedImgV;
  14. @end
  15. @implementation YOUPAILZVipRenewItemCell
  16. - (instancetype)initWithFrame:(CGRect)frame{
  17. if (self = [super initWithFrame:frame]) {
  18. [self youpaifinitUI];
  19. }
  20. return self;
  21. }
  22. - (void)youpaifinitUI{
  23. self.backgroundColor = HexColorFromRGB(0x31303D);
  24. self.layer.cornerRadius = ScaleSize(5.0f);
  25. self.clipsToBounds = YES;
  26. self.layer.borderColor = HexColorFromRGB(0xFF2F64).CGColor;
  27. UIImageView *iconImgV = [[UIImageView alloc] init];
  28. [self.contentView addSubview:iconImgV];
  29. self.youpaipiconImgV = iconImgV;
  30. [iconImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.top.offset(ScaleSize(6.0f));
  32. make.centerX.equalTo(self.contentView);
  33. make.size.mas_offset(CGSizeMake(ScaleSize(36.0f), ScaleSize(33.0f)));
  34. }];
  35. UILabel *nameL = [[UILabel alloc] init];
  36. nameL.font = LCFont(ScaleSize(13.0f));
  37. nameL.textColor = [UIColor whiteColor];
  38. nameL.textAlignment = NSTextAlignmentCenter;
  39. [self.contentView addSubview:nameL];
  40. self.youpaipnameL = nameL;
  41. [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.offset(ScaleSize(12.0f));
  43. make.top.equalTo(iconImgV.mas_bottom).offset(ScaleSize(5.0f));
  44. make.right.offset(ScaleSize(-12.0f));
  45. }];
  46. UIImageView *selectedImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_profile_vip_selected"]];
  47. selectedImgV.hidden = YES;
  48. [self.contentView addSubview:selectedImgV];
  49. self.youpaipselectedImgV = selectedImgV;
  50. [selectedImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.right.bottom.offset(0.0f);
  52. make.size.mas_offset(CGSizeMake(ScaleSize(27.0f), ScaleSize(27.0f)));
  53. }];
  54. UILabel *moneyL = [[UILabel alloc] init];
  55. moneyL.font = LCFont(ScaleSize(11.0f));
  56. moneyL.textColor = HexColorFromRGB(0xFF4848);
  57. moneyL.textAlignment = NSTextAlignmentCenter;
  58. [self.contentView addSubview:moneyL];
  59. self.youpaipmoneyL = moneyL;
  60. [moneyL mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.offset(ScaleSize(12.0f));
  62. make.top.equalTo(nameL.mas_bottom).offset(ScaleSize(4.0f));
  63. make.right.offset(ScaleSize(-12.0f));
  64. }];
  65. }
  66. -(void)youpaifreloadWithModel:(YOUPAILZVipRenewModel *)model{
  67. self.youpaipselectedImgV.hidden = YES;
  68. self.layer.borderWidth = 0.0f;
  69. self.youpaipnameL.text = model.youpaipname;
  70. [self.youpaipiconImgV sd_setImageWithURL:[LCTools getImageUrlWithAddress:model.youpaipimg]];
  71. if ([model.youpaippay_info.youpaipstatus isEqual:@"forbid"]) {
  72. self.youpaipmoneyL.textColor = HexColorFromRGB(0x58575E);
  73. self.youpaipmoneyL.text = model.youpaippay_info.youpaiptip;
  74. }else{
  75. self.youpaipmoneyL.textColor = HexColorFromRGB(0xFF4848);
  76. self.youpaipmoneyL.text = [NSString stringWithFormat:@"%@元",model.youpaippay_info.youpaipprice];
  77. if (model.youpaipisSelected) {
  78. self.youpaipselectedImgV.hidden = NO;
  79. self.layer.borderWidth = 1.0f;
  80. }
  81. }
  82. }
  83. @end