| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- //
- // SalesOutStorageGoodsListCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/17.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "SalesOutStorageGoodsListCell.h"
- @implementation SalesOutStorageGoodsListCell
- #pragma mark 公共函数
- /**
- 加载 cell
- @param style <#style description#>
- @param reuseIdentifier <#reuseIdentifier description#>
- @return <#return value description#>
- */
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-
- return self;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- }
- #pragma mark 私有函数
- /**
- 初始化cell UI和数据
- @param salesOutStorageGoodsListModel <#salesOutStorageGoodsListModel description#>
- */
- - (void)setSalesOutStorageGoodsListModel:(SalesOutStorageSalesSlipGoodsListModel *)salesOutStorageGoodsListModel{
- if(salesOutStorageGoodsListModel==nil){
- return;
- }
- _goodsListModel=salesOutStorageGoodsListModel;
- CGFloat heightLine = 1;
- CGFloat heightRow = 40;
- CGFloat lblx = 20;
- CGFloat lbly = 8;
- CGFloat lblwidth = 70;
- CGFloat lblheight = 25;
- CGFloat valuey = 8;
- CGFloat valueheight = 25;
-
- UIView *vSalesNo = [UIView new];
- vSalesNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
- [self.contentView addSubview:vSalesNo];
- UILabel *lblSalesNoTitle = [UILabel new];
- lblSalesNoTitle.frame=CGRectMake(lblx, lbly,lblwidth, lblheight);
- lblSalesNoTitle.text=@"销售单号:";
- lblSalesNoTitle.textColor = [UIColor blackColor];
- lblSalesNoTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSalesNo addSubview:lblSalesNoTitle];
-
- _lblSalesNo=[[UILabel alloc]init];
- _lblSalesNo.frame=CGRectMake(CGRectGetMaxX(lblSalesNoTitle.frame)+10, lbly,Screen_Width-CGRectGetMaxX(lblSalesNoTitle.frame)-10, valueheight);
- _lblSalesNo.textColor = [UIColor blackColor];
- _lblSalesNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _lblSalesNo.text=_goodsListModel.salesNo;
- [vSalesNo addSubview:_lblSalesNo];
- //分割线
- _topSeparator= [UIView new];
- _topSeparator.frame = CGRectMake(0, CGRectGetMaxY(vSalesNo.frame), Screen_Width, heightLine);
-
- [self.contentView addSubview:_topSeparator];
- UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
- btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
- [_topSeparator addSubview:btnLine];
-
- UIView *vGoodsName = [UIView new];
- vGoodsName.frame=CGRectMake(0,CGRectGetMaxY(_topSeparator.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vGoodsName];
- _btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];
- _btnCheck.frame=CGRectMake(lblx,valuey, 25, 25);
- [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
- [vGoodsName addSubview:_btnCheck];
-
- _lblGoodsName = [UILabel new];
- _lblGoodsName.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+10, valuey, Screen_Width-CGRectGetMaxX(_btnCheck.frame), valueheight);
- _lblGoodsName.textColor = [UIColor blackColor];
- _lblGoodsName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsName addSubview:_lblGoodsName];
- _lblGoodsName.text = _goodsListModel.goodsName;
-
- _middleSeparator1= [UIView new];
- _middleSeparator1.frame = CGRectMake(0, CGRectGetMaxY(vGoodsName.frame), Screen_Width, heightLine);
- [_middleSeparator1 setBackgroundColor:LineBackgroundColor];
- [self.contentView addSubview:_middleSeparator1];
-
- //商品编码
- UIView *vGoodsCode = [UIView new];
- vGoodsCode.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparator1.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vGoodsCode];
-
- UILabel *lblGoodsCodeTitle=[UILabel new];
- lblGoodsCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblGoodsCodeTitle.text=@"商品编码:";
- lblGoodsCodeTitle.textColor = [UIColor blackColor];
- lblGoodsCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:lblGoodsCodeTitle];
- _lblGoodsCode = [UILabel new];
- _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblGoodsCodeTitle.frame), valueheight);
- _lblGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vGoodsCode addSubview:_lblGoodsCode];
- _lblGoodsCode.text = _goodsListModel.goodsCode;
-
- //唯一编码
- UIView *vOnlyCode = [UIView new];
- vOnlyCode.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_middleSeparator1.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vOnlyCode];
-
- UILabel *lblOnlyCodeTitle=[UILabel new];
- lblOnlyCodeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblOnlyCodeTitle.text=@"唯一编码:";
- lblOnlyCodeTitle.textColor = [UIColor blackColor];
- lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:lblOnlyCodeTitle];
- _lblOnlyCode= [UILabel new];
- _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOnlyCode addSubview:_lblOnlyCode];
- _lblOnlyCode.text = _goodsListModel.onlyCode;
-
-
- //销售价格
- UIView *vSalesPrice = [UIView new];
- vSalesPrice.frame=CGRectMake(0, CGRectGetMaxY(vGoodsCode.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vSalesPrice];
-
- UILabel *lblSalesPriceTitle=[UILabel new];
- lblSalesPriceTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblSalesPriceTitle.text=@"销售价格:";
- lblSalesPriceTitle.textColor = [UIColor blackColor];
- lblSalesPriceTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSalesPrice addSubview:lblSalesPriceTitle];
- _lblSalesPrice = [UILabel new];
- _lblSalesPrice.frame=CGRectMake(CGRectGetMaxX(lblSalesPriceTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblSalesPriceTitle.frame), valueheight);
- _lblSalesPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSalesPrice addSubview:_lblSalesPrice];
- _lblSalesPrice.text = _goodsListModel.salesPrice;
-
- UIView *vSalesQuantity= [UIView new];
- vSalesQuantity.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vGoodsCode.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vSalesQuantity];
-
- UILabel *lblSalesQuantityTitle=[UILabel new];
- lblSalesQuantityTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblSalesQuantityTitle.text=@"销售数量:";
- lblSalesQuantityTitle.textColor = [UIColor blackColor];
- lblSalesQuantityTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSalesQuantity addSubview:lblSalesQuantityTitle];
- _lblSalesQuantity= [UILabel new];
- _lblSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSalesQuantity addSubview:_lblSalesQuantity];
- _lblSalesQuantity.text = _goodsListModel.salesQuantity;
- // 规格
- UIView *vSpecification= [UIView new];
- vSpecification.frame=CGRectMake(0, CGRectGetMaxY(vSalesPrice.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vSpecification];
- UILabel *lblSpecificationTitle=[UILabel new];
- lblSpecificationTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblSpecificationTitle.text=@"规 格:";
- lblSpecificationTitle.textColor = [UIColor blackColor];
- lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:lblSpecificationTitle];
- _lblSpecification = [UILabel new];
- _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblSpecificationTitle.frame), valueheight);
- _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSpecification addSubview:_lblSpecification];
- _lblSpecification.text = _goodsListModel.goodsSpecification;
-
- UIView *vColorNumber= [UIView new];
- vColorNumber.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vSalesPrice.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vColorNumber];
-
- UILabel *lblColorNumberTitle=[UILabel new];
- lblColorNumberTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblColorNumberTitle.text=@"色 号:";
- lblColorNumberTitle.textColor = [UIColor blackColor];
- lblColorNumberTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vColorNumber addSubview:lblColorNumberTitle];
- _lblColorNumber= [UILabel new];
- _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblColorNumberTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vColorNumber addSubview:_lblColorNumber];
- _lblColorNumber.text = _goodsListModel.colorNumber;
-
- UIView *vBrand= [UIView new];
- vBrand.frame=CGRectMake(0, CGRectGetMaxY(vSpecification.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vBrand];
- UILabel *lblBrandTitle=[UILabel new];
- lblBrandTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblBrandTitle.text=@"品 牌:";
- lblBrandTitle.textColor = [UIColor blackColor];
- lblBrandTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:lblBrandTitle];
- _lblBrand = [UILabel new];
- _lblBrand.frame=CGRectMake(CGRectGetMaxX(lblBrandTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblBrandTitle.frame), valueheight);
- _lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vBrand addSubview:_lblBrand];
- _lblBrand.text = _goodsListModel.brandName;
-
- _middleSeparator2= [UIView new];
- _middleSeparator2.frame = CGRectMake(0, CGRectGetMaxY(vBrand.frame), Screen_Width, heightLine);
- [_middleSeparator2 setBackgroundColor:LineBackgroundColor];
- [self.contentView addSubview:_middleSeparator2];
- _btnMoreInfo = [UIButton buttonWithType:UIButtonTypeCustom];
- [_btnMoreInfo setTitle:@"更多信息" forState:UIControlStateNormal];
- [_btnMoreInfo setTitleColor:LabelGrayTextColor forState:UIControlStateNormal];
- _btnMoreInfo.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
- _btnMoreInfo.layer.borderWidth = 0.0f;//设置边框颜色
- _btnMoreInfo.frame = CGRectMake(Screen_Width-70-8 ,CGRectGetMaxY(_middleSeparator2.frame)+10 , 70, valueheight);
- [_btnMoreInfo addTarget:self action:@selector(btnGoMoreInfo) forControlEvents:UIControlEventTouchUpInside];
- [self.contentView addSubview:_btnMoreInfo];
-
- _bottomSeparator= [UIView new];
- _bottomSeparator.frame = CGRectMake(0, CGRectGetMaxY(_btnMoreInfo.frame)+10, Screen_Width,10);
- [_bottomSeparator setBackgroundColor:LineBackgroundColor];
- [self.contentView addSubview:_bottomSeparator];
-
-
-
- }
- /**
- 选中checkbox
- */
- -(void)btnGoCheck
- {
- if([self.checkDelegate respondsToSelector:@selector(btnCheckPressed:)])
- {
- [self.checkDelegate btnCheckPressed:_cellIndex];
-
- }
- }
- /**
- 跳转到更多信息
- */
- -(void)btnGoMoreInfo{
- if([self.checkDelegate respondsToSelector:@selector(goMoreInfo:)])
- {
- [self.checkDelegate goMoreInfo:_goodsListModel];
-
- }
- }
- /**
- 设置checkbox背景图片
- @param checked <#checked description#>
- */
- - (void) setCheckBackground: (BOOL) checked
- {
- if(!checked)
- {
-
- [_btnCheck setImage:[UIImage imageNamed:@"uncheck_round"] forState:UIControlStateNormal];
-
-
- }
- else
- {
-
- [_btnCheck setImage:[UIImage imageNamed:@"check_round"] forState:UIControlStateNormal];
-
- }
- }
- @end
|