// // ASCheckoutAddressCell.m // Asteria // // Created by xingyu on 2024/5/9. // #import "ASCheckoutAddressCell.h" @implementation ASCheckoutAddressData @end @interface ASCheckoutAddressCell() @property (nonatomic, strong) UILabel *addressLab; @property (nonatomic, strong) UILabel *shipMethodLab; @property (nonatomic, strong) UILabel *shipPriceLab; @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); }]; 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); }]; UIView *shipMethodView = [[UIView alloc] init]; TT_ViewRadius(shipMethodView, 4); shipMethodView.backgroundColor = [UIColor whiteColor]; [self.contentView addSubview:shipMethodView]; [shipMethodView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.equalTo(backView.mas_bottom).offset(10); make.right.mas_equalTo(-10); make.bottom.mas_equalTo(0); }]; UILabel *shipMethodLab1 = [UILabel labelCreateWithText:@"Shipping Method" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B]; [shipMethodView addSubview:shipMethodLab1]; [shipMethodLab1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(20); }]; _shipPriceLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B]; _shipPriceLab.textAlignment = NSTextAlignmentRight; _shipPriceLab.adjustsFontSizeToFitWidth = YES; [shipMethodView addSubview:_shipPriceLab]; [_shipPriceLab mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.mas_equalTo(shipMethodView); make.width.mas_equalTo(64); }]; _shipMethodLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666]; [shipMethodView addSubview:_shipMethodLab]; [_shipMethodLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-84); make.top.equalTo(shipMethodLab1.mas_bottom).offset(10); make.height.mas_equalTo(18); make.bottom.mas_equalTo(-20); }]; } - (void)configData:(id)Data{ ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data; if (NIL(model.addressInfoStr)) { _addressLab.textColor = [UIColor getColor:@"#E60013"]; _addressLab.text = @"Please fill in your address"; } else { _addressLab.textColor = _0B0B0B; _addressLab.text = model.addressInfoStr; } if (NIL(model.shipmethodStr)) { _shipMethodLab.text = @"--"; } else { _shipMethodLab.text = model.shipmethodStr; } _shipPriceLab.text = [NSString stringWithFormat:@"%@%@", model.shipmethodSymbol, model.shipmethodPrice]; } @end