|
@@ -7,8 +7,159 @@
|
|
|
|
|
|
#import "ASGoodsCouponCell.h"
|
|
#import "ASGoodsCouponCell.h"
|
|
|
|
|
|
|
|
+@interface ASGoodsCouponCell()
|
|
|
|
+
|
|
|
|
+@property (nonatomic, strong) UIView *backView;
|
|
|
|
+@property (nonatomic, strong) UILabel *titleLab;
|
|
|
|
+@property (nonatomic, strong) UILabel *titleDescLab;
|
|
|
|
+@property (nonatomic, strong) UIButton *rTopBtn;
|
|
|
|
+
|
|
|
|
+@property (nonatomic, strong) UIView *couponView;
|
|
|
|
+
|
|
|
|
+@end
|
|
|
|
+
|
|
@implementation ASGoodsCouponCell
|
|
@implementation ASGoodsCouponCell
|
|
|
|
|
|
|
|
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
|
|
|
+ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
|
|
|
+ _backView = [[UIView alloc] init];
|
|
|
|
+ TT_ViewRadius(_backView, 8);
|
|
|
|
+ _backView.backgroundColor = _113632;
|
|
|
|
+ [self.contentView addSubview:_backView];
|
|
|
|
+ [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(10);
|
|
|
|
+ make.top.mas_equalTo(10);
|
|
|
|
+ make.right.mas_equalTo(-10);
|
|
|
|
+// make.height.mas_equalTo(45);
|
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ _titleLab = [UILabel labelCreateWithText:@"COUPON" font:[UIFont fontWithName:Rob_Bold size:14] textColor:Col_FFF];
|
|
|
|
+ _titleDescLab.adjustsFontSizeToFitWidth = YES;
|
|
|
|
+ [_backView addSubview:_titleLab];
|
|
|
|
+ [_titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(10);
|
|
|
|
+ make.top.mas_equalTo(12);
|
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
|
+ make.width.mas_equalTo(60);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ _titleDescLab = [UILabel labelCreateWithText:@"All wigs 10% off code:wkwig" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_FFF];
|
|
|
|
+ _titleDescLab.adjustsFontSizeToFitWidth = YES;
|
|
|
|
+ [_backView addSubview:_titleDescLab];
|
|
|
|
+ [_titleDescLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.mas_equalTo(_titleLab.mas_right).offset(4);
|
|
|
|
+ make.centerY.mas_equalTo(_titleLab);
|
|
|
|
+ make.right.mas_equalTo(-40);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ _rTopBtn = [[UIButton alloc]init];
|
|
|
|
+// _rTopBtn.selected = NO;
|
|
|
|
+ [_rTopBtn addTarget:self action:@selector(_couponEvent:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
+ [_rTopBtn setImage:[UIImage imageNamed:@"base_add_white"] forState:UIControlStateNormal];
|
|
|
|
+ [_rTopBtn setImage:[UIImage imageNamed:@"base_subtract_white"] forState:UIControlStateSelected];
|
|
|
|
+ [_backView addSubview:_rTopBtn];
|
|
|
|
+ [_rTopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.centerY.equalTo(_titleLab);
|
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
|
+ make.width.mas_equalTo(40);
|
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ _couponView = [[UIView alloc] init];
|
|
|
|
+ _couponView.backgroundColor = [UIColor clearColor];
|
|
|
|
+ [_backView addSubview:_couponView];
|
|
|
|
+ [_couponView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.left.right.bottom.mas_equalTo(0);
|
|
|
|
+ make.height.mas_equalTo(1);
|
|
|
|
+ make.top.mas_equalTo(_titleLab.mas_bottom).offset(12);
|
|
|
|
+ make.bottom.mas_equalTo(0);
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+ return self;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)setupSubviewS {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)configData:(id)Data isSelect:(BOOL)isSelect{
|
|
|
|
+ GoodsInformationM *model = (GoodsInformationM *)Data;
|
|
|
|
+
|
|
|
|
+ self.rTopBtn.selected = isSelect;
|
|
|
|
+
|
|
|
|
+ if (self.rTopBtn.selected) {//展开
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ NSArray *array = @[@"1", @"2", @"3", @"4", @"5", @"6"];
|
|
|
|
+
|
|
|
|
+ float itemWidth = (KScreenWidth - 50)/2;
|
|
|
|
+ float itemX = 10;
|
|
|
|
+ float itemY = 10;
|
|
|
|
+ for (int i = 0; i < array.count; i++) {
|
|
|
|
+ ASGoodsCouponItemView *itemView = [[ASGoodsCouponItemView alloc] initWithFrame:CGRectMake(itemX, itemY, itemWidth, 100)];
|
|
|
|
+ [_couponView addSubview:itemView];
|
|
|
|
+
|
|
|
|
+ if (i % 2 == 1) {
|
|
|
|
+ itemX = 10;
|
|
|
|
+ itemY = itemY + 100 + 10;
|
|
|
|
+ } else {
|
|
|
|
+ itemX = itemX + itemWidth + 10;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (array.count % 2 != 0) {
|
|
|
|
+ itemY = itemY + 100 + 10;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ [_couponView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.height.mas_equalTo(itemY);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ } else {//收起
|
|
|
|
+
|
|
|
|
+ [self.couponView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.height.mas_equalTo(1);
|
|
|
|
+ }];
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+- (void)_couponEvent:(UIButton *)button {
|
|
|
|
+// button.selected = !button.selected;
|
|
|
|
+ self.rTopBtn.selected = !self.rTopBtn.selected;
|
|
|
|
+// TT_ViewRadius(self.backView, 0);
|
|
|
|
+ if (self.currencyparameterClose) {
|
|
|
|
+ self.currencyparameterClose(self.rTopBtn.selected, nil);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@end
|
|
|
|
+
|
|
|
|
+@interface ASGoodsCouponItemView()
|
|
|
|
+
|
|
|
|
+@end
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@implementation ASGoodsCouponItemView
|
|
|
|
|
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
|
+ if (self = [super initWithFrame:frame]) {
|
|
|
|
+
|
|
|
|
+ UIImageView *bgImaegView = [[UIImageView alloc] init];
|
|
|
|
+ bgImaegView.image = [UIImage imageNamed:@"goods_coupon_bg"];
|
|
|
|
+ [self addSubview:bgImaegView];
|
|
|
|
+ [bgImaegView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
+ make.edges.mas_equalTo(0);
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return self;
|
|
|
|
+}
|
|
|
|
|
|
@end
|
|
@end
|