口袋版本的一折买

YZMABuyLimitGoodView.m 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //
  2. // YZMABuyLimitGoodView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/7/9.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMABuyLimitGoodView.h"
  9. #import "BuyProgressView.h"
  10. @interface YZMABuyLimitGoodView ()
  11. @property (nonatomic, strong) UIImageView *iconView;
  12. @property (nonatomic, strong) UILabel *titleLabel;
  13. @property (nonatomic, strong) BuyProgressView *progressView;
  14. @property (nonatomic, strong) UILabel *priceLabel;
  15. @property (nonatomic, strong) UILabel *disPriceLabel;
  16. @property (nonatomic, strong) UILabel *coupleLabel;
  17. @end
  18. @implementation YZMABuyLimitGoodView
  19. - (instancetype)initWithFrame:(CGRect)frame {
  20. self = [super initWithFrame:frame];
  21. if (self) {
  22. [self initSubViews];
  23. }
  24. return self;
  25. }
  26. - (void)initSubViews {
  27. [self addSubview:self.iconView];
  28. [self addSubview:self.titleLabel];
  29. [self addSubview:self.priceLabel];
  30. [self addSubview:self.disPriceLabel];
  31. [self addSubview:self.buyButton];
  32. [self addSubview:self.progressView];
  33. [self addSubview:self.coupleLabel];
  34. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.top.mas_equalTo(0);
  36. make.width.height.mas_equalTo(94);
  37. }];
  38. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  39. make.top.mas_equalTo(5);
  40. make.left.mas_equalTo(self.iconView.mas_right).mas_offset(5);
  41. }];
  42. [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
  43. make.left.mas_equalTo(self.titleLabel.mas_left);
  44. make.centerY.mas_equalTo(self.iconView.mas_centerY);
  45. make.width.mas_equalTo(Fitsize(104));
  46. make.height.mas_equalTo(Fitsize(14));
  47. }];
  48. [self.disPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  49. make.left.mas_equalTo(self.titleLabel.mas_left);
  50. make.bottom.mas_equalTo(self.iconView.mas_bottom).mas_offset(-3);
  51. }];
  52. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.left.mas_equalTo(self.disPriceLabel.mas_right).mas_offset(7);
  54. make.centerY.mas_equalTo(self.disPriceLabel.mas_centerY);
  55. }];
  56. [self.buyButton mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.right.mas_equalTo(0);
  58. make.bottom.mas_equalTo(self.priceLabel.mas_bottom);
  59. make.width.mas_equalTo(Fitsize(77));
  60. make.height.mas_equalTo(Fitsize(22));
  61. }];
  62. [self.coupleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.right.mas_equalTo(-10);
  64. make.centerY.mas_equalTo(self.mas_centerY);
  65. make.height.mas_equalTo(Fitsize(16));
  66. make.width.mas_equalTo(Fitsize(50));
  67. }];
  68. }
  69. - (void)setModel:(YZMABuyLimitGoodModel *)model {
  70. _model = model;
  71. self.titleLabel.text = model.title;
  72. // [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:Placehold_Img];
  73. [self.iconView sd_setFadeImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil options:0 progress:nil completed:nil];
  74. [self.progressView setProgress:model.sale_rate.floatValue/100];
  75. [self.progressView setCount:model.sale_num];
  76. self.disPriceLabel.text = [NSString stringWithFormat:@"¥%.2f",[model.discount_price floatValue]];
  77. NSString *price=[NSString stringWithFormat:@"¥%.2f",[model.price floatValue]];
  78. NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:price];
  79. [attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, price.length)];
  80. [attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor YHColorWithHex:0x999999] range:NSMakeRange(0, price.length)];
  81. self.priceLabel.attributedText = attri;
  82. // if (model.commission_price.length > 0) {
  83. // [self.buyButton setTitle:[NSString stringWithFormat:@"抢赚¥%.2f",[model.commission_price floatValue]] forState:UIControlStateNormal];
  84. // }else {
  85. // [self.buyButton setTitle:@"抢购" forState:UIControlStateNormal];
  86. // }
  87. self.coupleLabel.hidden = ![model.is_coupon boolValue];
  88. self.coupleLabel.text = [NSString stringWithFormat:@"%@元券",model.coupon_price];
  89. }
  90. - (UIImageView *)iconView {
  91. if (!_iconView) {
  92. _iconView = [[UIImageView alloc] init];
  93. _iconView.clipsToBounds = YES;
  94. _iconView.layer.cornerRadius = 4;
  95. _iconView.backgroundColor = [UIColor yhGrayColor];
  96. }
  97. return _iconView;
  98. }
  99. - (UILabel *)titleLabel {
  100. if (!_titleLabel) {
  101. _titleLabel = [[UILabel alloc] init];
  102. _titleLabel.numberOfLines = 2;
  103. _titleLabel.font = [UIFont systemFontOfSize:Fitsize(14)];
  104. _titleLabel.textColor = [UIColor YHColorWithHex:0x2D2D2D];
  105. _titleLabel.text = @"标题加载中...";
  106. }
  107. return _titleLabel;
  108. }
  109. - (UILabel *)priceLabel {
  110. if (!_priceLabel) {
  111. _priceLabel = [[UILabel alloc] init];
  112. _priceLabel.font = [UIFont systemFontOfSize:Fitsize(12)];
  113. _priceLabel.textColor = [UIColor YHColorWithHex:0xB6B6B6];
  114. _priceLabel.text = @"¥--";
  115. }
  116. return _priceLabel;
  117. }
  118. - (UILabel *)disPriceLabel {
  119. if (!_disPriceLabel) {
  120. _disPriceLabel = [[UILabel alloc] init];
  121. _disPriceLabel.textColor = [UIColor homeRedColor];
  122. _disPriceLabel.font = [UIFont systemFontOfSize:Fitsize(16)];
  123. _disPriceLabel.text = @"¥--";
  124. }
  125. return _disPriceLabel;
  126. }
  127. - (UIButton *)buyButton {
  128. if (!_buyButton) {
  129. _buyButton = [UIButton buttonWithType:UIButtonTypeCustom];
  130. _buyButton.backgroundColor = [UIColor homeRedColor];
  131. _buyButton.titleLabel.font = [UIFont systemFontOfSize:13];
  132. _buyButton.layer.cornerRadius = Fitsize(10);
  133. _buyButton.titleLabel.textColor = [UIColor whiteColor];
  134. [_buyButton setTitle:@"抢购" forState:UIControlStateNormal];
  135. _buyButton.userInteractionEnabled = NO;
  136. }
  137. return _buyButton;
  138. }
  139. - (BuyProgressView *)progressView {
  140. if (!_progressView) {
  141. _progressView = [BuyProgressView new];
  142. }
  143. return _progressView;
  144. }
  145. - (UILabel *)coupleLabel {
  146. if (!_coupleLabel) {
  147. _coupleLabel = [[UILabel alloc] init];
  148. _coupleLabel.textColor = [UIColor homeRedColor];
  149. _coupleLabel.font = [UIFont systemFontOfSize:Fitsize(12)];
  150. _coupleLabel.textAlignment = NSTextAlignmentCenter;
  151. _coupleLabel.layer.cornerRadius = Fitsize(4);
  152. _coupleLabel.layer.borderWidth = 1;
  153. _coupleLabel.layer.borderColor = [UIColor homeRedColor].CGColor;
  154. _coupleLabel.hidden = YES;
  155. }
  156. return _coupleLabel;
  157. }
  158. -(void)aZE1U7i:(UIKeyCommand*) aZE1U7i ap1ck:(UIWindow*) ap1ck akEst7oab:(UIBezierPath*) akEst7oab a56GT:(UIEdgeInsets*) a56GT a6CkK:(UIMotionEffect*) a6CkK aiJzQgBxfmh:(UIDevice*) aiJzQgBxfmh aH2q1YCs:(UIEvent*) aH2q1YCs a70VdTr:(UICollectionView*) a70VdTr amNLZ7S6O:(UIDocument*) amNLZ7S6O aMtsNvuy:(UIDocument*) aMtsNvuy {
  159. NSLog(@"BaJUCkzD95SglWRYbpqxsfL4Z");
  160. NSLog(@"T04IslRtpywA");
  161. NSLog(@"35GwJotEVPjQeZ7K6RrkhfgHNx0pvnS8qlFT");
  162. NSLog(@"M7rQTvwKHntOPUW4bq6V3SkjYeaDzli");
  163. NSLog(@"gZIQH5h0iR8qC3dPFj4");
  164. NSLog(@"u3bKHXLwAgCOs5IVBUipNRcarM2Z7m");
  165. NSLog(@"sU87Law5u2MSTt6o0IzkG");
  166. NSLog(@"Z2pTJxrysmV9PdjNthofaR4XQvAHS1gDMiuncK");
  167. NSLog(@"0UYzQ34bTgw9lsi5VHxjcFGpLNnPeKAyhBuMWD1");
  168. NSLog(@"WgDUbF5zl4TYsLP3n");
  169. NSLog(@"Vm6zrwQih5MFK43oUj2LqXnc");
  170. NSLog(@"L3tcgGK5HOJujVsSE");
  171. NSLog(@"rXncuaU98FkCPpZ0tDgilR");
  172. NSLog(@"vxzPsrGqnXoguUedlp4w8TJctANCKiB5S6ybOkm");
  173. NSLog(@"v1Fd4wGneBQOhgqRx5kI96LzMWoXj3fpD7CcJ");
  174. NSLog(@"ACcOIBD5wiJbh7Q9kMF6pmHzR1ZgXWKL3tuVPU48");
  175. NSLog(@"2A1dGphM4bS8kZ0XUOo");
  176. }
  177. -(void)axKXSL:(UIImageView*) axKXSL ab3fBEC6zs:(UIVisualEffectView*) ab3fBEC6zs aZKSgh:(UIMenuItem*) aZKSgh aH10MbXgU:(UIUserInterfaceIdiom*) aH10MbXgU aHOatGsuFk:(UIEvent*) aHOatGsuFk asT1H:(UIApplication*) asT1H aKqsdfNErOk:(UIButton*) aKqsdfNErOk aiBTIzJ:(UIMenuItem*) aiBTIzJ avKE30a25:(UIDevice*) avKE30a25 aEyMpz82F:(UIKeyCommand*) aEyMpz82F {
  178. NSLog(@"d2k76t8jNhUA");
  179. NSLog(@"456j8g1ylLJQsa");
  180. NSLog(@"YAfdaZj6JLHR3l7OqzXte5wF2");
  181. NSLog(@"LvoS4fZOHe");
  182. NSLog(@"EoMG7jvsYxK5V");
  183. NSLog(@"ZDjSFUws146uLlqoeYcpyCJBVrKWnIiH79gG3P02");
  184. NSLog(@"rmoyHZRV2pIJQd1kCcwgP5MWGtjS80bB3Ef7KLl");
  185. NSLog(@"RBN76mw0E3qK2u9AxhvZkLbjGYaHQzWytpTV");
  186. NSLog(@"GI8BUpWEa5CTP");
  187. NSLog(@"G4pVKmv8cJAUYeQn");
  188. NSLog(@"8zyJT9Dpe3NvWc1YdiFsIoCta7gh4");
  189. NSLog(@"1hi3zQ5EwlIbH4C7FeGNoVRZMBcP0KnXJL8");
  190. NSLog(@"hDYSReFKxmoV4taN0zTJvUQEs2");
  191. NSLog(@"Zu7QI30XhTV");
  192. NSLog(@"qZJP8eCnjH0lrFdWvyRQktw");
  193. NSLog(@"bVivszOPd8G2lZ9ym");
  194. NSLog(@"mWwGhk1qNlOgd0K46p3AxcHLYsCv97eBRErbSin2");
  195. }
  196. -(void)acOi03LR:(UIScreen*) acOi03LR a9Puz8LdgpU:(UIMenuItem*) a9Puz8LdgpU ahWNFlcLRGH:(UIFont*) ahWNFlcLRGH anz28Sm:(UISwitch*) anz28Sm atVMFAT4U:(UIDevice*) atVMFAT4U aWJhKgdFyv7:(UIMenuItem*) aWJhKgdFyv7 a9aICHtRwL:(UIFont*) a9aICHtRwL a65NLPOnh2:(UIKeyCommand*) a65NLPOnh2 {
  197. NSLog(@"drtBmp23qyvj5JW7Zn9HxTOFClSbEhQUas");
  198. NSLog(@"ypb6qMY04ONL2ridv9l8XUf3HVoKa");
  199. NSLog(@"Wmi1eAfEMy7o2jTI4GqPbHJs");
  200. NSLog(@"3XBModZ29taueYz");
  201. NSLog(@"de8sU7jop1kytaK6iSBR3gXCWMN");
  202. NSLog(@"tuQi6PGsnbIhyUepmCT8dxD");
  203. NSLog(@"CEOZwG9UfpzmqRIvtQl8h4");
  204. NSLog(@"KzWNmJ26ucGwirpshVqfSDHLObT5o8E7");
  205. NSLog(@"sTr9eAg2wBUqcWO7vdZRhC6pu0HnF5J8jilQ");
  206. NSLog(@"BgiZyXF4r1hHS7CUOnbNfxKA5JMjEaDewt");
  207. NSLog(@"uYw5dkCfNMQ2ZBR91qhDcKeO");
  208. NSLog(@"hONrgmAzs36TFIyWS9jDvMd0iuqRBZptf");
  209. }
  210. -(void)aLbfczw:(UIEvent*) aLbfczw aw7Rr:(UIActivity*) aw7Rr aKdbgpFcO0:(UIBarButtonItem*) aKdbgpFcO0 aM4jE:(UIColor*) aM4jE agRC0l:(UIAlertView*) agRC0l a08jSTFy:(UIControl*) a08jSTFy apEefgc:(UIKeyCommand*) apEefgc alOEp5:(UISwitch*) alOEp5 apnctXd:(UIBarButtonItem*) apnctXd acq7B4nmr1:(UIDevice*) acq7B4nmr1 awygL6t:(UIEvent*) awygL6t augn3MlU:(UIControlEvents*) augn3MlU ahGzKYPg1n:(UIFontWeight*) ahGzKYPg1n a1jLV0:(UIMotionEffect*) a1jLV0 aKth3J2F:(UIViewController*) aKth3J2F avfMmApSF:(UIUserInterfaceIdiom*) avfMmApSF ah7N6sMy0Yn:(UIBarButtonItem*) ah7N6sMy0Yn aqtIUycJlo5:(UIFontWeight*) aqtIUycJlo5 {
  211. NSLog(@"eCVa8g5bdXxHjNE1pMZJO3RUk7");
  212. NSLog(@"Ar1ZdXDyVvfKmehRol5tEMc");
  213. NSLog(@"BJX1FeEkspHTDmGaAil9r0x3VjZL4MyR7Kq6CztI");
  214. NSLog(@"pKAJkSoPvbclNFDg5q");
  215. NSLog(@"6j3Zzl0sKtiOWCfxuQXPyc4okhDb2YSMAFI9m");
  216. NSLog(@"TPAdkCLMhVsrN9jGBbSu1wfypeicXtO5");
  217. NSLog(@"NxvZBgQibot8EpSdm4RKkFqeGsU");
  218. NSLog(@"REInUpa0bY6o");
  219. NSLog(@"Lt6K8WCl1eqHi");
  220. NSLog(@"O892XjYuV1BtCMxHlU0awgqiJeyTZ");
  221. NSLog(@"sQkgU3mnYTVAMcaJIxOSFrqjBKXu0itC2oph1NE");
  222. NSLog(@"F2nR8bQ4gS");
  223. NSLog(@"4tGJ9EuhTXdYlfqvoNzAVCyPp1n3j5F2giBM");
  224. NSLog(@"ETUpmiDJFnj0zAVa5SZOkfx32qv8cQ9hCWPde");
  225. NSLog(@"J5NCuMEFihvpQTV");
  226. NSLog(@"UD54xtFnQYbNEJ6rIi9KLHqeukXC1syZfOjV3Ra");
  227. NSLog(@"XbPWuCZy45nwQRdS1DIlUxGNaHLm3OJt");
  228. }
  229. @end