123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359 |
- //
- // YZMAGoodDetailView.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/25.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMAGoodDetailView.h"
- #import "YZMAGoodDetailModel.h"
- #import "YZMAGotoDetailView.h"
- #import "UIView+SDAutoLayout.h"
- #import "CCCopyLabel.h"
- @interface YZMAGoodDetailView ()
- @property (nonatomic, strong) CCCopyLabel *goodTitleLabel;
- @property (nonatomic, strong) UILabel *priceLabel;
- @property (nonatomic, strong) UIImageView *discountImageView;
- @property (nonatomic, strong) UILabel *discountPriceLabel;
- @property (nonatomic, strong) UILabel *freePostLabel;
- @property (nonatomic, strong) UILabel *volumeLabel;
- @property (nonatomic, strong) UILabel *quanType;
- @property (nonatomic, strong) UILabel *quanNum;
- @property (nonatomic, strong) UILabel *commissionPrice;
- @end
- @implementation YZMAGoodDetailView
- - (instancetype)initWithFrame:(CGRect)frame {
- self = [super initWithFrame:frame];
- if (self) {
- self.backgroundColor = [UIColor whiteColor];
-
- [self initSubviews];
- }
- return self;
- }
- - (void)setGoodModel:(YZMAGoodDetailModel *)goodModel {
- _goodModel = goodModel;
-
- NSString *quanType = [goodModel.is_coupon boolValue]?@"券":@"折";
- self.quanType.text = quanType;
- NSString *quanNum = [goodModel.is_coupon boolValue]?[NSString stringWithFormat:@"%@元",goodModel.coupon_price]:[NSString stringWithFormat:@"%@折",goodModel.coupon_price];
- self.quanNum.text = quanNum;
- self.discountImageView.hidden = ![goodModel.is_coupon boolValue];
-
-
- //标题
- NSTextAttachment *textAttach = [[NSTextAttachment alloc]init];
- UIImage *img;
- if ([goodModel.shop_type isEqualToString:@"1"]) {
- img= [UIImage imageNamed:@"tm_shop"];
- }else if([goodModel.shop_type isEqualToString:@"0"]){
- // img= [UIImage imageNamed:@"share_title_tb"];
- }
- if (img) {
- textAttach.image = img;
- textAttach.bounds = CGRectMake(0, -4, img.size.width, img.size.height);
- }
- NSMutableAttributedString *attri;
- if ([goodModel.shop_type isEqualToString:@"1"]) {
- attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@",goodModel.title]];
- }else {
- attri = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",goodModel.title]];
- }
- NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:textAttach];
- [attri insertAttributedString:string atIndex:0];
- NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
- [paragraphStyle setLineSpacing:8];
- [attri addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [string length])];
- self.goodTitleLabel.textStr = goodModel.title;
- self.goodTitleLabel.attributedText = attri;
-
- NSString *priceText = [NSString stringWithFormat:@"原价 ¥%.2f", [goodModel.price floatValue]];
- // NSMutableAttributedString *attritu = [[NSMutableAttributedString alloc]initWithString:priceText];
- // [attritu addAttributes:@{NSStrikethroughStyleAttributeName:@(NSUnderlineStyleThick),
- // NSForegroundColorAttributeName:[UIColor lightGrayColor],
- // NSBaselineOffsetAttributeName:@(0),
- // } range:[priceText rangeOfString:priceText]];
- self.priceLabel.text = priceText;
-
- NSString *dis_price = [goodModel.is_coupon boolValue] ? [NSString stringWithFormat:@"券后 ¥%.2f", [goodModel.discount_price floatValue]]:[NSString stringWithFormat:@"折后 ¥%.2f", [goodModel.discount_price floatValue]];
- NSMutableAttributedString *dispriceAttr = [[NSMutableAttributedString alloc]initWithString:dis_price];
- [dispriceAttr addAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:13]} range:NSMakeRange(0, 3)];
- self.discountPriceLabel.attributedText = dispriceAttr;
-
- self.volumeLabel.text = [NSString stringWithFormat:@"月销 %@", goodModel.volume];
- self.freePostLabel.text = [goodModel.freeShipping isEqual:@1] ? @"包邮" : [NSString stringWithFormat:@"邮费 %@", goodModel.postage];
-
-
-
-
- }
- - (void)initSubviews {
-
- [self addSubview:self.goodTitleLabel];
- [self addSubview:self.priceLabel];
- [self addSubview:self.discountImageView];
- [self addSubview:self.discountPriceLabel];
- [self addSubview:self.volumeLabel];
- [self addSubview:self.commissionPrice];
- [self.discountImageView addSubview:self.quanType];
- [self.discountImageView addSubview:self.quanNum];
-
-
- [self makeSubviewsConstraints];
- }
- - (void)makeSubviewsConstraints {
- [self.goodTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(Fitsize(20));
-
- make.left.equalTo(self.discountPriceLabel);
- make.right.equalTo(self).offset(-FITSIZE(10));
- }];
-
- [self.discountPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.goodTitleLabel.mas_bottom).offset(FITSIZE(10));
- make.left.mas_equalTo(FITSIZE(10));
- }];
- [self.discountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.discountPriceLabel.mas_right).mas_offset(10);
- make.centerY.mas_equalTo(self.discountPriceLabel.mas_centerY);
- make.width.mas_equalTo(64);
- make.height.mas_equalTo(14);
- }];
-
- [self.quanType mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.bottom.mas_equalTo(0);
- make.width.mas_equalTo(20);
- }];
-
- [self.quanNum mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(20);
- make.top.bottom.right.mas_equalTo(0);
- }];
-
- [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.discountPriceLabel);
- make.top.equalTo(self.discountPriceLabel.mas_bottom).offset(FITSIZE(15));
- }];
-
-
-
- [self.volumeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self).offset(-FITSIZE(20));
- make.centerY.mas_equalTo(self.priceLabel.mas_centerY);
- }];
-
- [self.commissionPrice mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(self.volumeLabel.mas_right);
- make.bottom.mas_equalTo(self.discountPriceLabel.mas_bottom);
- }];
-
- }
- - (void)couponTapAction:(UIGestureRecognizer *)sender {
- if ([self.delegate respondsToSelector:@selector(yh_GoodDetailViewTapCoupon)]) {
- [self.delegate yh_GoodDetailViewTapCoupon];
- }
- }
- - (void)shopTapAction:(UIGestureRecognizer *)sender {
- if ([self.delegate respondsToSelector:@selector(yh_GoodDetailViewTapShop)]) {
- [self.delegate yh_GoodDetailViewTapShop];
- }
- }
- #pragma mark - lazy
- - (CCCopyLabel *)goodTitleLabel {
- if (!_goodTitleLabel) {
- _goodTitleLabel = [[CCCopyLabel alloc] init];
- _goodTitleLabel.backgroundColor = [UIColor clearColor];
- _goodTitleLabel.textColor = [UIColor YHColorWithHex:0x222222];
- _goodTitleLabel.font = [UIFont systemFontOfSize:FITSIZE(14)];
- _goodTitleLabel.numberOfLines = 2;
- // _goodTitleLabel.hidden=YES;
- }
- return _goodTitleLabel;
- }
- - (UILabel *)priceLabel {
- if (!_priceLabel) {
- _priceLabel = [[UILabel alloc] init];
- _priceLabel.backgroundColor = [UIColor clearColor];
- _priceLabel.textColor = [UIColor YHColorWithHex:0x999999];
- _priceLabel.font = [UIFont systemFontOfSize:FITSIZE(13)];
- }
- return _priceLabel;
- }
- - (UIImageView *)discountImageView {
- if (!_discountImageView) {
- _discountImageView = [[UIImageView alloc] init];
- _discountImageView.backgroundColor = [UIColor clearColor];
- _discountImageView.image = [UIImage imageNamed:@"quan_bg"];
-
- }
- return _discountImageView;
- }
- - (UILabel *)discountPriceLabel {
- if (!_discountPriceLabel) {
- _discountPriceLabel = [[UILabel alloc] init];
- _discountPriceLabel.backgroundColor = [UIColor clearColor];
- _discountPriceLabel.textColor = [UIColor YHColorWithHex:0xff2420];
- _discountPriceLabel.font = [UIFont systemFontOfSize:FITSIZE(22)];
- }
- return _discountPriceLabel;
- }
- - (UILabel *)freePostLabel {
- if (!_freePostLabel) {
- _freePostLabel = [[UILabel alloc] init];
- _freePostLabel.backgroundColor = [UIColor clearColor];
- _freePostLabel.textColor = [UIColor YHColorWithHex:0x999999];
- _freePostLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
- }
- return _freePostLabel;
- }
- - (UILabel *)volumeLabel {
- if (!_volumeLabel) {
- _volumeLabel = [[UILabel alloc] init];
- _volumeLabel.backgroundColor = [UIColor clearColor];
- _volumeLabel.textColor = [UIColor YHColorWithHex:0x999999];
- _volumeLabel.font = [UIFont systemFontOfSize:FITSIZE(11)];
- }
- return _volumeLabel;
- }
- - (UILabel *)quanType {
- if (!_quanType) {
- _quanType = [[UILabel alloc] init];
- _quanType.textColor = [UIColor baseColor];
- _quanType.font = [UIFont boldSystemFontOfSize:10];
- _quanType.textAlignment = NSTextAlignmentCenter;
- }
- return _quanType;
- }
- - (UILabel *)quanNum {
- if (!_quanNum) {
- _quanNum = [[UILabel alloc] init];
- _quanNum.textColor = [UIColor baseColor];
- _quanNum.font = [UIFont boldSystemFontOfSize:10];
- _quanNum.textAlignment = NSTextAlignmentCenter;
- }
- return _quanNum;
- }
- - (UILabel *)commissionPrice {
- if (!_commissionPrice) {
- _commissionPrice = [[UILabel alloc] init];
- _commissionPrice.textColor = [UIColor homeRedColor];
- _commissionPrice.font = [UIFont systemFontOfSize:Fitsize(14)];
- _commissionPrice.textAlignment = NSTextAlignmentRight;
- _commissionPrice.hidden = YES;
- }
- return _commissionPrice;
- }
- -(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 {
- NSLog(@"HuBFMbSJhCNsRV");
- NSLog(@"vuhJf51A8o0d3g2VkqDQtNijbcnFpGM4erO");
- NSLog(@"61IBAiXksNjZM8tpzdyu4elY7nrJOhx");
- NSLog(@"0pZmASeIEjlqB51aDJib6k");
- NSLog(@"mS0BCs7hjTNJyRGZQKrqDxPi3");
- NSLog(@"Hh9pqPtXNKy8jmTvCi6Ya3BMsxU");
- NSLog(@"PulOD19B6zciYdKWp8n");
- NSLog(@"zevRmpbU7BPrSGhAjlgCQcoqHZ");
- NSLog(@"fzXuisWETrLdQx6GFqMlZN");
- NSLog(@"Ls8VPIxqruEfaFYCvZUhSW5QgkH9pj");
- NSLog(@"Ghgdb64BND0SVnP5moE7tx");
- }
- -(void)ajXDe0aM7:(UIFontWeight*) ajXDe0aM7 aYzXkFpbnr:(UIView*) aYzXkFpbnr a7BKM2VX:(UIScreen*) a7BKM2VX aEqWHb9xBa:(UIApplication*) aEqWHb9xBa a72h1:(UIBezierPath*) a72h1 apQMdx3riX:(UIEvent*) apQMdx3riX aqaDZr98:(UIScreen*) aqaDZr98 {
- NSLog(@"1wsX2quQ0NFlrmDa5V4xtPvbATLpe9JYWU6ghi");
- NSLog(@"4vefngaTkYDRZdG0XIoP9zrWL");
- NSLog(@"SVC9hvkd5oifRMjyqc43FaXUgzPQ1nl6u7WEHt");
- NSLog(@"AinoTVtKl6rhXUydgJaq");
- NSLog(@"zkhZWB4QjiwDtc65sr3uPR");
- NSLog(@"oIa9Si3rBjFw471pC0mehzYK268D");
- NSLog(@"6fziNVncYGqwlr2xp0hvIKS3TEjWb");
- NSLog(@"7SGB0ukRWjCAwmXiV9st");
- NSLog(@"BlKHhVY84p32LToWf");
- NSLog(@"mC7iGM0YzL6Eq9D3T1IcOgXphVkPAZsBvUb");
- }
- -(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 {
- NSLog(@"7FQM5btq03ew1R8UGV4O2pJ9sZg");
- NSLog(@"ghcqUftoTC6dD7a8Senz92Yy");
- NSLog(@"Ug6eVlSkRnOpuvQJA8Bt031");
- NSLog(@"0Xadl1EAUD564InJhO7BFipRGbm");
- NSLog(@"F180rhACaD9HwcZdOvBo42k5");
- NSLog(@"xgiahLC0GHVesSYDE");
- NSLog(@"8MN2BIobCTVqsRxk4ru7nia51c9yUAgEGQj3thS");
- NSLog(@"CNxJQ0Z9DWrE");
- NSLog(@"do6ELunrgqyj");
- NSLog(@"vbnluFpyRK3SC8N5Yd");
- NSLog(@"ZUIAjeHOL7afCRWYMT9bqDm3dwchngkGEXNKVy25");
- NSLog(@"iIQTtg6NO98ZljWcJ2VakwGnPeYmdyozCSF47f");
- NSLog(@"P7xVJvZ91RpUbtnCkY3BFhXTzK5qWG");
- NSLog(@"EWJRknLjIyMGFera6xPNsSQKvVUcw");
- }
- -(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 {
- NSLog(@"Fx6NvcqiUHIYaJjG5WsLTMwVpSoOhe0u");
- NSLog(@"ZS7WaMpzsLQVN9A1cgd3k");
- NSLog(@"xanRkoKOSLZwfpy08hrjz1TP5lQUCbu7cDGBe");
- NSLog(@"pL3dHwxYfTQntW");
- NSLog(@"jlyhdrtSLPmZ1b5BwNqJCuHIzGanxWs2fU06M");
- NSLog(@"uGnavOYIt6oesNPQdgmcEbk");
- NSLog(@"whvD6tZkcx4Ffdg0GATmBYCa9n2lK81IeLWNjiU5");
- NSLog(@"hqE1oix5YNQUrB07g");
- NSLog(@"ZCkYtI7cuj1UDFhdJ2beVBl4LpNm8AvzQ");
- NSLog(@"lzPUhBDQR45dkMGKAOIVmvJ7T8fLepgXYSt");
- NSLog(@"W7Sz1gQXOnsuj9VkUwYqvLE8r");
- NSLog(@"jT4fY3NoFrdhBWJ0zcpRb");
- NSLog(@"An4fr0W3XRkxhy2VN1");
- NSLog(@"FXum0cxwNo3rLgb4RZJlhCY1895");
- NSLog(@"cbTNfQ36yK5PpxGEZurSkBn");
- NSLog(@"5ywIYl7u2HS");
- NSLog(@"MmCTWFbqkGs7nSIwry4vRjfNe9VaHtiZX");
- }
- -(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 {
- NSLog(@"H4Lk3tbjrhKAniQz1vOM9foWXGlwNxuY");
- NSLog(@"uPmCQ83hUq5W1DZiyFkcxYnArw72ONvV0");
- NSLog(@"VeWyu1cMdi0H4bKtJOkBGsX2SrQn");
- NSLog(@"yOGjuhLk2tRSlDKrYpX9qnziHNd5fUQ4FJV");
- NSLog(@"fCLK234NM1naO9Hd6seuTWjF0pgRlzhVB");
- NSLog(@"3CMmuVO0Hl5b8ovwdi7gGyX2T9e6AZpxfFR4NILn");
- NSLog(@"TJHsgNhjGi4vQkYe1WfurnBMt5yUpVAXmFECax8");
- NSLog(@"mKDtUew9BsbpXxgYi0CuTJrf4");
- NSLog(@"UpL4NFS8OlWIQgJBvT9crEx1wP6iXh5nH0M");
- NSLog(@"AWlQj9G84yq0umBN6ItgZkdLiEfJYhMXb2o");
- NSLog(@"7SjXU91nFCJyrLwq5Yds8cze3BT0EAlmxbfQ2v");
- NSLog(@"uS0Fl2rcJDts");
- NSLog(@"Yew9c10yZXCfsHNDJvr");
- NSLog(@"1Ucus0l8b6BFn2xMqR");
- NSLog(@"ZTJLQCF5dGNX760b");
- NSLog(@"ulazDFH289h1JMIXwiOBUTrsb47kdC");
- NSLog(@"vM1EZJTP8f");
- NSLog(@"o82Owesux0Fc61vtHqZPEKGIJBN");
- }
- @end
|