PeriodBonusList.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\bonus;
  3. use common\helpers\Cache;
  4. use common\helpers\Tool;
  5. use common\helpers\user\Info;
  6. use common\libs\dataList\column\Price;
  7. use common\libs\dataList\DataListInterface;
  8. use common\models\CalcBonus;
  9. use common\models\UserInfo;
  10. use common\libs\dataList\column\DateTime;
  11. use Yii;
  12. class PeriodBonusList extends \common\libs\dataList\DataList implements DataListInterface
  13. {
  14. /**
  15. * 列表名称
  16. * @return string
  17. */
  18. public function getListName(){
  19. return '奖金列表';
  20. }
  21. /**
  22. * 列表筛选到的数据
  23. * @throws \yii\base\Exception
  24. */
  25. public function dataHandle()
  26. {
  27. $yearMonth = $this->others['yearMonth'];
  28. $this->listData = CalcBonus::lists($this->condition, $this->params, [
  29. 'select'=>'CB.*,UI.CON_UID,UI.REC_UID',
  30. 'from' => CalcBonus::tableName().' AS CB',
  31. 'join' => [
  32. ['INNER JOIN', UserInfo::tableName() . ' AS UI', 'CB.USER_ID=UI.USER_ID'],
  33. ],
  34. 'yearMonth' => $yearMonth,
  35. 'orderBy' => 'CB.CREATED_AT DESC, CB.ID DESC',
  36. 'page' => $this->page,
  37. 'pageSize' => $this->pageSize,
  38. ]);
  39. unset($yearMonth);
  40. if ($this->listData['list']) {
  41. foreach ($this->listData['list'] as $key => $value) {
  42. $this->listData['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_DEC_LV']]['LEVEL_NAME'];
  43. $this->listData['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_EMP_LV']]['LEVEL_NAME'];
  44. $this->listData['list'][$key]['LAST_ELITE_LV_NAME'] = Cache::getEliteLevelConfig()[$value['LAST_ELITE_LV']]['LEVEL_NAME'];
  45. $this->listData['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$value['LAST_STATUS']]['label'];
  46. $this->listData['list'][$key]['LAST_REC_USER_NAME'] = Info::getUserNameByUserId($value['REC_UID']);
  47. $this->listData['list'][$key]['LAST_REC_REAL_NAME'] = Info::getUserRealNameByUserId($value['REC_UID']);
  48. }
  49. }
  50. }
  51. /**
  52. * 要展示和导出的所有字段
  53. * @return array
  54. */
  55. public function getColumn(){
  56. if(!$this->columns){
  57. $this->columns = [
  58. 'ID' => null,
  59. 'PERIOD_NUM' => [
  60. 'header' => \Yii::t('ctx', 'payCycle'), // 结算期数
  61. 'headerOther' => [
  62. 'width' => '150',
  63. ],
  64. 'valueOther' => [
  65. 'tag'=>['type'=>'', 'size' => 'small', 'class'=>'no-border'],
  66. ],
  67. ],
  68. 'CALC_MONTH' => [
  69. 'header' => Yii::t('ctx', 'bonusMonth'), // 结算月
  70. 'headerOther' => [
  71. 'width' => '110',
  72. ],
  73. ],
  74. 'LAST_USER_NAME' => [
  75. 'header' => \Yii::t('ctx', 'memberCode'), // 会员编号
  76. 'headerOther' => [
  77. 'width' => '150',
  78. ],
  79. 'valueOther' => [
  80. 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border']
  81. ],
  82. ],
  83. 'LAST_REAL_NAME' => [
  84. 'header' => \Yii::t('ctx', 'memberName'), // 会员姓名
  85. 'headerOther' => [
  86. 'width' => '120',
  87. ],
  88. 'valueOther' => [
  89. 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
  90. ],
  91. ],
  92. 'LAST_DEC_LV_NAME' => [
  93. 'header' => \Yii::t('ctx', 'PCMemberLevel'), // 结算时会员级别
  94. 'headerOther' => [
  95. 'width' => '140',
  96. ],
  97. ],
  98. 'LAST_EMP_LV_NAME' => [
  99. 'header' => \Yii::t('ctx', 'latestDirector'), // 结算时会员最新管理星级
  100. 'headerOther' => [
  101. 'width' => '140',
  102. ],
  103. ],
  104. 'LAST_ELITE_LV_NAME' => [
  105. 'header' => \Yii::t('ctx', 'latestElite'), // 结算时会员最新ELite
  106. 'headerOther' => [
  107. 'width' => '140',
  108. ],
  109. ],
  110. 'LAST_REC_USER_NAME' => [
  111. 'header' => Yii::t('ctx', 'sponsorNo'), // 开拓者编号
  112. 'headerOther' => [
  113. 'width' => '150',
  114. ],
  115. ],
  116. 'LAST_REC_REAL_NAME' => [
  117. 'header' => Yii::t('ctx', 'sponsorName'), // 开拓者姓名
  118. 'headerOther' => [
  119. 'width' => '120',
  120. ],
  121. ],
  122. ];
  123. }
  124. return $this->columns;
  125. }
  126. /**
  127. * 前台用于筛选的类型集合
  128. * @return mixed
  129. */
  130. public function getFilterTypes()
  131. {
  132. if(!$this->filterTypes){
  133. $this->filterTypes = [
  134. 'LAST_USER_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberCode')], // 会员编号
  135. 'LAST_REAL_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'memberName')], // 会员姓名
  136. 'LAST_DEC_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'PCMemberLevel'), 'other'=> 'decLevel'], // 结算时会员级别
  137. 'LAST_EMP_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'latestDirector'), 'other'=> 'empLevel'], // 结算时会员管理星级
  138. 'LAST_ELITE_LV_NAME'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'latestElite'), 'other'=> 'elite'], // 结算时会员Elite
  139. 'CALC_MONTH'=> ['isUserTable'=> false, 'name'=> Yii::t('ctx', 'bonusMonth')], // 结算月
  140. ];
  141. }
  142. return $this->filterTypes;
  143. }
  144. }