// // OrderDetailTableViewCell.m // IBOSSmini // // Created by guan hong hou on 2017/5/25. // Copyright © 2017年 elongtian. All rights reserved. // #import "OrderDetailTableViewCell.h" #import "NSString+Tools.h" #define orderTextFont [UIFont systemFontOfSize:14] @implementation OrderDetailTableViewCell #pragma mark - 公共函数 /** 加载自定义cell函数 */ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.layer.cornerRadius=20; self.layer.backgroundColor=[UIColor redColor].CGColor; self.layer.masksToBounds=YES; } return self; } #pragma mark - 私有函数 /** 初始化cell UI */ -(void)parseOrderInfo:(ShopCartItemModel *)orderItem{ UIView *contentView=[[UIView alloc]init]; contentView.frame=CGRectZero; [self addSubview:contentView]; CGFloat xpadding=10; CGFloat ypadding=10; UILabel *lblTitleCode=[[UILabel alloc]init]; lblTitleCode.frame=CGRectMake(xpadding, ypadding,80,25); lblTitleCode.text=@"商品编码:"; lblTitleCode.font=orderTextFont; [contentView addSubview:lblTitleCode]; _lblCode=[[UILabel alloc]init]; _lblCode.frame=CGRectMake(CGRectGetMaxX(lblTitleCode.frame), ypadding,250, 25); _lblCode.text=orderItem.code; _lblCode.font=orderTextFont; [contentView addSubview:_lblCode]; UILabel *lblTitleOnlyCode=[[UILabel alloc]init]; lblTitleOnlyCode.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleCode.frame)+ypadding,80,25); lblTitleOnlyCode.text=@"唯一编码:"; lblTitleOnlyCode.font=orderTextFont; [contentView addSubview:lblTitleOnlyCode]; _lblOnlyCode=[[UILabel alloc]init]; _lblOnlyCode.text=orderItem.onlyCode; _lblOnlyCode.font=orderTextFont; _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame),CGRectGetMaxY(lblTitleCode.frame)+ypadding ,250,25); [contentView addSubview:_lblOnlyCode]; UILabel *lblTitleBrand=[[UILabel alloc]init]; lblTitleBrand.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleOnlyCode.frame)+ypadding,80,25); lblTitleBrand.font=orderTextFont; lblTitleBrand.text=@"商品品牌:"; lblTitleBrand.font=orderTextFont; [contentView addSubview:lblTitleBrand]; _lblBrandName=[[UILabel alloc]init]; _lblBrandName.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame),CGRectGetMaxY(lblTitleOnlyCode.frame)+ypadding ,250,25); _lblBrandName.text=orderItem.brandName; _lblBrandName.font=orderTextFont; [contentView addSubview:_lblBrandName]; UILabel *lblTitleKind=[[UILabel alloc]init]; lblTitleKind.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleBrand.frame)+ypadding,80,25); lblTitleKind.font=orderTextFont; lblTitleKind.text=@"商品种类:"; lblTitleKind.font=orderTextFont; [contentView addSubview:lblTitleKind]; _lblKindName=[[UILabel alloc]init]; _lblKindName.frame=CGRectMake(CGRectGetMaxX(lblTitleKind.frame),CGRectGetMaxY(lblTitleBrand.frame)+ypadding ,250,25); _lblKindName.text=orderItem.kindName; _lblKindName.font=orderTextFont; [contentView addSubview:_lblKindName]; UILabel *lblTitleVariety =[[UILabel alloc]init]; lblTitleVariety.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleKind.frame)+ypadding,80,25); lblTitleVariety.font=orderTextFont; lblTitleVariety.text=@"商品品种:"; lblTitleVariety.font=orderTextFont; [contentView addSubview:lblTitleVariety]; _lblVarietyName=[[UILabel alloc]init]; _lblVarietyName.frame=CGRectMake(CGRectGetMaxX(lblTitleVariety.frame),CGRectGetMaxY(lblTitleKind.frame)+ypadding ,250,25); _lblVarietyName.text=orderItem.varietyName; _lblVarietyName.font=orderTextFont; [contentView addSubview:_lblVarietyName]; UILabel *lblTitleSeries =[[UILabel alloc]init]; lblTitleSeries.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVariety.frame)+ypadding,80,25); lblTitleSeries.font=orderTextFont; lblTitleSeries.text=@"商品系列:"; lblTitleSeries.font=orderTextFont; [contentView addSubview:lblTitleSeries]; _lblSeriesName=[[UILabel alloc]init]; _lblSeriesName.frame=CGRectMake(CGRectGetMaxX(lblTitleSeries.frame),CGRectGetMaxY(lblTitleVariety.frame)+ypadding ,250,25); _lblSeriesName.text=orderItem.seriesName; _lblSeriesName.font=orderTextFont; [contentView addSubview:_lblSeriesName]; UILabel *lblTitleWarehouse =[[UILabel alloc]init]; lblTitleWarehouse.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSeries.frame)+ypadding,80,25); lblTitleWarehouse.font=orderTextFont; lblTitleWarehouse.text=@"库 区:"; lblTitleWarehouse.font=orderTextFont; [contentView addSubview:lblTitleWarehouse]; _lblWarehouseName=[[UILabel alloc]init]; _lblWarehouseName.frame=CGRectMake(CGRectGetMaxX(lblTitleWarehouse.frame),CGRectGetMaxY(lblTitleSeries.frame)+ypadding ,250,25); _lblWarehouseName.text=orderItem.warehouseName; _lblWarehouseName.font=orderTextFont; [contentView addSubview:_lblWarehouseName]; UILabel *lblTitlePositionNumber =[[UILabel alloc]init]; lblTitlePositionNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding,80,25); lblTitlePositionNumber.font=orderTextFont; lblTitlePositionNumber.text=@"仓 位 号:"; lblTitlePositionNumber.font=orderTextFont; [contentView addSubview:lblTitlePositionNumber]; _lblPositionNumber=[[UILabel alloc]init]; _lblPositionNumber.frame=CGRectMake(CGRectGetMaxX(lblTitlePositionNumber.frame),CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding ,250,25); _lblPositionNumber.text=orderItem.positionNumber; _lblPositionNumber.font=orderTextFont; [contentView addSubview:_lblPositionNumber]; UILabel *lblTitleColorNumber =[[UILabel alloc]init]; lblTitleColorNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding,80,25); lblTitleColorNumber.font=orderTextFont; lblTitleColorNumber.text=@"色 号:"; lblTitleColorNumber.font=orderTextFont; [contentView addSubview:lblTitleColorNumber]; _lblColorNumber=[[UILabel alloc]init]; _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColorNumber.frame),CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding ,250,25); _lblColorNumber.text=orderItem.colorNumber; _lblColorNumber.font=orderTextFont; [contentView addSubview:_lblColorNumber]; UILabel *lblTitleSpecification =[[UILabel alloc]init]; lblTitleSpecification.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding,80,25); lblTitleSpecification.font=orderTextFont; lblTitleSpecification.text=@"规 格:"; lblTitleSpecification.font=orderTextFont; [contentView addSubview:lblTitleSpecification]; _lblSpecification=[[UILabel alloc]init]; _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame),CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding ,250,25); _lblSpecification.text=orderItem.specification; _lblSpecification.font=orderTextFont; [contentView addSubview:_lblSpecification]; UILabel *lblTitleArea =[[UILabel alloc]init]; lblTitleArea.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSpecification.frame)+ypadding,80,25); lblTitleArea.font=orderTextFont; lblTitleArea.text=@"面 积:"; lblTitleArea.font=orderTextFont; [contentView addSubview:lblTitleArea]; _lblAcreage=[[UILabel alloc]init]; _lblAcreage.frame=CGRectMake(CGRectGetMaxX(lblTitleArea.frame),CGRectGetMaxY(lblTitleSpecification.frame)+ypadding ,250,25); _lblAcreage.text=orderItem.acreage; _lblAcreage.font=orderTextFont; [contentView addSubview:_lblAcreage]; UILabel *lblTitleVolume =[[UILabel alloc]init]; lblTitleVolume.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleArea.frame)+ypadding,80,25); lblTitleVolume.font=orderTextFont; lblTitleVolume.text=@"体 积:"; lblTitleVolume.font=orderTextFont; [contentView addSubview:lblTitleVolume]; _lblVolume=[[UILabel alloc]init]; _lblVolume.frame=CGRectMake(CGRectGetMaxX(lblTitleVolume.frame),CGRectGetMaxY(lblTitleArea.frame)+ypadding ,250,25); _lblVolume.text=orderItem.volume; _lblVolume.font=orderTextFont; [contentView addSubview:_lblVolume]; UILabel *lblTitleUnit =[[UILabel alloc]init]; lblTitleUnit.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVolume.frame)+ypadding,80,25); lblTitleUnit.font=orderTextFont; lblTitleUnit.text=@"计量单位:"; lblTitleUnit.font=orderTextFont; [contentView addSubview:lblTitleUnit]; _lblUnitName=[[UILabel alloc]init]; _lblUnitName.frame=CGRectMake(CGRectGetMaxX(lblTitleUnit.frame),CGRectGetMaxY(lblTitleVolume.frame)+ypadding ,250,25); _lblUnitName.text=orderItem.unitName; _lblUnitName.font=orderTextFont; [contentView addSubview:_lblUnitName]; UILabel *lblTitleSalesQuantity =[[UILabel alloc]init]; lblTitleSalesQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleUnit.frame)+ypadding,80,25); lblTitleSalesQuantity.font=orderTextFont; lblTitleSalesQuantity.text=@"数 量:"; lblTitleSalesQuantity.font=orderTextFont; [contentView addSubview:lblTitleSalesQuantity]; _lblSalesQuantity=[[UILabel alloc]init]; _lblSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleSalesQuantity.frame),CGRectGetMaxY(lblTitleUnit.frame)+ypadding ,250,25); _lblSalesQuantity.text=orderItem.salesQuantity; _lblSalesQuantity.font=orderTextFont; [contentView addSubview:_lblSalesQuantity]; UILabel *lblTitleSalesPrice =[[UILabel alloc]init]; lblTitleSalesPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesQuantity.frame)+ypadding,80,25); lblTitleSalesPrice.font=orderTextFont; lblTitleSalesPrice.text=@"商品售价:"; lblTitleSalesPrice.font=orderTextFont; [contentView addSubview:lblTitleSalesPrice]; _lblSalesPrice=[[UILabel alloc]init]; _lblSalesPrice.frame=CGRectMake(CGRectGetMaxX(lblTitleSalesPrice.frame),CGRectGetMaxY(lblTitleSalesQuantity.frame)+ypadding ,250,25); _lblSalesPrice.text=orderItem.salesPrice; _lblSalesPrice.font=orderTextFont; [contentView addSubview:_lblSalesPrice]; UILabel *lblTitleMarkedPrice =[[UILabel alloc]init]; lblTitleMarkedPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesPrice.frame)+ypadding,80,25); lblTitleMarkedPrice.font=orderTextFont; lblTitleMarkedPrice.text=@"商品标价:"; lblTitleMarkedPrice.font=orderTextFont; [contentView addSubview:lblTitleMarkedPrice]; _lblMarkedPrice=[[UILabel alloc]init]; _lblMarkedPrice.frame=CGRectMake(CGRectGetMaxX(lblTitleMarkedPrice.frame),CGRectGetMaxY(lblTitleSalesPrice.frame)+ypadding ,250,25); _lblMarkedPrice.text=orderItem.markedPrice; _lblMarkedPrice.font=orderTextFont; [contentView addSubview:_lblMarkedPrice]; // UILabel *lblTitleRemarks =[[UILabel alloc]init]; // lblTitleRemarks.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleMarkedPrice.frame)+ypadding,80,25); // lblTitleRemarks.font=orderTextFont; // lblTitleRemarks.text=@"备 注:"; // lblTitleRemarks.font=orderTextFont; // [contentView addSubview:lblTitleRemarks]; // _lblRemarks=[[UILabel alloc]init]; // _lblRemarks.frame=CGRectMake(CGRectGetMaxX(lblTitleRemarks.frame),CGRectGetMaxY(lblTitleMarkedPrice.frame)+ypadding ,250,25); // _lblRemarks.text=orderItem.remarks; // _lblRemarks.font=orderTextFont; // [contentView addSubview:_lblRemarks]; contentView.frame=CGRectMake(0, 0,self.frame.size.width,CGRectGetMaxY( lblTitleMarkedPrice.frame)+5); } @end