TransferList.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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_IN_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_IN_DEC_LV']]['LEVEL_NAME'] ?? '';
  46. }
  47. }
  48. /**
  49. * 要展示和导出的所有字段
  50. * @return array
  51. */
  52. public function getColumn() {
  53. if (!$this->columns) {
  54. $this->columns = [
  55. 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  56. 'TRANSFER_SN' => [
  57. 'header' => 'Transfer record serial number', // 转账记录流水号
  58. 'headerOther' => [
  59. 'width' => '250',
  60. ],
  61. 'valueOther' => function ($row) {
  62. return [
  63. 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
  64. ];
  65. },
  66. ],
  67. 'LAST_OUT_USER_NAME' => [
  68. 'header' => 'Transfer out Member No', // 转出会员编号
  69. 'headerOther' => ['width' => '150'],
  70. ],
  71. 'LAST_OUT_REAL_NAME' => [
  72. 'header' => 'Name of transfer out member', // 转出会员姓名
  73. 'headerOther' => [
  74. 'width' => '120',
  75. ],
  76. ],
  77. 'LAST_OUT_DEC_LV_NAME' => [
  78. 'header' => '转出主体会员级别',
  79. 'headerOther' => [
  80. 'width' => '150',
  81. ],
  82. ],
  83. 'OUT_WALLET' => [
  84. 'header' => '转出账户',
  85. 'value' => function ($row) {
  86. return Transfer::WALLET_NAME[$row['OUT_WALLET']];
  87. },
  88. 'headerOther' => [
  89. 'width' => '150',
  90. ],
  91. ],
  92. 'LAST_IN_USER_NAME' => [
  93. 'header' => '转入会员编号',
  94. 'headerOther' => ['width' => '150'],
  95. ],
  96. 'LAST_IN_REAL_NAME' => [
  97. 'header' => '转入会员姓名',
  98. 'headerOther' => [
  99. 'width' => '120',
  100. ],
  101. ],
  102. 'LAST_IN_DEC_LV_NAME' => [
  103. 'header' => '转入主体级别',
  104. 'headerOther' => [
  105. 'width' => '150',
  106. ],
  107. ],
  108. 'IN_WALLET' => [
  109. 'header' => '转入账户',
  110. 'value' => function ($row) {
  111. return Transfer::WALLET_NAME[$row['IN_WALLET']];
  112. },
  113. 'headerOther' => [
  114. 'width' => '150',
  115. ],
  116. ],
  117. 'ORI_AMOUNT' => [
  118. 'header' => '转账金额',
  119. 'value' => function ($row) {
  120. return Tool::formatPrice($row['ORI_AMOUNT']);
  121. },
  122. 'headerOther' => [
  123. 'width' => '150',
  124. ],
  125. ],
  126. 'FEE' => [
  127. 'header' => '手续费',
  128. 'value' => function ($row) {
  129. return Tool::formatPrice($row['FEE']);
  130. },
  131. 'headerOther' => [
  132. 'width' => '150',
  133. ],
  134. ],
  135. 'AMOUNT' => [
  136. 'header' => '实际转入金额',
  137. 'value' => function ($row) {
  138. return Tool::formatPrice($row['AMOUNT']);
  139. },
  140. 'headerOther' => [
  141. 'width' => '150',
  142. ],
  143. 'valueOther' => function ($row) {
  144. return [
  145. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  146. ];
  147. },
  148. ],
  149. 'CREATED_AT' => [
  150. 'header' => '转账时间',
  151. 'value' => function ($row) {
  152. return (new DateTime([
  153. 'value' => $row['CREATED_AT'],
  154. ]))->result();
  155. },
  156. 'headerOther' => ['width' => '190'],
  157. ],
  158. 'PERIOD_NUM' => [
  159. 'header' => '转账期数',
  160. 'headerOther' => [
  161. 'width' => '150',
  162. ],
  163. ],
  164. 'REMARK' => [
  165. 'header' => '备注',
  166. 'headerOther' => [
  167. 'width' => '200',
  168. ],
  169. ],
  170. ];
  171. }
  172. return $this->columns;
  173. }
  174. /**
  175. * 前台用于筛选的类型集合
  176. * @return mixed
  177. */
  178. public function getFilterTypes() {
  179. if (!$this->filterTypes) {
  180. $this->filterTypes = [
  181. 'TRANSFER_SN' => ['isUserTable' => false, 'name' => '转账记录流水号'],
  182. 'LAST_OUT_USER_NAME' => ['isUserTable' => false, 'name' => '转出会员编号'],
  183. 'LAST_OUT_REAL_NAME' => ['isUserTable' => false, 'name' => '转出会员姓名'],
  184. 'LAST_OUT_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转出主体会员级别', 'other' => 'decLevel'],
  185. 'OUT_WALLET' => ['isUserTable' => false, 'name' => '转出账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  186. 'LAST_IN_USER_NAME' => ['isUserTable' => false, 'name' => '转入会员编号'],
  187. 'LAST_IN_REAL_NAME' => ['isUserTable' => false, 'name' => '转入会员姓名'],
  188. 'LAST_IN_DEC_LV_NAME' => ['isUserTable' => false, 'name' => '转入主体级别', 'other' => 'decLevel'],
  189. 'IN_WALLET' => ['isUserTable' => false, 'name' => '转入账户', 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  190. 'ORI_AMOUNT' => ['isUserTable' => false, 'name' => '转账金额'],
  191. 'FEE' => ['isUserTable' => false, 'name' => '手续费'],
  192. 'AMOUNT' => ['isUserTable' => false, 'name' => '实际转入金额'],
  193. 'CREATED_AT' => ['isUserTable' => false, 'name' => '转账时间', 'other' => 'date'],
  194. 'PERIOD_NUM' => ['isUserTable' => false, 'name' => '转账期数'],
  195. 'REMARK' => ['isUserTable' => false, 'name' => '备注'],
  196. ];
  197. }
  198. return $this->filterTypes;
  199. }
  200. }