// // ASCheckoutAddressCell.m // Asteria // // Created by xingyu on 2024/5/9. // #import "ASCheckoutAddressCell.h" @implementation ASCheckoutAddressData @end @interface ASCheckoutAddressCell() @property (nonatomic, strong) UILabel *addressLab; @end @implementation ASCheckoutAddressCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)setupSubviewS { self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"]; UIView *backView = [[UIView alloc] init]; TT_ViewRadius(backView, 4); backView.backgroundColor = [UIColor whiteColor]; [self.contentView addSubview:backView]; [backView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.mas_equalTo(10); make.right.mas_equalTo(-10); make.bottom.mas_equalTo(0); }]; UIImageView *arrowRightImgV = [[UIImageView alloc] init]; arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"]; [backView addSubview:arrowRightImgV]; [arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.equalTo(backView); make.width.height.mas_equalTo(14); }]; UILabel *shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666]; [backView addSubview:shipTitleLab]; [shipTitleLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(20); }]; _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B]; [backView addSubview:_addressLab]; [_addressLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-48); make.top.equalTo(shipTitleLab.mas_bottom).offset(10); make.height.mas_equalTo(18); make.bottom.mas_equalTo(-20); }]; } - (void)configData:(id)Data{ ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data; ASAddressModel *addressModel = model.addressModel; if (addressModel) { NSString *addressInfoStr = [NSString stringWithFormat:@"%@ %@ %@ %@,%@ tel:%@", addressModel.firstname, addressModel.lastname, [addressModel.street componentsJoinedByString:@" "], addressModel.city, addressModel.postcode, addressModel.telephone]; if (NIL(addressInfoStr)) { _addressLab.textColor = [UIColor getColor:@"#E60013"]; _addressLab.text = @"Please fill in your address"; } else { _addressLab.textColor = _0B0B0B; _addressLab.text = addressInfoStr; } } else { _addressLab.text = @"--"; } } @end