HistoryOrderTableViewCell.m 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. //
  2. // HistoryOrderTableViewCell.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/24.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "HistoryOrderTableViewCell.h"
  9. #define orderTextFont [UIFont systemFontOfSize:14]
  10. @implementation HistoryOrderTableViewCell
  11. #pragma mark - 公共函数
  12. /**
  13. 加载自定义cell函数
  14. */
  15. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  16. {
  17. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  18. if (self) {
  19. }
  20. return self;
  21. }
  22. #pragma mark - 私有函数
  23. /**
  24. 初始化cell UI和数据
  25. */
  26. -(void)parseCartInfo:(HistoryOrderFrame *)orderFrame{
  27. _orderModel= orderFrame.orderItemModel;
  28. _lblOrderNo=[[UILabel alloc]init];
  29. _lblOrderNo.frame=orderFrame.lblOrderNoF;
  30. _lblOrderNo.font=orderTextFont;
  31. _lblOrderNo.text=_orderModel.orderNo;
  32. [self.contentView addSubview:_lblOrderNo];
  33. _btnDelete=[UIButton buttonWithType:UIButtonTypeCustom];
  34. _btnDelete.frame=orderFrame.btnDeleteOrderF;
  35. [self.contentView addSubview:_btnDelete];
  36. [_btnDelete addTarget:self action:@selector(deleteOrder) forControlEvents:UIControlEventTouchUpInside];
  37. UIImageView *deleteImg=[[UIImageView alloc]init];
  38. deleteImg.frame=CGRectMake(0,4,15,15);
  39. [deleteImg setImage:[UIImage imageNamed:@"icon_delete"]];
  40. deleteImg.userInteractionEnabled=NO;
  41. [_btnDelete addSubview:deleteImg];
  42. UILabel *deleteTitle=[[UILabel alloc]init];
  43. deleteTitle.frame=CGRectMake(CGRectGetMaxX(deleteImg.frame)+3,0,40, 25);
  44. deleteTitle.text=@"删除";
  45. deleteTitle.font=orderTextFont;
  46. [_btnDelete addSubview:deleteTitle];
  47. UIView *topSeparator=[[UIView alloc]init];
  48. topSeparator.frame=[orderFrame topSeparatorF];
  49. topSeparator.backgroundColor=LineBackgroundColor;
  50. [self.contentView addSubview:topSeparator];
  51. UILabel *lblTitleCustomerName=[[UILabel alloc]init];
  52. NSString *titleCustomerName=@"客户名称:";
  53. lblTitleCustomerName.frame=orderFrame.lblTitleCustomerNameF;
  54. lblTitleCustomerName.font=orderTextFont;
  55. lblTitleCustomerName.textColor=LabelGrayTextColor;
  56. lblTitleCustomerName.text=titleCustomerName;
  57. [self.contentView addSubview:lblTitleCustomerName];
  58. NSString *customerName=_orderModel.customerName;
  59. if(customerName!=nil){
  60. _lblCustomerName=[[UILabel alloc]init];
  61. _lblCustomerName.frame=orderFrame.lblCustomerNameF;
  62. _lblCustomerName.font=orderTextFont;
  63. _lblCustomerName.text=customerName;
  64. [self.contentView addSubview:_lblCustomerName];
  65. }
  66. UILabel *lblTitleCreateDate=[[UILabel alloc]init];
  67. NSString *titleCreateDate=@"创建日期:";
  68. lblTitleCreateDate.frame=orderFrame.lblTitleCreateDateF;
  69. lblTitleCreateDate.font=orderTextFont;
  70. lblTitleCreateDate.textColor=LabelGrayTextColor;
  71. lblTitleCreateDate.text=titleCreateDate;
  72. [self.contentView addSubview:lblTitleCreateDate];
  73. NSString *createDate=_orderModel.createDate;
  74. if(createDate!=nil){
  75. _lblCreateDate=[[UILabel alloc]init];
  76. _lblCreateDate.frame=orderFrame.lblCreateDateF;
  77. _lblCreateDate.font=orderTextFont;
  78. _lblCreateDate.text=createDate;
  79. [self.contentView addSubview:_lblCreateDate];
  80. }
  81. UILabel *lblTitleMarkedPriceAmount=[[UILabel alloc]init];
  82. NSString *titleMarkedPriceAmount=@"标价总额:";
  83. lblTitleMarkedPriceAmount.frame=orderFrame.lblTitleMarkedPriceAmountF;
  84. lblTitleMarkedPriceAmount.font=orderTextFont;
  85. lblTitleMarkedPriceAmount.textColor=LabelGrayTextColor;
  86. lblTitleMarkedPriceAmount.text=titleMarkedPriceAmount;
  87. [self.contentView addSubview:lblTitleMarkedPriceAmount];
  88. NSString *markedPriceAmount=_orderModel.markedPriceAmount;
  89. if(markedPriceAmount!=nil){
  90. _lblMarkedPriceAmount=[[UILabel alloc]init];
  91. _lblMarkedPriceAmount.frame=orderFrame.lblMarkedPriceAmountF;
  92. _lblMarkedPriceAmount.font=orderTextFont;
  93. _lblMarkedPriceAmount.text=markedPriceAmount;
  94. [self.contentView addSubview:_lblMarkedPriceAmount];
  95. }
  96. UILabel *lblTitleGoodsAmount=[[UILabel alloc]init];
  97. NSString *titleGoodsAmount=@"货物总额:";
  98. lblTitleGoodsAmount.frame=orderFrame.lblTitleGoodsAmountF;
  99. lblTitleGoodsAmount.font=orderTextFont;
  100. lblTitleGoodsAmount.textColor=LabelGrayTextColor;
  101. lblTitleGoodsAmount.text=titleGoodsAmount;
  102. [self.contentView addSubview:lblTitleGoodsAmount];
  103. NSString *goodsAmount=_orderModel.goodsAmount;
  104. if(goodsAmount!=nil){
  105. _lblGoodsAmount=[[UILabel alloc]init];
  106. _lblGoodsAmount.frame=orderFrame.lblGoodsAmountF;
  107. _lblGoodsAmount.font=orderTextFont;
  108. _lblGoodsAmount.text=goodsAmount;
  109. [self.contentView addSubview: _lblGoodsAmount];
  110. }
  111. UILabel *lblTitleSalesMan=[[UILabel alloc]init];
  112. NSString *titleSalesMan=@"业务员:";
  113. lblTitleSalesMan.frame=orderFrame.lblTitleSalesManF;
  114. lblTitleSalesMan.font=orderTextFont;
  115. lblTitleSalesMan.textColor=LabelGrayTextColor;
  116. lblTitleSalesMan.text=titleSalesMan;
  117. [self.contentView addSubview:lblTitleSalesMan];
  118. NSString *staffName=_orderModel.staffName;
  119. if(staffName!=nil){
  120. _lblSalesMan=[[UILabel alloc]init];
  121. _lblSalesMan.frame=orderFrame.lblSalesManF;
  122. _lblSalesMan.font=orderTextFont;
  123. _lblSalesMan.text=staffName;
  124. [self.contentView addSubview: _lblSalesMan];
  125. }
  126. UILabel *lblTitleChannel=[[UILabel alloc]init];
  127. NSString *titleChannel=@"渠道:";
  128. lblTitleChannel.frame=orderFrame.lblTitleChannelF;
  129. lblTitleChannel.font=orderTextFont;
  130. lblTitleChannel.textColor=LabelGrayTextColor;
  131. lblTitleChannel.text=titleChannel;
  132. [self.contentView addSubview:lblTitleChannel];
  133. NSString *channelName=_orderModel.channelName;
  134. if(channelName!=nil){
  135. _lblChannel=[[UILabel alloc]init];
  136. _lblChannel.frame=orderFrame.lblChannelF;
  137. _lblChannel.font=orderTextFont;
  138. _lblChannel.text=channelName;
  139. [self.contentView addSubview: _lblChannel];
  140. }
  141. UILabel *lblTitleDepartment=[[UILabel alloc]init];
  142. NSString *titleDepartment=@"业务部门:";
  143. lblTitleDepartment.frame=orderFrame.lblTitleDepartmentF;
  144. lblTitleDepartment.font=orderTextFont;
  145. lblTitleDepartment.textColor=LabelGrayTextColor;
  146. lblTitleDepartment.text=titleDepartment;
  147. [self.contentView addSubview:lblTitleDepartment];
  148. NSString *departmentName=_orderModel.organizationName;
  149. if(departmentName!=nil){
  150. _lblDepartment=[[UILabel alloc]init];
  151. _lblDepartment.frame=orderFrame.lblDepartmentF;
  152. _lblDepartment.font=orderTextFont;
  153. _lblDepartment.text=departmentName;
  154. [self.contentView addSubview:_lblDepartment];
  155. }
  156. UILabel *lblTitleAddress=[[UILabel alloc]init];
  157. NSString *titleAddress=@"客户地址:";
  158. lblTitleAddress.frame=orderFrame.lblTitleAddressF;
  159. lblTitleAddress.font=orderTextFont;
  160. lblTitleAddress.textColor=LabelGrayTextColor;
  161. lblTitleAddress.text=titleAddress;
  162. [self.contentView addSubview:lblTitleAddress];
  163. NSString *address=_orderModel.address;
  164. if(address!=nil){
  165. _lblAddress=[[UILabel alloc]init];
  166. _lblAddress.frame=orderFrame.lblAddressF;
  167. _lblAddress.font=orderTextFont;
  168. _lblAddress.text=address;
  169. [self.contentView addSubview:_lblAddress];
  170. }
  171. UIView *bottomSeparator=[[UIView alloc]init];
  172. bottomSeparator.frame=[orderFrame bottomSeparatorF];
  173. bottomSeparator.backgroundColor=LineBackgroundColor;
  174. [self.contentView addSubview:bottomSeparator];
  175. }
  176. //删除订单函数
  177. -(void)deleteOrder{
  178. if([self.delegate respondsToSelector:@selector(deleteHistoryOrderItem:)])
  179. {
  180. [self.delegate deleteHistoryOrderItem:_orderModel];
  181. }
  182. }
  183. @end