《省钱达人》与《猎豆优选》UI相同版。域名tbk

DRDetailGuideView.m 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // DRDetailGuideView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/13.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "DRDetailGuideView.h"
  9. @implementation DRDetailGuideView
  10. - (instancetype)initWithFrame:(CGRect)frame {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.backgroundColor = [UIColor whiteColor];
  14. self.layer.masksToBounds = YES;
  15. [self initSubViews];
  16. }
  17. return self;
  18. }
  19. - (void)initSubViews {
  20. self.userInteractionEnabled=YES;
  21. _leftView =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(9), FITSIZE(1), SCREEN_WIDTH/2-FITSIZE(15), FITSIZE(53))];
  22. _leftView.backgroundColor=[UIColor colorWithRed:255/255.0 green:244/255.0 blue:223/255.0 alpha:1.0];
  23. _leftView.layer.cornerRadius=FITSIZE(5);
  24. _leftView.layer.masksToBounds=YES;
  25. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView)];
  26. [_leftView addGestureRecognizer:tap];
  27. // [self addSubview:_leftView];
  28. UILabel *numlabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(5), FITSIZE(8),FITSIZE(100), FITSIZE(22))];
  29. numlabel.font=[UIFont systemFontOfSize:FITSIZE(16)];
  30. numlabel.text=@"返¥0.00";
  31. numlabel.tag=2000;
  32. numlabel.textColor=[UIColor YHColorWithHex:0x99520F];
  33. [_leftView addSubview:numlabel];
  34. _leftView.userInteractionEnabled=YES;
  35. UILabel *tiplabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(5), FITSIZE(32), FITSIZE(130), FITSIZE(14))];
  36. tiplabel.font=[UIFont systemFontOfSize:FITSIZE(10)];
  37. tiplabel.textColor=[UIColor YHColorWithHex:0x99520F];
  38. tiplabel.text=@"自购和分享都有佣金";
  39. [_leftView addSubview:tiplabel];
  40. _rightview =[[UIImageView alloc]initWithFrame:CGRectMake(FITSIZE(9), FITSIZE(1), SCREEN_WIDTH/2-FITSIZE(14.5), FITSIZE(53))];
  41. _rightview.image=[UIImage imageNamed:@"quan_short"];
  42. _rightview.layer.cornerRadius=FITSIZE(3);
  43. _rightview.userInteractionEnabled=YES;
  44. _rightview.layer.masksToBounds=YES;
  45. [self addSubview:_rightview];
  46. UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapbuyImageView)];
  47. [_rightview addGestureRecognizer:tap1];
  48. [self addSubview:_leftView];
  49. UILabel *rightpricelabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(14), FITSIZE(8),FITSIZE(100), FITSIZE(22))];
  50. rightpricelabel.font=[UIFont systemFontOfSize:FITSIZE(16)];
  51. rightpricelabel.text=@"券 0.00元";
  52. rightpricelabel.tag=1000;
  53. rightpricelabel.textColor=[UIColor YHColorWithHex:0xF5112A];
  54. [_rightview addSubview:rightpricelabel];
  55. UILabel *timelabel =[[UILabel alloc]initWithFrame:CGRectMake(FITSIZE(14), FITSIZE(32), FITSIZE(130), FITSIZE(14))];
  56. timelabel.font=[UIFont systemFontOfSize:FITSIZE(10)];
  57. timelabel.textColor=[UIColor YHColorWithHex:0xF5112A];
  58. timelabel.text=@"数量有限 先到先领";
  59. timelabel.tag=1111;
  60. rightpricelabel.textAlignment=NSTextAlignmentLeft;
  61. timelabel.textAlignment=NSTextAlignmentLeft;
  62. [_rightview addSubview:timelabel];
  63. self.leftView.hidden=YES;
  64. self.rightview.hidden=YES;
  65. }
  66. -(void)setModel:(DRGoodDetailModel *)model
  67. {
  68. _model=model;
  69. UILabel *pirceLabel =[self.rightview viewWithTag:1000];
  70. if ([model.is_coupon boolValue]) {//佣金和优惠券都存在的时候
  71. pirceLabel.text=[NSString stringWithFormat:@"券 %@元",model.coupon_price];
  72. self.rightview.hidden=NO;
  73. }else {
  74. self.height = 0;
  75. }
  76. }
  77. - (void)tapViewAction {
  78. [MobClick event:GoodsDetailVipInfo];
  79. if (self.tapAction) {
  80. self.tapAction();
  81. }
  82. }
  83. //跳转
  84. -(void)tapImageView
  85. {
  86. if ([self.delegate respondsToSelector:@selector(commisionClickPage)]) {
  87. [self.delegate commisionClickPage];
  88. }
  89. }
  90. //购买
  91. -(void)tapbuyImageView
  92. {
  93. if ([self.delegate respondsToSelector:@selector(goBuyWithModel:)]) {
  94. [self.delegate goBuyWithModel:_model];
  95. }
  96. }
  97. @end