123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- //
- // ASGoodsGuaranteeInfoCell.m
- // Asteria
- //
- // Created by xingyu on 2024/5/20.
- //
- #import "ASGoodsGuaranteeInfoCell.h"
- #import "GoodsDetailsPayV.h"
- #import "GoodsDetailsIntroduceV.h"
- #import "RadioButton.h"
- @interface ASGoodsGuaranteeInfoCell()
- @property (nonatomic, strong) GoodsDetailsPayV *datails_payV;
- @property (nonatomic, strong) GoodsDetailsIntroduceV *datails_IntroduceV;
- @property (nonatomic, strong) NSMutableArray *radioBtnAry;
- @property (nonatomic, strong) UIButton *leftBtn;
- @property (nonatomic, strong) UIButton *rightBtn;
- @end
- @implementation ASGoodsGuaranteeInfoCell
- - (void)setupSubviewS{
-
- _radioBtnAry = [[NSMutableArray alloc] initWithCapacity:1];
-
- [self.contentView addSubview:self.datails_payV];
- [self.contentView addSubview:self.datails_IntroduceV];
-
- [self.datails_payV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(10);
- make.width.mas_equalTo(KScreenWidth-20);
- make.height.mas_equalTo(78);
- }];
-
- [self.datails_IntroduceV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10);
- make.top.equalTo(self.datails_payV.mas_bottom).offset(10);
- make.width.mas_equalTo(KScreenWidth-20);
- make.height.mas_equalTo(120);
- }];
-
- NSArray *titleAry = @[@"PRODUCT DETAILS",@"REVIEWS"];
- for (int i= 0; i<titleAry.count; i++) {
- UIButton *radBtn= [UIButton buttonWithType:UIButtonTypeCustom];
- radBtn.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- radBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:14];
- radBtn.layer.cornerRadius = 4;
- radBtn.clipsToBounds = YES;
- radBtn.tag = i;
- [radBtn setTitle:titleAry[i] forState:UIControlStateNormal];
- [radBtn setTitleColor:[UIColor colorWithHexString:@"#000000"] forState:UIControlStateNormal];
- [radBtn setTitleColor:[UIColor colorWithHexString:@"#FFFFFF"] forState:UIControlStateSelected];
- [radBtn addTarget:self action:@selector(_onButtonClick:) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:radBtn];
- // [self.radioBtnAry addObject:radBtn];
- CGFloat btnWidth = (KScreenWidth -30)/2;
- [radBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(10+(10+btnWidth)*i);
- make.height.mas_equalTo(40);
- make.top.equalTo(self.datails_IntroduceV.mas_bottom).offset(20);
- make.width.mas_equalTo(btnWidth);
- make.bottom.mas_equalTo(-10);
- }];
-
- if (i == 0) {
- radBtn.selected = YES;
- radBtn.backgroundColor = [UIColor colorWithHexString:@"#113632"];
- self.leftBtn = radBtn;
- } else {
- radBtn.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- self.rightBtn = radBtn;
- }
- }
- // RadioButton *firstBtn = self.radioBtnAry[0];
- // [firstBtn setGroupButtons:self.radioBtnAry];
- // [self.radioBtnAry[0] setSelected:YES];
- // [self xxx_onRadioButtonValueChanged:self.radioBtnAry[0]];
-
-
- // self.datails_payV.titleLab.text = [NSString stringWithFormat:@"Pay in 4 interest-free payments of %@%.2f with",model.currency_symbol,[model.final_prices floatValue]/4];
- }
- - (void)configData:(id)Data{
- GoodsInformationM *model = (GoodsInformationM *)Data;
-
- _infoModel = model;
-
- self.datails_payV.titleLab.text = [NSString stringWithFormat:@"Pay in 4 interest-free payments of %@%.2f with",model.currency_symbol,[model.final_prices floatValue]/4];
- }
- -(void)_onButtonClick:(UIButton *)btn{
-
- int tag = (int)btn.tag;
- if (tag == 0) {
- if (self.leftBtn.isSelected) {
- return;
- }
- self.leftBtn.selected = YES;
- self.rightBtn.selected = NO;
- self.leftBtn.backgroundColor = [UIColor colorWithHexString:@"#113632"];
- self.rightBtn.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- } else {
- if (self.rightBtn.isSelected) {
- return;
- }
- self.rightBtn.selected = YES;
- self.leftBtn.selected = NO;
- self.rightBtn.backgroundColor = [UIColor colorWithHexString:@"#113632"];
- self.leftBtn.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- }
- if (self.currencyparameterClose) {
- self.currencyparameterClose(tag + 2, self.infoModel);
- }
- }
- -(GoodsDetailsPayV *)datails_payV{
- if (!_datails_payV) {
- _datails_payV = [[GoodsDetailsPayV alloc]initWithFrame:CGRectMake(10, 0, KScreenWidth-20, 78)];
- _datails_payV.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
- _datails_payV.layer.cornerRadius = 4;
- _datails_payV.clipsToBounds = YES;
- }
- return _datails_payV;
- }
- - (GoodsDetailsIntroduceV *)datails_IntroduceV {
- if (!_datails_IntroduceV) {
- _datails_IntroduceV = [[GoodsDetailsIntroduceV alloc] initWithFrame:CGRectMake(10, 0, KScreenWidth-20, 120)];
- _datails_IntroduceV.backgroundColor = _F5F5F5;
- _datails_IntroduceV.clipsToBounds = YES;
- }
- return _datails_IntroduceV;
- }
- @end
|