ASCheckoutAddressCell.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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) UILabel *addressLab;
  12. @property (nonatomic, strong) UILabel *shipMethodLab;
  13. @property (nonatomic, strong) UILabel *shipPriceLab;
  14. @end
  15. @implementation ASCheckoutAddressCell
  16. - (void)awakeFromNib {
  17. [super awakeFromNib];
  18. // Initialization code
  19. }
  20. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  21. [super setSelected:selected animated:animated];
  22. // Configure the view for the selected state
  23. }
  24. - (void)setupSubviewS {
  25. self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
  26. UIView *backView = [[UIView alloc] init];
  27. TT_ViewRadius(backView, 4);
  28. backView.backgroundColor = [UIColor whiteColor];
  29. [self.contentView addSubview:backView];
  30. [backView mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.left.top.mas_equalTo(10);
  32. make.right.mas_equalTo(-10);
  33. }];
  34. UIImageView *arrowRightImgV = [[UIImageView alloc] init];
  35. arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"];
  36. [backView addSubview:arrowRightImgV];
  37. [arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.right.mas_equalTo(-10);
  39. make.centerY.equalTo(backView);
  40. make.width.height.mas_equalTo(14);
  41. }];
  42. UILabel *shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666];
  43. [backView addSubview:shipTitleLab];
  44. [shipTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  45. make.left.mas_equalTo(10);
  46. make.top.mas_equalTo(20);
  47. }];
  48. _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
  49. [backView addSubview:_addressLab];
  50. [_addressLab mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.mas_equalTo(10);
  52. make.right.mas_equalTo(-48);
  53. make.top.equalTo(shipTitleLab.mas_bottom).offset(10);
  54. make.height.mas_equalTo(18);
  55. make.bottom.mas_equalTo(-20);
  56. }];
  57. UIView *shipMethodView = [[UIView alloc] init];
  58. TT_ViewRadius(shipMethodView, 4);
  59. shipMethodView.backgroundColor = [UIColor whiteColor];
  60. [self.contentView addSubview:shipMethodView];
  61. [shipMethodView mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.left.mas_equalTo(10);
  63. make.top.equalTo(backView.mas_bottom).offset(10);
  64. make.right.mas_equalTo(-10);
  65. make.bottom.mas_equalTo(0);
  66. }];
  67. UILabel *shipMethodLab1 = [UILabel labelCreateWithText:@"Shipping Method" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
  68. [shipMethodView addSubview:shipMethodLab1];
  69. [shipMethodLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.mas_equalTo(10);
  71. make.top.mas_equalTo(20);
  72. }];
  73. _shipPriceLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
  74. _shipPriceLab.textAlignment = NSTextAlignmentRight;
  75. _shipPriceLab.adjustsFontSizeToFitWidth = YES;
  76. [shipMethodView addSubview:_shipPriceLab];
  77. [_shipPriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.right.mas_equalTo(-10);
  79. make.centerY.mas_equalTo(shipMethodView);
  80. make.width.mas_equalTo(64);
  81. }];
  82. _shipMethodLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666];
  83. [shipMethodView addSubview:_shipMethodLab];
  84. [_shipMethodLab mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.left.mas_equalTo(10);
  86. make.right.mas_equalTo(-84);
  87. make.top.equalTo(shipMethodLab1.mas_bottom).offset(10);
  88. make.height.mas_equalTo(18);
  89. make.bottom.mas_equalTo(-20);
  90. }];
  91. }
  92. - (void)configData:(id)Data{
  93. ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data;
  94. if (NIL(model.addressInfoStr)) {
  95. _addressLab.textColor = [UIColor getColor:@"#E60013"];
  96. _addressLab.text = @"Please fill in your address";
  97. } else {
  98. _addressLab.textColor = _0B0B0B;
  99. _addressLab.text = model.addressInfoStr;
  100. }
  101. if (NIL(model.shipmethodStr)) {
  102. _shipMethodLab.text = @"--";
  103. } else {
  104. _shipMethodLab.text = model.shipmethodStr;
  105. }
  106. _shipPriceLab.text = [NSString stringWithFormat:@"%@%@", model.shipmethodSymbol, model.shipmethodPrice];
  107. }
  108. @end