| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 | 
							- //
 
- //  ASCheckoutShipMethodCell.m
 
- //  Asteria
 
- //
 
- //  Created by xingyu on 2024/5/9.
 
- //
 
- #import "ASCheckoutShipMethodCell.h"
 
- @implementation ASCheckoutShipMethodData
 
- @end
 
- @interface ASCheckoutShipMethodCell()
 
- @property (nonatomic, strong) UIView *shipMethodView;
 
- @property (nonatomic, strong) UILabel *shipMethodLab;
 
- @property (nonatomic, strong) UILabel *shipPriceLab;
 
- @end
 
- @implementation ASCheckoutShipMethodCell
 
- - (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"];
 
-     
 
-     
 
-     [self.contentView addSubview:self.shipMethodView];
 
-     [self.shipMethodView mas_makeConstraints:^(MASConstraintMaker *make) {
 
-         make.left.mas_equalTo(10);
 
-         make.top.mas_equalTo(10);
 
-         make.right.mas_equalTo(-10);
 
-         make.height.mas_equalTo(50);
 
-         make.bottom.mas_equalTo(0);
 
-     }];
 
- }
 
- - (void)configData:(id)Data{
 
-     ASCheckoutShipMethodData *model = (ASCheckoutShipMethodData *)Data;
 
-     
 
-     self.cellData = model;
 
-     
 
-     float floatY = 0;
 
-     
 
-     [self.shipMethodView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
 
-     
 
-     for (int i = 0; i < model.shipMethodArray.count; i++) {
 
-         ASCheckoutShipMethodModel *shipModel = model.shipMethodArray[i];
 
-         
 
-         ASShipMethodItem *shipItem = [[ASShipMethodItem alloc] initWithFrame:CGRectMake(0, floatY, KScreenWidth - 20, 53)];
 
-         [self.shipMethodView addSubview:shipItem];
 
-         
 
-         [shipItem setShipItemData:shipModel symbol:AS_String_NotNull(model.shipmethodSymbol)];
 
-         shipItem.selectBtn.tag = i;
 
-         [shipItem.selectBtn addTarget:self action:@selector(_selectShipMethod:) forControlEvents:UIControlEventTouchUpInside];
 
-         
 
-         
 
-         floatY = floatY + 53;
 
-         
 
-     }
 
-     
 
-     [self.shipMethodView mas_updateConstraints:^(MASConstraintMaker *make) {
 
-         make.height.mas_equalTo(floatY);
 
-     }];
 
-     
 
- }
 
- - (void)_selectShipMethod:(UIButton *)button {
 
-     
 
-     if (button.selected) {
 
-         return;
 
-     }
 
-     
 
-     button.selected = !button.selected;
 
-     
 
-     
 
-     if (self.currencyparameterClose) {
 
-         self.currencyparameterClose(button.tag, self.cellData);
 
-     }
 
- }
 
- - (UIView *)shipMethodView {
 
-     if (!_shipMethodView) {
 
-         _shipMethodView = [[UIView alloc] init];
 
-         TT_ViewRadius(_shipMethodView, 4);
 
-         _shipMethodView.backgroundColor = [UIColor whiteColor];
 
-     }
 
-     return _shipMethodView;
 
- }
 
- @end
 
- @interface ASShipMethodItem()
 
- @property (nonatomic, strong) UILabel *shipMethodLab;
 
- @property (nonatomic, strong) UILabel *shipPriceLab;
 
- @end
 
- @implementation ASShipMethodItem
 
- - (instancetype)initWithFrame:(CGRect)frame {
 
-     if (self = [super initWithFrame:frame]) {
 
-         
 
-         [self addSubview:self.selectBtn];
 
-         [self addSubview:self.shipPriceLab];
 
-         [self addSubview:self.shipMethodLab];
 
-         
 
-         
 
-         [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
 
-             make.right.mas_equalTo(-10);
 
-             make.width.height.mas_equalTo(26);
 
-             make.centerY.equalTo(self);
 
-         }];
 
-         
 
-         [self.shipPriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
 
-             make.right.mas_equalTo(self.selectBtn.mas_left).offset(-8);
 
-             make.centerY.mas_equalTo(self);
 
-         }];
 
-         
 
-         [self.shipMethodLab mas_makeConstraints:^(MASConstraintMaker *make) {
 
-             make.left.mas_equalTo(10);
 
-             make.right.mas_equalTo(self.shipPriceLab.mas_left).offset(-8);
 
-             make.centerY.mas_equalTo(self);
 
-             make.height.mas_equalTo(18);
 
-             make.bottom.mas_equalTo(-20);
 
-         }];
 
-     }
 
-     return self;
 
- }
 
- - (void)setShipItemData:(ASCheckoutShipMethodModel *)shipModel symbol:(NSString *)symbol {
 
-     
 
-     self.shipMethodLab.text = [NSString stringWithFormat:@"%@ %@", AS_String_NotNull(shipModel.method_title), AS_String_NotNull(shipModel.carrier_title)];
 
-     self.shipPriceLab.text = [NSString stringWithFormat:@"%@%.2f", symbol, [shipModel.amount floatValue]];
 
-     
 
-     self.selectBtn.selected = shipModel.isSelect;
 
- }
 
- - (UIButton *)selectBtn {
 
-     if (!_selectBtn) {
 
-         _selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
 
-         [_selectBtn setImage:[UIImage imageNamed:@"base_radio_unselect"] forState:UIControlStateNormal];
 
-         [_selectBtn setImage:[UIImage imageNamed:@"base_radio_select"] forState:UIControlStateSelected];
 
-     }
 
-     return _selectBtn;
 
- }
 
- - (UILabel *)shipPriceLab {
 
-     if (!_shipPriceLab) {
 
-         _shipPriceLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
 
-         _shipPriceLab.textAlignment = NSTextAlignmentRight;
 
-         _shipPriceLab.adjustsFontSizeToFitWidth = YES;
 
-     }
 
-     return _shipPriceLab;
 
- }
 
- - (UILabel *)shipMethodLab {
 
-     if (!_shipMethodLab) {
 
-         _shipMethodLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
 
-     }
 
-     return _shipMethodLab;
 
- }
 
- @end
 
 
  |