两折卖----返利app-----返利圈

LZMGoodHorizontalCollectionCell.m 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. //
  2. // LZMGoodHorizontalCollectionCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/5/3.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMGoodHorizontalCollectionCell.h"
  9. #import "DateFunction.h"
  10. @interface LZMGoodHorizontalCollectionCell ()
  11. @property (nonatomic, strong) UIImageView *iconView;
  12. @property (nonatomic, strong) UILabel *titleLabel;
  13. @property (nonatomic, strong) UILabel *endDateLabel;
  14. @property (nonatomic, strong) UILabel *endDateLabel2;
  15. @property (nonatomic, strong) UILabel *priceLabel;
  16. @property (nonatomic, strong) UILabel *disPriceLabel;
  17. @property (nonatomic, strong) UIImageView *ticketImg;
  18. @property (nonatomic, strong) UILabel *ticketLabel;
  19. @property (nonatomic, strong) UILabel *outTimeLabel;
  20. @property (nonatomic, strong) UIButton *sameButton;
  21. @property (nonatomic, strong) UILabel *ticketType;
  22. @property (nonatomic, strong) UIImageView *outDateImg;
  23. @property (nonatomic, strong) UIButton *cancelCollection;
  24. @property (nonatomic, strong) UILabel *commissionLabel;
  25. @end
  26. @implementation LZMGoodHorizontalCollectionCell
  27. - (instancetype)initWithFrame:(CGRect)frame {
  28. self = [super initWithFrame:frame];
  29. if (self) {
  30. self.backgroundColor = [UIColor whiteColor];
  31. [self initSubView];
  32. }
  33. return self;
  34. }
  35. - (void)initSubView {
  36. [self.contentView addSubview:self.iconView];
  37. [self.contentView addSubview:self.titleLabel];
  38. [self.contentView addSubview:self.endDateLabel];
  39. [self.contentView addSubview:self.endDateLabel2];
  40. [self.contentView addSubview:self.priceLabel];
  41. [self.contentView addSubview:self.disPriceLabel];
  42. [self.contentView addSubview:self.ticketImg];
  43. [self addSubview:self.cancelCollection];
  44. [self.ticketImg addSubview:self.ticketType];
  45. [self.ticketImg addSubview:self.ticketLabel];
  46. [self.iconView addSubview:self.outTimeLabel];
  47. [self.outTimeLabel addSubview:self.outDateImg];
  48. [self.iconView addSubview:self.commissionLabel];
  49. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  50. make.left.mas_equalTo(15);
  51. make.width.height.mas_equalTo(100);
  52. make.top.mas_equalTo(10);
  53. }];
  54. [self.commissionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.left.right.mas_equalTo(0);
  56. make.bottom.mas_equalTo(0);
  57. make.height.mas_equalTo(20);
  58. }];
  59. [self.outTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.right.top.bottom.mas_equalTo(0);
  61. }];
  62. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.top.mas_equalTo(10);
  64. make.left.mas_equalTo(self.iconView.mas_right).mas_offset(10);
  65. make.right.mas_equalTo(-10);
  66. }];
  67. [self.endDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.left.mas_equalTo(self.titleLabel.mas_left);
  69. make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8);
  70. make.height.mas_equalTo(15);
  71. // make.right.mas_equalTo(-10);
  72. }];
  73. [self.endDateLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.left.mas_equalTo(self.titleLabel.mas_left);
  75. make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8);
  76. make.height.mas_equalTo(15);
  77. // make.right.mas_equalTo(-10);
  78. }];
  79. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  80. make.left.mas_equalTo(self.titleLabel.mas_left);
  81. make.bottom.mas_equalTo(-10);
  82. }];
  83. [self.disPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  84. make.left.mas_equalTo(self.priceLabel.mas_right).mas_offset(5);
  85. make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
  86. }];
  87. [self.ticketImg mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.right.mas_equalTo(-10);
  89. make.bottom.mas_equalTo(self.iconView.mas_bottom);
  90. make.width.mas_equalTo(64);
  91. make.height.mas_equalTo(14);
  92. }];
  93. [self.ticketType mas_makeConstraints:^(MASConstraintMaker *make) {
  94. make.left.top.bottom.mas_equalTo(0);
  95. make.width.mas_equalTo(20);
  96. }];
  97. [self.ticketLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  98. make.left.mas_equalTo(20);
  99. make.top.bottom.right.mas_equalTo(0);
  100. }];
  101. [self.outDateImg mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.width.mas_equalTo(60);
  103. make.height.mas_equalTo(38);
  104. make.center.mas_equalTo(self.outTimeLabel.center);
  105. }];
  106. [self.cancelCollection mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.right.mas_equalTo(-10);
  108. make.centerY.mas_equalTo(self.mas_centerY);
  109. make.width.height.mas_equalTo(30);
  110. }];
  111. }
  112. - (void)setCollectionModel:(LZMCollectionModel *)collectionModel {
  113. _collectionModel = collectionModel;
  114. //头像、标题
  115. [_iconView sd_setImageWithURL:[NSURL URLWithString:collectionModel.img]];
  116. self.titleLabel.text = collectionModel.title;
  117. self.outTimeLabel.hidden = ![collectionModel.isExpire isEqualToString:@"1"];
  118. //过期时间
  119. if ([collectionModel.isExpire isEqualToString:@"2"]) {
  120. int endCount = [DateFunction intervalSinceNow:collectionModel.coupon_end_time];
  121. NSString *endDateStr = [NSString stringWithFormat:@"%d天后过期",endCount];
  122. CGSize size = [PublicFunction getAutoWidthWith:endDateStr andSize:CGSizeMake(1000, 15) andFont:11];
  123. [self.endDateLabel2 mas_updateConstraints:^(MASConstraintMaker *make) {
  124. make.width.mas_equalTo(size.width+20);
  125. }];
  126. self.endDateLabel2.text = endDateStr;
  127. self.endDateLabel.hidden = YES;
  128. self.endDateLabel2.hidden = NO;
  129. }else {
  130. NSString *endText = [NSString stringWithFormat:@"到期时间:%@",collectionModel.coupon_end_time];
  131. self.endDateLabel.text = endText;
  132. self.endDateLabel2.hidden = YES;
  133. self.endDateLabel.hidden = NO;
  134. }
  135. //折扣还是券
  136. self.endDateLabel2.hidden = ![collectionModel.is_coupon boolValue];
  137. self.endDateLabel.hidden = ![collectionModel.is_coupon boolValue];
  138. NSString *type = [collectionModel.is_coupon boolValue]?@"券后":@"折后";
  139. NSString *price = [NSString stringWithFormat:@"%@¥%.2f",type,[collectionModel.discount_price floatValue]];
  140. NSMutableAttributedString *priceAttr = [[NSMutableAttributedString alloc] initWithString:price];
  141. [priceAttr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:11] range:NSMakeRange(0, 3)];
  142. self.priceLabel.attributedText = priceAttr;
  143. self.ticketType.text = [collectionModel.is_coupon boolValue]?@"券":@"折";
  144. self.ticketImg.hidden = ![collectionModel.is_coupon boolValue];
  145. //价钱
  146. NSString *disPrice = [NSString stringWithFormat:@"¥%.2f",[collectionModel.price floatValue]];
  147. NSAttributedString *attr = [[NSAttributedString alloc] initWithString:disPrice attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11],
  148. NSForegroundColorAttributeName:[UIColor YHColorWithHex:0x999999],
  149. NSStrikethroughColorAttributeName:[UIColor YHColorWithHex:0x999999],
  150. NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle|NSUnderlinePatternSolid)}];
  151. self.disPriceLabel.attributedText = attr;
  152. if ([collectionModel.is_coupon boolValue]) {
  153. self.ticketLabel.text = [NSString stringWithFormat:@"%@元",collectionModel.coupon_price];
  154. }else {
  155. self.ticketLabel.text = [NSString stringWithFormat:@"%@折",collectionModel.coupon_price];
  156. }
  157. }
  158. - (void)cancelAction {
  159. if (self.cancelBlock) {
  160. self.cancelBlock();
  161. }
  162. }
  163. #pragma mark ------------------
  164. - (UIImageView *)iconView {
  165. if (!_iconView) {
  166. _iconView = [[UIImageView alloc] init];
  167. _iconView.backgroundColor = [UIColor yhGrayColor];
  168. }
  169. return _iconView;
  170. }
  171. - (UILabel *)titleLabel {
  172. if (!_titleLabel) {
  173. _titleLabel = [[UILabel alloc] init];
  174. _titleLabel.textColor = [UIColor YHColorWithHex:0x444444];
  175. _titleLabel.font = [UIFont systemFontOfSize:14];
  176. _titleLabel.numberOfLines = 2;
  177. }
  178. return _titleLabel;
  179. }
  180. - (UILabel *)endDateLabel {
  181. if (!_endDateLabel) {
  182. _endDateLabel = [[UILabel alloc] init];
  183. _endDateLabel.textColor = [UIColor YHColorWithHex:0x999999];
  184. _endDateLabel.font = [UIFont systemFontOfSize:11];
  185. }
  186. return _endDateLabel;
  187. }
  188. - (UILabel *)endDateLabel2 {
  189. if (!_endDateLabel2) {
  190. _endDateLabel2 = [[UILabel alloc] init];
  191. _endDateLabel2.textColor = [UIColor YHColorWithHex:0x999999];
  192. _endDateLabel2.font = [UIFont systemFontOfSize:11];
  193. _endDateLabel2.textAlignment = NSTextAlignmentCenter;
  194. _endDateLabel2.layer.cornerRadius = 7;
  195. _endDateLabel2.layer.masksToBounds = YES;
  196. _endDateLabel2.backgroundColor = [UIColor homeRedColor];
  197. _endDateLabel2.textColor = [UIColor whiteColor];
  198. }
  199. return _endDateLabel2;
  200. }
  201. - (UILabel *)priceLabel {
  202. if (!_priceLabel) {
  203. _priceLabel = [[UILabel alloc] init];
  204. _priceLabel.font = [UIFont systemFontOfSize:15];
  205. _priceLabel.textColor = [UIColor homeRedColor];
  206. }
  207. return _priceLabel;
  208. }
  209. - (UILabel *)disPriceLabel {
  210. if (!_disPriceLabel) {
  211. _disPriceLabel = [[UILabel alloc] init];
  212. _disPriceLabel.font = [UIFont systemFontOfSize:11];
  213. _disPriceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  214. }
  215. return _disPriceLabel;
  216. }
  217. - (UIImageView *)ticketImg {
  218. if (!_ticketImg) {
  219. _ticketImg = [[UIImageView alloc] init];
  220. _ticketImg.image = [UIImage imageNamed:@"quan_bg"];
  221. }
  222. return _ticketImg;
  223. }
  224. - (UILabel *)ticketLabel {
  225. if (!_ticketLabel) {
  226. _ticketLabel = [[UILabel alloc] init];
  227. _ticketLabel.textColor = [UIColor whiteColor];
  228. _ticketLabel.font = [UIFont systemFontOfSize:14];
  229. _ticketLabel.textAlignment = NSTextAlignmentCenter;
  230. _ticketLabel.font = [UIFont systemFontOfSize:10];
  231. _ticketLabel.textAlignment = NSTextAlignmentCenter;
  232. _ticketLabel.textColor = [UIColor whiteColor];
  233. }
  234. return _ticketLabel;
  235. }
  236. - (UILabel *)outTimeLabel {
  237. if (!_outTimeLabel) {
  238. _outTimeLabel = [[UILabel alloc] init];
  239. _outTimeLabel.textAlignment = NSTextAlignmentCenter;
  240. _outTimeLabel.textColor = [UIColor whiteColor];
  241. _outTimeLabel.font = [UIFont systemFontOfSize:12];
  242. _outTimeLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
  243. _outTimeLabel.hidden = YES;
  244. }
  245. return _outTimeLabel;
  246. }
  247. - (UILabel *)ticketType {
  248. if (!_ticketType) {
  249. _ticketType = [[UILabel alloc] init];
  250. _ticketType.font = [UIFont systemFontOfSize:10];
  251. _ticketType.textAlignment = NSTextAlignmentCenter;
  252. _ticketType.textColor = [UIColor whiteColor];
  253. }
  254. return _ticketType;
  255. }
  256. - (UIImageView *)outDateImg {
  257. if (!_outDateImg) {
  258. _outDateImg = [[UIImageView alloc] init];
  259. _outDateImg.image = [UIImage imageNamed:@"outDateImg"];
  260. _outDateImg.backgroundColor = [UIColor clearColor];
  261. }
  262. return _outDateImg;
  263. }
  264. - (UIButton *)cancelCollection {
  265. if (!_cancelCollection) {
  266. _cancelCollection = [UIButton buttonWithType:UIButtonTypeCustom];
  267. [_cancelCollection setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
  268. [_cancelCollection addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
  269. }
  270. return _cancelCollection;
  271. }
  272. - (UILabel *)commissionLabel {
  273. if (!_commissionLabel) {
  274. _commissionLabel = [[UILabel alloc] init];
  275. _commissionLabel.font = [UIFont systemFontOfSize:11];
  276. _commissionLabel.textColor = [UIColor whiteColor];
  277. _commissionLabel.textAlignment = NSTextAlignmentCenter;
  278. _commissionLabel.backgroundColor = [UIColor changeColor];
  279. _commissionLabel.hidden = YES;
  280. }
  281. return _commissionLabel;
  282. }
  283. -(void)a2rCno:(UIFont*) a2rCno aD8Hlqj9:(UIFont*) aD8Hlqj9 aGtoz3:(UIControlEvents*) aGtoz3 aWtJ7QEV:(UIImageView*) aWtJ7QEV aiyN8Lf:(UIUserInterfaceIdiom*) aiyN8Lf alkNwV:(UIEdgeInsets*) alkNwV a7NnM:(UIApplication*) a7NnM aZBoLuv:(UIButton*) aZBoLuv ajsND:(UIBarButtonItem*) ajsND aEQDPR3flm:(UIScreen*) aEQDPR3flm a5Ar7xG:(UIKeyCommand*) a5Ar7xG azNOqj8dZ:(UIBezierPath*) azNOqj8dZ akRNCpaGsgW:(UIUserInterfaceIdiom*) akRNCpaGsgW aPjDmF1uH:(UIRegion*) aPjDmF1uH aWaLzhB:(UIBarButtonItem*) aWaLzhB {
  284. NSLog(@"fw3ZCpR5XJ6dH7jeN28KY0OVzSTasux1");
  285. NSLog(@"fusF4kEUQ2");
  286. NSLog(@"orKhObUnwl5m2vpiLqSHgZQI7RzYVD");
  287. NSLog(@"0uaI9KldWG1F5XQbRZxkgrANyVfoq");
  288. NSLog(@"aruIveYd8JCHoZtGnTOEMc5wm0jA7RsbQiNWp");
  289. NSLog(@"EBchCPISOvYUueFlMNTtpAgZi5LsRxQ3");
  290. NSLog(@"miEwCHax67WSUPBsh");
  291. NSLog(@"Vf2UvGqF1SNcrAtRZPjT7p");
  292. NSLog(@"XC9kUMNVJa7Qht1Zmib");
  293. NSLog(@"9Sw2r1xEHFl5sTO");
  294. NSLog(@"OjJAmz9b1NurHR8W3tlD6psBEVXMCTKea4kwc");
  295. NSLog(@"4OGzUlJPAdb3cImSFY5gkKHpEyt6sno89");
  296. NSLog(@"EWiHvj8LlBgrpXDIx");
  297. NSLog(@"u7ZxiIFUkXo3RG6hpnSQLMsyVAgtwd1DYa2Tj8m");
  298. NSLog(@"FquSZJeAOx73GfnhRt0gL8rIBvHsVijz");
  299. NSLog(@"z09QdgcZWs");
  300. NSLog(@"OT5EDMjiWxfQr4ZuKeNIwys08gab");
  301. NSLog(@"mKRuwIiOr5c2");
  302. NSLog(@"7WKZGzNCMqiJXucFse2mI1pADOSjr5");
  303. }
  304. -(void)aTA5DC:(UIVisualEffectView*) aTA5DC adZJMr0HY:(UIAlertView*) adZJMr0HY aVDqltW:(UIButton*) aVDqltW aOIgHyd:(UIViewController*) aOIgHyd a5jsRVJpyc:(UICollectionView*) a5jsRVJpyc avqSfaLOE:(UIEdgeInsets*) avqSfaLOE aMt7GF6H1O:(UIImage*) aMt7GF6H1O amgxb46:(UIDevice*) amgxb46 aMbJy:(UICollectionView*) aMbJy aTSvw:(UILabel*) aTSvw a7DLBP2mJbd:(UIKeyCommand*) a7DLBP2mJbd aSiHUYl4wt:(UIRegion*) aSiHUYl4wt aqKSfij9s:(UISwitch*) aqKSfij9s {
  305. NSLog(@"ph2Tac1Vw9XZ");
  306. NSLog(@"uxBpqUAWdgrzHoy7LIekTvQ4tja3Z6F");
  307. NSLog(@"dLbzZtMcrhCq04j");
  308. NSLog(@"CZ20t6kXfJGyF59xdpvPIjVeKu8nAEcBzY");
  309. NSLog(@"8zIMmFWNTaef9ASsHbr0xdh2GtyjCEJ13lLnU");
  310. NSLog(@"yGg8pYUJtrwFf1COk57PMRLsN9eVxK04D6BmoIhS");
  311. NSLog(@"hH3MgKqYU7wOlPZnxNC4Q8XvDJEBbiVozaSejy9");
  312. NSLog(@"DZ3BNiKmMd7khVgTI");
  313. NSLog(@"dnIZ81jw4h0bDS59TpCfGgi");
  314. NSLog(@"peBXQ5sYV1gl");
  315. }
  316. -(void)aRAcOPLgzQ1:(UIFontWeight*) aRAcOPLgzQ1 a24IU1Pc:(UIWindow*) a24IU1Pc a5aGyJi:(UISearchBar*) a5aGyJi aOvtnuUWH:(UIWindow*) aOvtnuUWH adtFC:(UIView*) adtFC aTEY6PaX:(UIMenuItem*) aTEY6PaX auFc6ewU:(UISearchBar*) auFc6ewU aSDzjC6NX3:(UICollectionView*) aSDzjC6NX3 ahwbgeziA1p:(UIActivity*) ahwbgeziA1p aQzlLeR:(UIDevice*) aQzlLeR abEYrey:(UIActivity*) abEYrey ashqe1ybT0P:(UIWindow*) ashqe1ybT0P ah2KmS:(UIBarButtonItem*) ah2KmS aN5qF0R1v:(UIMotionEffect*) aN5qF0R1v afIkTWmvOM7:(UIDevice*) afIkTWmvOM7 aNqQp8eiK:(UIWindow*) aNqQp8eiK {
  317. NSLog(@"RoAc8iwhukOMIEv2");
  318. NSLog(@"tfsUS5Qbvu3in6zcFVgMad0mo4eZpWNTR1");
  319. NSLog(@"7PWbZoKzMCHi");
  320. NSLog(@"9GIUOrdjJNF");
  321. NSLog(@"qGu2hUfgEwPaCRxe0v8rOm4ljY6In7KX1FskL5cA");
  322. NSLog(@"nfqjr36xoPZFCLG2");
  323. NSLog(@"uLCG80nB67XDsPeaWbqSmVUkcoltwzJQvO");
  324. NSLog(@"0oArukSFMglYDxEs4");
  325. NSLog(@"u134mLkrb8RHD7OKXGvBVPEdU52w");
  326. NSLog(@"P9GMTFhesV1lk43WdRc2");
  327. NSLog(@"vajTLNY4k7UW5dbDmMHy");
  328. NSLog(@"k4KBO8xgEF5oCwitALfZ2XU");
  329. NSLog(@"hGFcQ20aSOLDofgxs1Ee7XAJTWV");
  330. NSLog(@"SIzdGnpkgijA5a");
  331. }
  332. @end