ASCheckoutAddressCell.m 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. @end
  13. @implementation ASCheckoutAddressCell
  14. - (void)awakeFromNib {
  15. [super awakeFromNib];
  16. // Initialization code
  17. }
  18. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  19. [super setSelected:selected animated:animated];
  20. // Configure the view for the selected state
  21. }
  22. - (void)setupSubviewS {
  23. self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
  24. UIView *backView = [[UIView alloc] init];
  25. TT_ViewRadius(backView, 4);
  26. backView.backgroundColor = [UIColor whiteColor];
  27. [self.contentView addSubview:backView];
  28. [backView mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.top.mas_equalTo(10);
  30. make.right.mas_equalTo(-10);
  31. make.bottom.mas_equalTo(0);
  32. }];
  33. UIImageView *arrowRightImgV = [[UIImageView alloc] init];
  34. arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"];
  35. [backView addSubview:arrowRightImgV];
  36. [arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.right.mas_equalTo(-10);
  38. make.centerY.equalTo(backView);
  39. make.width.height.mas_equalTo(14);
  40. }];
  41. UILabel *shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666];
  42. [backView addSubview:shipTitleLab];
  43. [shipTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.left.mas_equalTo(10);
  45. make.top.mas_equalTo(20);
  46. }];
  47. _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
  48. [backView addSubview:_addressLab];
  49. [_addressLab mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.mas_equalTo(10);
  51. make.right.mas_equalTo(-48);
  52. make.top.equalTo(shipTitleLab.mas_bottom).offset(10);
  53. make.height.mas_equalTo(18);
  54. make.bottom.mas_equalTo(-20);
  55. }];
  56. }
  57. - (void)configData:(id)Data{
  58. ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data;
  59. ASAddressModel *addressModel = model.addressModel;
  60. if (addressModel) {
  61. NSString *addressInfoStr = [NSString stringWithFormat:@"%@ %@ %@ %@,%@ tel:%@", addressModel.firstname, addressModel.lastname, [addressModel.street componentsJoinedByString:@" "], addressModel.city, addressModel.postcode, addressModel.telephone];
  62. if (NIL(addressInfoStr)) {
  63. _addressLab.textColor = [UIColor getColor:@"#E60013"];
  64. _addressLab.text = @"Please fill in your address";
  65. } else {
  66. _addressLab.textColor = _0B0B0B;
  67. _addressLab.text = addressInfoStr;
  68. }
  69. } else {
  70. _addressLab.text = @"--";
  71. }
  72. }
  73. @end