Browse Source

feat:代码调整

“wangdongchao” 1 year ago
parent
commit
85ee6a4f46

+ 52 - 23
Asteria/Fuction/Cart/Checkout/ASCheckoutAddressCell.m

@@ -13,6 +13,10 @@
 
 @interface ASCheckoutAddressCell()
 
+@property (nonatomic, strong) UIView *backView;
+
+@property (nonatomic, strong) UIImageView *arrowRightImgV;
+@property (nonatomic, strong) UILabel *shipTitleLab;
 @property (nonatomic, strong) UILabel *addressLab;
 
 @end
@@ -34,38 +38,33 @@
     
     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) {
+    [self.contentView addSubview:self.backView];
+    
+    [self.backView addSubview:self.arrowRightImgV];
+    [self.backView addSubview:self.shipTitleLab];
+    [self.backView addSubview:self.addressLab];
+    
+    [self.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) {
+    [self.arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
         make.right.mas_equalTo(-10);
-        make.centerY.equalTo(backView);
+        make.centerY.equalTo(self.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) {
+    [self.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) {
+    [self.addressLab mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(10);
         make.right.mas_equalTo(-48);
-        make.top.equalTo(shipTitleLab.mas_bottom).offset(10);
+        make.top.equalTo(self.shipTitleLab.mas_bottom).offset(10);
         make.height.mas_equalTo(18);
         make.bottom.mas_equalTo(-20);
     }];
@@ -80,14 +79,44 @@
     if (addressModel) {
         NSString *addressInfoStr = [NSString stringWithFormat:@"%@ %@ %@ %@,%@ tel:%@", addressModel.firstname, addressModel.lastname, [addressModel.street componentsJoinedByString:@" "], addressModel.city, addressModel.postcode, addressModel.telephone];
         
-        _addressLab.textColor = _0B0B0B;
-        _addressLab.text = addressInfoStr;
+        self.addressLab.textColor = _0B0B0B;
+        self.addressLab.text = addressInfoStr;
     } else {
-        _addressLab.textColor = [UIColor getColor:@"#E60013"];
-        _addressLab.text = @"Please fill in your address";
+        self.addressLab.textColor = [UIColor getColor:@"#E60013"];
+        self.addressLab.text = @"Please fill in your address";
     }
-    
-    
+}
+
+
+- (UIView *)backView {
+    if (!_backView) {
+        _backView = [[UIView alloc] init];
+        TT_ViewRadius(_backView, 4);
+        _backView.backgroundColor = [UIColor whiteColor];
+    }
+    return _backView;
+}
+
+- (UIImageView *)arrowRightImgV {
+    if (!_arrowRightImgV) {
+        _arrowRightImgV = [[UIImageView alloc] init];
+        _arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"];
+    }
+    return _arrowRightImgV;
+}
+
+- (UILabel *)shipTitleLab {
+    if (!_shipTitleLab) {
+        _shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666];
+    }
+    return _shipTitleLab;
+}
+
+- (UILabel *)addressLab {
+    if (!_addressLab) {
+        _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
+    }
+    return _addressLab;
 }
 
 @end

+ 27 - 11
Asteria/Fuction/Cart/Checkout/ASCheckoutCommentCell.m

@@ -13,6 +13,9 @@
 
 @interface ASCheckoutCommentCell()<UITextFieldDelegate>
 
+@property (nonatomic, strong) UIView *backView;
+@property (nonatomic, strong) UILabel *titleLab;
+
 @property (nonatomic, strong) TT_CustonTF  *commentTF;
 
 @end
@@ -22,32 +25,29 @@
 - (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) {
+    [self.contentView addSubview:self.backView];
+    
+    [self.backView addSubview:self.titleLab];
+    [self.backView addSubview:self.commentTF];
+    
+    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.top.mas_equalTo(10);
         make.right.mas_equalTo(-10);
         make.bottom.mas_equalTo(0);
     }];
     
-    UILabel *titleLab = [UILabel labelCreateWithText:@"Comment" font:[UIFont fontWithName:Rob_Bold size:16] textColor:Col_000];
-    [backView addSubview:titleLab];
-    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
+    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(10);
         make.top.mas_equalTo(20);
     }];
     
