TraceDownYcList.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\bonus;
  3. use backendApi\modules\v1\models\Admin;
  4. use common\helpers\bonus\CalcCache;
  5. use common\helpers\Cache;
  6. use common\helpers\Tool;
  7. use common\helpers\user\Info;
  8. use common\libs\dataList\column\Price;
  9. use common\libs\dataList\column\YesNo;
  10. use common\libs\dataList\DataListInterface;
  11. use common\models\CalcBonus;
  12. use common\models\CalcBonusYC;
  13. use common\models\PerfOrder;
  14. use common\models\PerfPeriod;
  15. use common\models\Period;
  16. use common\models\Region;
  17. use common\models\UserBind;
  18. use common\models\UserBonus;
  19. use common\models\UserInfo;
  20. use common\libs\dataList\column\DateTime;
  21. use common\models\UserNetwork;
  22. use common\models\UserSystem;
  23. use common\models\Withdraw;
  24. use Yii;
  25. class TraceDownYcList extends \common\libs\dataList\DataList implements DataListInterface
  26. {
  27. /**
  28. * 列表名称
  29. * @return string
  30. */
  31. public function getListName(){
  32. return '荣衔奖向下追溯';
  33. }
  34. /**
  35. * 列表筛选到的数据
  36. * @throws \yii\base\Exception
  37. */
  38. public function dataHandle()
  39. {
  40. $yearMonth = $this->others['yearMonth'];
  41. $data = CalcBonusYC::lists($this->condition, $this->params, [
  42. 'select' => 'CBY.*',
  43. 'from' => CalcBonusYC::tableName() . ' AS CBY',
  44. 'join' => [
  45. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'CBY.USER_ID=UI.USER_ID'],
  46. ],
  47. 'orderBy' => 'CBY.DEEP ASC, CBY.ID ASC',
  48. 'yearMonth' => $yearMonth,
  49. 'page' => $this->page,
  50. 'pageSize' => $this->pageSize,
  51. ]);
  52. if ($data['list']) {
  53. foreach ($data['list'] as $key => $value) {
  54. $userInfo = Info::baseInfoZh($value['FROM_USER_ID']);
  55. $data['list'][$key] = array_merge($userInfo, $value);
  56. $data['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_FROM_DEC_LV']]['LEVEL_NAME'] ?? '';
  57. $data['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_FROM_EMP_LV']]['LEVEL_NAME'] ?? '';
  58. $data['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$value['LAST_FROM_STATUS']]['label'] ?? '';
  59. }
  60. }
  61. $this->listData = $data;
  62. }
  63. /**
  64. * 要展示和导出的所有字段
  65. * @return array
  66. */
  67. public function getColumn(){
  68. if(!$this->columns){
  69. $this->columns = [
  70. 'PERIOD_NUM' => [
  71. 'header' => '结算期数',
  72. ],
  73. 'USER_NAME' => [
  74. 'header' => '提供者编号',
  75. 'headerOther' => [
  76. 'width' => '150',
  77. ],
  78. 'valueOther' => [
  79. 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border']
  80. ],
  81. ],
  82. 'REAL_NAME' => [
  83. 'header' => '提供者姓名',
  84. 'headerOther' => [
  85. 'width' => '120',
  86. ],
  87. 'valueOther' => [
  88. 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
  89. ],
  90. ],
  91. 'LAST_STATUS_NAME' => [
  92. 'header' => '结算时状态',
  93. 'headerOther' => [
  94. 'width' => '110',
  95. ],
  96. ],
  97. 'LAST_DEC_LV_NAME' => [
  98. 'header' => '结算时会员级别',
  99. 'headerOther' => [
  100. 'width' => '120',
  101. ],
  102. ],
  103. 'LAST_EMP_LV_NAME' => [
  104. 'header' => '结算时会员聘级',
  105. 'headerOther' => [
  106. 'width' => '140',
  107. ],
  108. ],
  109. 'BONUS_TYPE' => [
  110. 'header' => '奖金类型',
  111. 'value' => function($row) {
  112. return CalcBonusYC::BONUS_TYPE_NAME[$row['BONUS_TYPE']] ?? '未知';
  113. },
  114. 'headerOther' => ['width' => '110'],
  115. ],
  116. 'AMOUNT' => [
  117. 'header' => '提供荣衔奖金额',
  118. 'headerOther' => [
  119. 'width' => '150',
  120. ],
  121. 'value' => function($row) {
  122. return (new Price([
  123. 'value' => $row['AMOUNT'],
  124. ]))->result();
  125. },
  126. 'valueOther' => function($row){
  127. return [
  128. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  129. ];
  130. },
  131. ],
  132. // 'DEEP' => [
  133. // 'header' => '紧缩代数',
  134. // 'headerOther' => [
  135. // 'width' => '80',
  136. // ],
  137. // ],
  138. 'CALC_MONTH' => [
  139. 'header' => '结算月',
  140. 'headerOther' => [
  141. 'width' => '110',
  142. ],
  143. ],
  144. ];
  145. }
  146. return $this->columns;
  147. }
  148. /**
  149. * 前台用于筛选的类型集合
  150. * @return mixed
  151. */
  152. public function getFilterTypes()
  153. {
  154. if(!$this->filterTypes){
  155. $this->filterTypes = [];
  156. }
  157. return $this->filterTypes;
  158. }
  159. }