TraceDownBdList.php 6.9 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\CalcBonusBD;
  13. use common\models\CalcBonusYC;
  14. use common\models\PerfOrder;
  15. use common\models\PerfPeriod;
  16. use common\models\Period;
  17. use common\models\Region;
  18. use common\models\UserBind;
  19. use common\models\UserBonus;
  20. use common\models\UserInfo;
  21. use common\libs\dataList\column\DateTime;
  22. use common\models\UserNetwork;
  23. use common\models\UserSystem;
  24. use common\models\Withdraw;
  25. use Yii;
  26. class TraceDownBdList extends \common\libs\dataList\DataList implements DataListInterface
  27. {
  28. /**
  29. * 列表名称
  30. * @return string
  31. */
  32. public function getListName(){
  33. return '服务奖向下追溯';
  34. }
  35. /**
  36. * 列表筛选到的数据
  37. * @throws \yii\base\Exception
  38. */
  39. public function dataHandle()
  40. {
  41. $yearMonth = $this->others['yearMonth'];
  42. $data = CalcBonusBD::lists($this->condition, $this->params, [
  43. 'select' => 'CBB.*',
  44. 'from' => CalcBonusBD::tableName() . ' AS CBB',
  45. 'join' => [
  46. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'CBB.USER_ID=UI.USER_ID'],
  47. ],
  48. 'orderBy' => 'CBB.CREATED_AT ASC, CBB.ID ASC',
  49. 'yearMonth' => $yearMonth,
  50. 'page' => $this->page,
  51. 'pageSize' => $this->pageSize,
  52. ]);
  53. if ($data['list']) {
  54. foreach ($data['list'] as $key => $value) {
  55. $userInfo = Info::baseInfoZh($value['FROM_USER_ID']);
  56. $data['list'][$key] = array_merge($userInfo, $value);
  57. $data['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_FROM_DEC_LV']]['LEVEL_NAME'] ?? '';
  58. $data['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_FROM_EMP_LV']]['LEVEL_NAME'] ?? '';
  59. $data['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$value['LAST_FROM_STATUS']]['label'] ?? '';
  60. }
  61. }
  62. $this->listData = $data;
  63. }
  64. /**
  65. * 要展示和导出的所有字段
  66. * @return array
  67. */
  68. public function getColumn(){
  69. if(!$this->columns){
  70. $this->columns = [
  71. 'PERIOD_NUM' => [
  72. 'header' => '结算期数',
  73. ],
  74. 'USER_NAME' => [
  75. 'header' => '提供者编号',
  76. 'headerOther' => [
  77. 'width' => '150',
  78. ],
  79. 'valueOther' => [
  80. 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border']
  81. ],
  82. ],
  83. 'REAL_NAME' => [
  84. 'header' => '提供者姓名',
  85. 'headerOther' => [
  86. 'width' => '120',
  87. ],
  88. 'valueOther' => [
  89. 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
  90. ],
  91. ],
  92. 'LAST_STATUS_NAME' => [
  93. 'header' => '结算时状态',
  94. 'headerOther' => [
  95. 'width' => '110',
  96. ],
  97. ],
  98. 'LAST_DEC_LV_NAME' => [
  99. 'header' => '结算时会员级别',
  100. 'headerOther' => [
  101. 'width' => '120',
  102. ],
  103. ],
  104. 'LAST_EMP_LV_NAME' => [
  105. 'header' => '结算时会员聘级',
  106. 'headerOther' => [
  107. 'width' => '140',
  108. ],
  109. ],
  110. 'AMOUNT' => [
  111. 'header' => '服务奖金额',
  112. 'headerOther' => [
  113. 'width' => '150',
  114. ],
  115. 'value' => function($row) {
  116. return (new Price([
  117. 'value' => $row['AMOUNT'],
  118. ]))->result();
  119. },
  120. 'valueOther' => function($row){
  121. return [
  122. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  123. ];
  124. },
  125. ],
  126. 'ORI_BONUS' => [
  127. 'header' => '原金额',
  128. 'headerOther' => [
  129. 'width' => '150',
  130. ],
  131. 'value' => function($row) {
  132. return (new Price([
  133. 'value' => $row['ORI_BONUS'],
  134. ]))->result();
  135. },
  136. 'valueOther' => function($row){
  137. return [
  138. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  139. ];
  140. },
  141. ],
  142. 'RECONSUME_POINTS' => [
  143. 'header' => '复消积分',
  144. 'headerOther' => [
  145. 'width' => '150',
  146. ],
  147. 'value' => function($row) {
  148. return (new Price([
  149. 'value' => $row['RECONSUME_POINTS'],
  150. ]))->result();
  151. },
  152. 'valueOther' => function($row){
  153. return [
  154. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  155. ];
  156. },
  157. ],
  158. 'MANAGE_TAX' => [
  159. 'header' => '管理费',
  160. 'headerOther' => [
  161. 'width' => '150',
  162. ],
  163. 'value' => function($row) {
  164. return (new Price([
  165. 'value' => $row['MANAGE_TAX'],
  166. ]))->result();
  167. },
  168. 'valueOther' => function($row){
  169. return [
  170. 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
  171. ];
  172. },
  173. ],
  174. 'CALC_MONTH' => [
  175. 'header' => '结算月',
  176. 'headerOther' => [
  177. 'width' => '110',
  178. ],
  179. ],
  180. ];
  181. }
  182. return $this->columns;
  183. }
  184. /**
  185. * 前台用于筛选的类型集合
  186. * @return mixed
  187. */
  188. public function getFilterTypes()
  189. {
  190. if(!$this->filterTypes){
  191. $this->filterTypes = [];
  192. }
  193. return $this->filterTypes;
  194. }
  195. }