OrderSearchFrame.m 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // OrderSearchFrame.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/16.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "OrderSearchFrame.h"
  9. #import "NSString+Tools.h"
  10. @implementation OrderSearchFrame
  11. -(void)setOrderSearchModel:(GoodsSearchItemModel *)searchItem{
  12. _searchModel=searchItem;
  13. CGFloat xpadding =10;
  14. CGFloat ypadding =10;
  15. NSDictionary *orderDict = @{NSFontAttributeName:orderTextFont};
  16. NSString *productCode= [_searchModel code];
  17. CGRect productCodeFrame = [productCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  18. productCodeFrame.origin.x =xpadding;
  19. productCodeFrame.origin.y = ypadding;
  20. _productCodeF = productCodeFrame;
  21. NSString *inventoryId= [_searchModel inventoryID];
  22. if(inventoryId!=nil){
  23. CGRect inventoryIdFrame = [inventoryId textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  24. inventoryIdFrame.origin.x =CGRectGetMaxX(_productCodeF)+10;
  25. inventoryIdFrame.origin.y = ypadding;
  26. _inventoryIdF = inventoryIdFrame;
  27. }
  28. _substractBtnF=CGRectMake(Screen_Width/2, ypadding,25,25);
  29. _salesQuantityF=CGRectMake(CGRectGetMaxX(_substractBtnF)-1,ypadding,50, 25);
  30. _addBtnF=CGRectMake(CGRectGetMaxX(_salesQuantityF)-1, ypadding, 25, 25);
  31. _joinCartBtnF=CGRectMake(Screen_Width-50, ypadding, 39, 28);
  32. _middleSeparatorF=CGRectMake(0, CGRectGetMaxY(_joinCartBtnF)+10,Screen_Width,1);
  33. NSString *titleBrand=@"品牌:";
  34. CGRect titleBrandFrame = [titleBrand textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict];
  35. titleBrandFrame.origin.x =xpadding+5;
  36. titleBrandFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10;
  37. _titleBrandF=titleBrandFrame;
  38. NSString *brand=[_searchModel brandName];
  39. if(brand!=nil){
  40. CGRect brandFrame = [brand textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  41. brandFrame.origin.x =CGRectGetMaxX(_titleBrandF)+8;
  42. brandFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10;
  43. _brandF=brandFrame;
  44. }
  45. NSString *titleOnlyCode=@"唯一编码:";
  46. CGRect titleOnlyCodeFrame = [titleOnlyCode textRectWithSize:CGSizeMake(120, MAXFLOAT) attributes:orderDict];
  47. titleOnlyCodeFrame.origin.x =Screen_Width/2;
  48. titleOnlyCodeFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10;
  49. _titleOnlyCodeF=titleOnlyCodeFrame;
  50. NSString *onlyCode=[_searchModel onlyCode];
  51. if(onlyCode!=nil){
  52. CGRect onlyCodeFrame = [onlyCode textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  53. onlyCodeFrame.origin.x =CGRectGetMaxX(_titleOnlyCodeF)+8;
  54. onlyCodeFrame.origin.y = CGRectGetMaxY(_middleSeparatorF)+10;
  55. _onlyCodeF=onlyCodeFrame;
  56. }
  57. NSString *titleColorNumber=@"色号:";
  58. CGRect titleColorNumberFrame = [titleColorNumber textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict];
  59. titleColorNumberFrame.origin.x =xpadding+5;
  60. titleColorNumberFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  61. _titleColorNumberF=titleColorNumberFrame;
  62. NSString *colorNumber=[_searchModel colorNumber];
  63. if(colorNumber!=nil){
  64. CGRect colorNumberFrame = [colorNumber textRectWithSize:CGSizeMake(150, MAXFLOAT) attributes:orderDict];
  65. colorNumberFrame.origin.x =CGRectGetMaxX(_titleColorNumberF);
  66. colorNumberFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  67. _colorNumberF=colorNumberFrame;
  68. }
  69. NSString *titleSpecification=@"规格:";
  70. CGRect titleSpecificationFrame = [titleSpecification textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict];
  71. titleSpecificationFrame.origin.x =Screen_Width/3;
  72. titleSpecificationFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  73. _titleSpecificationF=titleSpecificationFrame;
  74. NSString *specification=[_searchModel specification];
  75. if(specification!=nil){
  76. CGRect specificationFrame = [specification textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  77. specificationFrame.origin.x =CGRectGetMaxX(_titleSpecificationF);
  78. specificationFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  79. _specificationF=specificationFrame;
  80. }
  81. NSString *titleLevel=@"等级:";
  82. CGRect titleLevelFrame = [titleLevel textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict];
  83. titleLevelFrame.origin.x =(Screen_Width/3)*2;
  84. titleLevelFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  85. _titleLevelF= titleLevelFrame;
  86. NSString *level= [_searchModel gradeName];
  87. if(level!=nil){
  88. CGRect levelFrame = [level textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:orderDict];
  89. levelFrame.origin.x =CGRectGetMaxX(_titleLevelF)+8;
  90. levelFrame.origin.y = CGRectGetMaxY(_titleBrandF)+10;
  91. _levelF= levelFrame;
  92. }
  93. NSString *titleWarehouseArea=@"库区:";
  94. CGRect titleWarehouseAreaFrame = [titleWarehouseArea textRectWithSize:CGSizeMake(90, MAXFLOAT) attributes:orderDict];
  95. titleWarehouseAreaFrame.origin.x =xpadding+5;;
  96. titleWarehouseAreaFrame.origin.y = CGRectGetMaxY(_titleColorNumberF)+10;
  97. _titleWarehouseAreaF= titleWarehouseAreaFrame;
  98. NSString *warehouseArea= [_searchModel warehouseName];
  99. if(warehouseArea!=nil){
  100. CGRect warehouseAreaFrame = [warehouseArea textRectWithSize:CGSizeMake(300, MAXFLOAT) attributes:orderDict];
  101. warehouseAreaFrame.origin.x =CGRectGetMaxX( titleWarehouseAreaFrame)+8;
  102. warehouseAreaFrame.origin.y = CGRectGetMaxY(_titleColorNumberF)+10;
  103. _warehouseAreaF=warehouseAreaFrame;
  104. }
  105. _separatorF = CGRectMake(0,CGRectGetMaxY(_titleWarehouseAreaF)+10,Screen_Width,1);
  106. _bottomTextF = CGRectMake(0,CGRectGetMaxY(_separatorF)+15,Screen_Width-10,17);
  107. _bottomSeparatorF=CGRectMake(0,CGRectGetMaxY(_bottomTextF)+15,Screen_Width,10);
  108. _cellHeight=CGRectGetMaxY(_bottomSeparatorF);
  109. }
  110. - (id)copyWithZone:(nullable NSZone *)zone{
  111. OrderSearchFrame *frame = [[self class] allocWithZone:zone];
  112. frame.searchModel=[_searchModel copy];
  113. frame.productCodeF=_productCodeF;
  114. frame.inventoryIdF=_inventoryIdF;
  115. frame.substractBtnF=_substractBtnF;
  116. frame.salesQuantityF=_salesQuantityF;
  117. frame.addBtnF=_addBtnF;
  118. frame.joinCartBtnF=_joinCartBtnF;
  119. frame.titleBrandF=_titleBrandF;
  120. frame.brandF=_brandF;
  121. frame.titleOnlyCodeF=_titleOnlyCodeF;
  122. frame.onlyCodeF=_onlyCodeF;
  123. frame.titleColorNumberF=_titleColorNumberF;
  124. frame.colorNumberF=_colorNumberF;
  125. frame.titleSpecificationF=_titleSpecificationF;
  126. frame.specificationF=_specificationF;
  127. frame.titleLevelF=_titleLevelF;
  128. frame.levelF=_levelF;
  129. frame.titleWarehouseAreaF=_titleWarehouseAreaF;
  130. frame.warehouseAreaF=_warehouseAreaF;
  131. frame.separatorF=_separatorF;
  132. frame.bottomTextF=_bottomTextF;
  133. frame.bottomSeparatorF=_bottomSeparatorF;
  134. frame.middleSeparatorF=_middleSeparatorF;
  135. frame.cellHeight=_cellHeight;
  136. return frame;
  137. }
  138. @end