123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- //
- // DRDetailGuideView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/7/13.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "DRDetailGuideView.h"
- @implementation DRDetailGuideView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
- self.layer.masksToBounds = YES;
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
- self.userInteractionEnabled=YES;
- _leftView =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(9), FITSIZE(1), SCREEN_WIDTH/2-FITSIZE(15), FITSIZE(53))];
- _leftView.backgroundColor=[UIColor colorWithRed:255/255.0 green:244/255.0 blue:223/255.0 alpha:1.0];
- _leftView.layer.cornerRadius=FITSIZE(5);
- _leftView.layer.masksToBounds=YES;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView)];
- [_leftView addGestureRecognizer:tap];
- // [self addSubview:_leftView];
-
- UILabel *numlabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(5), FITSIZE(8),FITSIZE(100), FITSIZE(22))];
- numlabel.font=[UIFont systemFontOfSize:FITSIZE(16)];
- numlabel.text=@"返¥0.00";
- numlabel.tag=2000;
- numlabel.textColor=[UIColor YHColorWithHex:0x99520F];
- [_leftView addSubview:numlabel];
- _leftView.userInteractionEnabled=YES;
-
- UILabel *tiplabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(5), FITSIZE(32), FITSIZE(130), FITSIZE(14))];
- tiplabel.font=[UIFont systemFontOfSize:FITSIZE(10)];
- tiplabel.textColor=[UIColor YHColorWithHex:0x99520F];
- tiplabel.text=@"自购和分享都有佣金";
- [_leftView addSubview:tiplabel];
-
- _rightview =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(9), FITSIZE(1), SCREEN_WIDTH/2-FITSIZE(14.5), FITSIZE(53))];
- _rightview.image=[UIImage imageNamed:@"quan_short"];
- _rightview.layer.cornerRadius=FITSIZE(3);
- _rightview.userInteractionEnabled=YES;
- _rightview.layer.masksToBounds=YES;
- [self addSubview:_rightview];
- UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapbuyImageView)];
- [_rightview addGestureRecognizer:tap1];
- [self addSubview:_leftView];
- UILabel *rightpricelabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(14), FITSIZE(8),FITSIZE(100), FITSIZE(22))];
- rightpricelabel.font=[UIFont systemFontOfSize:FITSIZE(16)];
- rightpricelabel.text=@"券 0.00元";
- rightpricelabel.tag=1000;
- rightpricelabel.textColor=[UIColor YHColorWithHex:0xF5112A];
- [_rightview addSubview:rightpricelabel];
-
- UILabel *timelabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(14), FITSIZE(32), FITSIZE(130), FITSIZE(14))];
- timelabel.font=[UIFont systemFontOfSize:FITSIZE(10)];
- timelabel.textColor=[UIColor YHColorWithHex:0xF5112A];
- timelabel.text=@"数量有限 先到先领";
- timelabel.tag=1111;
- rightpricelabel.textAlignment=NSTextAlignmentLeft;
- timelabel.textAlignment=NSTextAlignmentLeft;
- [_rightview addSubview:timelabel];
-
- self.leftView.hidden=YES;
- self.rightview.hidden=YES;
- }
- -(void)setModel:(DRGoodDetailModel *)model
- {
- _model=model;
- UILabel *pirceLabel =[self.rightview viewWithTag:1000];
-
- if ([model.is_coupon boolValue]) {//佣金和优惠券都存在的时候
- pirceLabel.text=[NSString stringWithFormat:@"券 %@元",model.coupon_price];
- self.rightview.hidden=NO;
-
- }else {
- self.height = 0;
- }
-
-
- }
- - (void)tapViewAction {
- [MobClick event:GoodsDetailVipInfo];
- if (self.tapAction) {
- self.tapAction();
- }
- }
- //跳转
- -(void)tapImageView
- {
- if ([self.delegate respondsToSelector:@selector(commisionClickPage)]) {
- [self.delegate commisionClickPage];
- }
- }
- //购买
- -(void)tapbuyImageView
- {
- if ([self.delegate respondsToSelector:@selector(goBuyWithModel:)]) {
- [self.delegate goBuyWithModel:_model];
- }
- }
- @end
|