一折买app------返利---------返利宝

YZMAGoodDetailView.m 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. //
  2. // YZMAGoodDetailView.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/25.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMAGoodDetailView.h"
  9. #import "YZMAGoodDetailModel.h"
  10. #import "YZMAGotoDetailView.h"
  11. #import "UIView+SDAutoLayout.h"
  12. #import "CCCopyLabel.h"
  13. @interface YZMAGoodDetailView ()
  14. @property (nonatomic, strong) CCCopyLabel *goodTitleLabel;
  15. @property (nonatomic, strong) UILabel *priceLabel;
  16. @property (nonatomic, strong) UIImageView *discountImageView;
  17. @property (nonatomic, strong) UILabel *discountPriceLabel;
  18. @property (nonatomic, strong) UILabel *freePostLabel;
  19. @property (nonatomic, strong) UILabel *volumeLabel;
  20. @property (nonatomic, strong) UILabel *quanType;
  21. @property (nonatomic, strong) UILabel *quanNum;
  22. @property (nonatomic, strong) UILabel *commissionPrice;
  23. @end
  24. @implementation YZMAGoodDetailView
  25. - (instancetype)initWithFrame:(CGRect)frame {
  26. self = [super initWithFrame:frame];
  27. if (self) {
  28. self.backgroundColor = [UIColor whiteColor];
  29. [self initSubviews];
  30. }
  31. return self;
  32. }
  33. - (void)setGoodModel:(YZMAGoodDetailModel *)goodModel {
  34. _goodModel = goodModel;
  35. NSString *quanType = [goodModel.is_coupon boolValue]?@"券":@"折";
  36. self.quanType.text = quanType;
  37. NSString *quanNum = [goodModel.is_coupon boolValue]?[NSString stringWithFormat:@"%@元",goodModel.coupon_price]:[NSString stringWithFormat:@"%@折",goodModel.coupon_price];
  38. self.quanNum.text = quanNum;
  39. self.discountImageView.hidden = ![goodModel.is_coupon boolValue];
  40. //标题
  41. NSTextAttachment *textAttach = [[NSTextAttachment alloc]init];
  42. UIImage *img;
  43. if ([goodModel.shop_type isEqualToString:@"1"]) {
  44. img= [UIImage imageNamed:@"tm_shop"];
  45. }else if([goodModel.shop_type isEqualToString:@"0"]){
  46. // img= [UIImage imageNamed:@"share_title_tb"];
  47. }
  48. if (img) {
  49. textAttach.image = img;
  50. textAttach.bounds = CGRectMake(0, -4, img.size.width, img.size.height);
  51. }
  52. NSMutableAttributedString *attri;
  53. if ([goodModel.shop_type isEqualToString:@"1"]) {
  54. attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@",goodModel.title]];
  55. }else {
  56. attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",goodModel.title]];
  57. }
  58. NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:textAttach];
  59. [attri insertAttributedString:string atIndex:0];
  60. NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  61. [paragraphStyle setLineSpacing:8];
  62. [attri addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [string length])];
  63. self.goodTitleLabel.textStr = goodModel.title;
  64. self.goodTitleLabel.attributedText = attri;
  65. NSString *priceText = [NSString stringWithFormat:@"原价 ¥%.2f", [goodModel.price floatValue]];
  66. // NSMutableAttributedString *attritu = [[NSMutableAttributedString alloc]initWithString:priceText];
  67. // [attritu addAttributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleThick),
  68. // NSForegroundColorAttributeName:[UIColor lightGrayColor],
  69. // NSBaselineOffsetAttributeName:@(0),
  70. // } range:[priceText rangeOfString:priceText]];
  71. self.priceLabel.text = priceText;
  72. NSString *dis_price = [goodModel.is_coupon boolValue] ? [NSString stringWithFormat:@"券后 ¥%.2f", [goodModel.discount_price floatValue]]:[NSString stringWithFormat:@"折后 ¥%.2f", [goodModel.discount_price floatValue]];
  73. NSMutableAttributedString *dispriceAttr = [[NSMutableAttributedString alloc]initWithString:dis_price];
  74. [dispriceAttr addAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:13]} range:NSMakeRange(0, 3)];
  75. self.discountPriceLabel.attributedText = dispriceAttr;
  76. self.volumeLabel.text = [NSString stringWithFormat:@"月销 %@", goodModel.volume];
  77. self.freePostLabel.text = [goodModel.freeShipping isEqual:@1] ? @"包邮" : [NSString stringWithFormat:@"邮费 %@", goodModel.postage];
  78. }
  79. - (void)initSubviews {
  80. [self addSubview:self.goodTitleLabel];
  81. [self addSubview:self.priceLabel];
  82. [self addSubview:self.discountImageView];
  83. [self addSubview:self.discountPriceLabel];
  84. [self addSubview:self.volumeLabel];
  85. [self addSubview:self.commissionPrice];
  86. [self.discountImageView addSubview:self.quanType];
  87. [self.discountImageView addSubview:self.quanNum];
  88. [self makeSubviewsConstraints];
  89. }
  90. - (void)makeSubviewsConstraints {
  91. [self.goodTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.top.mas_equalTo(Fitsize(20));
  93. make.left.equalTo(self.discountPriceLabel);
  94. make.right.equalTo(self).offset(-FITSIZE(10));
  95. }];
  96. [self.discountPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  97. make.top.mas_equalTo(self.goodTitleLabel.mas_bottom).offset(FITSIZE(10));
  98. make.left.mas_equalTo(FITSIZE(10));
  99. }];
  100. [self.discountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  101. make.left.mas_equalTo(self.discountPriceLabel.mas_right).mas_offset(10);
  102. make.centerY.mas_equalTo(self.discountPriceLabel.mas_centerY);
  103. make.width.mas_equalTo(64);
  104. make.height.mas_equalTo(14);
  105. }];
  106. [self.quanType mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.top.left.bottom.mas_equalTo(0);
  108. make.width.mas_equalTo(20);
  109. }];
  110. [self.quanNum mas_makeConstraints:^(MASConstraintMaker *make) {
  111. make.left.mas_equalTo(20);
  112. make.top.bottom.right.mas_equalTo(0);
  113. }];
  114. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  115. make.left.equalTo(self.discountPriceLabel);
  116. make.top.equalTo(self.discountPriceLabel.mas_bottom).offset(FITSIZE(15));
  117. }];
  118. [self.volumeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  119. make.right.equalTo(self).offset(-FITSIZE(20));
  120. make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
  121. }];
  122. [self.commissionPrice mas_makeConstraints:^(MASConstraintMaker *make) {
  123. make.right.mas_equalTo(self.volumeLabel.mas_right);
  124. make.bottom.mas_equalTo(self.discountPriceLabel.mas_bottom);
  125. }];
  126. }
  127. - (void)couponTapAction:(UIGestureRecognizer *)sender {
  128. if ([self.delegate respondsToSelector:@selector(yh_GoodDetailViewTapCoupon)]) {
  129. [self.delegate yh_GoodDetailViewTapCoupon];
  130. }
  131. }
  132. - (void)shopTapAction:(UIGestureRecognizer *)sender {
  133. if ([self.delegate respondsToSelector:@selector(yh_GoodDetailViewTapShop)]) {
  134. [self.delegate yh_GoodDetailViewTapShop];
  135. }
  136. }
  137. #pragma mark - lazy
  138. - (CCCopyLabel *)goodTitleLabel {
  139. if (!_goodTitleLabel) {
  140. _goodTitleLabel = [[CCCopyLabel alloc] init];
  141. _goodTitleLabel.backgroundColor = [UIColor clearColor];
  142. _goodTitleLabel.textColor = [UIColor YHColorWithHex:0x222222];
  143. _goodTitleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
  144. _goodTitleLabel.numberOfLines = 2;
  145. // _goodTitleLabel.hidden=YES;
  146. }
  147. return _goodTitleLabel;
  148. }
  149. - (UILabel *)priceLabel {
  150. if (!_priceLabel) {
  151. _priceLabel = [[UILabel alloc] init];
  152. _priceLabel.backgroundColor = [UIColor clearColor];
  153. _priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
  154. _priceLabel.font = [UIFont systemFontOfSize:FITSIZE(13)];
  155. }
  156. return _priceLabel;
  157. }
  158. - (UIImageView *)discountImageView {
  159. if (!_discountImageView) {
  160. _discountImageView = [[UIImageView alloc] init];
  161. _discountImageView.backgroundColor = [UIColor clearColor];
  162. _discountImageView.image = [UIImage imageNamed:@"quan_bg"];
  163. }
  164. return _discountImageView;
  165. }
  166. - (UILabel *)discountPriceLabel {
  167. if (!_discountPriceLabel) {
  168. _discountPriceLabel = [[UILabel alloc] init];
  169. _discountPriceLabel.backgroundColor = [UIColor clearColor];
  170. _discountPriceLabel.textColor = [UIColor YHColorWithHex:0xff2420];
  171. _discountPriceLabel.font = [UIFont systemFontOfSize:FITSIZE(22)];
  172. }
  173. return _discountPriceLabel;
  174. }
  175. - (UILabel *)freePostLabel {
  176. if (!_freePostLabel) {
  177. _freePostLabel = [[UILabel alloc] init];
  178. _freePostLabel.backgroundColor = [UIColor clearColor];
  179. _freePostLabel.textColor = [UIColor YHColorWithHex:0x999999];
  180. _freePostLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
  181. }
  182. return _freePostLabel;
  183. }
  184. - (UILabel *)volumeLabel {
  185. if (!_volumeLabel) {
  186. _volumeLabel = [[UILabel alloc] init];
  187. _volumeLabel.backgroundColor = [UIColor clearColor];
  188. _volumeLabel.textColor = [UIColor YHColorWithHex:0x999999];
  189. _volumeLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
  190. }
  191. return _volumeLabel;
  192. }
  193. - (UILabel *)quanType {
  194. if (!_quanType) {
  195. _quanType = [[UILabel alloc] init];
  196. _quanType.textColor = [UIColor baseColor];
  197. _quanType.font = [UIFont boldSystemFontOfSize:10];
  198. _quanType.textAlignment = NSTextAlignmentCenter;
  199. }
  200. return _quanType;
  201. }
  202. - (UILabel *)quanNum {
  203. if (!_quanNum) {
  204. _quanNum = [[UILabel alloc] init];
  205. _quanNum.textColor = [UIColor baseColor];
  206. _quanNum.font = [UIFont boldSystemFontOfSize:10];
  207. _quanNum.textAlignment = NSTextAlignmentCenter;
  208. }
  209. return _quanNum;
  210. }
  211. - (UILabel *)commissionPrice {
  212. if (!_commissionPrice) {
  213. _commissionPrice = [[UILabel alloc] init];
  214. _commissionPrice.textColor = [UIColor homeRedColor];
  215. _commissionPrice.font = [UIFont systemFontOfSize:Fitsize(14)];
  216. _commissionPrice.textAlignment = NSTextAlignmentRight;
  217. _commissionPrice.hidden = YES;
  218. }
  219. return _commissionPrice;
  220. }
  221. -(void)auXRc53Zy6:(UIControl*) auXRc53Zy6 acI7MOugFe2:(UIControlEvents*) acI7MOugFe2 av3U2rD:(UIControl*) av3U2rD ak1VOl:(UIFont*) ak1VOl agAerGo:(UIInputView*) agAerGo akypdgs:(UIEvent*) akypdgs aqYT6:(UIEvent*) aqYT6 a0yQYUKsw3c:(UISearchBar*) a0yQYUKsw3c a2HCrBnfdc:(UIScreen*) a2HCrBnfdc aNEkM54:(UIControlEvents*) aNEkM54 {
  222. NSLog(@"HuBFMbSJhCNsRV");
  223. NSLog(@"vuhJf51A8o0d3g2VkqDQtNijbcnFpGM4erO");
  224. NSLog(@"61IBAiXksNjZM8tpzdyu4elY7nrJOhx");
  225. NSLog(@"0pZmASeIEjlqB51aDJib6k");
  226. NSLog(@"mS0BCs7hjTNJyRGZQKrqDxPi3");
  227. NSLog(@"Hh9pqPtXNKy8jmTvCi6Ya3BMsxU");
  228. NSLog(@"PulOD19B6zciYdKWp8n");
  229. NSLog(@"zevRmpbU7BPrSGhAjlgCQcoqHZ");
  230. NSLog(@"fzXuisWETrLdQx6GFqMlZN");
  231. NSLog(@"Ls8VPIxqruEfaFYCvZUhSW5QgkH9pj");
  232. NSLog(@"Ghgdb64BND0SVnP5moE7tx");
  233. }
  234. -(void)ajXDe0aM7:(UIFontWeight*) ajXDe0aM7 aYzXkFpbnr:(UIView*) aYzXkFpbnr a7BKM2VX:(UIScreen*) a7BKM2VX aEqWHb9xBa:(UIApplication*) aEqWHb9xBa a72h1:(UIBezierPath*) a72h1 apQMdx3riX:(UIEvent*) apQMdx3riX aqaDZr98:(UIScreen*) aqaDZr98 {
  235. NSLog(@"1wsX2quQ0NFlrmDa5V4xtPvbATLpe9JYWU6ghi");
  236. NSLog(@"4vefngaTkYDRZdG0XIoP9zrWL");
  237. NSLog(@"SVC9hvkd5oifRMjyqc43FaXUgzPQ1nl6u7WEHt");
  238. NSLog(@"AinoTVtKl6rhXUydgJaq");
  239. NSLog(@"zkhZWB4QjiwDtc65sr3uPR");
  240. NSLog(@"oIa9Si3rBjFw471pC0mehzYK268D");
  241. NSLog(@"6fziNVncYGqwlr2xp0hvIKS3TEjWb");
  242. NSLog(@"7SGB0ukRWjCAwmXiV9st");
  243. NSLog(@"BlKHhVY84p32LToWf");
  244. NSLog(@"mC7iGM0YzL6Eq9D3T1IcOgXphVkPAZsBvUb");
  245. }
  246. -(void)aUZqJV8:(UIAlertView*) aUZqJV8 aZzw1Sg:(UILabel*) aZzw1Sg azUwnfbZAv:(UIControl*) azUwnfbZAv anRLGf4A:(UIAlertView*) anRLGf4A ayncYgS:(UIViewController*) ayncYgS avh9yKkr:(UIMotionEffect*) avh9yKkr aSuB1WT:(UILabel*) aSuB1WT a52qduDh:(UILabel*) a52qduDh aDMZjyH:(UIApplication*) aDMZjyH aUtcTZsHzb7:(UIImageView*) aUtcTZsHzb7 aWf935vuo:(UIUserInterfaceIdiom*) aWf935vuo {
  247. NSLog(@"7FQM5btq03ew1R8UGV4O2pJ9sZg");
  248. NSLog(@"ghcqUftoTC6dD7a8Senz92Yy");
  249. NSLog(@"Ug6eVlSkRnOpuvQJA8Bt031");
  250. NSLog(@"0Xadl1EAUD564InJhO7BFipRGbm");
  251. NSLog(@"F180rhACaD9HwcZdOvBo42k5");
  252. NSLog(@"xgiahLC0GHVesSYDE");
  253. NSLog(@"8MN2BIobCTVqsRxk4ru7nia51c9yUAgEGQj3thS");
  254. NSLog(@"CNxJQ0Z9DWrE");
  255. NSLog(@"do6ELunrgqyj");
  256. NSLog(@"vbnluFpyRK3SC8N5Yd");
  257. NSLog(@"ZUIAjeHOL7afCRWYMT9bqDm3dwchngkGEXNKVy25");
  258. NSLog(@"iIQTtg6NO98ZljWcJ2VakwGnPeYmdyozCSF47f");
  259. NSLog(@"P7xVJvZ91RpUbtnCkY3BFhXTzK5qWG");
  260. NSLog(@"EWJRknLjIyMGFera6xPNsSQKvVUcw");
  261. }
  262. -(void)ai6YwPCM:(UIDevice*) ai6YwPCM aUCgYyXq0:(UIDevice*) aUCgYyXq0 aJim6HcwU:(UIImageView*) aJim6HcwU al4zcwh:(UIVisualEffectView*) al4zcwh adHejQ3:(UIInputView*) adHejQ3 aaQDI:(UIInputView*) aaQDI aozvEmUZ0:(UIControl*) aozvEmUZ0 aWNfqm:(UIWindow*) aWNfqm a9pLUD:(UISwitch*) a9pLUD a3CG6Tly:(UIControlEvents*) a3CG6Tly axbR8um:(UICollectionView*) axbR8um aKpZkmr:(UIScreen*) aKpZkmr a8xbIPERS5g:(UIColor*) a8xbIPERS5g am0bx9NCFW:(UIDocument*) am0bx9NCFW aGaMEKD4:(UIControlEvents*) aGaMEKD4 a35VQNIh:(UIFont*) a35VQNIh aNA8B7:(UIColor*) aNA8B7 ayZiuTDx:(UIEvent*) ayZiuTDx {
  263. NSLog(@"Fx6NvcqiUHIYaJjG5WsLTMwVpSoOhe0u");
  264. NSLog(@"ZS7WaMpzsLQVN9A1cgd3k");
  265. NSLog(@"xanRkoKOSLZwfpy08hrjz1TP5lQUCbu7cDGBe");
  266. NSLog(@"pL3dHwxYfTQntW");
  267. NSLog(@"jlyhdrtSLPmZ1b5BwNqJCuHIzGanxWs2fU06M");
  268. NSLog(@"uGnavOYIt6oesNPQdgmcEbk");
  269. NSLog(@"whvD6tZkcx4Ffdg0GATmBYCa9n2lK81IeLWNjiU5");
  270. NSLog(@"hqE1oix5YNQUrB07g");
  271. NSLog(@"ZCkYtI7cuj1UDFhdJ2beVBl4LpNm8AvzQ");
  272. NSLog(@"lzPUhBDQR45dkMGKAOIVmvJ7T8fLepgXYSt");
  273. NSLog(@"W7Sz1gQXOnsuj9VkUwYqvLE8r");
  274. NSLog(@"jT4fY3NoFrdhBWJ0zcpRb");
  275. NSLog(@"An4fr0W3XRkxhy2VN1");
  276. NSLog(@"FXum0cxwNo3rLgb4RZJlhCY1895");
  277. NSLog(@"cbTNfQ36yK5PpxGEZurSkBn");
  278. NSLog(@"5ywIYl7u2HS");
  279. NSLog(@"MmCTWFbqkGs7nSIwry4vRjfNe9VaHtiZX");
  280. }
  281. -(void)acGoibE6:(UILabel*) acGoibE6 a26nQBpi:(UILabel*) a26nQBpi ad0ONH:(UIApplication*) ad0ONH aXTMe4tWr8U:(UIScreen*) aXTMe4tWr8U a80iR:(UIFontWeight*) a80iR afwTzqER:(UIButton*) afwTzqER aiUz7625:(UIImageView*) aiUz7625 alL71:(UIKeyCommand*) alL71 afIm2YXq6yV:(UIUserInterfaceIdiom*) afIm2YXq6yV a0dgVe419i:(UIButton*) a0dgVe419i al9BVMZT:(UIView*) al9BVMZT a23Zm:(UIFontWeight*) a23Zm aes0l8JuEG:(UIBarButtonItem*) aes0l8JuEG afhLaK1ljt:(UIWindow*) afhLaK1ljt anxbktJYi8:(UIActivity*) anxbktJYi8 acQwtdi:(UIImageView*) acQwtdi awYpT5nOGy:(UIMenuItem*) awYpT5nOGy aPWQzT:(UIMotionEffect*) aPWQzT arsaAHJuymQ:(UIView*) arsaAHJuymQ {
  282. NSLog(@"H4Lk3tbjrhKAniQz1vOM9foWXGlwNxuY");
  283. NSLog(@"uPmCQ83hUq5W1DZiyFkcxYnArw72ONvV0");
  284. NSLog(@"VeWyu1cMdi0H4bKtJOkBGsX2SrQn");
  285. NSLog(@"yOGjuhLk2tRSlDKrYpX9qnziHNd5fUQ4FJV");
  286. NSLog(@"fCLK234NM1naO9Hd6seuTWjF0pgRlzhVB");
  287. NSLog(@"3CMmuVO0Hl5b8ovwdi7gGyX2T9e6AZpxfFR4NILn");
  288. NSLog(@"TJHsgNhjGi4vQkYe1WfurnBMt5yUpVAXmFECax8");
  289. NSLog(@"mKDtUew9BsbpXxgYi0CuTJrf4");
  290. NSLog(@"UpL4NFS8OlWIQgJBvT9crEx1wP6iXh5nH0M");
  291. NSLog(@"AWlQj9G84yq0umBN6ItgZkdLiEfJYhMXb2o");
  292. NSLog(@"7SjXU91nFCJyrLwq5Yds8cze3BT0EAlmxbfQ2v");
  293. NSLog(@"uS0Fl2rcJDts");
  294. NSLog(@"Yew9c10yZXCfsHNDJvr");
  295. NSLog(@"1Ucus0l8b6BFn2xMqR");
  296. NSLog(@"ZTJLQCF5dGNX760b");
  297. NSLog(@"ulazDFH289h1JMIXwiOBUTrsb47kdC");
  298. NSLog(@"vM1EZJTP8f");
  299. NSLog(@"o82Owesux0Fc61vtHqZPEKGIJBN");
  300. }
  301. @end