TransferList.php 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. namespace backendApi\modules\v1\models\lists\finance;
  3. use backendApi\modules\v1\models\Admin;
  4. use common\helpers\Audit;
  5. use common\helpers\Cache;
  6. use common\helpers\Tool;
  7. use common\helpers\user\Info;
  8. use common\helpers\user\Reconsume;
  9. use common\libs\dataList\column\DateTime;
  10. use common\libs\dataList\column\YesNo;
  11. use common\libs\dataList\DataListInterface;
  12. use common\models\BalanceAudit;
  13. use common\models\DealType;
  14. use common\models\forms\ReconsumeForm;
  15. use common\models\PerfAudit;
  16. use common\models\ReconsumeAudit;
  17. use common\models\ReconsumePool;
  18. use common\models\DecRole;
  19. use common\models\Transfer;
  20. use common\models\UserInfo;
  21. use common\models\UserSystem;
  22. use common\models\YearHighestEmpLv;
  23. use Yii;
  24. class TransferList extends \common\libs\dataList\DataList implements DataListInterface {
  25. /**
  26. * 列表名称
  27. * @return string
  28. */
  29. public function getListName() {
  30. return '转账记录列表';
  31. }
  32. /**
  33. * 列表筛选到的数据
  34. * @throws \yii\base\Exception
  35. */
  36. public function dataHandle() {
  37. $this->listData = Transfer::lists($this->condition, $this->params, [
  38. 'orderBy' => 'CREATED_AT DESC, ID DESC',
  39. 'from' => Transfer::tableName(),
  40. 'page' => $this->page,
  41. 'pageSize' => $this->pageSize,
  42. ]);
  43. foreach ($this->listData['list'] as $key => $value) {
  44. $this->listData['list'][$key]['LAST_OUT_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_OUT_DEC_LV']]['LEVEL_NAME'] ?? '';
  45. // $this->listData['list'][$key]['LAST_OUT_DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['LAST_OUT_DEC_ROLE_ID']);
  46. // $this->listData['list'][$key]['LAST_OUT_SYSTEM_NAME'] = UserSystem::getSystem($value['LAST_OUT_SYSTEM_ID'])['SYSTEM_NAME'] ?? '';
  47. $this->listData['list'][$key]['LAST_IN_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_IN_DEC_LV']]['LEVEL_NAME'] ?? '';
  48. // $this->listData['list'][$key]['LAST_IN_SYSTEM_NAME'] = UserSystem::getSystem($value['LAST_IN_SYSTEM_ID'])['SYSTEM_NAME'] ?? '';
  49. }
  50. }
  51. /**
  52. * 要展示和导出的所有字段
  53. * @return array
  54. */
  55. public function getColumn() {
  56. if (!$this->columns) {
  57. $this->columns = [
  58. 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  59. 'TRANSFER_SN' => [
  60. 'header' => '转账记录流水号',
  61. 'headerOther' => [
  62. 'width' => '250',
  63. ],
  64. 'valueOther' => function ($row) {
  65. return [
  66. 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
  67. ];
  68. },
  69. ],
  70. 'LAST_OUT_USER_NAME' => [
  71. 'header' => '转出会员编号',
  72. 'headerOther' => ['width' => '150'],
  73. ],
  74. 'LAST_OUT_REAL_NAME' => [
  75. 'header' => '转出会员姓名',
  76. 'headerOther' => [
  77. 'width' => '120',
  78. ],
  79. ],
  80. 'LAST_OUT_DEC_LV_NAME' => [
  81. 'header' => '转出主体会员级别',
  82. 'headerOther' => [
  83. 'width' => '150',
  84. ],
  85. ],
  86. // 'LAST_OUT_DEC_ROLE_NAME' => [
  87. // 'header' => '转出主体报单中心级别',
  88. // 'headerOther' => [
  89. // 'width' => '170',
  90. // ],
  91. // ],
  92. 'OUT_WALLET' => [
  93. 'header' => '转出账户',
  94. 'value' => function ($row) {
  95. return Transfer::WALLET_NAME[$row['OUT_WALLET']];
  96. },
  97. 'headerOther' => [
  98. 'width' => '150',
  99. ],
  100. ],
  101. // 'LAST_OUT_SYSTEM_NAME' => [
  102. // 'header' => '转出会员体系',
  103. // 'headerOther' => [
  104. // 'width' => '150',
  105. // ],
  106. // ],
  107. 'LAST_IN_USER_NAME' => [
  108. 'header' => '转入会员编号',
  109. 'headerOther' => ['width' => '150'],
  110. ],
  111. 'LAST_IN_REAL_NAME' => [
  112. 'header' => '转入会员姓名',
  113. 'headerOther' => [
  114. 'width' => '120',
  115. ],
  116. ],
  117. 'LAST_IN_DEC_LV_NAME' => [
  118. 'header' => '转入主体级别',
  119. 'headerOther' => [
  120. 'width' => '150',
  121. ],
  122. ],
  123. 'IN_WALLET' => [
  124. 'header' => '转入账户',
  125. 'value' => function ($row) {
  126. return Transfer::WALLET_NAME[$row['IN_WALLET']];
  127. },
  128. 'headerOther' => [
  129. 'width' => '150',
  130. ],
  131. ],
  132. // 'LAST_IN_SYSTEM_NAME' => [
  133. // 'header' => '转入会员体系',
  134. // 'headerOther' => [
  135. // 'width' => '150',
  136. // ],
  137. // ],
  138. 'ORI_AMOUNT' => [
  139. 'header' => '转账金额',
  140. 'value' => function ($row) {
  141. return Tool::formatPrice($row['ORI_AMOUNT']);
  142. },
  143. 'headerOther' => [
  144. 'width' => '150',
  145. ],
  146. ],
  147. 'FEE' => [
  148. 'header' => '手续费',
  149. 'value' => function ($row) {
  150. return Tool::formatPrice($row['FEE']);
  151. },
  152. 'headerOther' => [
  153. 'width' => '150',
  154. ],
  155. ],
  156. 'AMOUNT' => [
  157. 'header' => '实际转入金额',
  158. 'value' => function ($row) {
  159. return Tool::formatPrice($row['AMOUNT']);
  160. },
  161. 'headerOther' => [
  162. 'width' => '150',
  163. ],
  164. 'valueOther' => function ($row) {
  165. return [
  166. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  167. ];
  168. },
  169. ],
  170. 'CREATED_AT' => [
  171. 'header' => '转账时间',
  172. 'value' => function ($row) {
  173. return (new DateTime([
  174. 'value' => $row['CREATED_AT'],
  175. ]))->result();
  176. },
  177. 'headerOther' => ['width' => '190'],
  178. ],
  179. 'PERIOD_NUM' => [
  180. 'header' => '转账期数',
  181. 'headerOther' => [
  182. 'width' => '150',
  183. ],
  184. ],
  185. 'REMARK' => [
  186. 'header' => '备注',
  187. 'headerOther' => [
  188. 'width' => '200',
  189. ],
  190. ],
  191. ];
  192. }
  193. return $this->columns;
  194. }
  195. /**
  196. * 前台用于筛选的类型集合
  197. * @return mixed
  198. */
  199. public function getFilterTypes() {
  200. if (!$this->filterTypes) {
  201. $this->filterTypes = [
  202. 'TRANSFER_SN' => ['isUserTable' => false, 'name' => '转账记录流水号'],
  203. 'LAST_OUT_USER_NAME' => ['isUserTable' => false, 'name' => '转出会员编号'],
  204. 'LAST_OUT_REAL_NAME' => ['isUserTable' => false, 'name' => '转出会员姓名'],
  205. 'LAST_OUT_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转出主体会员级别', 'other' => 'decLevel'],
  206. // 'LAST_OUT_DEC_ROLE_NAME' => ['isUserTable' => false, 'name' => '转出主体报单中心级别', 'other' => 'decRole'],
  207. 'OUT_WALLET' => ['isUserTable' => false, 'name' => '转出账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  208. // 'LAST_OUT_SYSTEM_NAME' => ['isUserTable' => false, 'name' => '转出会员体系', 'other' => 'systems'],
  209. 'LAST_IN_USER_NAME' => ['isUserTable' => false, 'name' => '转入会员编号'],
  210. 'LAST_IN_REAL_NAME' => ['isUserTable' => false, 'name' => '转入会员姓名'],
  211. 'LAST_IN_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转入主体级别', 'other' => 'decLevel'],
  212. 'IN_WALLET' => ['isUserTable' => false, 'name' => '转入账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  213. // 'LAST_IN_SYSTEM_NAME' => ['isUserTable' => false, 'name' => '转入会员体系', 'other' => 'systems'],
  214. 'ORI_AMOUNT' => ['isUserTable' => false, 'name' => '转账金额'],
  215. 'FEE' => ['isUserTable' => false, 'name' => '手续费'],
  216. 'AMOUNT' => ['isUserTable' => false, 'name' => '实际转入金额'],
  217. 'CREATED_AT' => ['isUserTable' => false, 'name' => '转账时间', 'other' => 'date'],
  218. 'PERIOD_NUM' => ['isUserTable' => false, 'name' => '转账期数'],
  219. 'REMARK' => ['isUserTable' => false, 'name' => '备注'],
  220. ];
  221. }
  222. return $this->filterTypes;
  223. }
  224. }