TraceDownYjList.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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\CalcBonusYJ;
  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 TraceDownYjList 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 = CalcBonusYJ::lists($this->condition, $this->params, [
  42. 'select' => 'CYJ.*',
  43. 'from' => CalcBonusYJ::tableName() . ' AS CYJ',
  44. 'join' => [
  45. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'CYJ.USER_ID=UI.USER_ID'],
  46. ],
  47. 'orderBy' => 'CYJ.CREATED_AT ASC, CYJ.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. 'AMOUNT' => [
  110. 'header' => '业绩奖金额',
  111. 'headerOther' => [
  112. 'width' => '150',
  113. ],
  114. 'value' => function($row) {
  115. return (new Price([
  116. 'value' => $row['AMOUNT'],
  117. ]))->result();
  118. },
  119. 'valueOther' => function($row){
  120. return [
  121. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  122. ];
  123. },
  124. ],
  125. 'ORI_BONUS' => [
  126. 'header' => '原金额',
  127. 'headerOther' => [
  128. 'width' => '150',
  129. ],
  130. 'value' => function($row) {
  131. return (new Price([
  132. 'value' => $row['ORI_BONUS'],
  133. ]))->result();
  134. },
  135. 'valueOther' => function($row){
  136. return [
  137. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  138. ];
  139. },
  140. ],
  141. 'RECONSUME_POINTS' => [
  142. 'header' => '复消积分',
  143. 'headerOther' => [
  144. 'width' => '150',
  145. ],
  146. 'value' => function($row) {
  147. return (new Price([
  148. 'value' => $row['RECONSUME_POINTS'],
  149. ]))->result();
  150. },
  151. 'valueOther' => function($row){
  152. return [
  153. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  154. ];
  155. },
  156. ],
  157. 'MANAGE_TAX' => [
  158. 'header' => '管理费',
  159. 'headerOther' => [
  160. 'width' => '150',
  161. ],
  162. 'value' => function($row) {
  163. return (new Price([
  164. 'value' => $row['MANAGE_TAX'],
  165. ]))->result();
  166. },
  167. 'valueOther' => function($row){
  168. return [
  169. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  170. ];
  171. },
  172. ],
  173. 'CALC_MONTH' => [
  174. 'header' => '结算月',
  175. 'headerOther' => [
  176. 'width' => '110',
  177. ],
  178. ],
  179. ];
  180. }
  181. return $this->columns;
  182. }
  183. /**
  184. * 前台用于筛选的类型集合
  185. * @return mixed
  186. */
  187. public function getFilterTypes()
  188. {
  189. if(!$this->filterTypes){
  190. $this->filterTypes = [];
  191. }
  192. return $this->filterTypes;
  193. }
  194. }