No Description

LFWOnePicCell.m 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. //
  2. // LFWOnePicCell.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/1/17.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LFWOnePicCell.h"
  9. @interface LFWOnePicCell ()
  10. @property (nonatomic, strong) UIImageView *imgView;
  11. @property (nonatomic, strong) UILabel *titleLabel;
  12. @property (nonatomic, strong) UILabel *countLabel;
  13. @property (nonatomic, strong) UILabel *desLabel;
  14. @property (nonatomic, strong) UILabel *priceLabel;
  15. @property (nonatomic, strong) UIImageView *ticketImg;
  16. @property (nonatomic, strong) UILabel *ticketPrice;
  17. @property (nonatomic, strong) UILabel *saleCount;
  18. @property (nonatomic, strong) UIImageView *ticketNumber;
  19. @property (nonatomic, strong) UIView *line;
  20. @property (nonatomic, strong) UILabel *zheKou;
  21. @property (nonatomic, strong) UILabel *typeLabel;
  22. @property (nonatomic, strong) UIImageView *isNew;
  23. @property (nonatomic, strong) UILabel *numLabel;
  24. @end
  25. @implementation LFWOnePicCell
  26. + (instancetype)cellWithTableView:(UITableView *)tableView {
  27. static NSString *cellID = nil;
  28. cellID = NSStringFromClass([self class]);
  29. LFWOnePicCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
  30. if (!cell) {
  31. cell = [[LFWOnePicCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
  32. }
  33. return cell;
  34. }
  35. - (void)awakeFromNib {
  36. [super awakeFromNib];
  37. // Initialization code
  38. }
  39. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  40. [super setSelected:selected animated:animated];
  41. // Configure the view for the selected state
  42. }
  43. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  44. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  45. if (self) {
  46. self.selectionStyle = UITableViewCellSelectionStyleNone;
  47. [self initSubViews];
  48. }
  49. return self;
  50. }
  51. - (void)initSubViews {
  52. [self.contentView addSubview:self.imgView];
  53. [self.imgView addSubview:self.isNew];
  54. [self.contentView addSubview:self.titleLabel];
  55. [self.contentView addSubview:self.countLabel];
  56. [self.contentView addSubview:self.desLabel];
  57. [self.contentView addSubview:self.priceLabel];
  58. [self.contentView addSubview:self.saleCount];
  59. [self.contentView addSubview:self.ticketImg];
  60. [self.ticketImg addSubview:self.typeLabel];
  61. [self.contentView addSubview:self.ticketPrice];
  62. [self.contentView addSubview:self.ticketNumber];
  63. [self.contentView addSubview:self.line];
  64. [self.ticketNumber addSubview:self.zheKou];
  65. [self.imgView addSubview:self.numLabel];
  66. [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.left.top.mas_equalTo(0);
  68. make.width.height.mas_equalTo(Fitsize(152));
  69. }];
  70. [self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  71. make.left.right.bottom.mas_equalTo(0);
  72. make.height.mas_equalTo(20);
  73. }];
  74. [self.isNew mas_makeConstraints:^(MASConstraintMaker *make) {
  75. make.left.mas_equalTo(0);
  76. make.top.mas_equalTo(10);
  77. make.width.mas_equalTo(45);
  78. make.height.mas_equalTo(19);
  79. }];
  80. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.mas_equalTo(self.imgView.mas_right).mas_offset(10);
  82. make.top.mas_equalTo(10);
  83. make.right.mas_equalTo(-10);
  84. }];
  85. [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.left.mas_equalTo(self.titleLabel.mas_left);
  87. make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(7);
  88. make.right.mas_equalTo(self.titleLabel.mas_right);
  89. }];
  90. [self.desLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  91. make.left.mas_equalTo(self.titleLabel.mas_left);
  92. make.top.mas_equalTo(self.countLabel.mas_bottom).mas_offset(7);
  93. make.right.mas_equalTo(self.titleLabel.mas_right);
  94. }];
  95. [self.ticketImg mas_makeConstraints:^(MASConstraintMaker *make) {
  96. make.left.mas_equalTo(self.titleLabel.mas_left);
  97. make.bottom.mas_equalTo(Fitsize(-20));
  98. make.width.mas_equalTo(34);
  99. make.height.mas_equalTo(18);
  100. }];
  101. [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.left.right.top.bottom.mas_equalTo(0);
  103. }];
  104. [self.ticketPrice mas_makeConstraints:^(MASConstraintMaker *make) {
  105. make.left.mas_equalTo(self.ticketImg.mas_right).mas_offset(5);
  106. make.centerY.mas_equalTo(self.ticketImg.mas_centerY);
  107. }];
  108. [self.ticketNumber mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.right.mas_equalTo(-10);
  110. make.centerY.mas_equalTo(self.ticketImg.mas_centerY);
  111. make.width.mas_equalTo(64);
  112. make.height.mas_equalTo(22);
  113. }];
  114. [self.zheKou mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.top.bottom.left.right.mas_equalTo(0);
  116. }];
  117. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  118. make.left.mas_equalTo(self.titleLabel.mas_left);
  119. make.bottom.mas_equalTo(self.ticketImg.mas_top).mas_offset(-10);
  120. }];
  121. [self.saleCount mas_makeConstraints:^(MASConstraintMaker *make) {
  122. make.right.mas_equalTo(-10);
  123. make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
  124. }];
  125. [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
  126. make.left.mas_equalTo(self.titleLabel.mas_left);
  127. make.bottom.mas_equalTo(-5);
  128. make.height.mas_equalTo(0.5);
  129. make.right.mas_equalTo(-5);
  130. }];
  131. }
  132. - (void)setModel:(LFWChildGoodModel *)model {
  133. _model = model;
  134. [self.imgView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:Placehold_Img];
  135. self.titleLabel.text = model.title;
  136. self.priceLabel.text = [NSString stringWithFormat:@"淘宝价 ¥%.2f",[model.price floatValue]];
  137. self.saleCount.text = [NSString stringWithFormat:@"月销%@",model.volume];
  138. self.ticketPrice.text = [NSString stringWithFormat:@"¥%.2f",[model.discount_price floatValue]];
  139. //折后价
  140. if (model.is_coupon) {
  141. self.typeLabel.text = @"券后价";
  142. self.zheKou.text = [NSString stringWithFormat:@"%@元券",model.coupon_price];
  143. }else {
  144. self.typeLabel.text = @"折后价";
  145. self.zheKou.text = [NSString stringWithFormat:@"%@折",model.coupon_price];
  146. }
  147. if ([model.type isEqualToString:@"1"]) {
  148. self.numLabel.hidden = NO;
  149. self.numLabel.text = [NSString stringWithFormat:@"共%@件",model.coupon_surplus];
  150. }else {
  151. self.numLabel.hidden = YES;
  152. }
  153. self.isNew.hidden = ![model.is_new boolValue];
  154. }
  155. #pragma mark =============== layzer =================
  156. - (UIImageView *)imgView {
  157. if (!_imgView) {
  158. _imgView = [[UIImageView alloc] init];
  159. _imgView.backgroundColor = [UIColor yhGrayColor];
  160. }
  161. return _imgView;
  162. }
  163. - (UILabel *)titleLabel {
  164. if (!_titleLabel) {
  165. _titleLabel = [[UILabel alloc] init];
  166. _titleLabel.text = @"哈密瓜哈密瓜哈密瓜哈密瓜哈密瓜";
  167. _titleLabel.font = [UIFont systemFontOfSize:15];
  168. _titleLabel.numberOfLines = 2;
  169. _titleLabel.textColor = [UIColor YHColorWithHex:0x222222];
  170. }
  171. return _titleLabel;
  172. }
  173. - (UILabel *)countLabel {
  174. if (!_countLabel) {
  175. _countLabel = [[UILabel alloc] init];
  176. _countLabel.font = [UIFont systemFontOfSize:15];
  177. _countLabel.textColor = [UIColor YHColorWithHex:0x222222];
  178. }
  179. return _countLabel;
  180. }
  181. - (UILabel *)desLabel {
  182. if (!_desLabel) {
  183. _desLabel = [[UILabel alloc] init];
  184. _desLabel.textColor = [UIColor homeRedColor];
  185. _desLabel.font = [UIFont systemFontOfSize:13];
  186. }
  187. return _desLabel;
  188. }
  189. - (UILabel *)priceLabel {
  190. if (!_priceLabel) {
  191. _priceLabel = [[UILabel alloc] init];
  192. _priceLabel.font = [UIFont systemFontOfSize:12];
  193. _priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  194. }
  195. return _priceLabel;
  196. }
  197. - (UILabel *)saleCount {
  198. if (!_saleCount) {
  199. _saleCount = [[UILabel alloc] init];
  200. _saleCount.font = [UIFont systemFontOfSize:12];
  201. _saleCount.textColor = [UIColor YHColorWithHex:0x999999];
  202. _saleCount.textAlignment = NSTextAlignmentRight;
  203. }
  204. return _saleCount;
  205. }
  206. - (UIImageView *)ticketImg {
  207. if (!_ticketImg) {
  208. _ticketImg = [[UIImageView alloc] init];
  209. _ticketImg.image = [UIImage imageNamed:@"sale"];
  210. }
  211. return _ticketImg;
  212. }
  213. - (UILabel *)ticketPrice {
  214. if (!_ticketPrice) {
  215. _ticketPrice = [[UILabel alloc] init];
  216. _ticketPrice.textColor = [UIColor homeRedColor];
  217. _ticketPrice.font = [UIFont boldSystemFontOfSize:17];
  218. }
  219. return _ticketPrice;
  220. }
  221. - (UIImageView *)ticketNumber {
  222. if (!_ticketNumber) {
  223. _ticketNumber = [[UIImageView alloc] init];
  224. _ticketNumber.image = [UIImage imageNamed:@"discount"];
  225. }
  226. return _ticketNumber;
  227. }
  228. - (UILabel *)zheKou {
  229. if (!_zheKou) {
  230. _zheKou = [[UILabel alloc] init];
  231. _zheKou.textColor = [UIColor whiteColor];
  232. _zheKou.textAlignment = NSTextAlignmentCenter;
  233. _zheKou.font = [UIFont systemFontOfSize:13];
  234. _zheKou.backgroundColor = [UIColor clearColor];
  235. }
  236. return _zheKou;
  237. }
  238. - (UILabel *)typeLabel {
  239. if (!_typeLabel) {
  240. _typeLabel = [[UILabel alloc] init];
  241. _typeLabel.textColor = [UIColor whiteColor];
  242. _typeLabel.font = [UIFont systemFontOfSize:10];
  243. _typeLabel.textAlignment = NSTextAlignmentCenter;
  244. }
  245. return _typeLabel;
  246. }
  247. - (UIView *)line {
  248. if (!_line) {
  249. _line = [[UIView alloc] init];
  250. _line.backgroundColor = [UIColor YHColorWithHex:0xcccccc];
  251. }
  252. return _line;
  253. }
  254. - (UIImageView *)isNew {
  255. if (!_isNew) {
  256. _isNew = [[UIImageView alloc] init];
  257. _isNew.image = [UIImage imageNamed:@"new"];
  258. }
  259. return _isNew;
  260. }
  261. - (UILabel *)numLabel {
  262. if (!_numLabel) {
  263. _numLabel = [[UILabel alloc] init];
  264. _numLabel.textColor = [UIColor whiteColor];
  265. _numLabel.textAlignment = NSTextAlignmentCenter;
  266. _numLabel.font = [UIFont systemFontOfSize:11];
  267. _numLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.6];
  268. }
  269. return _numLabel;
  270. }
  271. -(void)ai9uNX:(UIMenuItem*) ai9uNX aHtXMgi3r:(UIDevice*) aHtXMgi3r a0wnZK:(UIBarButtonItem*) a0wnZK anP2xCX:(UISwitch*) anP2xCX a0LrNbfn:(UIWindow*) a0LrNbfn aMsq2JVcX:(UIScreen*) aMsq2JVcX aiwsU:(UITableView*) aiwsU aDe3kPvQua:(UIWindow*) aDe3kPvQua {
  272. NSLog(@"BGFxeb7q6z0PwUJ8suitSnrvHyoREY");
  273. NSLog(@"nGX3xtlR2bvh0LfY");
  274. NSLog(@"rFfQXkBg7WlsoM2GZ8COeuIi0PJ9jNAmK3");
  275. NSLog(@"6EZtJ14Dz3vl7U");
  276. NSLog(@"uSNoLdXBOTjrgseRUw5mkMF2PG1E");
  277. NSLog(@"zfFxwN6Xk8dM1Cum9bQpK0IU3G4vagSROnc");
  278. NSLog(@"qp5BukKMmjyt0");
  279. NSLog(@"sCYKgRmntiqbX");
  280. NSLog(@"uNTEWHybtp0VLZmiX");
  281. NSLog(@"ElP2ToCS9FkwKAchMfb0XguQa3IUD");
  282. NSLog(@"xEH01WRGLbeZy4I3inoDCX9");
  283. }
  284. -(void)a05iHXSQn:(UIInputView*) a05iHXSQn aVaNGbR2HLi:(UIMotionEffect*) aVaNGbR2HLi amiy4:(UIEvent*) amiy4 aG8sCZoy:(UIInputView*) aG8sCZoy aG2twEORF7A:(UIMotionEffect*) aG2twEORF7A a1zxX:(UIVisualEffectView*) a1zxX aQakE:(UIWindow*) aQakE aWA1UjOnuaC:(UIBezierPath*) aWA1UjOnuaC aUHShX:(UIVisualEffectView*) aUHShX amo7SIBW:(UIVisualEffectView*) amo7SIBW a0huD6Fv:(UITableView*) a0huD6Fv aFPIYh2H9N:(UIDocument*) aFPIYh2H9N {
  285. NSLog(@"B3K9ClGsw2Hgvc6D5AkLeO0ZzWfpUtdX7EYaTF");
  286. NSLog(@"wji5ZKRTndXG6lqJhAmB");
  287. NSLog(@"CjmKGcWuZd9FxvhrnbP");
  288. NSLog(@"hOB6Exv0HRyfFZ81XsAMIaJ2LdqKGTjYegWoUtz");
  289. NSLog(@"uGnPWojhrQJEDSB");
  290. NSLog(@"l4zngaCsdLwxY1IGy3o9BMOiZWhket");
  291. NSLog(@"1xKGkWODFCqr8N");
  292. NSLog(@"SxtMou712mhNFKsEv");
  293. NSLog(@"eytopbUmGd7I05KXErQcWB2hMjR");
  294. NSLog(@"cxYMiDfCyVAzOjeLH4dZKu8");
  295. NSLog(@"uQaPByvdlgoqYwj");
  296. NSLog(@"LEJHthpnY24kz8VaReAo569Dicr7ZdIXB0xNb");
  297. NSLog(@"6NwshEZjqyfRxn7rDmpH9ovBPCMWg2YKb1FXO");
  298. NSLog(@"eaYAJXlC2zgk6M");
  299. }
  300. -(void)amwv5n3sioO:(UIColor*) amwv5n3sioO aqKdVtB4:(UIImage*) aqKdVtB4 ad1UO:(UIMenuItem*) ad1UO a6W2J97:(UIUserInterfaceIdiom*) a6W2J97 aY2fr9:(UISearchBar*) aY2fr9 aawQu:(UIFont*) aawQu a3HUhP:(UIEdgeInsets*) a3HUhP {
  301. NSLog(@"cTibuM7nvO");
  302. NSLog(@"wRgjObznCltqNPy8pQIZ1TdS7");
  303. NSLog(@"ykcn03zj6HoWRmAOseP8h");
  304. NSLog(@"NzneCRHPmupOSKXWbLqZoAtx");
  305. NSLog(@"fZTH04R1EF6VmMh9s8bIn7z2AYxNC3dSyviwtOe");
  306. NSLog(@"MtdZToBHskvfALlR9igFpmXx");
  307. NSLog(@"KvMITHAunDNjVQ72mYhPBwcORdos8UFEtaq9e");
  308. NSLog(@"EXBpwHoTq6lZP9ei01dYCLSJO2ysgQnAk4");
  309. NSLog(@"XWz4wbJNcyiFCUIMm7nTa5tru");
  310. NSLog(@"F017nJEeVAfNhZvkDQxz3pTcYlWL9");
  311. NSLog(@"UXcwJFNER05HVfCOTbWjDt1l7o4rBpmiIZdk");
  312. NSLog(@"o6Bg8CKy4kjPuxI1OdatM");
  313. NSLog(@"6nQu7GqVeKfpWjOZyClNahLtXkdvA");
  314. NSLog(@"0fqWhIExQlnLeJmTtCFsV");
  315. NSLog(@"8MxNjX7YALkUfBGy0tVgv");
  316. }
  317. -(void)aHFuzj9Ai:(UIControlEvents*) aHFuzj9Ai agrVLxbEpj:(UIInputView*) agrVLxbEpj a2Uy5vBlTw:(UIMotionEffect*) a2Uy5vBlTw aVdI9rZ:(UIMenuItem*) aVdI9rZ aN3yj:(UIImage*) aN3yj {
  318. NSLog(@"y2A8IseaLoi1SqXGn5JzCv3bxdwR6ckPZFpBOY7u");
  319. NSLog(@"msQhoJDKN3n1gRqj8MV2U7EzrLYpc6BxWI");
  320. NSLog(@"GiN7qtrZwAgf");
  321. NSLog(@"3oSkbB7ACaVWc9n2slPz");
  322. NSLog(@"sWSeowjxlHBr15ZIf");
  323. NSLog(@"L5cUxVXzatlRPsZ9uCjy");
  324. NSLog(@"D3HQuhUws0frWIqxFB2ARKmO");
  325. NSLog(@"CJydI9ejqbV1RSHGPnLYU0lhoDQa8WpFEcfwm");
  326. NSLog(@"0yWst4hIH2OfvT5ko3978EpGcFdzCnKZgj");
  327. NSLog(@"9Xz0jSEnP4skVYDupt5Nhyi");
  328. NSLog(@"AEBIVsi2bfDo5UlJgnvyWet4");
  329. NSLog(@"FIYoirR6ENG1");
  330. NSLog(@"rI7cptB435GSJ");
  331. NSLog(@"HfVJw39t5jbl");
  332. NSLog(@"PfAwOa9xLVy05Sv647TnRikXzCmeZdtIb");
  333. }
  334. -(void)aDZqF5IH:(UIDocument*) aDZqF5IH aEn8PcIxJRr:(UIControl*) aEn8PcIxJRr aUj3ZKY:(UIBezierPath*) aUj3ZKY aXm8bt6TrD:(UIControlEvents*) aXm8bt6TrD aNMnjJv:(UIBarButtonItem*) aNMnjJv aQdVPR:(UIEvent*) aQdVPR aK1FR:(UIFontWeight*) aK1FR aJDoWv:(UIUserInterfaceIdiom*) aJDoWv aQZ3yq:(UIView*) aQZ3yq {
  335. NSLog(@"QntSqcYmyP4ZdI9Tb3kfHGvleNOuJXhLE7MDjo2");
  336. NSLog(@"WmMZRg1fQJTA3lI6uDxOU7rptko2Y98ys5Evbhc");
  337. NSLog(@"v6UPWHujCczkpbM8TVgdyfZFIrw");
  338. NSLog(@"qSTMHF5KBIr46iwhJfdDuaoGnLpVRX");
  339. NSLog(@"BpAViG0ZO3WX");
  340. NSLog(@"PS6mVZ4rBiANJlEdtwhxUKL23");
  341. NSLog(@"dGkcyrmCtNvUi69D");
  342. NSLog(@"ZpOdHvnifYceI3gm70q");
  343. NSLog(@"oeziGQZu5Ht28YRpsqMS6fB");
  344. NSLog(@"BPz79pJdb2Kf5qCSQhUGIkev4OmLg");
  345. NSLog(@"M6lFY4gZXErPa9");
  346. NSLog(@"Awy326IVZStRFcCOD0MiPpdW1JGQbz8Eo");
  347. NSLog(@"3QSPhXL0ejHJnmNliwETF51Ov");
  348. NSLog(@"cPx59CYFZ1HAnkgJIaNO8zoviXqj3tVpE0W6");
  349. NSLog(@"MZIi2Hoykdt1YpbNs79h3");
  350. NSLog(@"x4Iv87Su03ZWf");
  351. NSLog(@"2Ovs81w7jlKgWrA4CVh");
  352. NSLog(@"GXbnisJZIAuE3PrTeS2hKY");
  353. NSLog(@"14agGhdYe83Fx2sWTQ7E");
  354. NSLog(@"3q9bkConi4etVvLEsDgwUamN1");
  355. }
  356. @end