ASCheckoutAddressCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. //
  2. // ASCheckoutAddressCell.m
  3. // Asteria
  4. //
  5. // Created by xingyu on 2024/5/9.
  6. //
  7. #import "ASCheckoutAddressCell.h"
  8. @implementation ASCheckoutAddressData
  9. @end
  10. @interface ASCheckoutAddressCell()
  11. @property (nonatomic, strong) UIView *backView;
  12. @property (nonatomic, strong) UIImageView *arrowRightImgV;
  13. @property (nonatomic, strong) UILabel *shipTitleLab;
  14. @property (nonatomic, strong) UILabel *addressLab;
  15. @end
  16. @implementation ASCheckoutAddressCell
  17. - (void)awakeFromNib {
  18. [super awakeFromNib];
  19. // Initialization code
  20. }
  21. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  22. [super setSelected:selected animated:animated];
  23. // Configure the view for the selected state
  24. }
  25. - (void)setupSubviewS {
  26. self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
  27. [self.contentView addSubview:self.backView];
  28. [self.backView addSubview:self.arrowRightImgV];
  29. [self.backView addSubview:self.shipTitleLab];
  30. [self.backView addSubview:self.addressLab];
  31. [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
  32. make.left.top.mas_equalTo(10);
  33. make.right.mas_equalTo(-10);
  34. make.bottom.mas_equalTo(0);
  35. }];
  36. [self.arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.mas_equalTo(-10);
  38. make.centerY.equalTo(self.backView);
  39. make.width.height.mas_equalTo(14);
  40. }];
  41. [self.shipTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.mas_equalTo(10);
  43. make.top.mas_equalTo(20);
  44. }];
  45. [self.addressLab mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.left.mas_equalTo(10);
  47. make.right.mas_equalTo(-48);
  48. make.top.equalTo(self.shipTitleLab.mas_bottom).offset(10);
  49. make.height.mas_equalTo(18);
  50. make.bottom.mas_equalTo(-20);
  51. }];
  52. }
  53. - (void)configData:(id)Data{
  54. ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data;
  55. ASAddressModel *addressModel = model.addressModel;
  56. if (addressModel) {
  57. NSString *addressInfoStr = [NSString stringWithFormat:@"%@ %@ %@ %@,%@ tel:%@", addressModel.firstname, addressModel.lastname, [addressModel.street componentsJoinedByString:@" "], addressModel.city, addressModel.postcode, addressModel.telephone];
  58. self.addressLab.textColor = _0B0B0B;
  59. self.addressLab.text = addressInfoStr;
  60. } else {
  61. self.addressLab.textColor = [UIColor getColor:@"#E60013"];
  62. self.addressLab.text = @"Please fill in your address";
  63. }
  64. }
  65. - (UIView *)backView {
  66. if (!_backView) {
  67. _backView = [[UIView alloc] init];
  68. TT_ViewRadius(_backView, 4);
  69. _backView.backgroundColor = [UIColor whiteColor];
  70. }
  71. return _backView;
  72. }
  73. - (UIImageView *)arrowRightImgV {
  74. if (!_arrowRightImgV) {
  75. _arrowRightImgV = [[UIImageView alloc] init];
  76. _arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"];
  77. }
  78. return _arrowRightImgV;
  79. }
  80. - (UILabel *)shipTitleLab {
  81. if (!_shipTitleLab) {
  82. _shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666];
  83. }
  84. return _shipTitleLab;
  85. }
  86. - (UILabel *)addressLab {
  87. if (!_addressLab) {
  88. _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
  89. }
  90. return _addressLab;
  91. }
  92. @end