两折买改口袋样式

LZMGoodCollectionCell.m 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. //
  2. // LZMGoodCollectionCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/18.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMGoodCollectionCell.h"
  9. #import "LZMGoodTagsView.h"
  10. @interface LZMGoodCollectionCell ()
  11. @property (nonatomic, strong) UIImageView *imgView; //大图
  12. @property (nonatomic, strong) YYLabel *titleLabel; //标题
  13. @property (nonatomic, strong) YYLabel *priceLabel; //原价
  14. @property (nonatomic, strong) UILabel *saleCount; // 月销量
  15. @property (nonatomic, strong) YYLabel *disPriceL; // 优惠后价格
  16. @property (nonatomic, strong) UIImageView *ticketNumber; //
  17. @property (nonatomic, strong) UILabel *totalCount; // 总件数
  18. @property (nonatomic, strong) UILabel *zheKou; // 几折,或者几元券
  19. @property (nonatomic, strong) UILabel *ticketType;
  20. @property (nonatomic, strong) UILabel *commissionLabel; //预估佣金
  21. @property (nonatomic, strong) LZMGoodTagsView *tagsView;
  22. @end
  23. @implementation LZMGoodCollectionCell
  24. - (instancetype)initWithFrame:(CGRect)frame {
  25. self = [super initWithFrame:frame];
  26. if (self) {
  27. // self.layer.borderWidth = 1;
  28. // self.layer.borderColor = [UIColor YHColorWithHex:0xE7E7E7].CGColor;
  29. self.layer.cornerRadius = 6;
  30. self.layer.masksToBounds = YES;
  31. self.contentView.backgroundColor = [UIColor whiteColor];
  32. [self initSubViews];
  33. }
  34. return self;
  35. }
  36. - (void)initSubViews {
  37. [self.contentView addSubview:self.imgView];
  38. [self.contentView addSubview:self.titleLabel];
  39. [self.contentView addSubview:self.disPriceL];
  40. [self.contentView addSubview:self.priceLabel];
  41. [self.contentView addSubview:self.ticketNumber];
  42. [self.contentView addSubview:self.commissionLabel];
  43. [self.ticketNumber addSubview:self.ticketType];
  44. [self.ticketNumber addSubview:self.zheKou];
  45. [self.contentView addSubview:self.saleCount];
  46. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.right.top.mas_equalTo(0);
  48. make.height.mas_equalTo((SCREEN_WIDTH-5)/2.f);
  49. }];
  50. [self.commissionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.right.mas_equalTo(0);
  52. make.top.mas_equalTo(self.imgView.mas_bottom).mas_offset(3);
  53. make.height.mas_equalTo(0).priorityLow();
  54. }];
  55. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.left.mas_equalTo(10);
  57. make.right.mas_equalTo(-10);
  58. make.top.mas_equalTo(self.commissionLabel.mas_bottom).mas_offset(4);
  59. }];
  60. [self.disPriceL mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.mas_equalTo(self.titleLabel.mas_left);
  62. make.bottom.mas_equalTo(-10);
  63. }];
  64. [self.ticketNumber mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.left.mas_equalTo(self.titleLabel.mas_left);
  66. make.width.mas_equalTo(64);
  67. make.height.mas_equalTo(14);
  68. make.bottom.mas_equalTo(self.disPriceL.mas_top).mas_offset(-10);
  69. }];
  70. [self.ticketType mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.top.bottom.mas_equalTo(0);
  72. make.width.mas_equalTo(20);
  73. }];
  74. [self.zheKou mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.mas_equalTo(self.ticketType.mas_right);
  76. make.top.mas_equalTo(0);
  77. make.height.mas_equalTo(14);
  78. make.width.mas_equalTo(44);
  79. }];
  80. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.mas_equalTo(self.disPriceL.mas_right).mas_offset(5);
  82. make.bottom.mas_equalTo(self.disPriceL.mas_bottom).mas_offset(-2);
  83. }];
  84. // [self.tagsView mas_makeConstraints:^(MASConstraintMaker *make) {
  85. // make.left.mas_equalTo(self.ticketNumber.mas_right).mas_offset(5);
  86. // make.centerY.mas_equalTo(self.ticketNumber.mas_centerY);
  87. // make.width.mas_equalTo(80);
  88. // make.height.mas_equalTo(12);
  89. // }];
  90. //
  91. [self.saleCount mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.right.mas_equalTo(-10);
  93. make.centerY.mas_equalTo(self.disPriceL.mas_centerY);
  94. }];
  95. }
  96. - (void)setModel:(LZMChildGoodModel *)model {
  97. _model = model;
  98. //标题
  99. UIImage *img;
  100. if ([model.shop_type isEqualToString:@"1"]) {
  101. img= [UIImage imageNamed:@"tm_shop"];
  102. }
  103. YYAnimatedImageView *imgeView = [[YYAnimatedImageView alloc] initWithImage:img];
  104. if ([model.shop_type isEqualToString:@"1"]) {
  105. imgeView.frame = CGRectMake(0, 0, 15, 15);
  106. }else {
  107. imgeView.frame = CGRectMake(0, 0, 0, 0);
  108. }
  109. NSMutableAttributedString *mua = [NSMutableAttributedString yy_attachmentStringWithContent:imgeView contentMode:UIViewContentModeScaleAspectFit attachmentSize:imgeView.frame.size alignToFont:[UIFont systemFontOfSize:14] alignment:YYTextVerticalAlignmentCenter];
  110. NSMutableAttributedString *attri;
  111. if ([model.shop_type isEqualToString:@"1"]) {
  112. attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@",model.title]];
  113. }else {
  114. attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",model.title]];
  115. }
  116. [attri insertAttributedString:mua atIndex:0];
  117. attri.yy_font = [UIFont systemFontOfSize:14];
  118. attri.yy_color = [UIColor YHColorWithHex:0x444444];
  119. attri.yy_lineSpacing = 4;
  120. self.titleLabel.attributedText = attri;
  121. [self.imgView sd_setFadeImageWithURL:[NSURL URLWithString:model.img] placeholderImage:nil options:0 progress:nil completed:nil];
  122. NSString *price = [NSString stringWithFormat:@"¥%.2f",[model.price floatValue]];
  123. NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:price];
  124. attrStr.yy_font = [UIFont systemFontOfSize:11];
  125. attrStr.yy_color = [UIColor YHColorWithHex:0x999999];
  126. YYTextDecoration *decoration = [YYTextDecoration decorationWithStyle:YYTextLineStyleSingle width:@1 color:[UIColor YHColorWithHex:0x999999]];
  127. [attrStr yy_setTextStrikethrough:decoration range:NSMakeRange(0, price.length)];
  128. self.priceLabel.attributedText = attrStr;
  129. self.saleCount.text = [NSString stringWithFormat:@"月销:%@",model.volume];
  130. //折后价
  131. NSString *disStr;
  132. if ([model.is_coupon boolValue]) {
  133. disStr = [NSString stringWithFormat:@"券后¥%.2f",[model.discount_price floatValue]];
  134. self.zheKou.text = [NSString stringWithFormat:@"%@元",model.coupon_price];
  135. self.ticketType.text = @"券";
  136. }else {
  137. disStr = [NSString stringWithFormat:@"折后¥%.2f",[model.discount_price floatValue]];
  138. self.zheKou.text = [NSString stringWithFormat:@"%@折",model.coupon_price];
  139. self.ticketType.text = @"折";
  140. }
  141. //券相关
  142. self.ticketNumber.hidden = ![model.is_coupon boolValue];
  143. CGFloat width = [model.is_coupon boolValue] ? 64 : 0;
  144. // [self.ticketNumber mas_updateConstraints:^(MASConstraintMaker *make) {
  145. // make.width.mas_equalTo(width);
  146. // }];
  147. //券后价格
  148. NSMutableAttributedString *disAttr = [[NSMutableAttributedString alloc] initWithString:disStr];
  149. [disAttr yy_setFont:[UIFont systemFontOfSize:10] range:NSMakeRange(0, 3)];
  150. [disAttr yy_setFont:[UIFont systemFontOfSize:16] range:NSMakeRange(3, disStr.length-3)];
  151. disAttr.yy_color = [UIColor homeRedColor];
  152. self.disPriceL.attributedText = disAttr;
  153. }
  154. - (UIImageView *)imgView {
  155. if (!_imgView) {
  156. _imgView = [[UIImageView alloc] init];
  157. _imgView.backgroundColor = [UIColor YHColorWithHex:0xf0f0f0];
  158. }
  159. return _imgView;
  160. }
  161. - (YYLabel *)titleLabel {
  162. if (!_titleLabel) {
  163. _titleLabel = [[YYLabel alloc] init];
  164. _titleLabel.displaysAsynchronously = YES;
  165. _titleLabel.font = [UIFont systemFontOfSize:14];
  166. _titleLabel.textColor = [UIColor YHColorWithHex:0x444444];
  167. _titleLabel.numberOfLines = 2;
  168. _titleLabel.preferredMaxLayoutWidth = SCREEN_WIDTH/2-Fitsize(20);
  169. }
  170. return _titleLabel;
  171. }
  172. - (YYLabel *)priceLabel {
  173. if (!_priceLabel) {
  174. _priceLabel = [[YYLabel alloc] init];
  175. _priceLabel.displaysAsynchronously = YES;
  176. _priceLabel.font = [UIFont systemFontOfSize:11];
  177. _priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  178. }
  179. return _priceLabel;
  180. }
  181. - (UILabel *)saleCount {
  182. if (!_saleCount) {
  183. _saleCount = [[UILabel alloc] init];
  184. _saleCount.font = [UIFont systemFontOfSize:10];
  185. _saleCount.textColor = [UIColor YHColorWithHex:0x999999];
  186. _saleCount.textAlignment = NSTextAlignmentRight;
  187. _saleCount.hidden = YES;
  188. }
  189. return _saleCount;
  190. }
  191. - (YYLabel *)disPriceL {
  192. if (!_disPriceL) {
  193. _disPriceL = [[YYLabel alloc] init];
  194. _disPriceL.displaysAsynchronously = YES;
  195. _disPriceL.font = [UIFont systemFontOfSize:16];
  196. _disPriceL.textColor = [UIColor homeRedColor];
  197. }
  198. return _disPriceL;
  199. }
  200. - (UIImageView *)ticketNumber {
  201. if (!_ticketNumber) {
  202. _ticketNumber = [[UIImageView alloc] init];
  203. _ticketNumber.image = [UIImage imageNamed:@"quan_bg"];
  204. }
  205. return _ticketNumber;
  206. }
  207. - (UILabel *)totalCount {
  208. if (!_totalCount) {
  209. _totalCount = [[UILabel alloc] init];
  210. _totalCount.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
  211. _totalCount.layer.cornerRadius = 3;
  212. _totalCount.font = [UIFont systemFontOfSize:10];
  213. _totalCount.textAlignment = NSTextAlignmentCenter;
  214. _totalCount.textColor = [UIColor YHColorWithHex:0xffffff];
  215. }
  216. return _totalCount;
  217. }
  218. - (UILabel *)zheKou {
  219. if (!_zheKou) {
  220. _zheKou = [[UILabel alloc] init];
  221. _zheKou.textColor = [UIColor whiteColor];
  222. _zheKou.textAlignment = NSTextAlignmentCenter;
  223. _zheKou.font = [UIFont systemFontOfSize:10];
  224. }
  225. return _zheKou;
  226. }
  227. - (UILabel *)ticketType {
  228. if (!_ticketType) {
  229. _ticketType = [[UILabel alloc] init];
  230. _ticketType.font = [UIFont systemFontOfSize:10];
  231. _ticketType.textAlignment = NSTextAlignmentCenter;
  232. _ticketType.textColor = [UIColor whiteColor];
  233. }
  234. return _ticketType;
  235. }
  236. - (UILabel *)commissionLabel {
  237. if (!_commissionLabel) {
  238. _commissionLabel = [[UILabel alloc] init];
  239. _commissionLabel.font = [UIFont systemFontOfSize:11];
  240. _commissionLabel.textColor = [UIColor whiteColor];
  241. _commissionLabel.textAlignment = NSTextAlignmentCenter;
  242. _commissionLabel.backgroundColor = [UIColor changeColor];
  243. }
  244. return _commissionLabel;
  245. }
  246. //- (KDGoodTagsView *)tagsView {
  247. // if (!_tagsView) {
  248. // _tagsView = [[KDGoodTagsView alloc] init];
  249. // }
  250. // return _tagsView;
  251. //}
  252. -(void)aIVCRbt0:(UIColor*) aIVCRbt0 azuaAeBw0ZV:(UIScreen*) azuaAeBw0ZV aT3IfO0EQ4:(UIMotionEffect*) aT3IfO0EQ4 apgA4YISDK:(UISearchBar*) apgA4YISDK amQzi:(UIViewController*) amQzi a79Vg:(UIControlEvents*) a79Vg aYCb4BEJ:(UIUserInterfaceIdiom*) aYCb4BEJ au8s4vV:(UIActivity*) au8s4vV asb3g6wGFx:(UIView*) asb3g6wGFx aFcLoYz6B:(UIImageView*) aFcLoYz6B aaXoq:(UIMotionEffect*) aaXoq avKe7QmAgiM:(UISwitch*) avKe7QmAgiM awvxQGWhfl4:(UIBarButtonItem*) awvxQGWhfl4 awlK3ps:(UIMotionEffect*) awlK3ps afXujb8G2m1:(UIApplication*) afXujb8G2m1 aMxCf:(UIViewController*) aMxCf aEL94TX:(UIEdgeInsets*) aEL94TX {
  253. NSLog(@"9ZKYawX3LetAN");
  254. NSLog(@"RynJ2ELd4tlAN9Fu1pIOXiMDU5VTr0");
  255. NSLog(@"ATvPH5qXlp8htCxy7YSk0NsUgdQI43bVemuZR");
  256. NSLog(@"sYUpix5Jc4jVBz");
  257. NSLog(@"IZ1cFEhsPnWKLbCrM9Dp2qe0zdlHOkjB");
  258. NSLog(@"eNxoF8JlS4UQais3y215b");
  259. NSLog(@"rLkeUFHdaKnzG0hC32vp");
  260. NSLog(@"ud78tEC4qVzjfGo20MxaZk");
  261. NSLog(@"51V2PRs4IgemnrhkobDFQS");
  262. NSLog(@"QOoTMZ2Hd7Gq18jCe3WulcVm");
  263. NSLog(@"oDdLnUc6RF3");
  264. NSLog(@"XehbzWdQwvUL35FjIxZRuHEyf7BKAMTVSsYt");
  265. NSLog(@"LQRj9Fkfs5HN48W");
  266. NSLog(@"w30ExedR6FXVkHynhoNZDOAs9");
  267. NSLog(@"oilA0bxFQ92zwsD3MRTOvfVGKt7ampJh48IHUPg");
  268. NSLog(@"uMnHvAZYfJoUc8dESW96gzPq3KV");
  269. }
  270. -(void)aZWw70p:(UIVisualEffectView*) aZWw70p abKQt65Vv:(UIVisualEffectView*) abKQt65Vv akSnOY:(UIBarButtonItem*) akSnOY ad3GrOiAS:(UIEvent*) ad3GrOiAS aM84unI:(UIControl*) aM84unI aWNZ93jqs:(UIBezierPath*) aWNZ93jqs aXTCIF:(UIInputView*) aXTCIF aCYqvTw:(UIBarButtonItem*) aCYqvTw ahUCzg:(UIImageView*) ahUCzg aLJBn:(UISearchBar*) aLJBn azOpv:(UIVisualEffectView*) azOpv af2HjK8pBLi:(UILabel*) af2HjK8pBLi a8ZCSAJU:(UITableView*) a8ZCSAJU {
  271. NSLog(@"LrVNT2QZOIadUD0AP3u8qcKimYS7e4tWMHs1Bf");
  272. NSLog(@"WQjhX3mtrD2EKI0eH1VOTfaZsi");
  273. NSLog(@"tWeVUGsrOCi4bjd1gFwnyuXNSf");
  274. NSLog(@"54jUs7zGYcPw8v2yaMpteWFgbT9ZIQJdRqoCSLA");
  275. NSLog(@"0W536ROdCnNpQjlDALUFqIcE1KoP8J2G4VrxbtZ");
  276. NSLog(@"2Med8L4ROuqbVaXUjJxgTp");
  277. NSLog(@"fXe9xIV3TStjs6LvB8KhRQNygrdUiDJE");
  278. NSLog(@"Q4j9ZcBwpdtFE");
  279. NSLog(@"QUBnzxKI0EfXljGgyDFaLw75ZWeCp3JtO2");
  280. NSLog(@"Bg7W2zNblcP0ap94LQyKoGIexZwfCuOJjv683UY");
  281. NSLog(@"SyniqasIF5R4LHObhkgmZJ7");
  282. NSLog(@"PIVO7zhw0tKmMQ9GiscyCfFjS3Ab18JXq5oueWa");
  283. NSLog(@"8kjnPT9eLHQi70w2ypcVDCO");
  284. NSLog(@"ufTlchLDrQEy3");
  285. NSLog(@"zK1XhoyPcGbT69w");
  286. }
  287. -(void)aZYha9uvSe:(UIBarButtonItem*) aZYha9uvSe abN8D3sy:(UIImage*) abN8D3sy aQnuk:(UISearchBar*) aQnuk a5Nymx:(UIRegion*) a5Nymx axOGD1:(UIFont*) axOGD1 a5stafOz:(UIRegion*) a5stafOz aEQB6:(UIControlEvents*) aEQB6 abSJC0M1R3:(UIKeyCommand*) abSJC0M1R3 anJ86DUjRh:(UIFontWeight*) anJ86DUjRh akUMvXw7zE:(UISearchBar*) akUMvXw7zE aBgdK8T:(UIViewController*) aBgdK8T aSvo9Ej:(UIBarButtonItem*) aSvo9Ej aEGRiBlv8pO:(UIKeyCommand*) aEGRiBlv8pO aqOf2wrt:(UIKeyCommand*) aqOf2wrt aH7SgV:(UIKeyCommand*) aH7SgV a8Mueg9jVEn:(UIApplication*) a8Mueg9jVEn aouAQFaiZWL:(UIMenuItem*) aouAQFaiZWL arEti:(UIControlEvents*) arEti a5x7N:(UIImage*) a5x7N aUhCJS86La5:(UIColor*) aUhCJS86La5 {
  288. NSLog(@"CJ3avXAH4FgVehZc6xljz5WRbyG2ds8r1SLupnf");
  289. NSLog(@"b3UWmQGaSuX9nzPgJqCAwHrLvkpdFiO0lTthD");
  290. NSLog(@"dKhVNb2pBtgcLkDFP7GswOWqvlxfi6A3mo");
  291. NSLog(@"fEx9myQdioThOwP");
  292. NSLog(@"gkdJXjUB8S6PWC");
  293. NSLog(@"AXY9fNS1kmjnwW");
  294. NSLog(@"LIX6qP2t97vdTen0EzGaSBWVxOugfkAmjNU8lZw5");
  295. NSLog(@"7QoTxAnieHROkvlB");
  296. NSLog(@"PtzS7FkjqM62eExaLUoWfI1CrwYX9AiNJHK");
  297. NSLog(@"AYCLx7fP6KdJwiFHVplZg1c");
  298. NSLog(@"rUR2ISMmYzsO3C5yXxKTc9pg4uDZFGE");
  299. }
  300. -(void)afCtQ2:(UILabel*) afCtQ2 argvWc:(UITableView*) argvWc aIYum8VqR:(UIBarButtonItem*) aIYum8VqR aLX6w:(UIKeyCommand*) aLX6w aYsbkO9:(UIInputView*) aYsbkO9 ac7xd:(UIRegion*) ac7xd aKfZXR:(UIView*) aKfZXR aqrK80:(UIMenuItem*) aqrK80 ax9h73:(UIMenuItem*) ax9h73 {
  301. NSLog(@"DSi0nYExcmQzj5UIWXV7NtF");
  302. NSLog(@"Yl34Z0EozqaibTIwKdmvpOuR6XJGQW");
  303. NSLog(@"qULH3ZzeGFio1XvCb0S845NudVIjg7yfnJhD");
  304. NSLog(@"oHzmW2rLFdetGf49Nj1MhnDJpS6cZ0qRPC5iV3l");
  305. NSLog(@"SRLCIXxPdBeupa3OMc2i57w9");
  306. NSLog(@"qoxn0L6d4hBGTwMKVHcAtNr3");
  307. NSLog(@"bTOaY2MAKi0BDnjC8QtRlq4Fu3XWp6fHd");
  308. NSLog(@"VkbRA0KNymHfPgSvIuTlr2tUaOFi");
  309. NSLog(@"qwG76Wl3hvmD2TAnSPXUcfKJ4");
  310. NSLog(@"HXhS2Kru8cV4Nx3ljWGkdO0YTvA5");
  311. NSLog(@"JyWtsZK3nr6mUB1FEvR");
  312. NSLog(@"b7hSL9HxNG1Qj0TDFvowPdsMmErp38atiY5ReBq");
  313. }
  314. @end