123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- //
- // YOUPAILZVipFooterView.m
- // VQU
- //
- // Created by CY on 2021/8/23.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZVipFooterView.h"
- @interface YOUPAILZVipFooterView ()
- @property (nonatomic,weak)UILabel *youpaipmoneyL;
- @property (nonatomic,weak)UILabel *youpaipoldMoneyL;
- @property (nonatomic,weak)UILabel *youpaiprebateL;
- @property (nonatomic,weak)UIButton *youpaipconfimBtn;
- @property (nonatomic,weak)UIView *youpaipbgV;
- @property (nonatomic,weak)UILabel *youpaipdisablePayL;
- @property (nonatomic,weak)UIView *youpaipbgV1;
- @property (nonatomic,weak)UILabel *youpaipdetailsL;
- @property (nonatomic,weak)UIButton *youpaipconfimBtn1;
- @end
- @implementation YOUPAILZVipFooterView
- - (instancetype)init{
- if (self = [super init]) {
- [self youpaifinitUI];
- }
- return self;
- }
- - (void)youpaifinitUI{
- UIView *bgV = [[UIView alloc] init];
- bgV.hidden = YES;
- [self addSubview:bgV];
- self.youpaipbgV = bgV;
- [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.right.offset(0.0f);
- }];
-
- UILabel *disablePayL = [[UILabel alloc] init];
- disablePayL.text = @"不可购买比当前低级的贵族";
- disablePayL.font = LCFont(15.0f);
- disablePayL.textColor = HexColorFromRGB(0x75170A);
- disablePayL.hidden = YES;
- [self addSubview:disablePayL];
- self.youpaipdisablePayL = disablePayL;
- [disablePayL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(27.0f);
- make.centerX.equalTo(self);
- }];
-
- UILabel *moneyL = [[UILabel alloc] init];
- moneyL.font = LCBoldFont(18.0f);
- moneyL.textColor = HexColorFromRGB(0x75170A);
- [bgV addSubview:moneyL];
- self.youpaipmoneyL = moneyL;
- [moneyL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(15.0f);
- make.top.offset(16.0f);
- }];
-
- UILabel *oldMoneyL = [[UILabel alloc] init];
- oldMoneyL.textColor = HexColorFromRGB(0xA85D3C);
- oldMoneyL.font = LCFont12;
- [bgV addSubview:oldMoneyL];
- self.youpaipoldMoneyL = oldMoneyL;
- [oldMoneyL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(moneyL.mas_right).offset(4.0f);
- make.centerY.equalTo(moneyL.mas_centerY);
- }];
-
- UIView *deleteLine = [[UIView alloc] init];
- deleteLine.backgroundColor = HexColorFromRGB(0xA85D3C);
- [bgV addSubview:deleteLine];
- [deleteLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(oldMoneyL.mas_left).offset(0.0f);
- make.right.equalTo(oldMoneyL.mas_right).offset(0.0f);
- make.centerY.equalTo(oldMoneyL.mas_centerY);
- make.height.offset(0.5f);
- }];
-
- UILabel *rebateL = [[UILabel alloc] init];
- rebateL.font = LCFont(12.0f);
- rebateL.textColor = HexColorFromRGB(0x75170A);
- [bgV addSubview:rebateL];
- self.youpaiprebateL = rebateL;
- [rebateL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(15.0f);
- make.top.equalTo(moneyL.mas_bottom).offset(8.0f);
- }];
-
- UIButton *confimBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- confimBtn.backgroundColor = HexColorFromRGB(0x2A2935);
- confimBtn.layer.cornerRadius = 24.0f;
- confimBtn.clipsToBounds = YES;
- [confimBtn setTitleColor:HexColorFromRGB(0xFDCC88) forState:UIControlStateNormal];
- confimBtn.titleLabel.font = LCFont(17.0f);
- [confimBtn addTarget:self action:@selector(youpaifconfimBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [bgV addSubview:confimBtn];
- self.youpaipconfimBtn = confimBtn;
- [confimBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(11.0f);
- make.right.offset(-14.0f);
- make.size.mas_offset(CGSizeMake(128.0f, 48.0f));
- }];
-
-
- UIView *bgV1 = [[UIView alloc] init];
- bgV1.hidden = YES;
- [self addSubview:bgV1];
- self.youpaipbgV1 = bgV1;
- [bgV1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.bottom.right.offset(0.0f);
- }];
-
- UILabel *detailsL = [[UILabel alloc] init];
- detailsL.font = LCBoldFont(16.0f);
- detailsL.textColor = HexColorFromRGB(0x75170A);
- [bgV1 addSubview:detailsL];
- self.youpaipdetailsL = detailsL;
- [detailsL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(15.0f);
- make.top.offset(27.0f);
- }];
-
- UIButton *confimBtn1 = [UIButton buttonWithType:UIButtonTypeCustom];
- confimBtn1.backgroundColor = HexColorFromRGB(0x2A2935);
- confimBtn1.layer.cornerRadius = 24.0f;
- confimBtn1.clipsToBounds = YES;
- [confimBtn1 setTitleColor:HexColorFromRGB(0xFDCC88) forState:UIControlStateNormal];
- confimBtn1.titleLabel.font = LCFont(17.0f);
- [confimBtn1 addTarget:self action:@selector(youpaifconfimBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [bgV1 addSubview:confimBtn1];
- self.youpaipconfimBtn1 = confimBtn1;
- [confimBtn1 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(11.0f);
- make.right.offset(-14.0f);
- make.size.mas_offset(CGSizeMake(128.0f, 48.0f));
- }];
- }
- - (void)youpaifreloadWithModel:(YOUPAILZVipInfoModel *)model{
- if ([model.youpaippay_info.youpaipstatus isEqual:@"forbid"]) {
- self.youpaipbgV.hidden = YES;
- self.youpaipbgV1.hidden = YES;
- self.youpaipdisablePayL.hidden = NO;
- }else if ([model.youpaippay_info.youpaipstatus isEqual:@"activity"] || model.is_start == 2) {//活动
- self.youpaipbgV.hidden = YES;
- self.youpaipbgV1.hidden = NO;
- self.youpaipdisablePayL.hidden = YES;
- if (model.is_start == 2) {
- model.youpaippay_info.youpaipbtn = @"参与活动开通";
- }
- [self.youpaipconfimBtn1 setTitle:model.youpaippay_info.youpaipbtn forState:UIControlStateNormal];
-
- NSString *nameText = @"开通即享30天";
- NSRange rebateRange = NSMakeRange(nameText.length,model.youpaipnoble.youpaipname.length);
- nameText = [NSString stringWithFormat:@"%@%@特权",nameText,model.youpaipnoble.youpaipname];
- NSMutableAttributedString *nameAttrStr = [[NSMutableAttributedString alloc] initWithString:nameText];
- [nameAttrStr addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFF4848) range:rebateRange];
- self.youpaipdetailsL.attributedText = nameAttrStr.copy;
-
- }
- else{
- self.youpaipbgV.hidden = NO;
- self.youpaipbgV1.hidden = YES;
- self.youpaipdisablePayL.hidden = YES;
- [self.youpaipconfimBtn setTitle:model.youpaippay_info.youpaipbtn forState:UIControlStateNormal];
- NSString *moneyText = [NSString stringWithFormat:@"%@",model.youpaippay_info.youpaipprice];
- NSRange priceRange = NSMakeRange(0, moneyText.length);
- moneyText = [NSString stringWithFormat:@"%@元/",moneyText];
- NSRange expireDateRange = NSMakeRange(moneyText.length, model.youpaippay_info.youpaipexpire_date.length);
- moneyText = [NSString stringWithFormat:@"%@%@天",moneyText,model.youpaippay_info.youpaipexpire_date];
-
- NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:moneyText];
- [attrStr addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFF4848) range:priceRange];
- [attrStr addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFF4848) range:expireDateRange];
- self.youpaipmoneyL.attributedText = attrStr;
- if (model.youpaippay_info.youpaipold_price.length != 0) {
- self.youpaipoldMoneyL.text = [NSString stringWithFormat:@"(原价%@元)",model.youpaippay_info.youpaipold_price];
- }
-
- NSString *rebateText = @"开通后立即返还";
- NSRange rebateRange = NSMakeRange(rebateText.length, model.youpaippay_info.youpaipreturn_coin.length);
- rebateText = [NSString stringWithFormat:@"%@%@钻石",rebateText,model.youpaippay_info.youpaipreturn_coin];
- NSMutableAttributedString *rebateAttrStr = [[NSMutableAttributedString alloc] initWithString:rebateText];
- [rebateAttrStr addAttribute:NSForegroundColorAttributeName value:HexColorFromRGB(0xFF4848) range:rebateRange];
- self.youpaiprebateL.attributedText = rebateAttrStr.copy;
- }
- }
- - (void)youpaifconfimBtnClick{
- if (self.payBlock != nil) {
- self.payBlock();
- }
- }
- @end
|