No Description

LFWGoodCollectionCell.m 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. //
  2. // LFWGoodCollectionCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWGoodCollectionCell.h"
  9. @interface LFWGoodCollectionCell ()
  10. @property (nonatomic, strong) UIImageView *imgView; //大图
  11. @property (nonatomic, strong) UILabel *titleLabel; //标题
  12. @property (nonatomic, strong) UILabel *priceLabel; //原价
  13. @property (nonatomic, strong) UILabel *saleCount; // 月销量
  14. @property (nonatomic, strong) UILabel *disPriceL; // 优惠后价格
  15. @property (nonatomic, strong) UIImageView *ticketNumber; //
  16. @property (nonatomic, strong) UILabel *totalCount; // 总件数
  17. //@property (nonatomic, strong) UILabel *ticketCount; //
  18. @property (nonatomic, strong) UILabel *zheKou; // 几折,或者几元券
  19. @end
  20. @implementation LFWGoodCollectionCell
  21. - (instancetype)initWithFrame:(CGRect)frame {
  22. self = [super initWithFrame:frame];
  23. if (self) {
  24. self.contentView.backgroundColor = [UIColor whiteColor];
  25. [self initSubViews];
  26. }
  27. return self;
  28. }
  29. - (void)initSubViews {
  30. [self.contentView addSubview:self.imgView];
  31. [self.contentView addSubview:self.titleLabel];
  32. [self.contentView addSubview:self.priceLabel];
  33. [self.contentView addSubview:self.saleCount];
  34. [self.contentView addSubview:self.disPriceL];
  35. [self.contentView addSubview:self.ticketNumber];
  36. [self.imgView addSubview:self.totalCount];
  37. // [self.imgView addSubview:self.ticketCount];
  38. [self.ticketNumber addSubview:self.zheKou];
  39. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.right.top.mas_equalTo(0);
  41. make.height.mas_equalTo((SCREEN_WIDTH-5)/2.f);
  42. }];
  43. // [self.ticketCount mas_makeConstraints:^(MASConstraintMaker *make) {
  44. // make.size.equalTo(self.imgView);
  45. // }];
  46. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.mas_equalTo(10);
  48. make.right.mas_equalTo(-10);
  49. make.top.mas_equalTo(self.imgView.mas_bottom).mas_offset(7);
  50. }];
  51. [self.disPriceL mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.mas_equalTo(self.titleLabel.mas_left);
  53. make.bottom.mas_equalTo(-10);
  54. }];
  55. [self.ticketNumber mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.centerY.mas_equalTo(self.disPriceL.mas_centerY);
  57. make.right.mas_equalTo(self.titleLabel.mas_right);
  58. make.width.mas_equalTo(64*0.7);
  59. make.height.mas_equalTo(22*0.7);
  60. }];
  61. [self.zheKou mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.top.bottom.left.right.mas_equalTo(0);
  63. }];
  64. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.mas_equalTo(self.titleLabel.mas_left);
  66. make.bottom.mas_equalTo(self.disPriceL.mas_top).mas_offset(-5);
  67. }];
  68. [self.saleCount mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.right.mas_equalTo(self.titleLabel.mas_right);
  70. make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
  71. }];
  72. [self.totalCount mas_makeConstraints:^(MASConstraintMaker *make) {
  73. make.right.top.mas_equalTo(0);
  74. make.height.mas_equalTo(20);
  75. }];
  76. }
  77. - (void)setModel:(LFWChildGoodModel *)model {
  78. //标题
  79. NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithString:model.title];
  80. NSTextAttachment *attach = [[NSTextAttachment alloc] init];
  81. if ([model.freeShipping boolValue]) {
  82. attach.image = [UIImage imageNamed:@"Rectangle"];
  83. attach.bounds = CGRectMake(0, -1, 26, 13);
  84. [attStr insertAttributedString:[NSAttributedString attributedStringWithAttachment:attach] atIndex:0];
  85. }
  86. self.titleLabel.attributedText = attStr;
  87. //
  88. [self.imgView yy_setImageWithURL:[NSURL URLWithString:model.img] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation];
  89. self.priceLabel.text = [NSString stringWithFormat:@"淘宝价 ¥%.2f",[model.price floatValue]];
  90. self.saleCount.text = [NSString stringWithFormat:@"月销%@",model.volume];
  91. if ([model.type boolValue]) {
  92. self.totalCount.hidden = NO;
  93. self.totalCount.text = [NSString stringWithFormat:@" 共%@件 ",model.coupon_surplus];
  94. }else {
  95. self.totalCount.hidden = YES;
  96. }
  97. //折后价
  98. NSString *disStr;
  99. if (model.is_coupon) {
  100. disStr = [NSString stringWithFormat:@"券后¥%.2f",[model.discount_price floatValue]];
  101. self.zheKou.text = [NSString stringWithFormat:@"%@元券",model.coupon_price];
  102. }else {
  103. disStr = [NSString stringWithFormat:@"折后¥%.2f",[model.discount_price floatValue]];
  104. self.zheKou.text = [NSString stringWithFormat:@"%@折",model.coupon_price];
  105. }
  106. NSMutableAttributedString *disAttr = [[NSMutableAttributedString alloc] initWithString:disStr];
  107. [disAttr addAttributes:@{NSForegroundColorAttributeName:[UIColor homeRedColor]} range:NSMakeRange(0, disAttr.length)];
  108. [disAttr addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12]} range:NSMakeRange(0, 2)];
  109. self.disPriceL.attributedText = disAttr;
  110. self.disPriceL.text = disStr;
  111. }
  112. - (UIImageView *)imgView {
  113. if (!_imgView) {
  114. _imgView = [[UIImageView alloc] init];
  115. _imgView.backgroundColor = [UIColor YHColorWithHex:0xf0f0f0];
  116. }
  117. return _imgView;
  118. }
  119. - (UILabel *)titleLabel {
  120. if (!_titleLabel) {
  121. _titleLabel = [[UILabel alloc] init];
  122. _titleLabel.font = [UIFont systemFontOfSize:14];
  123. _titleLabel.textColor = [UIColor YHColorWithHex:0x444444];
  124. _titleLabel.numberOfLines = 2;
  125. }
  126. return _titleLabel;
  127. }
  128. - (UILabel *)priceLabel {
  129. if (!_priceLabel) {
  130. _priceLabel = [[UILabel alloc] init];
  131. _priceLabel.font = [UIFont systemFontOfSize:11];
  132. _priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  133. }
  134. return _priceLabel;
  135. }
  136. - (UILabel *)saleCount {
  137. if (!_saleCount) {
  138. _saleCount = [[UILabel alloc] init];
  139. _saleCount.font = [UIFont systemFontOfSize:11];
  140. _saleCount.textColor = [UIColor YHColorWithHex:0x999999];
  141. _saleCount.textAlignment = NSTextAlignmentRight;
  142. }
  143. return _saleCount;
  144. }
  145. - (UILabel *)disPriceL {
  146. if (!_disPriceL) {
  147. _disPriceL = [[UILabel alloc] init];
  148. _disPriceL.font = [UIFont systemFontOfSize:18];
  149. _disPriceL.textColor = [UIColor homeRedColor];
  150. }
  151. return _disPriceL;
  152. }
  153. - (UIImageView *)ticketNumber {
  154. if (!_ticketNumber) {
  155. _ticketNumber = [[UIImageView alloc] init];
  156. _ticketNumber.image = [UIImage imageNamed:@"discount"];
  157. }
  158. return _ticketNumber;
  159. }
  160. - (UILabel *)totalCount {
  161. if (!_totalCount) {
  162. _totalCount = [[UILabel alloc] init];
  163. _totalCount.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
  164. _totalCount.layer.cornerRadius = 3;
  165. _totalCount.font = [UIFont systemFontOfSize:10];
  166. _totalCount.textAlignment = NSTextAlignmentCenter;
  167. _totalCount.textColor = [UIColor YHColorWithHex:0xffffff];
  168. }
  169. return _totalCount;
  170. }
  171. //- (UILabel *)ticketCount {
  172. // if (!_ticketCount) {
  173. // _ticketCount = [[UILabel alloc] init];
  174. // _ticketCount.textColor = [UIColor whiteColor];
  175. // _ticketCount.font = [UIFont systemFontOfSize:9];
  176. // }
  177. // return _ticketCount;
  178. //}
  179. - (UILabel *)zheKou {
  180. if (!_zheKou) {
  181. _zheKou = [[UILabel alloc] init];
  182. _zheKou.textColor = [UIColor whiteColor];
  183. _zheKou.textAlignment = NSTextAlignmentCenter;
  184. _zheKou.font = [UIFont systemFontOfSize:10];
  185. _zheKou.backgroundColor = [UIColor clearColor];
  186. }
  187. return _zheKou;
  188. }
  189. -(void)aWxz5:(UIFontWeight*) aWxz5 azZv2e:(UIEvent*) azZv2e awr3HB:(UIMenuItem*) awr3HB ap6JhOjCQ2:(UIMenuItem*) ap6JhOjCQ2 aUbn5:(UIVisualEffectView*) aUbn5 an34oRHWcv:(UIFont*) an34oRHWcv ao1HqZId:(UIBarButtonItem*) ao1HqZId avpt91lJZ3:(UIControl*) avpt91lJZ3 aCetNr4B:(UISearchBar*) aCetNr4B as48H:(UIApplication*) as48H arYFpHaA:(UIButton*) arYFpHaA a17eR0:(UIMotionEffect*) a17eR0 aEYwk:(UIControlEvents*) aEYwk ajVyhQ:(UIBarButtonItem*) ajVyhQ aJzBU1E:(UIWindow*) aJzBU1E aco2h:(UIColor*) aco2h asHzy:(UICollectionView*) asHzy aIpyUWBt:(UIBezierPath*) aIpyUWBt avSKIlxN:(UIUserInterfaceIdiom*) avSKIlxN {
  190. NSLog(@"vEyJ43qkNjV15XK70AUHRMdglpQe8I6bxW");
  191. NSLog(@"SGYb0fXIJKOvWEmULgBa2wNqy1ki");
  192. NSLog(@"PDXieJbNBEdIu8vqRlkf0raTwGs1jnH4tyW9S");
  193. NSLog(@"Ce0Hi6RoE7nbM9gJw");
  194. NSLog(@"fmc5HzBvKpsG");
  195. NSLog(@"vORZ8w5tTHL6s");
  196. NSLog(@"Te0tg3VbWjDms");
  197. NSLog(@"aRkz3ATpU40xu1PlNOmsVGC6");
  198. NSLog(@"kHnyNRqe1gol3PD0Mhmwz7uad");
  199. NSLog(@"Lx1QGr5dZFqRa3eU9gpJWmMNvVIwiCEtSck6j4bT");
  200. }
  201. -(void)aPZv3W9:(UIImageView*) aPZv3W9 aCo4e:(UIControlEvents*) aCo4e acXNVW:(UIControlEvents*) acXNVW aavbCc:(UIBezierPath*) aavbCc aDLuYqti:(UIInputView*) aDLuYqti ahVBal31:(UIUserInterfaceIdiom*) ahVBal31 aTJbpeUqy:(UIBezierPath*) aTJbpeUqy ayZq0w:(UIInputView*) ayZq0w a1hRKp7Tc:(UITableView*) a1hRKp7Tc awPHtQ:(UIActivity*) awPHtQ ac8rGCt5n:(UIImageView*) ac8rGCt5n awOrqS0u:(UISearchBar*) awOrqS0u adpcW4:(UIMenuItem*) adpcW4 aFTkce:(UISwitch*) aFTkce {
  202. NSLog(@"LaX3xgGJyiqM");
  203. NSLog(@"zvoDk1MyxYlFb9dT4fI8VG5qaCJNPip67eght");
  204. NSLog(@"5ofEzaQF8A");
  205. NSLog(@"ZGyMbRDsvn7uLjof9TtkaA1pQC8crwKmJzOeN");
  206. NSLog(@"okC2A8cTaLbIhJWzM0xmnGHr3gU7RD");
  207. NSLog(@"b92zEWmQqXk86txngHl0PMhiI1");
  208. NSLog(@"GDTL3dQxjU5WCzABfJ9nIY1loikeP");
  209. NSLog(@"XQnyakHrPpMxeqgf4vN");
  210. NSLog(@"I3nf0qE8XHxLO2z");
  211. NSLog(@"ZBaDVq1SfjTX7bzC8GMrxdUleNWRtvk");
  212. }
  213. -(void)aqLnkd6cUt:(UIInputView*) aqLnkd6cUt atWwS:(UIMotionEffect*) atWwS a5DfKH4MTpx:(UICollectionView*) a5DfKH4MTpx aYswS:(UIMenuItem*) aYswS aZSeD3bGVE1:(UISwitch*) aZSeD3bGVE1 agSG0IB:(UILabel*) agSG0IB agN825:(UICollectionView*) agN825 a5ZdplAKY2:(UIFont*) a5ZdplAKY2 abXxg:(UIImageView*) abXxg auyHL4E:(UIUserInterfaceIdiom*) auyHL4E aPn1yh:(UIBarButtonItem*) aPn1yh a0TplmL:(UIWindow*) a0TplmL aLiIxjUAky:(UIBezierPath*) aLiIxjUAky ayI8DgPeQmE:(UIBezierPath*) ayI8DgPeQmE {
  214. NSLog(@"7SP1LjHBMlbhOKUv3pFWXYJkZTf640");
  215. NSLog(@"4n68XatesY3qibPDI1L0ZJEMWoz5pwCyuxr");
  216. NSLog(@"tP7jVqDSeYwroyIH5scK3TB1AF829JmlgUxGuz");
  217. NSLog(@"PmdcRKoC2LBhY1T5I9fDWj0OvAUeirqpu4Mkxn");
  218. NSLog(@"jSo8QGCAqT7k");
  219. NSLog(@"2TSbmjClhLMaeUEnYDQXPdg3Fc");
  220. NSLog(@"JR7HDAt3CwETlfpu2m8K5I0rXYNZj4VhOdb9cU");
  221. NSLog(@"nBvtzF2XZieMC7RwEPrIAxgd0N8qpf4");
  222. NSLog(@"nZgIVyXUWDvcmw5sPfHM1KQlF40B6o");
  223. NSLog(@"F5SzNKmu9RCpf8yqsvXGgOY");
  224. NSLog(@"lIB0aMf1Jk3UYTHCVGNDcbKFOhsnpd5iLxS");
  225. NSLog(@"7zdLNh4nZgFlAJPTm");
  226. NSLog(@"UVSpNa2CJ4R1sQ3PZ9wfG8ybjhoiXlAInvYzm");
  227. NSLog(@"qVokOdx2Nu0ShYLJBWtfzQcEg73sK8ZPMFw");
  228. NSLog(@"xciELPAVDjeBg30q7w18CT");
  229. NSLog(@"esFSzXpHWvCyoiZlMTcOLhV3a7bxY");
  230. NSLog(@"NCAwtYjs2KBlqXH0p6nIk7yL");
  231. NSLog(@"7VqHAM18DoznTBL9Y0khWUlftSag2Cxcy3Zbver");
  232. NSLog(@"4W7Hc1Bhbv5GrTe0");
  233. NSLog(@"OiF9d2L5P0osTuyV8BKYteqSpc");
  234. }
  235. -(void)aNEjfBnh2p:(UITableView*) aNEjfBnh2p aPix36:(UIUserInterfaceIdiom*) aPix36 aEV8MqOLYdZ:(UIViewController*) aEV8MqOLYdZ aCexDN:(UIDevice*) aCexDN aPFomNBA:(UIKeyCommand*) aPFomNBA aK6JxO213:(UIKeyCommand*) aK6JxO213 azmyM6YBGC:(UIUserInterfaceIdiom*) azmyM6YBGC ac1yI9:(UIControl*) ac1yI9 aj1Py4fA:(UIFont*) aj1Py4fA alLCsHkXh:(UIVisualEffectView*) alLCsHkXh anC0PkJAbu:(UIWindow*) anC0PkJAbu aCOmZ8:(UIImage*) aCOmZ8 aGECbeixOgP:(UIActivity*) aGECbeixOgP azkV9Z0PWbL:(UIUserInterfaceIdiom*) azkV9Z0PWbL aWIgLHUf:(UISearchBar*) aWIgLHUf a9uIwd:(UIBarButtonItem*) a9uIwd aU6pDxZWih:(UIApplication*) aU6pDxZWih aTxbscDmd6g:(UIBarButtonItem*) aTxbscDmd6g amO8Sqwx:(UIAlertView*) amO8Sqwx {
  236. NSLog(@"rc73G9tTfzlExyH8P2wsoJUVYS4I5DQnCK");
  237. NSLog(@"FnAcl3LhOJQ491WSK7");
  238. NSLog(@"uFeZ8Q5Y1kCjoSytUHVhLwB");
  239. NSLog(@"NCJl1rf3aDidVnW");
  240. NSLog(@"iWpgEnmv9exbJIHQCGkr3sOP24M");
  241. NSLog(@"v4QoUy20h5CNY9O");
  242. NSLog(@"2x1tFVXizGkUNZ6lfRDnAuy");
  243. NSLog(@"csd8yoBv7lhGA41CaW6LtSPYf9zUbmJ3eIXnN");
  244. NSLog(@"ah7dXmlGMSjHfQJ0CNxIiBPqLKgbVEuo");
  245. NSLog(@"sNcEL8p9fr4vYoJtj3x6FKmVwCnqSGO");
  246. NSLog(@"vfERsVghtGk9qXo");
  247. NSLog(@"uyGfKWVN8atiUlk4bYxe6qdZIJM2E");
  248. NSLog(@"BJ2hTGLHO0iWcbd47");
  249. NSLog(@"1OaueJboIgs6W0");
  250. NSLog(@"BLA2YulSKIvZ5FNgX9p1");
  251. }
  252. @end