OrderAuditListCell.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. //
  2. // OrderAuditListCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2018/11/13.
  6. // Copyright © 2018 elongtian. All rights reserved.
  7. //
  8. #import "OrderAuditListCell.h"
  9. @implementation OrderAuditListCell
  10. #pragma mark - 公共函数
  11. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  12. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. return self;
  14. }
  15. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  16. [super setSelected:selected animated:animated];
  17. }
  18. #pragma mark - 私有函数
  19. - (void)setOrderAuditCell:(OrderAuditListModel *)auditListModel{
  20. if (auditListModel == nil) {
  21. return;
  22. }
  23. CGFloat heightLine = 1;
  24. CGFloat heightRow = 31;
  25. CGFloat lblx = 10;
  26. CGFloat lbly = 0;
  27. CGFloat lblwidth = 70;
  28. CGFloat lblheight = 31;
  29. CGFloat valuey = 0;
  30. CGFloat valueheight = 31;
  31. //客户对象 —————————
  32. UIView *vTitle = [UIView new];
  33. vTitle.frame=CGRectMake(0, 0, Screen_Width, 10);
  34. vTitle.backgroundColor = LineBackgroundColor;
  35. [self.contentView addSubview:vTitle];
  36. //客户名称 —————————
  37. UIView *vOrderNo = [UIView new];
  38. vOrderNo.frame=CGRectMake(0, CGRectGetMaxY(vTitle.frame)+8, Screen_Width, heightRow);
  39. [self.contentView addSubview:vOrderNo];
  40. _btnCheck = [UIButton buttonWithType:UIButtonTypeCustom];
  41. _btnCheck.frame=CGRectMake(lblx,valuey+3, 25, 25);
  42. [_btnCheck addTarget:self action:@selector(btnGoCheck) forControlEvents:UIControlEventTouchUpInside];
  43. [vOrderNo addSubview:_btnCheck];
  44. UILabel *orderNoView = [UILabel new];
  45. orderNoView.frame=CGRectMake(CGRectGetMaxX(_btnCheck.frame)+5, valuey,200, valueheight);
  46. orderNoView.font = [UIFont systemFontOfSize: TitleFontOfSize];
  47. [vOrderNo addSubview:orderNoView];
  48. orderNoView.text = auditListModel.orderNo;
  49. UILabel *lblCheckFlag = [UILabel new];
  50. lblCheckFlag.frame=CGRectMake(Screen_Width-90 , valuey,80, valueheight);
  51. lblCheckFlag.textColor = [UIColor hexColor:LIGHT_BROWN];
  52. Boolean checkFlag= auditListModel.checkFlag;
  53. NSString *checkFlagStr;
  54. if(!checkFlag){
  55. checkFlagStr=@"未审核";
  56. }
  57. else{
  58. checkFlagStr=@"审核";
  59. }
  60. lblCheckFlag.text=checkFlagStr;
  61. lblCheckFlag.textAlignment = NSTextAlignmentRight;
  62. lblCheckFlag.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  63. [vOrderNo addSubview:lblCheckFlag];
  64. //分割线
  65. UIView *viewBackgroud = [UIView new];
  66. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vOrderNo.frame)+8, Screen_Width, heightLine);
  67. [self.contentView addSubview:viewBackgroud];
  68. UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
  69. [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
  70. btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
  71. [viewBackgroud addSubview:btnLine];
  72. UIView *vCustomerCode = [UIView new];
  73. vCustomerCode.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame)+8, Screen_Width/2, heightRow);
  74. [self.contentView addSubview:vCustomerCode];
  75. UILabel *lblTitleCustomerCode = [UILabel new];
  76. lblTitleCustomerCode.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  77. lblTitleCustomerCode.text = @"客户编码:";
  78. lblTitleCustomerCode.textColor = [UIColor blackColor];
  79. lblTitleCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  80. [vCustomerCode addSubview:lblTitleCustomerCode];
  81. UILabel *lblCustomerCode = [UILabel new];
  82. lblCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomerCode.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleCustomerCode.frame), valueheight);
  83. lblCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  84. [vCustomerCode addSubview:lblCustomerCode];
  85. lblCustomerCode.text = auditListModel.customerCode;
  86. UIView *vBusinessType = [UIView new];
  87. vBusinessType.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(viewBackgroud.frame)+8, Screen_Width/2, heightRow);
  88. [self.contentView addSubview:vBusinessType];
  89. UILabel *lblTitleBusinessType = [UILabel new];
  90. lblTitleBusinessType.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  91. lblTitleBusinessType.text = @"业务类型:";
  92. lblTitleBusinessType.textColor = [UIColor blackColor];
  93. lblTitleBusinessType.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  94. [vBusinessType addSubview:lblTitleBusinessType];
  95. UILabel *lblBusinessType = [UILabel new];
  96. lblBusinessType.frame=CGRectMake(CGRectGetMaxX(lblTitleBusinessType.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleBusinessType.frame), valueheight);
  97. lblBusinessType.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  98. [vBusinessType addSubview:lblBusinessType];
  99. lblBusinessType.text = auditListModel.orderType;
  100. UIView *vCustomerName = [UIView new];
  101. vCustomerName.frame=CGRectMake(0, CGRectGetMaxY(vCustomerCode.frame)+8, Screen_Width/2, heightRow);
  102. [self.contentView addSubview:vCustomerName];
  103. UILabel *lblTitleCustomerName = [UILabel new];
  104. lblTitleCustomerName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  105. lblTitleCustomerName.text = @"客户名称:";
  106. lblTitleCustomerName.textColor = [UIColor blackColor];
  107. lblTitleCustomerName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  108. [vCustomerName addSubview:lblTitleCustomerName];
  109. UILabel *lblCustomerName = [UILabel new];
  110. lblCustomerName.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomerName.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleCustomerName.frame), valueheight);
  111. lblCustomerName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  112. [vCustomerName addSubview:lblCustomerName];
  113. lblCustomerName.text = auditListModel.customerName;
  114. UIView *vTelephone = [UIView new];
  115. vTelephone.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(vCustomerCode.frame)+8, Screen_Width/2, heightRow);
  116. [self.contentView addSubview:vTelephone];
  117. UILabel *lblTitleTelephone = [UILabel new];
  118. lblTitleTelephone.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  119. lblTitleTelephone.text = @"联系电话:";
  120. lblTitleTelephone.textColor = [UIColor blackColor];
  121. lblTitleTelephone.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  122. [vTelephone addSubview:lblTitleTelephone];
  123. UILabel *lblTelephone = [UILabel new];
  124. lblTelephone.frame=CGRectMake(CGRectGetMaxX(lblTitleTelephone.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleTelephone.frame), valueheight);
  125. lblTelephone.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  126. [vTelephone addSubview:lblTelephone];
  127. lblTelephone.text = auditListModel.telephone;
  128. UIView *vAddress = [UIView new];
  129. vAddress.frame=CGRectMake(0, CGRectGetMaxY(vCustomerName.frame)+8, Screen_Width, heightRow);
  130. [self.contentView addSubview:vAddress];
  131. UILabel *lblTitleAddress = [UILabel new];
  132. lblTitleAddress.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  133. lblTitleAddress.text = @"客户地址:";
  134. lblTitleAddress.textColor = [UIColor blackColor];
  135. lblTitleAddress.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  136. [vAddress addSubview:lblTitleAddress];
  137. UILabel *lblAddress= [UILabel new];
  138. lblAddress.frame=CGRectMake(CGRectGetMaxX(lblTitleAddress.frame), valuey, Screen_Width-CGRectGetMaxX(lblTitleAddress.frame), valueheight);
  139. lblAddress.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  140. [vAddress addSubview:lblAddress];
  141. lblAddress.text = auditListModel.customerAddress;
  142. UIView *vDepartment = [UIView new];
  143. vDepartment.frame=CGRectMake(0, CGRectGetMaxY(vAddress.frame)+8, Screen_Width/2, heightRow);
  144. [self.contentView addSubview:vDepartment];
  145. UILabel *lblTitleDepartment = [UILabel new];
  146. lblTitleDepartment.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  147. lblTitleDepartment.text = @"业务部门:";
  148. lblTitleDepartment.textColor = [UIColor blackColor];
  149. lblTitleDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  150. [vDepartment addSubview:lblTitleDepartment];
  151. UILabel *lblDepartment = [UILabel new];
  152. lblDepartment.frame=CGRectMake(CGRectGetMaxX(lblTitleDepartment.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleDepartment.frame), valueheight);
  153. lblDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  154. [vDepartment addSubview:lblDepartment];
  155. lblDepartment.text = auditListModel.organizationName;
  156. UIView *vStaff = [UIView new];
  157. vStaff.frame=CGRectMake(Screen_Width/2, CGRectGetMaxY(vAddress.frame)+8, Screen_Width/2, heightRow);
  158. [self.contentView addSubview:vStaff];
  159. UILabel *lblTitleStaff = [UILabel new];
  160. lblTitleStaff.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
  161. lblTitleStaff.text = @"业务员:";
  162. lblTitleStaff.textColor = [UIColor blackColor];
  163. lblTitleStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  164. [vStaff addSubview:lblTitleStaff];
  165. UILabel *lblStaff = [UILabel new];
  166. lblStaff.frame=CGRectMake(CGRectGetMaxX(lblTitleStaff.frame), valuey, Screen_Width/2-CGRectGetMaxX(lblTitleStaff.frame), valueheight);
  167. lblStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
  168. [vStaff addSubview:lblStaff];
  169. lblStaff.text = auditListModel.staffName;
  170. viewBackgroud = [UIView new];
  171. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vDepartment.frame)+8, Screen_Width, 1);
  172. viewBackgroud.backgroundColor = LineBackgroundColor;
  173. [self.contentView addSubview:viewBackgroud];
  174. UIView *vAmount = [UIView new];
  175. vAmount.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame)+8, Screen_Width, heightRow);
  176. [self.contentView addSubview:vAmount];
  177. UILabel *lblAmount=[UILabel new];
  178. lblAmount.frame=CGRectMake(lblx, valuey, Screen_Width-2*lblx, valueheight);
  179. lblAmount.textAlignment=NSTextAlignmentRight;
  180. lblAmount.textColor=[UIColor redColor];
  181. lblAmount.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
  182. lblAmount.text=[NSString stringWithFormat:@"%@%@%@%@%@%@",@"货物总额:",auditListModel.goodsAmount,@"合计金额:",auditListModel.totalAmount,@"费用金额:",auditListModel.feesAmount];
  183. [vAmount addSubview:lblAmount];
  184. viewBackgroud = [UIView new];
  185. viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vAmount.frame)+8, Screen_Width, 1);
  186. viewBackgroud.backgroundColor = LineBackgroundColor;
  187. [self.contentView addSubview:viewBackgroud];
  188. }
  189. /**
  190. 设置checkbox背景图片
  191. @param checked <#checked description#>
  192. */
  193. - (void) setCheckBackground: (BOOL) checked
  194. { if(!checked)
  195. {
  196. [_btnCheck setImage:[UIImage imageNamed:@"order_unchecked"] forState:UIControlStateNormal];
  197. }
  198. else
  199. {
  200. [_btnCheck setImage:[UIImage imageNamed:@"order_checked"] forState:UIControlStateNormal];
  201. }
  202. }
  203. -(void)btnGoCheck{
  204. if([self.delegate respondsToSelector:@selector(btnCheckPressed:)])
  205. {
  206. [self.delegate btnCheckPressed:_position];
  207. }
  208. }
  209. @end