-    [backView addSubview:self.commentTF];
     [self.commentTF mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.mas_equalTo(10);
         make.right.mas_equalTo(-10);
-        make.top.equalTo(titleLab.mas_bottom).offset(20);
+        make.top.equalTo(self.titleLab.mas_bottom).offset(20);
         make.height.mas_equalTo(45);
         make.bottom.mas_equalTo(-20);
     }];
-    
 }
 
 
@@ -58,6 +58,22 @@
     }
 }
 
+- (UIView *)backView {
+    if (!_backView) {
+        _backView = [[UIView alloc] init];
+        TT_ViewRadius(_backView, 4);
+        _backView.backgroundColor = [UIColor whiteColor];
+    }
+    return _backView;
+}
+
+- (UILabel *)titleLab {
+    if (!_titleLab) {
+        _titleLab = [UILabel labelCreateWithText:@"Comment" font:[UIFont fontWithName:Rob_Bold size:16] textColor:Col_000];
+    }
+    return _titleLab;
+}
+
 -(TT_CustonTF *)commentTF{
     if(!_commentTF){
         _commentTF = [[TT_CustonTF alloc] init];

+ 50 - 27
Asteria/Fuction/Cart/Checkout/ASCheckoutShipMethodCell.m

@@ -38,11 +38,9 @@
     
     self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
     
-    _shipMethodView = [[UIView alloc] init];
-    TT_ViewRadius(_shipMethodView, 4);
-    _shipMethodView.backgroundColor = [UIColor whiteColor];
-    [self.contentView addSubview:_shipMethodView];
-    [_shipMethodView mas_makeConstraints:^(MASConstraintMaker *make) {
+    
+    [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);
@@ -64,7 +62,7 @@
         ASCheckoutShipMethodModel *shipModel = model.shipMethodArray[i];
         
         ASShipMethodItem *shipItem = [[ASShipMethodItem alloc] initWithFrame:CGRectMake(0, floatY, KScreenWidth - 20, 53)];
-        [_shipMethodView addSubview:shipItem];
+        [self.shipMethodView addSubview:shipItem];
         
         [shipItem setShipItemData:shipModel symbol:AS_String_NotNull(model.shipmethodSymbol)];
         shipItem.selectBtn.tag = i;
@@ -75,7 +73,7 @@
         
     }
     
-    [_shipMethodView mas_updateConstraints:^(MASConstraintMaker *make) {
+    [self.shipMethodView mas_updateConstraints:^(MASConstraintMaker *make) {
         make.height.mas_equalTo(floatY);
     }];
     
@@ -95,6 +93,14 @@
     }
 }
 
+- (UIView *)shipMethodView {
+    if (!_shipMethodView) {
+        _shipMethodView = [[UIView alloc] init];
+        TT_ViewRadius(_shipMethodView, 4);
+        _shipMethodView.backgroundColor = [UIColor whiteColor];
+    }
+    return _shipMethodView;
+}
 
 @end
 
@@ -114,37 +120,29 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
         
-        _selectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_selectBtn setImage:[UIImage imageNamed:@"base_radio_unselect"] forState:UIControlStateNormal];
-        [_selectBtn setImage:[UIImage imageNamed:@"base_radio_select"] forState:UIControlStateSelected];
+        [self addSubview:self.selectBtn];
+        [self addSubview:self.shipPriceLab];
+        [self addSubview:self.shipMethodLab];
+        
         
-        [self addSubview:_selectBtn];
-        [_selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
             make.right.mas_equalTo(-10);
             make.width.height.mas_equalTo(26);
             make.centerY.equalTo(self);
         }];
         
-        _shipPriceLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
-        _shipPriceLab.textAlignment = NSTextAlignmentRight;
-        _shipPriceLab.adjustsFontSizeToFitWidth = YES;
-        [self addSubview:_shipPriceLab];
-        [_shipPriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
-            make.right.mas_equalTo(_selectBtn.mas_left).offset(-8);
+        [self.shipPriceLab mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.right.mas_equalTo(self.selectBtn.mas_left).offset(-8);
             make.centerY.mas_equalTo(self);
         }];
         
-        _shipMethodLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B];
-        [self addSubview:_shipMethodLab];
-        [_shipMethodLab mas_makeConstraints:^(MASConstraintMaker *make) {
+        [self.shipMethodLab mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.mas_equalTo(10);
-            make.right.mas_equalTo(_shipPriceLab.mas_left).offset(-8);
+            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;
 }
@@ -152,10 +150,35 @@
 
 - (void)setShipItemData:(ASCheckoutShipMethodModel *)shipModel symbol:(NSString *)symbol {
     
-    _shipMethodLab.text = [NSString stringWithFormat:@"%@ %@", AS_String_NotNull(shipModel.method_title), AS_String_NotNull(shipModel.carrier_title)];
-    _shipPriceLab.text = [NSString stringWithFormat:@"%@%@", symbol, shipModel.amount];
+    self.shipMethodLab.text = [NSString stringWithFormat:@"%@ %@", AS_String_NotNull(shipModel.method_title), AS_String_NotNull(shipModel.carrier_title)];
+    self.shipPriceLab.text = [NSString stringWithFormat:@"%@%@", symbol, shipModel.amount];
     
-    _selectBtn.selected = shipModel.isSelect;
+    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

+ 31 - 32
Asteria/Fuction/Cart/Checkout/ASCheckoutTopView.m

@@ -9,38 +9,6 @@
 
 @implementation ASCheckoutTopView
 
-- (UILabel *)countLab {
-    if (!_countLab) {
-        _countLab = [[UILabel alloc] init];
-        _countLab.textColor = _0B0B0B;
-        _countLab.text = @"show order items";
-        _countLab.font = [UIFont fontWithName:Rob_Bold size:16];
-    }
-    return _countLab;
-}
-
-- (UIButton *)arrowBtn {
-    if (!_arrowBtn) {
-        _arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-        [_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_up"] forState:UIControlStateNormal];
-        [_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_down"] forState:UIControlStateSelected];
-        _arrowBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:12];
-        [_arrowBtn addTarget:self action:@selector(_isFlodClick:) forControlEvents:UIControlEventTouchUpInside];
-        [_arrowBtn setTitleColor:_0B0B0B forState:0];
-    }
-    return _arrowBtn;
-}
-
-- (UILabel *)priceLab {
-    if (!_priceLab) {
-        _priceLab = [[UILabel alloc] init];
-        _priceLab.textColor = _0B0B0B;
-        _priceLab.font = [UIFont fontWithName:Rob_Bold size:16];
-    }
-    return _priceLab;
-}
-
-
 - (instancetype)initWithFrame:(CGRect)frame {
     if (self = [super initWithFrame:frame]) {
         self.backgroundColor = ThemeLightColor;
@@ -83,4 +51,35 @@
     
 }
 
+- (UILabel *)countLab {
+    if (!_countLab) {
+        _countLab = [[UILabel alloc] init];
+        _countLab.textColor = _0B0B0B;
+        _countLab.text = @"show order items";
+        _countLab.font = [UIFont fontWithName:Rob_Bold size:16];
+    }
+    return _countLab;
+}
+
+- (UIButton *)arrowBtn {
+    if (!_arrowBtn) {
+        _arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+        [_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_up"] forState:UIControlStateNormal];
+        [_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_down"] forState:UIControlStateSelected];
+        _arrowBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:12];
+        [_arrowBtn addTarget:self action:@selector(_isFlodClick:) forControlEvents:UIControlEventTouchUpInside];
+        [_arrowBtn setTitleColor:_0B0B0B forState:0];
+    }
+    return _arrowBtn;
+}
+
+- (UILabel *)priceLab {
+    if (!_priceLab) {
+        _priceLab = [[UILabel alloc] init];
+        _priceLab.textColor = _0B0B0B;
+        _priceLab.font = [UIFont fontWithName:Rob_Bold size:16];
+    }
+    return _priceLab;
+}
+
 @end

+ 90 - 42
Asteria/Fuction/Goods/V/ASGoodsCouponCell.m

@@ -22,57 +22,46 @@
 
 - (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) {
+        
+        [self.contentView addSubview:self.backView];
+        
+        [self.backView addSubview:self.titleLab];
+        [self.backView addSubview:self.titleDescLab];
+        [self.backView addSubview:self.rTopBtn];
+        
+        [self.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) {
+        [self.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);
+        [self.titleDescLab mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.mas_equalTo(self.titleLab.mas_right).offset(4);
+            make.centerY.mas_equalTo(self.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);
+        [self.rTopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.centerY.equalTo(self.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) {
+        
+        [self.backView addSubview:self.couponView];
+        [self.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.top.mas_equalTo(self.titleLab.mas_bottom).offset(12);
             make.bottom.mas_equalTo(0);
         }];
     }
@@ -102,7 +91,7 @@
         for (int i = 0; i < array.count; i++) {
             ASGoodsCouponItemView *itemView = [[ASGoodsCouponItemView alloc] initWithFrame:CGRectMake(itemX, itemY, itemWidth, 100)];
             itemView.tag = i;
-            [_couponView addSubview:itemView];
+            [self.couponView addSubview:itemView];
             
             itemView.userInteractionEnabled = YES;
             UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_clickAction:)];
@@ -122,7 +111,7 @@
             itemY = itemY + 100 + 10;
         }
         
-        [_couponView mas_updateConstraints:^(MASConstraintMaker *make) {
+        [self.couponView mas_updateConstraints:^(MASConstraintMaker *make) {
             make.height.mas_equalTo(itemY);
         }];
         
@@ -147,10 +136,55 @@
     }
 }
 
+- (UIView *)backView {
+    if (!_backView) {
+        _backView = [[UIView alloc] init];
+        TT_ViewRadius(_backView, 8);
+        _backView.backgroundColor = _113632;
+    }
+    return _backView;
+}
+
+- (UILabel *)titleLab {
+    if (!_titleLab) {
+        _titleLab = [UILabel labelCreateWithText:@"COUPON" font:[UIFont fontWithName:Rob_Bold size:14] textColor:Col_FFF];
+        _titleLab.adjustsFontSizeToFitWidth = YES;
+    }
+    return _titleLab;
+}
+
+- (UILabel *)titleDescLab {
+    if (!_titleDescLab) {
+        _titleDescLab = [UILabel labelCreateWithText:@"All wigs 10% off   code:wkwig" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_FFF];
+        _titleDescLab.adjustsFontSizeToFitWidth = YES;
+    }
+    return _titleDescLab;
+}
+
+- (UIButton *)rTopBtn {
+    if (!_rTopBtn) {
+        _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];
+    }
+    return _rTopBtn;
+}
+
+- (UIView *)couponView {
+    if (!_couponView) {
+        _couponView = [[UIView alloc] init];
+        _couponView.backgroundColor = [UIColor clearColor];
+    }
+    return _couponView;
+}
+
 @end
 
 @interface ASGoodsCouponItemView()
 
+@property (nonatomic, strong) UIImageView *bgImaegView;
 @property (nonatomic, strong) UILabel *couponCodeLab;
 @property (nonatomic, strong) UILabel *couponPriceLab;
 @property (nonatomic, strong) UILabel *couponDescLab;
@@ -160,26 +194,40 @@
 
 @implementation ASGoodsCouponItemView
 
+- (UIImageView *)bgImaegView {
+    if (!_bgImaegView) {
+        _bgImaegView = [[UIImageView alloc] init];
+        _bgImaegView.image = [UIImage imageNamed:@"goods_coupon_bg"];
+    }
+    return _bgImaegView;
+}
+
+- (UILabel *)couponCodeLab {
+    if (!_couponCodeLab) {
+        _couponCodeLab = [UILabel labelCreateWithText:@"code:1238" font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B];
+        _couponCodeLab.textAlignment = NSTextAlignmentCenter;
+    }
+    return _couponCodeLab;
+}
+
 - (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) {
+        
+        [self addSubview:self.bgImaegView];
+        
+        [self.bgImaegView addSubview:self.couponCodeLab];
+        
+        
+        [self.bgImaegView mas_makeConstraints:^(MASConstraintMaker *make) {
             make.edges.mas_equalTo(0);
         }];
         
-        _couponCodeLab = [UILabel labelCreateWithText:@"code:1238" font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B];
-        _couponCodeLab.textAlignment = NSTextAlignmentCenter;
-        [bgImaegView addSubview:_couponCodeLab];
-        [_couponCodeLab mas_makeConstraints:^(MASConstraintMaker *make) {
+        [self.couponCodeLab mas_makeConstraints:^(MASConstraintMaker *make) {
             make.bottom.mas_equalTo(-16);
-            make.centerX.equalTo(bgImaegView.mas_centerX).offset(-25);
+            make.centerX.equalTo(self.bgImaegView.mas_centerX).offset(-25);
             make.width.mas_equalTo((KScreenWidth - 50)/2 - 80);
         }];
-        
-        
     }
     return self;
 }

+ 18 - 18
Asteria/Fuction/Goods/V/ASGoodsReviewFootCell.m

@@ -9,31 +9,16 @@
 
 @interface ASGoodsReviewFootCell()
 
+@property (nonatomic, strong) UIButton *viewMoreBtn;
 
 @end
 
 @implementation ASGoodsReviewFootCell
 
 - (void)setupSubviewS {
-//    UIView *backView = [[UIView alloc] init];
-//    [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);
-//    }];
     
-    UIButton *viewMoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-    viewMoreBtn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:16];
-    [viewMoreBtn setTitle:@"VIEW MORE" forState:UIControlStateNormal];
-    [viewMoreBtn setTitleColor:Col_000 forState:UIControlStateNormal];
-    viewMoreBtn.backgroundColor = Col_FFF;
-    [viewMoreBtn addTarget:self action:@selector(_btnClick) forControlEvents:UIControlEventTouchUpInside];
-    TT_ViewBorderRadius(viewMoreBtn, 4, 1, Col_000);
-    [self.contentView addSubview:viewMoreBtn];
-    [viewMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+    [self.contentView addSubview:self.viewMoreBtn];
+    [self.viewMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.mas_equalTo(10);
         make.height.mas_equalTo(36);
         make.width.mas_equalTo(200);
@@ -49,4 +34,19 @@
     }
 }
 
+
+- (UIButton *)viewMoreBtn {
+    if (!_viewMoreBtn) {
+        _viewMoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+        _viewMoreBtn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:16];
+        [_viewMoreBtn setTitle:@"VIEW MORE" forState:UIControlStateNormal];
+        [_viewMoreBtn setTitleColor:Col_000 forState:UIControlStateNormal];
+        _viewMoreBtn.backgroundColor = Col_FFF;
+        [_viewMoreBtn addTarget:self action:@selector(_btnClick) forControlEvents:UIControlEventTouchUpInside];
+        TT_ViewBorderRadius(_viewMoreBtn, 4, 1, Col_000);
+    }
+    return _viewMoreBtn;
+}
+
+
 @end