123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- //
- // KDPDetailGoodInformationView.m
- // KuDianProject
- //
- // Created by 学丽 on 2019/7/9.
- // Copyright © 2019 KDP. All rights reserved.
- //
- #import "KDPDetailGoodInformationView.h"
- @implementation KDPDetailGoodInformationView
- -(instancetype)initWithFrame:(CGRect)frame
- {
- self=[super initWithFrame:frame];
- if (self) {
-
- self.imgView=[[SDCycleScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 395+KDStatusHeight)];
- self.imgView.backgroundColor=[UIColor colorWithHexString:LineColor];
- [self addSubview:self.imgView];
-
- UIView*backV=[[UIView alloc]initWithFrame:CGRectMake(0, self.imgView.height-50, SCREEN_WIDTH, 50)];
- backV.backgroundColor=[UIColor colorWithHexString:@"#444444"];
- [self addSubview:backV];
-
-
-
- // self.shopImgV=[[UIImageView alloc]initWithFrame:CGRectMake(10, self.imgView.bottom+14, 20, 20)];
- // self.shopImgV.image=[UIImage imageNamed:@"taobao_icon"];
- // [self addSubview:self.shopImgV];
-
- self.detailTitleL=[[UILabel alloc]initWithFrame:CGRectMake(10, self.imgView.bottom+14, SCREEN_WIDTH-20, 42)];
- self.detailTitleL.numberOfLines=0;
- self.detailTitleL.attributedText=[KDPublicMethod sethanggaoWithStr:@" -------" linSpacing:4];
- self.detailTitleL.textColor=[UIColor blackColor];
- self.detailTitleL.font=[UIFont systemFontOfSize:15];
- [self addSubview:self.detailTitleL];
-
-
- self.priceL=[[UILabel alloc]initWithFrame:CGRectMake(10, 0, 300, 50)];
- self.priceL.textColor=[UIColor whiteColor];
- self.priceL.font=[UIFont boldSystemFontOfSize:25];
- self.priceL.text=@"¥--";
-
- [backV addSubview:self.priceL];
- [self.priceL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(50);
- make.left.mas_equalTo(10);
- make.top.mas_equalTo(0);
- }];
-
- self.originalLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.priceL.right+10, 0, 100, 50)];
- self.originalLabel.textColor=[UIColor whiteColor];
- self.originalLabel.font=[UIFont systemFontOfSize:10];
- [backV addSubview:self.originalLabel];
- [self.originalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(self.priceL.mas_right).offset(5);
- make.height.mas_equalTo(45);
- make.top.mas_equalTo(5);
- }];
- self.profitsLabel=[[UILabel alloc]initWithFrame:CGRectMake(backV.width-88, 11, 78, 28)];
- [self addSubview:self.profitsLabel];
-
- CGFloat heishgt=self.detailTitleL.bottom+5;
- [self.profitsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(heishgt);
- make.right.mas_equalTo(-10);
- make.height.mas_equalTo(28);
- }];
- self.profitsLabel.text=@"利润 --%";
- self.profitsLabel.textColor=[UIColor whiteColor];
- self.profitsLabel.font=[UIFont systemFontOfSize:16];
- self.profitsLabel.backgroundColor=[UIColor gradientOneColor:[UIColor colorWithHexString:@"#FF235F"] toColor:[UIColor colorWithHexString:@"#FF7676"] Width:150];
- self.profitsLabel.layer.cornerRadius=6;
- self.profitsLabel.layer.masksToBounds=YES;
- self.profitsLabel.textAlignment=NSTextAlignmentCenter;
-
- //原件
- NSString *textStr =@"¥---";
-
- //中划线
- NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
- NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic];
- self.originalLabel.attributedText=attribtStr;
-
- self.volumeL=[[UILabel alloc]initWithFrame:CGRectMake(self.detailTitleL.left, self.detailTitleL.bottom+10, 60, 16)];
- self.volumeL.textAlignment=NSTextAlignmentLeft;
- self.volumeL.text=@"月销:--";
- self.volumeL.textColor=[UIColor colorWithHexString:@"#a9a9a9"];
- self.volumeL.font=[UIFont systemFontOfSize:10];
- [self addSubview:self.volumeL];
-
-
- [backV addSubview:self.couponImgV];
-
- [self.couponImgV addSubview:self.couponPriceL];
- self.couponImgV.frame=CGRectMake(backV.width-70, 17, 60, 16);
- self.couponPriceL.frame=CGRectMake(20, 0, 40, 16);
-
-
- UIView *lineV=[[UIView alloc]init];
- lineV.tag=1000;
- lineV.backgroundColor=[UIColor colorWithHexString:LineColor];
- [self addSubview:lineV];
- [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.top.mas_equalTo(self.mas_bottom).offset(-5);
- make.height.mas_equalTo(5);
- }];
- }
- return self;
- }
- -(void)setModel:(KDPGoodsModel *)model
- {
- _model=model;
- if (model.title.length<=0) {
- return;
- }
- self.detailTitleL.attributedText=[KDPublicMethod sethanggaoWithStr:[NSString stringWithFormat:@"%@",model.title] linSpacing:5];
-
- self.volumeL.text=[NSString stringWithFormat:@"月销 %@",model.volume];
-
- NSString *timetitle= [NSString stringWithFormat:@" 利润 %@ ",model.commission_rate];
-
- NSMutableAttributedString *timestr = [[NSMutableAttributedString alloc] initWithString:timetitle];
- [timestr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:12] range:NSMakeRange(0,4)]; //设置字体
- self.profitsLabel.attributedText=timestr;
-
- self.priceL.text=[NSString stringWithFormat:@"¥%@",model.discount_price];
-
- //原价
- NSString *textStr =[NSString stringWithFormat:@"¥%@",model.price];
- //中划线
- NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
- NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic];
- self.originalLabel.attributedText=attribtStr;
-
-
- NSMutableArray *array =[NSMutableArray array];
- [array addObject:model.img];
- [array addObjectsFromArray:model.small_img];
- self.imgView.imageURLStringsGroup=array;
- if (model.coupon_price.floatValue>0) {
- self.couponImgV.hidden=NO;
- self.couponPriceL.text=model.coupon_price;
- }else{
- self.couponImgV.hidden=YES;
- }
- UIView *lineV=[self viewWithTag:1000];
- if (model.goods_point.length>0) {
-
- lineV.hidden=YES;
- }else{
- lineV.hidden=NO;
- }
-
- }
- -(UIImageView *)couponImgV
- {
- if (!_couponImgV) {
- _couponImgV=[[UIImageView alloc]init];
- _couponImgV.image=[UIImage imageNamed:@"coupon_icon"];
-
- UILabel *quanL=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 20, 16)];
- quanL.text=@"券";
- quanL.font=[UIFont systemFontOfSize:12];
- quanL.textColor=[UIColor whiteColor];
- quanL.textAlignment=NSTextAlignmentCenter;
- [_couponImgV addSubview:quanL];
-
- }
- return _couponImgV;
- }
- -(UILabel *)couponPriceL
- {
- if (!_couponPriceL) {
- _couponPriceL=[[UILabel alloc]init];
- _couponPriceL.text=@"---";
- _couponPriceL.textColor=[UIColor colorWithHexString:ThemeColor];
- _couponPriceL.font=[UIFont systemFontOfSize:12];
- _couponPriceL.textAlignment=NSTextAlignmentCenter;
-
- }
- return _couponPriceL;
- }
- -(void)exitclickButton
- {
- if (self.returnBlock) {
- self.returnBlock();
- }
- }
- @end
|