WithdrawList.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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\libs\dataList\column\DateTime;
  8. use common\libs\dataList\DataListInterface;
  9. use common\models\OpenBank;
  10. use common\models\User;
  11. use common\models\Withdraw;
  12. class WithdrawList extends \common\libs\dataList\DataList implements DataListInterface {
  13. /**
  14. * 列表名称
  15. * @return string
  16. */
  17. public function getListName() {
  18. return '提现申请列表';
  19. }
  20. /**
  21. * 列表筛选到的数据
  22. */
  23. public function dataHandle() {
  24. $this->listData = Withdraw::lists($this->condition, $this->params, [
  25. 'select' => 'W.*,U.USER_NAME,U.REAL_NAME AS USER_REAL_NAME,U.ID_CARD,U.MOBILE,U.OPEN_BANK,U.BANK_PROVINCE,U.BANK_CITY,U.BANK_COUNTY,U.BANK_ADDRESS,U.BANK_NO,ADM.ADMIN_NAME UPDATE_ADMIN_NAME,ADMA.ADMIN_NAME AUDIT_ADMIN_NAME',
  26. 'orderBy' => 'W.CREATED_AT DESC',
  27. 'from' => Withdraw::tableName() . ' AS W',
  28. 'join' => [
  29. ['LEFT JOIN', User::tableName() . ' AS U', 'W.USER_ID=U.ID'],
  30. ['LEFT JOIN', Admin::tableName() . ' AS ADM', 'ADM.ID=W.UPDATE_ADMIN'],
  31. ['LEFT JOIN', Admin::tableName() . ' AS ADMA', 'ADMA.ID=W.AUDIT_ADMIN'],
  32. ],
  33. 'page' => $this->page,
  34. 'pageSize' => $this->pageSize,
  35. ]);
  36. }
  37. /**
  38. * 要展示和导出的所有字段
  39. * @return array
  40. */
  41. public function getColumn() {
  42. $regionConfig = Cache::getRegionConfig();
  43. if (!$this->columns) {
  44. $this->columns = [
  45. 'ID' => null,
  46. 'SN' => [
  47. 'header' => 'Withdrawal serial number', // 提现流水号
  48. 'headerOther' => [
  49. 'width' => '250',
  50. ],
  51. 'valueOther' => function ($row) {
  52. return [
  53. 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
  54. ];
  55. },
  56. ],
  57. 'WITHDRAW_PERIOD_NUM' => [
  58. 'header' => 'Period', // 提现期数
  59. 'headerOther' => ['width' => '150'],
  60. ],
  61. 'CREATED_AT' => [
  62. 'header' => 'Withdrawal time', // 提现时间
  63. 'value' => function ($row) {
  64. return (new DateTime([
  65. 'value' => $row['CREATED_AT'],
  66. ]))->result();
  67. },
  68. 'headerOther' => ['width' => '190'],
  69. ],
  70. 'AUDIT_STATUS' => null,
  71. 'AUDIT_STATUS_NAME' => [
  72. 'header' => 'State', // 提现状态
  73. 'headerOther' => ['width' => '150'],
  74. 'value' => function ($row) {
  75. return Withdraw::STATUS_NAME[$row['AUDIT_STATUS']];
  76. },
  77. ],
  78. 'USER_NAME' => [
  79. 'header' => 'Member code', // 会员编号
  80. 'headerOther' => ['width' => '150'],
  81. ],
  82. 'USER_REAL_NAME' => [
  83. 'header' => 'Member name', // 会员姓名
  84. 'headerOther' => ['width' => '150'],
  85. ],
  86. 'AMOUNT' => [
  87. 'header' => 'Withdrawal amount', // 提现金额
  88. 'value' => function ($row) {
  89. return Tool::formatPrice($row['AMOUNT']);
  90. },
  91. 'headerOther' => [
  92. 'width' => '150',
  93. ],
  94. 'valueOther' => function ($row) {
  95. return [
  96. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  97. ];
  98. },
  99. ],
  100. 'FEES' => [
  101. 'header' => 'Bank charge', // 手续费
  102. 'headerOther' => ['width' => '150'],
  103. ],
  104. 'REAL_AMOUNT' => [
  105. 'header' => 'Actual amount', // 实际到账金额
  106. 'headerOther' => ['width' => '150'],
  107. ],
  108. 'OPEN_BANK' => [
  109. 'header' => 'Bank info',
  110. 'headerOther' => ['width' => '150'],
  111. 'value' => function ($row) {
  112. return $row['OPEN_BANK'] ? OpenBank::getCnName($row['OPEN_BANK']) : '';
  113. },
  114. ],
  115. 'BANK_NO' => [
  116. 'header' => 'Bank account',
  117. 'headerOther' => ['width' => '190'],
  118. 'value' => function ($row) {
  119. return $row['BANK_NO'].' /';
  120. },
  121. ],
  122. 'MOBILE' => [
  123. 'header' => 'Phone Number', // 手机号
  124. 'headerOther' => ['width' => '150'],
  125. ],
  126. 'UPDATE_ADMIN_NAME' => [
  127. 'header' => 'Operations administrator', // 操作管理员
  128. 'headerOther' => ['width' => '200'],
  129. ],
  130. 'REMARK' => [
  131. 'header' => 'Remark', // 备注
  132. 'headerOther' => [
  133. 'width' => '200',
  134. ],
  135. ],
  136. 'BACK_REMARK' => [
  137. 'header' => 'Return note', // 退回备注
  138. 'headerOther' => [
  139. 'width' => '200',
  140. ],
  141. ],
  142. ];
  143. }
  144. return $this->columns;
  145. }
  146. /**
  147. * 前台用于筛选的类型集合
  148. * @return mixed
  149. */
  150. public function getFilterTypes() {
  151. if (!$this->filterTypes) {
  152. $this->filterTypes = [
  153. 'SN' => ['isUserTable' => false, 'name' => 'Withdrawal serial number'], // 提现流水号
  154. 'USER_NAME' => ['isUserTable' => false, 'name' => 'Member code'], // 会员编号
  155. 'WITHDRAW_PERIOD_NUM' => ['isUserTable' => false, 'name' => 'Period'], // 提现期数
  156. 'CREATED_AT' => ['isUserTable' => false, 'name' => 'Withdrawal time', 'other' => 'date'], // 申请时间
  157. 'REAL_AMOUNT' => ['isUserTable' => false, 'name' => 'Actual Amount']
  158. ];
  159. }
  160. return $this->filterTypes;
  161. }
  162. }