// // OrderSearchFrame.m // IBOSSmini // // Created by guan hong hou on 2017/5/16. // Copyright © 2017年 elongtian. All rights reserved. // #import "OrderSearchFrame.h" #import "NSString+Tools.h" @implementation OrderSearchFrame -(void)setOrderSearchModel:(GoodsSearchItemModel *)searchItem{ _searchModel=searchItem; CGFloat xpadding =10; CGFloat ypadding =10; NSDictionary *orderDict = @{NSFontAttributeName:orderTextFont}; NSString *productCode= [_searchModel code]; CGRect productCodeFrame = [productCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict]; productCodeFrame.origin.x =xpadding; productCodeFrame.origin.y = ypadding; _productCodeF = productCodeFrame; NSString *inventoryId= [_searchModel inventoryID]; if(inventoryId!=nil){ CGRect inventoryIdFrame = [inventoryId textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict]; inventoryIdFrame.origin.x =CGRectGetMaxX(_productCodeF)+10; inventoryIdFrame.origin.y = ypadding; _inventoryIdF = inventoryIdFrame; } _substractBtnF=CGRectMake(Screen_Width/2, ypadding,25,25); _salesQuantityF=CGRectMake(CGRectGetMaxX(_substractBtnF)-1,ypadding,50, 25); _addBtnF=CGRectMake(CGRectGetMaxX(_salesQuantityF)-1, ypadding, 25, 25); _joinCartBtnF=CGRectMake(Screen_Width-50, ypadding, 39, 28); _middleSeparatorF=CGRectMake(0, CGRectGetMaxY(_joinCartBtnF)+10,Screen_Width,1); NSString *titleBrand=@"品牌:"; CGRect titleBrandFrame = [titleBrand textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict]; titleBrandFrame.origin.x =xpadding+5; titleBrandFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10; _titleBrandF=titleBrandFrame; NSString *brand=[_searchModel brandName]; if(brand!=nil){ CGRect brandFrame = [brand textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict]; brandFrame.origin.x =CGRectGetMaxX(_titleBrandF)+8; brandFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10; _brandF=brandFrame; } NSString *titleOnlyCode=@"唯一编码:"; CGRect titleOnlyCodeFrame = [titleOnlyCode textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:orderDict]; titleOnlyCodeFrame.origin.x =Screen_Width/2; titleOnlyCodeFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10; _titleOnlyCodeF=titleOnlyCodeFrame; NSString *onlyCode=[_searchModel onlyCode]; if(onlyCode!=nil){ CGRect onlyCodeFrame = [onlyCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict]; onlyCodeFrame.origin.x =CGRectGetMaxX(_titleOnlyCodeF)+8; onlyCodeFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10; _onlyCodeF=onlyCodeFrame; } NSString *titleColorNumber=@"色号:"; CGRect titleColorNumberFrame = [titleColorNumber textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict]; titleColorNumberFrame.origin.x =xpadding+5; titleColorNumberFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _titleColorNumberF=titleColorNumberFrame; NSString *colorNumber=[_searchModel colorNumber]; if(colorNumber!=nil){ CGRect colorNumberFrame = [colorNumber textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict]; colorNumberFrame.origin.x =CGRectGetMaxX(_titleColorNumberF); colorNumberFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _colorNumberF=colorNumberFrame; } NSString *titleSpecification=@"规格:"; CGRect titleSpecificationFrame = [titleSpecification textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict]; titleSpecificationFrame.origin.x =Screen_Width/3; titleSpecificationFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _titleSpecificationF=titleSpecificationFrame; NSString *specification=[_searchModel specification]; if(specification!=nil){ CGRect specificationFrame = [specification textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict]; specificationFrame.origin.x =CGRectGetMaxX(_titleSpecificationF); specificationFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _specificationF=specificationFrame; } NSString *titleLevel=@"等级:"; CGRect titleLevelFrame = [titleLevel textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict]; titleLevelFrame.origin.x =(Screen_Width/3)*2; titleLevelFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _titleLevelF= titleLevelFrame; NSString *level= [_searchModel gradeName]; if(level!=nil){ CGRect levelFrame = [level textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict]; levelFrame.origin.x =CGRectGetMaxX(_titleLevelF)+8; levelFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10; _levelF= levelFrame; } NSString *titleWarehouseArea=@"库区:"; CGRect titleWarehouseAreaFrame = [titleWarehouseArea textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict]; titleWarehouseAreaFrame.origin.x =xpadding+5;; titleWarehouseAreaFrame.origin.y = CGRectGetMaxY(_titleColorNumberF)+10; _titleWarehouseAreaF= titleWarehouseAreaFrame; NSString *warehouseArea= [_searchModel warehouseName]; if(warehouseArea!=nil){ CGRect warehouseAreaFrame = [warehouseArea textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:orderDict]; warehouseAreaFrame.origin.x =CGRectGetMaxX( titleWarehouseAreaFrame)+8; warehouseAreaFrame.origin.y = CGRectGetMaxY(_titleColorNumberF)+10; _warehouseAreaF=warehouseAreaFrame; } _separatorF = CGRectMake(0,CGRectGetMaxY(_titleWarehouseAreaF)+10,Screen_Width,1); _bottomTextF = CGRectMake(0,CGRectGetMaxY(_separatorF)+15,Screen_Width-10,17); _bottomSeparatorF=CGRectMake(0,CGRectGetMaxY(_bottomTextF)+15,Screen_Width,10); _cellHeight=CGRectGetMaxY(_bottomSeparatorF); } - (id)copyWithZone:(nullable NSZone *)zone{ OrderSearchFrame *frame = [[self class] allocWithZone:zone]; frame.searchModel=[_searchModel copy]; frame.productCodeF=_productCodeF; frame.inventoryIdF=_inventoryIdF; frame.substractBtnF=_substractBtnF; frame.salesQuantityF=_salesQuantityF; frame.addBtnF=_addBtnF; frame.joinCartBtnF=_joinCartBtnF; frame.titleBrandF=_titleBrandF; frame.brandF=_brandF; frame.titleOnlyCodeF=_titleOnlyCodeF; frame.onlyCodeF=_onlyCodeF; frame.titleColorNumberF=_titleColorNumberF; frame.colorNumberF=_colorNumberF; frame.titleSpecificationF=_titleSpecificationF; frame.specificationF=_specificationF; frame.titleLevelF=_titleLevelF; frame.levelF=_levelF; frame.titleWarehouseAreaF=_titleWarehouseAreaF; frame.warehouseAreaF=_warehouseAreaF; frame.separatorF=_separatorF; frame.bottomTextF=_bottomTextF; frame.bottomSeparatorF=_bottomSeparatorF; frame.middleSeparatorF=_middleSeparatorF; frame.cellHeight=_cellHeight; return frame; } @end