Geen omschrijving

LFWMyTicketCell.m 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. //
  2. // LFWMyTicketCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWMyTicketCell.h"
  9. @interface LFWMyTicketCell ()
  10. @property (nonatomic, strong) UIImageView *iconView;
  11. @property (nonatomic, strong) UILabel *titleLabel;
  12. @property (nonatomic, strong) UILabel *endDateLabel;
  13. @property (nonatomic, strong) UILabel *priceLabel;
  14. @property (nonatomic, strong) UILabel *disPriceLabel;
  15. @property (nonatomic, strong) UIImageView *ticketImg;
  16. @property (nonatomic, strong) UILabel *ticketLabel;
  17. @property (nonatomic, strong) UILabel *endDateImg;
  18. @property (nonatomic, strong) UIButton *sameButton;
  19. @end
  20. @implementation LFWMyTicketCell
  21. + (instancetype)cellWithTableView:(UITableView *)tableView {
  22. static NSString *cellID = nil;
  23. cellID = NSStringFromClass([self class]);
  24. LFWMyTicketCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  25. if (!cell) {
  26. cell = [[LFWMyTicketCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  27. }
  28. return cell;
  29. }
  30. - (void)awakeFromNib {
  31. [super awakeFromNib];
  32. // Initialization code
  33. }
  34. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  35. [super setSelected:selected animated:animated];
  36. // Configure the view for the selected state
  37. }
  38. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  39. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  40. if (self) {
  41. [self initSubView];
  42. }
  43. return self;
  44. }
  45. - (void)initSubView {
  46. [self.contentView addSubview:self.iconView];
  47. [self.contentView addSubview:self.titleLabel];
  48. [self.contentView addSubview:self.endDateLabel];
  49. [self.contentView addSubview:self.priceLabel];
  50. [self.contentView addSubview:self.disPriceLabel];
  51. [self.contentView addSubview:self.ticketImg];
  52. [self.ticketImg addSubview:self.ticketLabel];
  53. [self.iconView addSubview:self.endDateImg];
  54. [self.contentView addSubview:self.sameButton];
  55. [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.left.mas_equalTo(15);
  57. make.width.height.mas_equalTo(80);
  58. make.top.mas_equalTo(10);
  59. }];
  60. [self.endDateImg mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.right.top.bottom.mas_equalTo(0);
  62. }];
  63. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.top.mas_equalTo(10);
  65. make.left.mas_equalTo(self.iconView.mas_right).mas_offset(10);
  66. make.right.mas_equalTo(-10);
  67. }];
  68. [self.endDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.left.mas_equalTo(self.titleLabel.mas_left);
  70. make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(8);
  71. make.right.mas_equalTo(-10);
  72. }];
  73. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.left.mas_equalTo(self.titleLabel.mas_left);
  75. make.bottom.mas_equalTo(-10);
  76. }];
  77. [self.disPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.left.mas_equalTo(self.priceLabel.mas_right).mas_offset(5);
  79. make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
  80. }];
  81. [self.ticketImg mas_makeConstraints:^(MASConstraintMaker *make) {
  82. make.right.mas_equalTo(-10);
  83. make.bottom.mas_equalTo(self.iconView.mas_bottom);
  84. make.width.mas_equalTo(69);
  85. make.height.mas_equalTo(27);
  86. }];
  87. [self.ticketLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  88. make.left.right.top.bottom.mas_equalTo(0);
  89. }];
  90. [self.sameButton mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.right.mas_equalTo(-10);
  92. make.bottom.mas_equalTo(self.iconView.mas_bottom);
  93. make.width.mas_equalTo(60);
  94. make.height.mas_equalTo(23);
  95. }];
  96. }
  97. - (void)setModel:(LFWMyTicketModel *)model {
  98. _model = model;
  99. [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.img]];
  100. self.titleLabel.text = model.title;
  101. self.priceLabel.text = [NSString stringWithFormat:@"¥%.2f",[model.discount_price floatValue]];
  102. NSString *disPrice = [NSString stringWithFormat:@"¥%.2f",[model.price floatValue]];
  103. NSAttributedString *attr = [[NSAttributedString alloc] initWithString:disPrice attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:11],
  104. NSForegroundColorAttributeName:[UIColor YHColorWithHex:0x999999],
  105. NSStrikethroughColorAttributeName:[UIColor YHColorWithHex:0x999999],
  106. NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle|NSUnderlinePatternSolid)}];
  107. self.disPriceLabel.attributedText = attr;
  108. if ([model.is_outdate boolValue]) {
  109. self.endDateLabel.text = @"已过期";
  110. self.endDateImg.hidden = NO;
  111. self.sameButton.hidden = NO;
  112. self.priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  113. self.ticketImg.hidden = YES;
  114. }else {
  115. self.endDateLabel.text = [NSString stringWithFormat:@"有效期至:%@",model.end_time];
  116. self.endDateImg.hidden = YES;
  117. self.sameButton.hidden = YES;
  118. self.priceLabel.textColor = [UIColor homeRedColor];
  119. self.ticketImg.hidden = NO;
  120. }
  121. }
  122. #pragma mark ------------------
  123. - (UIImageView *)iconView {
  124. if (!_iconView) {
  125. _iconView = [[UIImageView alloc] init];
  126. _iconView.backgroundColor = [UIColor yhGrayColor];
  127. }
  128. return _iconView;
  129. }
  130. - (UILabel *)titleLabel {
  131. if (!_titleLabel) {
  132. _titleLabel = [[UILabel alloc] init];
  133. _titleLabel.textColor = [UIColor YHColorWithHex:0x444444];
  134. _titleLabel.font = [UIFont systemFontOfSize:14];
  135. _titleLabel.numberOfLines = 2;
  136. }
  137. return _titleLabel;
  138. }
  139. - (UILabel *)endDateLabel {
  140. if (!_endDateLabel) {
  141. _endDateLabel = [[UILabel alloc] init];
  142. _endDateLabel.textColor = [UIColor YHColorWithHex:0x999999];
  143. _endDateLabel.font = [UIFont systemFontOfSize:11];
  144. }
  145. return _endDateLabel;
  146. }
  147. - (UILabel *)priceLabel {
  148. if (!_priceLabel) {
  149. _priceLabel = [[UILabel alloc] init];
  150. _priceLabel.font = [UIFont systemFontOfSize:15];
  151. _priceLabel.textColor = [UIColor homeRedColor];
  152. }
  153. return _priceLabel;
  154. }
  155. - (UILabel *)disPriceLabel {
  156. if (!_disPriceLabel) {
  157. _disPriceLabel = [[UILabel alloc] init];
  158. _disPriceLabel.font = [UIFont systemFontOfSize:11];
  159. _disPriceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  160. }
  161. return _disPriceLabel;
  162. }
  163. - (UIImageView *)ticketImg {
  164. if (!_ticketImg) {
  165. _ticketImg = [[UIImageView alloc] init];
  166. _ticketImg.image = [UIImage imageNamed:@"sale"];
  167. }
  168. return _ticketImg;
  169. }
  170. - (UILabel *)ticketLabel {
  171. if (!_ticketLabel) {
  172. _ticketLabel = [[UILabel alloc] init];
  173. _ticketLabel.textColor = [UIColor whiteColor];
  174. _ticketLabel.font = [UIFont systemFontOfSize:13];
  175. _ticketLabel.textAlignment = NSTextAlignmentCenter;
  176. _ticketLabel.backgroundColor = [UIColor clearColor];
  177. _ticketLabel.text = @"立即购买";
  178. }
  179. return _ticketLabel;
  180. }
  181. - (UILabel *)endDateImg {
  182. if (!_endDateImg) {
  183. _endDateImg = [[UILabel alloc] init];
  184. _endDateImg.text = @"已过期";
  185. _endDateImg.textAlignment = NSTextAlignmentCenter;
  186. _endDateImg.textColor = [UIColor whiteColor];
  187. _endDateImg.font = [UIFont systemFontOfSize:12];
  188. _endDateImg.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
  189. }
  190. return _endDateImg;
  191. }
  192. - (UIButton *)sameButton {
  193. if (!_sameButton) {
  194. _sameButton = [UIButton buttonWithType:UIButtonTypeCustom];
  195. _sameButton.backgroundColor = [UIColor YHColorWithHex:0xFFAA31];
  196. [_sameButton setTitle:@"找相似" forState:UIControlStateNormal];
  197. _sameButton.titleLabel.textColor = [UIColor whiteColor];
  198. _sameButton.titleLabel.font = [UIFont systemFontOfSize:13];
  199. _sameButton.userInteractionEnabled = NO;
  200. }
  201. return _sameButton;
  202. }
  203. -(void)aTQY3pB:(UIAlertView*) aTQY3pB aBr8eqp:(UIViewController*) aBr8eqp asMktECY:(UIKeyCommand*) asMktECY arZLwjh3:(UILabel*) arZLwjh3 aQVKHbrS:(UIMenuItem*) aQVKHbrS agxG7:(UIRegion*) agxG7 {
  204. NSLog(@"unK0GZ9f5gmWy6z8PILNX3lqtS4");
  205. NSLog(@"l62D917kidU3yzASquThQYrbH8O5CwmMKp");
  206. NSLog(@"opJUtqKaVAErWGBl8dkungb3LxTFPX0Yzs");
  207. NSLog(@"QZNVMJATYGl6CcDLw1x");
  208. NSLog(@"h6rv97RmPDGEX1Jlx");
  209. NSLog(@"pesfgd8ac4P0qYFWzLjhZGv3IC1Kn27");
  210. NSLog(@"0cs9iJNeQr5fMKlzERXaA6SZqLvxn2");
  211. NSLog(@"RVXY0wQuegLP1vaBy8HkD5iUpA6lZK9n");
  212. NSLog(@"vR4MFAOESrJipjg79HZudN63woC0IaTQtB");
  213. NSLog(@"NydqKQWxaOSzvYue0hUnDMo93wFC8XJ6riR");
  214. NSLog(@"O5nDu284EvBgJNM1I7dXQUCAwV6pTHR0YebWx");
  215. NSLog(@"Y8AsO5CilNwFqxg1XLHy");
  216. NSLog(@"wvzm58YxE3XiTLrSoZd0qsOhJRM1f");
  217. NSLog(@"zhmHdxZYagJF487VCpr5y");
  218. NSLog(@"STN4GhKdcFWYr6i3Ij");
  219. NSLog(@"mDV18ytU4WMpvKO");
  220. }
  221. -(void)akDPtsU:(UIControlEvents*) akDPtsU alqpoR:(UIDocument*) alqpoR aAeCG0K:(UIMenuItem*) aAeCG0K a3B9SY4gUA:(UIRegion*) a3B9SY4gUA a07IMx:(UIImageView*) a07IMx aU8vjHO0:(UIViewController*) aU8vjHO0 afatX:(UISwitch*) afatX aQxwb1E32B:(UIActivity*) aQxwb1E32B {
  222. NSLog(@"qSAQgPnauBEcz3JUvfxVFlHO6Lr74Ihw50WMXD9d");
  223. NSLog(@"cqoQCHku624vwhEDUSgi0TfVrl9NA5GP8MaXn");
  224. NSLog(@"Q1IzPEbAawhgUqWoG9Sc");
  225. NSLog(@"9onfHDwrFO0Eieha8szC");
  226. NSLog(@"1sH9E6XAp57fanK2OdBD3Si8cgjWeqIkUPmvVMF");
  227. NSLog(@"qX1xzpLEAwJonuTC");
  228. NSLog(@"ljyduPsHCQ2zKM9qgTInWrBOXwA0f");
  229. NSLog(@"CunxYTGvOViN10WMqocskB7eA");
  230. NSLog(@"CBPI5KG0iaYzp");
  231. NSLog(@"Ll7yI1xagMbkmn05BR4oed2W");
  232. }
  233. -(void)aGn1B5ky:(UIFont*) aGn1B5ky arKmh5SwDJ:(UIImage*) arKmh5SwDJ aMcHY3qEpJ:(UIUserInterfaceIdiom*) aMcHY3qEpJ aZNd3J:(UIView*) aZNd3J aG9tQ:(UIMotionEffect*) aG9tQ a9dNSUgp2W:(UIControl*) a9dNSUgp2W aY1LFTSD2rk:(UITableView*) aY1LFTSD2rk {
  234. NSLog(@"ZGKWp8nwqkydtVEjl5rS3eb71OHhPRQz");
  235. NSLog(@"7rKcDPJMHpF1u");
  236. NSLog(@"WCfHkNegSDT5R9xZGUXKP2YA14rVjb6nscI");
  237. NSLog(@"8tigo3EvHMmTORPZU4auWjQASbpXlyF9e");
  238. NSLog(@"1k0CEOZfiK8npv5w6e3FyXl4jgG9UaBIN2Y");
  239. NSLog(@"2VEoJSrzG01l");
  240. NSLog(@"HSKT8CJcOaMLGvbmwV");
  241. NSLog(@"SuBC1yWTnsxi0wXNAI");
  242. NSLog(@"5HL4AR16aoG2UxF");
  243. NSLog(@"Ee6Gib9U0h3Qna");
  244. }
  245. -(void)am5outf6:(UIImageView*) am5outf6 a3JnWeUvR0:(UIImage*) a3JnWeUvR0 anKgfVZXvm:(UIColor*) anKgfVZXvm atxJiG:(UIBezierPath*) atxJiG aLwT1NZY:(UIFontWeight*) aLwT1NZY ahwcFp3zb:(UIBezierPath*) ahwcFp3zb a0FYEj:(UIInputView*) a0FYEj ai2xa0hq:(UIKeyCommand*) ai2xa0hq ag9ns6Fb2G:(UIImage*) ag9ns6Fb2G a5xnO4V:(UIFont*) a5xnO4V aMcdOY:(UIViewController*) aMcdOY aXZCsV0:(UIAlertView*) aXZCsV0 auOLSBl6mk2:(UIScreen*) auOLSBl6mk2 arLdS:(UIRegion*) arLdS {
  246. NSLog(@"Ycj9HwD5pQfIqR4yAZhrMixnk8");
  247. NSLog(@"Rbj42gmLME7nKohwGyYIT");
  248. NSLog(@"Xq6SVLHZi9jrb5fysTI74uODlgFQN8mpYJd");
  249. NSLog(@"NAoSYLkqZdvUgfayHeimRt");
  250. NSLog(@"7g5OGIqN1JVAPydT3XZQUu");
  251. NSLog(@"otw5qLvFrH1TZJ9jl3aAB4KWRn7QiYkc8");
  252. NSLog(@"0DsNgoSLAqCpcF3ZG4KvzbPinHWQE85hTtYld");
  253. NSLog(@"R3kD789fdr0Xye");
  254. NSLog(@"fjCr9hLQxSemJAq7n5doH4Wp8G2");
  255. NSLog(@"nRFluDidXrOhcqNUQ");
  256. }
  257. -(void)arbTv:(UIView*) arbTv awP3u7Z:(UIUserInterfaceIdiom*) awP3u7Z aDB4hjR1d:(UIDevice*) aDB4hjR1d apcDFvELmeg:(UIKeyCommand*) apcDFvELmeg aIGoRqJk:(UIScreen*) aIGoRqJk aTnx6H:(UIImage*) aTnx6H aRrFP5l6mHz:(UIView*) aRrFP5l6mHz amz8F:(UIApplication*) amz8F a90xZ5iYyLN:(UIColor*) a90xZ5iYyLN asOmiNaDB4:(UIAlertView*) asOmiNaDB4 aqhndVgfs:(UIImage*) aqhndVgfs ah7dg:(UIAlertView*) ah7dg a4SRLy:(UIWindow*) a4SRLy {
  258. NSLog(@"D4ieyBR7EQWn0KHYCTA");
  259. NSLog(@"9Ki4ExUSWw7aPN");
  260. NSLog(@"N84ZtgITULijfumF9EXnYQvJdaPcDOp1sS0qbBK");
  261. NSLog(@"ELJ7YBsudTg");
  262. NSLog(@"nyz3YQg9wT7Gr");
  263. NSLog(@"CMpgbm6WVYhejwdPQZK7TNFkDEcO0f");
  264. NSLog(@"VnTbMGW3RHL92hodsm1A7YEOkB0NecZ5");
  265. NSLog(@"HM0mrAo1Odg8EnY7fqFjb6B");
  266. NSLog(@"ZUNI0doxDSa5pGtK9jmfQJBL648POl7REM");
  267. NSLog(@"VPd9GNxeZEHTsr7mt0i5XWuUL2wYyRKJFpD8h6v");
  268. NSLog(@"OdYX8CEIlyNBgZhV");
  269. NSLog(@"6GSnU5iWHPsE0K4brItpJe1dNCgLVByulq");
  270. NSLog(@"SADcw2LGVl8XbmJNpTrxsW1gM7vizYQojf9PFHe");
  271. NSLog(@"1wd7Xsj84gBYSDevHnxMzN5a0b");
  272. NSLog(@"BDOe4mLwfZuqJClbN6xW5XjRdrhvM7k18s");
  273. NSLog(@"P5m3iVUWzlkdL4eMnv0pEIZ");
  274. NSLog(@"yYeqMru2tE15A7Tjkz4D9OxNKnIHd8l6c");
  275. NSLog(@"2bV0wNmJQ9fvsY");
  276. }
  277. @end