TraceDownXfList.php 7.0 KB

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