TraceDownQyList.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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\PerfOrder;
  13. use common\models\Period;
  14. use common\models\Region;
  15. use common\models\User;
  16. use common\models\UserBind;
  17. use common\models\UserBonus;
  18. use common\models\UserInfo;
  19. use common\libs\dataList\column\DateTime;
  20. use common\models\UserNetwork;
  21. use common\models\UserSystem;
  22. use common\models\Withdraw;
  23. use Yii;
  24. class TraceDownQyList extends \common\libs\dataList\DataList implements DataListInterface
  25. {
  26. /**
  27. * 列表名称
  28. * @return string
  29. */
  30. public function getListName(){
  31. return '团队奖向下追溯';
  32. }
  33. /**
  34. * 列表筛选到的数据
  35. * @throws \yii\base\Exception
  36. */
  37. public function dataHandle()
  38. {
  39. $yearMonth = $this->others['yearMonth'];
  40. // $periodNum = $this->others['periodNum'];
  41. $this->listData = PerfOrder::lists($this->condition, $this->params, [
  42. 'select' => 'PO.PERIOD_NUM,PO.USER_ID,U.USER_NAME,U.REAL_NAME,PO.LAST_STATUS,PO.LAST_DEC_LV,PO.LAST_EMP_LV,PO.DEC_TYPE,PO.DEC_AMOUNT,PO.PV,PO.CALC_MONTH',
  43. 'from' => PerfOrder::tableName() . ' AS PO',
  44. 'join' => [
  45. ['LEFT JOIN', User::tableName() . ' AS U', 'PO.USER_ID=U.ID'],
  46. ],
  47. 'yearMonth' => $yearMonth,
  48. 'orderBy' => 'U.ID ASC',
  49. 'page' => $this->page,
  50. 'pageSize' => $this->pageSize,
  51. ]);
  52. $decConfig = Cache::getDecLevelConfig();
  53. $empConfig = Cache::getEmpLevelConfig();
  54. if ($this->listData['list']) {
  55. foreach ($this->listData['list'] as $key => $value) {
  56. $this->listData['list'][$key]['LAST_DEC_LV_NAME'] = $decConfig[$value['LAST_DEC_LV']]['LEVEL_NAME'] ?? '';
  57. $this->listData['list'][$key]['LAST_EMP_LV_NAME'] = $empConfig[$value['LAST_EMP_LV']]['LEVEL_NAME'] ?? '';
  58. $this->listData['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$value['LAST_STATUS']]['label'] ?? '';
  59. }
  60. }
  61. }
  62. /**
  63. * 要展示和导出的所有字段
  64. * @return array
  65. */
  66. public function getColumn(){
  67. if(!$this->columns){
  68. $this->columns = [
  69. 'PERIOD_NUM' => [
  70. 'header' => '期数',
  71. 'headerOther' => [
  72. 'width' => '150',
  73. ],
  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' => '150',
  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. // 'LOCATION' => [
  112. // 'header' => '市场',
  113. // 'headerOther' => [
  114. // 'width' => '100',
  115. // ],
  116. // ],
  117. 'DEC_TYPE' => [
  118. 'header' => '报单类型',
  119. 'headerOther' => [
  120. 'width' => '110',
  121. ],
  122. 'value' => function($row) {
  123. $decType = [
  124. 'ZC'=> '首购单',
  125. 'YH'=> '优惠单',
  126. 'ZG'=> '增购单',
  127. 'LS'=> '零售单',
  128. 'FX'=> '复销单',
  129. ];
  130. return $decType[$row['DEC_TYPE']];
  131. },
  132. ],
  133. 'DEC_AMOUNT' => [
  134. 'header' => '报单金额',
  135. 'value' => function($row) {
  136. return (new Price([
  137. 'value' => $row['DEC_AMOUNT'],
  138. ]))->result();
  139. },
  140. 'headerOther' => [
  141. 'width' => '150',
  142. 'prop'=>'DEC_AMOUNT',
  143. ],
  144. ],
  145. 'PV' => [
  146. 'header' => '报单BV',
  147. 'value' => function($row) {
  148. return (new Price([
  149. 'value' => $row['PV'],
  150. ]))->result();
  151. },
  152. 'headerOther' => [
  153. 'width' => '150',
  154. 'prop'=>'PV',
  155. ],
  156. ],
  157. 'CALC_MONTH' => [
  158. 'header' => '结算月',
  159. 'headerOther' => [
  160. 'width' => '110',
  161. ],
  162. ],
  163. ];
  164. }
  165. return $this->columns;
  166. }
  167. /**
  168. * 前台用于筛选的类型集合
  169. * @return mixed
  170. */
  171. public function getFilterTypes()
  172. {
  173. if(!$this->filterTypes){
  174. $this->filterTypes = [];
  175. }
  176. return $this->filterTypes;
  177. }
  178. }