TraceDownGxList.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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\CalcBonusGX;
  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 TraceDownGxList 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 = CalcBonusGX::lists($this->condition, $this->params, [
  42. 'select' => 'CGX.*',
  43. 'from' => CalcBonusGX::tableName() . ' AS CGX',
  44. 'join' => [
  45. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'CGX.USER_ID=UI.USER_ID'],
  46. ],
  47. 'orderBy' => 'CGX.CREATED_AT ASC, CGX.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::baseInfo($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. unset($showFromInfo);
  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_DEC_LV_NAME' => [
  92. 'header' => '结算时会员级别',
  93. 'headerOther' => [
  94. 'width' => '120',
  95. ],
  96. ],
  97. 'LAST_EMP_LV_NAME' => [
  98. 'header' => '结算时会员聘级',
  99. 'headerOther' => [
  100. 'width' => '140',
  101. ],
  102. ],
  103. 'AMOUNT' => [
  104. 'header' => '共享奖金额',
  105. 'headerOther' => [
  106. 'width' => '150',
  107. ],
  108. 'value' => function($row) {
  109. return (new Price([
  110. 'value' => $row['AMOUNT'],
  111. ]))->result();
  112. },
  113. 'valueOther' => function($row){
  114. return [
  115. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  116. ];
  117. },
  118. ],
  119. 'ORI_BONUS' => [
  120. 'header' => '原金额',
  121. 'headerOther' => [
  122. 'width' => '150',
  123. ],
  124. 'value' => function($row) {
  125. return (new Price([
  126. 'value' => $row['ORI_BONUS'],
  127. ]))->result();
  128. },
  129. 'valueOther' => function($row){
  130. return [
  131. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  132. ];
  133. },
  134. ],
  135. 'RECONSUME_POINTS' => [
  136. 'header' => '复消积分',
  137. 'headerOther' => [
  138. 'width' => '150',
  139. ],
  140. 'value' => function($row) {
  141. return (new Price([
  142. 'value' => $row['RECONSUME_POINTS'],
  143. ]))->result();
  144. },
  145. 'valueOther' => function($row){
  146. return [
  147. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  148. ];
  149. },
  150. ],
  151. 'MANAGE_TAX' => [
  152. 'header' => '管理费',
  153. 'headerOther' => [
  154. 'width' => '150',
  155. ],
  156. 'value' => function($row) {
  157. return (new Price([
  158. 'value' => $row['MANAGE_TAX'],
  159. ]))->result();
  160. },
  161. 'valueOther' => function($row){
  162. return [
  163. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  164. ];
  165. },
  166. ],
  167. // 'DEEP' => [
  168. // 'header' => '紧缩代数',
  169. // 'headerOther' => [
  170. // 'width' => '80',
  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. }