OrderDetailTableViewCell.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. //
  2. // OrderDetailTableViewCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/25.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "OrderDetailTableViewCell.h"
  9. #import "NSString+Tools.h"
  10. #define orderTextFont [UIFont systemFontOfSize:14]
  11. @implementation OrderDetailTableViewCell
  12. #pragma mark - 公共函数
  13. /**
  14. 加载自定义cell函数
  15. */
  16. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  17. {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. if (self) {
  20. self.layer.cornerRadius=20;
  21. self.layer.backgroundColor=[UIColor redColor].CGColor;
  22. self.layer.masksToBounds=YES;
  23. }
  24. return self;
  25. }
  26. #pragma mark - 私有函数
  27. /**
  28. 初始化cell UI
  29. */
  30. -(void)parseOrderInfo:(ShopCartItemModel *)orderItem{
  31. UIView *contentView=[[UIView alloc]init];
  32. contentView.frame=CGRectZero;
  33. [self addSubview:contentView];
  34. CGFloat xpadding=10;
  35. CGFloat ypadding=10;
  36. UILabel *lblTitleCode=[[UILabel alloc]init];
  37. lblTitleCode.frame=CGRectMake(xpadding, ypadding,80,25);
  38. lblTitleCode.text=@"商品编码:";
  39. lblTitleCode.font=orderTextFont;
  40. [contentView addSubview:lblTitleCode];
  41. _lblCode=[[UILabel alloc]init];
  42. _lblCode.frame=CGRectMake(CGRectGetMaxX(lblTitleCode.frame), ypadding,250, 25);
  43. _lblCode.text=orderItem.code;
  44. _lblCode.font=orderTextFont;
  45. [contentView addSubview:_lblCode];
  46. UILabel *lblTitleOnlyCode=[[UILabel alloc]init];
  47. lblTitleOnlyCode.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleCode.frame)+ypadding,80,25);
  48. lblTitleOnlyCode.text=@"唯一编码:";
  49. lblTitleOnlyCode.font=orderTextFont;
  50. [contentView addSubview:lblTitleOnlyCode];
  51. _lblOnlyCode=[[UILabel alloc]init];
  52. _lblOnlyCode.text=orderItem.onlyCode;
  53. _lblOnlyCode.font=orderTextFont;
  54. _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblTitleOnlyCode.frame),CGRectGetMaxY(lblTitleCode.frame)+ypadding ,250,25);
  55. [contentView addSubview:_lblOnlyCode];
  56. UILabel *lblTitleBrand=[[UILabel alloc]init];
  57. lblTitleBrand.frame=CGRectMake(xpadding,CGRectGetMaxY( lblTitleOnlyCode.frame)+ypadding,80,25);
  58. lblTitleBrand.font=orderTextFont;
  59. lblTitleBrand.text=@"商品品牌:";
  60. lblTitleBrand.font=orderTextFont;
  61. [contentView addSubview:lblTitleBrand];
  62. _lblBrandName=[[UILabel alloc]init];
  63. _lblBrandName.frame=CGRectMake(CGRectGetMaxX(lblTitleBrand.frame),CGRectGetMaxY(lblTitleOnlyCode.frame)+ypadding ,250,25);
  64. _lblBrandName.text=orderItem.brandName;
  65. _lblBrandName.font=orderTextFont;
  66. [contentView addSubview:_lblBrandName];
  67. UILabel *lblTitleKind=[[UILabel alloc]init];
  68. lblTitleKind.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleBrand.frame)+ypadding,80,25);
  69. lblTitleKind.font=orderTextFont;
  70. lblTitleKind.text=@"商品种类:";
  71. lblTitleKind.font=orderTextFont;
  72. [contentView addSubview:lblTitleKind];
  73. _lblKindName=[[UILabel alloc]init];
  74. _lblKindName.frame=CGRectMake(CGRectGetMaxX(lblTitleKind.frame),CGRectGetMaxY(lblTitleBrand.frame)+ypadding ,250,25);
  75. _lblKindName.text=orderItem.kindName;
  76. _lblKindName.font=orderTextFont;
  77. [contentView addSubview:_lblKindName];
  78. UILabel *lblTitleVariety =[[UILabel alloc]init];
  79. lblTitleVariety.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleKind.frame)+ypadding,80,25);
  80. lblTitleVariety.font=orderTextFont;
  81. lblTitleVariety.text=@"商品品种:";
  82. lblTitleVariety.font=orderTextFont;
  83. [contentView addSubview:lblTitleVariety];
  84. _lblVarietyName=[[UILabel alloc]init];
  85. _lblVarietyName.frame=CGRectMake(CGRectGetMaxX(lblTitleVariety.frame),CGRectGetMaxY(lblTitleKind.frame)+ypadding ,250,25);
  86. _lblVarietyName.text=orderItem.varietyName;
  87. _lblVarietyName.font=orderTextFont;
  88. [contentView addSubview:_lblVarietyName];
  89. UILabel *lblTitleSeries =[[UILabel alloc]init];
  90. lblTitleSeries.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVariety.frame)+ypadding,80,25);
  91. lblTitleSeries.font=orderTextFont;
  92. lblTitleSeries.text=@"商品系列:";
  93. lblTitleSeries.font=orderTextFont;
  94. [contentView addSubview:lblTitleSeries];
  95. _lblSeriesName=[[UILabel alloc]init];
  96. _lblSeriesName.frame=CGRectMake(CGRectGetMaxX(lblTitleSeries.frame),CGRectGetMaxY(lblTitleVariety.frame)+ypadding ,250,25);
  97. _lblSeriesName.text=orderItem.seriesName;
  98. _lblSeriesName.font=orderTextFont;
  99. [contentView addSubview:_lblSeriesName];
  100. UILabel *lblTitleWarehouse =[[UILabel alloc]init];
  101. lblTitleWarehouse.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSeries.frame)+ypadding,80,25);
  102. lblTitleWarehouse.font=orderTextFont;
  103. lblTitleWarehouse.text=@"库 区:";
  104. lblTitleWarehouse.font=orderTextFont;
  105. [contentView addSubview:lblTitleWarehouse];
  106. _lblWarehouseName=[[UILabel alloc]init];
  107. _lblWarehouseName.frame=CGRectMake(CGRectGetMaxX(lblTitleWarehouse.frame),CGRectGetMaxY(lblTitleSeries.frame)+ypadding ,250,25);
  108. _lblWarehouseName.text=orderItem.warehouseName;
  109. _lblWarehouseName.font=orderTextFont;
  110. [contentView addSubview:_lblWarehouseName];
  111. UILabel *lblTitlePositionNumber =[[UILabel alloc]init];
  112. lblTitlePositionNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding,80,25);
  113. lblTitlePositionNumber.font=orderTextFont;
  114. lblTitlePositionNumber.text=@"仓 位 号:";
  115. lblTitlePositionNumber.font=orderTextFont;
  116. [contentView addSubview:lblTitlePositionNumber];
  117. _lblPositionNumber=[[UILabel alloc]init];
  118. _lblPositionNumber.frame=CGRectMake(CGRectGetMaxX(lblTitlePositionNumber.frame),CGRectGetMaxY(lblTitleWarehouse.frame)+ypadding ,250,25);
  119. _lblPositionNumber.text=orderItem.positionNumber;
  120. _lblPositionNumber.font=orderTextFont;
  121. [contentView addSubview:_lblPositionNumber];
  122. UILabel *lblTitleColorNumber =[[UILabel alloc]init];
  123. lblTitleColorNumber.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding,80,25);
  124. lblTitleColorNumber.font=orderTextFont;
  125. lblTitleColorNumber.text=@"色 号:";
  126. lblTitleColorNumber.font=orderTextFont;
  127. [contentView addSubview:lblTitleColorNumber];
  128. _lblColorNumber=[[UILabel alloc]init];
  129. _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblTitleColorNumber.frame),CGRectGetMaxY(lblTitlePositionNumber.frame)+ypadding ,250,25);
  130. _lblColorNumber.text=orderItem.colorNumber;
  131. _lblColorNumber.font=orderTextFont;
  132. [contentView addSubview:_lblColorNumber];
  133. UILabel *lblTitleSpecification =[[UILabel alloc]init];
  134. lblTitleSpecification.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding,80,25);
  135. lblTitleSpecification.font=orderTextFont;
  136. lblTitleSpecification.text=@"规 格:";
  137. lblTitleSpecification.font=orderTextFont;
  138. [contentView addSubview:lblTitleSpecification];
  139. _lblSpecification=[[UILabel alloc]init];
  140. _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblTitleSpecification.frame),CGRectGetMaxY(lblTitleColorNumber.frame)+ypadding ,250,25);
  141. _lblSpecification.text=orderItem.specification;
  142. _lblSpecification.font=orderTextFont;
  143. [contentView addSubview:_lblSpecification];
  144. UILabel *lblTitleArea =[[UILabel alloc]init];
  145. lblTitleArea.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSpecification.frame)+ypadding,80,25);
  146. lblTitleArea.font=orderTextFont;
  147. lblTitleArea.text=@"面 积:";
  148. lblTitleArea.font=orderTextFont;
  149. [contentView addSubview:lblTitleArea];
  150. _lblAcreage=[[UILabel alloc]init];
  151. _lblAcreage.frame=CGRectMake(CGRectGetMaxX(lblTitleArea.frame),CGRectGetMaxY(lblTitleSpecification.frame)+ypadding ,250,25);
  152. _lblAcreage.text=orderItem.acreage;
  153. _lblAcreage.font=orderTextFont;
  154. [contentView addSubview:_lblAcreage];
  155. UILabel *lblTitleVolume =[[UILabel alloc]init];
  156. lblTitleVolume.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleArea.frame)+ypadding,80,25);
  157. lblTitleVolume.font=orderTextFont;
  158. lblTitleVolume.text=@"体 积:";
  159. lblTitleVolume.font=orderTextFont;
  160. [contentView addSubview:lblTitleVolume];
  161. _lblVolume=[[UILabel alloc]init];
  162. _lblVolume.frame=CGRectMake(CGRectGetMaxX(lblTitleVolume.frame),CGRectGetMaxY(lblTitleArea.frame)+ypadding ,250,25);
  163. _lblVolume.text=orderItem.volume;
  164. _lblVolume.font=orderTextFont;
  165. [contentView addSubview:_lblVolume];
  166. UILabel *lblTitleUnit =[[UILabel alloc]init];
  167. lblTitleUnit.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleVolume.frame)+ypadding,80,25);
  168. lblTitleUnit.font=orderTextFont;
  169. lblTitleUnit.text=@"计量单位:";
  170. lblTitleUnit.font=orderTextFont;
  171. [contentView addSubview:lblTitleUnit];
  172. _lblUnitName=[[UILabel alloc]init];
  173. _lblUnitName.frame=CGRectMake(CGRectGetMaxX(lblTitleUnit.frame),CGRectGetMaxY(lblTitleVolume.frame)+ypadding ,250,25);
  174. _lblUnitName.text=orderItem.unitName;
  175. _lblUnitName.font=orderTextFont;
  176. [contentView addSubview:_lblUnitName];
  177. UILabel *lblTitleSalesQuantity =[[UILabel alloc]init];
  178. lblTitleSalesQuantity.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleUnit.frame)+ypadding,80,25);
  179. lblTitleSalesQuantity.font=orderTextFont;
  180. lblTitleSalesQuantity.text=@"数 量:";
  181. lblTitleSalesQuantity.font=orderTextFont;
  182. [contentView addSubview:lblTitleSalesQuantity];
  183. _lblSalesQuantity=[[UILabel alloc]init];
  184. _lblSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblTitleSalesQuantity.frame),CGRectGetMaxY(lblTitleUnit.frame)+ypadding ,250,25);
  185. _lblSalesQuantity.text=orderItem.salesQuantity;
  186. _lblSalesQuantity.font=orderTextFont;
  187. [contentView addSubview:_lblSalesQuantity];
  188. UILabel *lblTitleSalesPrice =[[UILabel alloc]init];
  189. lblTitleSalesPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesQuantity.frame)+ypadding,80,25);
  190. lblTitleSalesPrice.font=orderTextFont;
  191. lblTitleSalesPrice.text=@"商品售价:";
  192. lblTitleSalesPrice.font=orderTextFont;
  193. [contentView addSubview:lblTitleSalesPrice];
  194. _lblSalesPrice=[[UILabel alloc]init];
  195. _lblSalesPrice.frame=CGRectMake(CGRectGetMaxX(lblTitleSalesPrice.frame),CGRectGetMaxY(lblTitleSalesQuantity.frame)+ypadding ,250,25);
  196. _lblSalesPrice.text=orderItem.salesPrice;
  197. _lblSalesPrice.font=orderTextFont;
  198. [contentView addSubview:_lblSalesPrice];
  199. UILabel *lblTitleMarkedPrice =[[UILabel alloc]init];
  200. lblTitleMarkedPrice.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleSalesPrice.frame)+ypadding,80,25);
  201. lblTitleMarkedPrice.font=orderTextFont;
  202. lblTitleMarkedPrice.text=@"商品标价:";
  203. lblTitleMarkedPrice.font=orderTextFont;
  204. [contentView addSubview:lblTitleMarkedPrice];
  205. _lblMarkedPrice=[[UILabel alloc]init];
  206. _lblMarkedPrice.frame=CGRectMake(CGRectGetMaxX(lblTitleMarkedPrice.frame),CGRectGetMaxY(lblTitleSalesPrice.frame)+ypadding ,250,25);
  207. _lblMarkedPrice.text=orderItem.markedPrice;
  208. _lblMarkedPrice.font=orderTextFont;
  209. [contentView addSubview:_lblMarkedPrice];
  210. // UILabel *lblTitleRemarks =[[UILabel alloc]init];
  211. // lblTitleRemarks.frame=CGRectMake(xpadding,CGRectGetMaxY(lblTitleMarkedPrice.frame)+ypadding,80,25);
  212. // lblTitleRemarks.font=orderTextFont;
  213. // lblTitleRemarks.text=@"备 注:";
  214. // lblTitleRemarks.font=orderTextFont;
  215. // [contentView addSubview:lblTitleRemarks];
  216. // _lblRemarks=[[UILabel alloc]init];
  217. // _lblRemarks.frame=CGRectMake(CGRectGetMaxX(lblTitleRemarks.frame),CGRectGetMaxY(lblTitleMarkedPrice.frame)+ypadding ,250,25);
  218. // _lblRemarks.text=orderItem.remarks;
  219. // _lblRemarks.font=orderTextFont;
  220. // [contentView addSubview:_lblRemarks];
  221. contentView.frame=CGRectMake(0, 0,self.frame.size.width,CGRectGetMaxY( lblTitleMarkedPrice.frame)+5);
  222. }
  223. @end