SalesAchievementDataListCell.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //
  2. // SalesAchievementDataListCellTableViewCell.m
  3. // IBOSS
  4. //
  5. // Created by guan hong hou on 2017/8/22.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. // 功能描述:销售业绩列表单元格
  9. #import "SalesAchievementDataListCell.h"
  10. #define kTextFont [UIFont systemFontOfSize:TitleFontOfSize]
  11. #define kSubTextFont [UIFont systemFontOfSize:LabelAndTextFontOfSize]
  12. @implementation SalesAchievementDataListCell
  13. #pragma 私有函数
  14. /**
  15. 设置销售业绩列表frame
  16. @param frame <#frame description#>
  17. */
  18. - (void)setSalesAchievementListFrame:(SalesAchievementListFrame *)frame{
  19. SalesAchievementRankModel *model = frame.achievementRankModel;
  20. if(model.objectName != nil && model.objectName.length > 0){
  21. _lblSalerName = [[UILabel alloc] initWithFrame:[frame salerNameF]];
  22. _lblSalerName.backgroundColor = [UIColor clearColor];
  23. _lblSalerName.textColor = [UIColor blackColor];
  24. _lblSalerName.textAlignment = NSTextAlignmentLeft;
  25. _lblSalerName.font = kTextFont;
  26. [self addSubview: _lblSalerName];
  27. _lblSalerName.text = model.objectName;
  28. }
  29. NSString *titleRank=@"排行:";
  30. UILabel *lblTitleRank=[[UILabel alloc] initWithFrame:[frame lblTitleRankF]];
  31. lblTitleRank.backgroundColor = [UIColor clearColor];
  32. lblTitleRank.textColor = [UIColor blackColor];
  33. lblTitleRank.textAlignment = NSTextAlignmentLeft;
  34. lblTitleRank.font = kTextFont;
  35. lblTitleRank.text = titleRank;
  36. [self addSubview: lblTitleRank];
  37. NSInteger orderOrder=model.orderSort;
  38. NSString *orderSortStr= [NSString stringWithFormat:@"%ld",(long)orderOrder];
  39. if(orderSortStr != nil && orderSortStr.length > 0){
  40. _lblRank = [[UILabel alloc] initWithFrame:[frame lblRankF]];
  41. _lblRank.textColor = [UIColor blackColor];
  42. _lblRank.textAlignment = NSTextAlignmentLeft;
  43. _lblRank.font = kTextFont;
  44. [self addSubview:_lblRank];
  45. _lblRank.text = orderSortStr;
  46. }
  47. NSString *titleSalesCustomerCount = @"客户数量:";
  48. UILabel *lblTitleSalesCustomerCount = [[UILabel alloc] initWithFrame:[frame lblTitleSalesCustomerCountF]];
  49. lblTitleSalesCustomerCount.backgroundColor = [UIColor clearColor];
  50. lblTitleSalesCustomerCount.textColor =LabelGrayTextColor;
  51. lblTitleSalesCustomerCount.textAlignment = NSTextAlignmentLeft;
  52. lblTitleSalesCustomerCount.font = kSubTextFont;
  53. lblTitleSalesCustomerCount.text = titleSalesCustomerCount;
  54. [self addSubview: lblTitleSalesCustomerCount];
  55. NSInteger salesCustomerCount=model.salesCustomerCount;
  56. NSString *salesCustomerCountStr= [NSString stringWithFormat:@"%ld",(long)salesCustomerCount];
  57. if(salesCustomerCountStr != nil && salesCustomerCountStr.length > 0){
  58. _lblSalesCustomerCount = [[UILabel alloc] initWithFrame:[frame lblSalesCustomerCountF]];
  59. _lblSalesCustomerCount.textColor = LabelGrayTextColor;
  60. _lblSalesCustomerCount.textAlignment = NSTextAlignmentLeft;
  61. _lblSalesCustomerCount.font = kSubTextFont;
  62. [self addSubview: _lblSalesCustomerCount];
  63. _lblSalesCustomerCount.text = salesCustomerCountStr;
  64. }
  65. NSString *titleSalesItemCount = @"单数:";
  66. UILabel *lblTitleSalesItemCount = [[UILabel alloc] initWithFrame:[frame lblTitleSalesItemCountF]];
  67. lblTitleSalesItemCount.backgroundColor = [UIColor clearColor];
  68. lblTitleSalesItemCount.textColor = LabelGrayTextColor;
  69. lblTitleSalesItemCount.textAlignment = NSTextAlignmentLeft;
  70. lblTitleSalesItemCount.font = kSubTextFont;
  71. lblTitleSalesItemCount.text = titleSalesItemCount;
  72. [self addSubview: lblTitleSalesItemCount];
  73. NSInteger salesItemCount=model.salesItemCount;
  74. NSString *salesItemCountStr= [NSString stringWithFormat:@"%ld",(long)salesItemCount];
  75. if(salesItemCountStr != nil && salesItemCountStr.length > 0){
  76. _lblSalesItemCount = [[UILabel alloc] initWithFrame:[frame lblSalesItemCountF]];
  77. _lblSalesItemCount.textColor = LabelGrayTextColor;
  78. _lblSalesItemCount.textAlignment = NSTextAlignmentLeft;
  79. _lblSalesItemCount.font = kSubTextFont;
  80. [self addSubview: _lblSalesItemCount];
  81. _lblSalesItemCount.text = salesItemCountStr;
  82. }
  83. NSString *titlePercent = @"比重:";
  84. UILabel *lblTitlePercent = [[UILabel alloc] initWithFrame:[frame lblTitlePercentF]];
  85. lblTitlePercent.backgroundColor = [UIColor clearColor];
  86. lblTitlePercent.textColor = LabelGrayTextColor;
  87. lblTitlePercent.textAlignment = NSTextAlignmentLeft;
  88. lblTitlePercent.font = kSubTextFont;
  89. lblTitlePercent.text = titlePercent;
  90. [self addSubview: lblTitlePercent];
  91. NSString *percent = model.percent;
  92. percent = [NSString stringWithFormat:@"%@%s",percent,"%"];
  93. if(percent != nil && percent.length > 0){
  94. _lblPercentage = [[UILabel alloc] initWithFrame:[frame lblPercentF]];
  95. _lblPercentage.textColor = LabelGrayTextColor;
  96. _lblPercentage.textAlignment = NSTextAlignmentRight;
  97. _lblPercentage.font = kSubTextFont;
  98. [self addSubview:_lblPercentage];
  99. _lblPercentage.text = percent;
  100. }
  101. NSString *titleSalesAmount = @"销售金额:";
  102. UILabel *lblTitleSalesAmount = [[UILabel alloc] initWithFrame:[frame lblTitleSalesAmountF]];
  103. lblTitleSalesAmount.backgroundColor = [UIColor clearColor];
  104. lblTitleSalesAmount.textColor = LabelGrayTextColor;
  105. lblTitleSalesAmount.textAlignment = NSTextAlignmentLeft;
  106. lblTitleSalesAmount.font = kSubTextFont;
  107. lblTitleSalesAmount.text = titleSalesAmount;
  108. [self addSubview: lblTitleSalesAmount];
  109. double salesAmount = model.goodsAmount;
  110. NSString *salesAmountStr = [NSString stringWithFormat:@"¥%.2f",salesAmount];
  111. if(salesAmountStr != nil && salesAmountStr.length > 0){
  112. _lblSalesAmount = [[UILabel alloc] initWithFrame:[frame lblSalesAmountF]];
  113. _lblSalesAmount.textColor = LabelGrayTextColor;
  114. _lblSalesAmount.textAlignment = NSTextAlignmentLeft;
  115. _lblSalesAmount.font = kSubTextFont;
  116. [self addSubview:_lblSalesAmount];
  117. _lblSalesAmount.text = salesAmountStr;
  118. }
  119. NSString *titleAverage = @"客户平均值:";
  120. UILabel *lblTitleAverage = [[UILabel alloc] initWithFrame:[frame lblTitleCustomerAverageF]];
  121. lblTitleAverage.backgroundColor = [UIColor clearColor];
  122. lblTitleAverage.textColor = LabelGrayTextColor;
  123. lblTitleAverage.textAlignment = NSTextAlignmentLeft;
  124. lblTitleAverage.text = titleAverage;
  125. lblTitleAverage.font = kSubTextFont;
  126. [self addSubview: lblTitleAverage];
  127. double average=model.average;
  128. NSString *averageStr = [NSString stringWithFormat:@"¥%.2f",average];
  129. if(averageStr != nil&&averageStr.length > 0){
  130. _lblAverage = [[UILabel alloc] initWithFrame:[frame lblCustomerAverageF]];
  131. _lblAverage.textColor = LabelGrayTextColor;
  132. _lblAverage.textAlignment = NSTextAlignmentLeft;
  133. _lblAverage.font = kSubTextFont;
  134. [self addSubview: _lblAverage];
  135. _lblAverage.text = averageStr;
  136. }
  137. UIView *separatorView = [[UIView alloc]init];
  138. separatorView.frame = [frame separatorF];
  139. separatorView.backgroundColor = LineBackgroundColor;
  140. [self addSubview:separatorView];
  141. }
  142. @end