SalesOutStorageGoodsListCell.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. //
  2. // SalesOutStorageGoodsListCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/17.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SalesOutStorageGoodsListCell.h"
  9. @implementation SalesOutStorageGoodsListCell
  10. #pragma mark 公共函数
  11. /**
  12. 加载 cell
  13. @param style <#style description#>
  14. @param reuseIdentifier <#reuseIdentifier description#>
  15. @return <#return value description#>
  16. */
  17. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. return self;
  20. }
  21. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  22. [super setSelected:selected animated:animated];
  23. }
  24. #pragma mark 私有函数
  25. /**
  26. 初始化cell UI和数据
  27. @param salesOutStorageGoodsListModel <#salesOutStorageGoodsListModel description#>
  28. */
  29. - (void)setSalesOutStorageGoodsListModel:(SalesOutStorageSalesSlipGoodsListModel *)salesOutStorageGoodsListModel{
  30. if(salesOutStorageGoodsListModel==nil){
  31. return;
  32. }
  33. _goodsListModel=salesOutStorageGoodsListModel;
  34. CGFloat heightLine = 1;
  35. CGFloat heightRow = 40;
  36. CGFloat lblx = 20;
  37. CGFloat lbly = 8;
  38. CGFloat lblwidth = 70;
  39. CGFloat lblheight = 25;
  40. CGFloat valuey = 8;
  41. CGFloat valueheight = 25;
  42. UIView *vSalesNo = [UIView new];
  43. vSalesNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
  44. [self.contentView addSubview:vSalesNo];
  45. UILabel *lblSalesNoTitle = [UILabel new];
  46. lblSalesNoTitle.frame=CGRectMake(lblx, lbly,lblwidth, lblheight);
  47. lblSalesNoTitle.text=@"销售单号:";
  48. lblSalesNoTitle.textColor = [UIColor blackColor];
  49. lblSalesNoTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  50. [vSalesNo addSubview:lblSalesNoTitle];
  51. _lblSalesNo=[[UILabel alloc]init];
  52. _lblSalesNo.frame=CGRectMake(CGRectGetMaxX(lblSalesNoTitle.frame)+10, lbly,Screen_Width-CGRectGetMaxX(lblSalesNoTitle.frame)-10, valueheight);
  53. _lblSalesNo.textColor = [UIColor blackColor];
  54. _lblSalesNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  55. _lblSalesNo.text=_goodsListModel.salesNo;
  56. [vSalesNo addSubview:_lblSalesNo];
  57. //分割线
  58. _topSeparator= [UIView new];
  59. _topSeparator.frame = CGRectMake(0, CGRectGetMaxY(vSalesNo.frame), Screen_Width, heightLine);
  60. [self.contentView addSubview:_topSeparator];
  61. UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
  62. [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
  63. btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
  64. [_topSeparator addSubview:btnLine];
  65. UIView *vGoodsName = [UIView new];
  66. vGoodsName.frame=CGRectMake(0,CGRectGetMaxY(_topSeparator.frame), Screen_Width, heightRow);
  67. [self.contentView addSubview:vGoodsName];
  68. _btnCheck=[UIButton buttonWithType:UIButtonTypeCustom];
  69. _btnCheck.frame=CGRectMake(lblx,valuey, 25, 25);
  70. [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
  71. [vGoodsName addSubview:_btnCheck];
  72. _lblGoodsName = [UILabel new];
  73. _lblGoodsName.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+10, valuey, Screen_Width-CGRectGetMaxX(_btnCheck.frame), valueheight);
  74. _lblGoodsName.textColor = [UIColor blackColor];
  75. _lblGoodsName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  76. [vGoodsName addSubview:_lblGoodsName];
  77. _lblGoodsName.text = _goodsListModel.goodsName;
  78. _middleSeparator1= [UIView new];
  79. _middleSeparator1.frame = CGRectMake(0, CGRectGetMaxY(vGoodsName.frame), Screen_Width, heightLine);
  80. [_middleSeparator1 setBackgroundColor:LineBackgroundColor];
  81. [self.contentView addSubview:_middleSeparator1];
  82. //商品编码
  83. UIView *vGoodsCode = [UIView new];
  84. vGoodsCode.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparator1.frame), Screen_Width/2, heightRow);
  85. [self.contentView addSubview:vGoodsCode];
  86. UILabel *lblGoodsCodeTitle=[UILabel new];
  87. lblGoodsCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  88. lblGoodsCodeTitle.text=@"商品编码:";
  89. lblGoodsCodeTitle.textColor = [UIColor blackColor];
  90. lblGoodsCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  91. [vGoodsCode addSubview:lblGoodsCodeTitle];
  92. _lblGoodsCode = [UILabel new];
  93. _lblGoodsCode.frame=CGRectMake(CGRectGetMaxX(lblGoodsCodeTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblGoodsCodeTitle.frame), valueheight);
  94. _lblGoodsCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  95. [vGoodsCode addSubview:_lblGoodsCode];
  96. _lblGoodsCode.text = _goodsListModel.goodsCode;
  97. //唯一编码
  98. UIView *vOnlyCode = [UIView new];
  99. vOnlyCode.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_middleSeparator1.frame), Screen_Width / 2, heightRow);
  100. [self.contentView addSubview: vOnlyCode];
  101. UILabel *lblOnlyCodeTitle=[UILabel new];
  102. lblOnlyCodeTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  103. lblOnlyCodeTitle.text=@"唯一编码:";
  104. lblOnlyCodeTitle.textColor = [UIColor blackColor];
  105. lblOnlyCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  106. [vOnlyCode addSubview:lblOnlyCodeTitle];
  107. _lblOnlyCode= [UILabel new];
  108. _lblOnlyCode.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  109. _lblOnlyCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  110. [vOnlyCode addSubview:_lblOnlyCode];
  111. _lblOnlyCode.text = _goodsListModel.onlyCode;
  112. //销售价格
  113. UIView *vSalesPrice = [UIView new];
  114. vSalesPrice.frame=CGRectMake(0, CGRectGetMaxY(vGoodsCode.frame), Screen_Width/2, heightRow);
  115. [self.contentView addSubview:vSalesPrice];
  116. UILabel *lblSalesPriceTitle=[UILabel new];
  117. lblSalesPriceTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  118. lblSalesPriceTitle.text=@"销售价格:";
  119. lblSalesPriceTitle.textColor = [UIColor blackColor];
  120. lblSalesPriceTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  121. [vSalesPrice addSubview:lblSalesPriceTitle];
  122. _lblSalesPrice = [UILabel new];
  123. _lblSalesPrice.frame=CGRectMake(CGRectGetMaxX(lblSalesPriceTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblSalesPriceTitle.frame), valueheight);
  124. _lblSalesPrice.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  125. [vSalesPrice addSubview:_lblSalesPrice];
  126. _lblSalesPrice.text = _goodsListModel.salesPrice;
  127. UIView *vSalesQuantity= [UIView new];
  128. vSalesQuantity.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vGoodsCode.frame), Screen_Width / 2, heightRow);
  129. [self.contentView addSubview: vSalesQuantity];
  130. UILabel *lblSalesQuantityTitle=[UILabel new];
  131. lblSalesQuantityTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  132. lblSalesQuantityTitle.text=@"销售数量:";
  133. lblSalesQuantityTitle.textColor = [UIColor blackColor];
  134. lblSalesQuantityTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  135. [vSalesQuantity addSubview:lblSalesQuantityTitle];
  136. _lblSalesQuantity= [UILabel new];
  137. _lblSalesQuantity.frame=CGRectMake(CGRectGetMaxX(lblOnlyCodeTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  138. _lblSalesQuantity.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  139. [vSalesQuantity addSubview:_lblSalesQuantity];
  140. _lblSalesQuantity.text = _goodsListModel.salesQuantity;
  141. // 规格
  142. UIView *vSpecification= [UIView new];
  143. vSpecification.frame=CGRectMake(0, CGRectGetMaxY(vSalesPrice.frame), Screen_Width/2, heightRow);
  144. [self.contentView addSubview:vSpecification];
  145. UILabel *lblSpecificationTitle=[UILabel new];
  146. lblSpecificationTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  147. lblSpecificationTitle.text=@"规 格:";
  148. lblSpecificationTitle.textColor = [UIColor blackColor];
  149. lblSpecificationTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  150. [vSpecification addSubview:lblSpecificationTitle];
  151. _lblSpecification = [UILabel new];
  152. _lblSpecification.frame=CGRectMake(CGRectGetMaxX(lblSpecificationTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblSpecificationTitle.frame), valueheight);
  153. _lblSpecification.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  154. [vSpecification addSubview:_lblSpecification];
  155. _lblSpecification.text = _goodsListModel.goodsSpecification;
  156. UIView *vColorNumber= [UIView new];
  157. vColorNumber.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vSalesPrice.frame), Screen_Width / 2, heightRow);
  158. [self.contentView addSubview: vColorNumber];
  159. UILabel *lblColorNumberTitle=[UILabel new];
  160. lblColorNumberTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
  161. lblColorNumberTitle.text=@"色 号:";
  162. lblColorNumberTitle.textColor = [UIColor blackColor];
  163. lblColorNumberTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  164. [vColorNumber addSubview:lblColorNumberTitle];
  165. _lblColorNumber= [UILabel new];
  166. _lblColorNumber.frame=CGRectMake(CGRectGetMaxX(lblColorNumberTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
  167. _lblColorNumber.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  168. [vColorNumber addSubview:_lblColorNumber];
  169. _lblColorNumber.text = _goodsListModel.colorNumber;
  170. UIView *vBrand= [UIView new];
  171. vBrand.frame=CGRectMake(0, CGRectGetMaxY(vSpecification.frame), Screen_Width/2, heightRow);
  172. [self.contentView addSubview:vBrand];
  173. UILabel *lblBrandTitle=[UILabel new];
  174. lblBrandTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  175. lblBrandTitle.text=@"品 牌:";
  176. lblBrandTitle.textColor = [UIColor blackColor];
  177. lblBrandTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  178. [vBrand addSubview:lblBrandTitle];
  179. _lblBrand = [UILabel new];
  180. _lblBrand.frame=CGRectMake(CGRectGetMaxX(lblBrandTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblBrandTitle.frame), valueheight);
  181. _lblBrand.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  182. [vBrand addSubview:_lblBrand];
  183. _lblBrand.text = _goodsListModel.brandName;
  184. _middleSeparator2= [UIView new];
  185. _middleSeparator2.frame = CGRectMake(0, CGRectGetMaxY(vBrand.frame), Screen_Width, heightLine);
  186. [_middleSeparator2 setBackgroundColor:LineBackgroundColor];
  187. [self.contentView addSubview:_middleSeparator2];
  188. _btnMoreInfo = [UIButton buttonWithType:UIButtonTypeCustom];
  189. [_btnMoreInfo setTitle:@"更多信息" forState:UIControlStateNormal];
  190. [_btnMoreInfo setTitleColor:LabelGrayTextColor forState:UIControlStateNormal];
  191. _btnMoreInfo.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
  192. _btnMoreInfo.layer.borderWidth = 0.0f;//设置边框颜色
  193. _btnMoreInfo.frame = CGRectMake(Screen_Width-70-8 ,CGRectGetMaxY(_middleSeparator2.frame)+10 , 70, valueheight);
  194. [_btnMoreInfo addTarget:self action:@selector(btnGoMoreInfo) forControlEvents:UIControlEventTouchUpInside];
  195. [self.contentView addSubview:_btnMoreInfo];
  196. _bottomSeparator= [UIView new];
  197. _bottomSeparator.frame = CGRectMake(0, CGRectGetMaxY(_btnMoreInfo.frame)+10, Screen_Width,10);
  198. [_bottomSeparator setBackgroundColor:LineBackgroundColor];
  199. [self.contentView addSubview:_bottomSeparator];
  200. }
  201. /**
  202. 选中checkbox
  203. */
  204. -(void)btnGoCheck
  205. {
  206. if([self.checkDelegate respondsToSelector:@selector(btnCheckPressed:)])
  207. {
  208. [self.checkDelegate btnCheckPressed:_cellIndex];
  209. }
  210. }
  211. /**
  212. 跳转到更多信息
  213. */
  214. -(void)btnGoMoreInfo{
  215. if([self.checkDelegate respondsToSelector:@selector(goMoreInfo:)])
  216. {
  217. [self.checkDelegate goMoreInfo:_goodsListModel];
  218. }
  219. }
  220. /**
  221. 设置checkbox背景图片
  222. @param checked <#checked description#>
  223. */
  224. - (void) setCheckBackground: (BOOL) checked
  225. {
  226. if(!checked)
  227. {
  228. [_btnCheck setImage:[UIImage imageNamed:@"uncheck_round"] forState:UIControlStateNormal];
  229. }
  230. else
  231. {
  232. [_btnCheck setImage:[UIImage imageNamed:@"check_round"] forState:UIControlStateNormal];
  233. }
  234. }
  235. @end