WithdrawList.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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' => \Yii::t('ctx', 'modelListFinanceWithdrawSn'), // 提现流水号
  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' => \Yii::t('ctx', 'modelListFinanceWithdrawPeriod'), // 提现期数
  59. 'headerOther' => ['width' => '150'],
  60. ],
  61. 'CREATED_AT' => [
  62. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawAt'), // 提现时间
  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' => \Yii::t('ctx', 'modelListFinanceWithdrawState'), // 提现状态
  73. 'headerOther' => ['width' => '150'],
  74. 'value' => function ($row) {
  75. return Withdraw::getStatusName()[$row['AUDIT_STATUS']];
  76. // return Withdraw::STATUS_NAME[$row['AUDIT_STATUS']];
  77. },
  78. ],
  79. 'USER_NAME' => [
  80. 'header' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName'), // 会员编号
  81. 'headerOther' => ['width' => '150'],
  82. ],
  83. 'USER_REAL_NAME' => [
  84. 'header' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListRealName'), // 会员姓名
  85. 'headerOther' => ['width' => '150'],
  86. ],
  87. 'AMOUNT' => [
  88. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawAmount'), // 提现金额
  89. 'value' => function ($row) {
  90. return Tool::formatPrice($row['AMOUNT']);
  91. },
  92. 'headerOther' => [
  93. 'width' => '150',
  94. ],
  95. 'valueOther' => function ($row) {
  96. return [
  97. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  98. ];
  99. },
  100. ],
  101. 'FEES' => [
  102. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawFees'), // 手续费
  103. 'headerOther' => ['width' => '150'],
  104. ],
  105. 'REAL_AMOUNT' => [
  106. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawRealAmount'), // 实际到账金额
  107. 'headerOther' => ['width' => '150'],
  108. ],
  109. 'OPEN_BANK' => [
  110. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawBank'), // 提现银行
  111. 'headerOther' => ['width' => '150'],
  112. 'value' => function ($row) {
  113. return $row['OPEN_BANK'] ? OpenBank::getCnName($row['OPEN_BANK']) : '';
  114. },
  115. ],
  116. 'BANK_NO' => [
  117. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawBankNo'),//银行地区
  118. 'headerOther' => ['width' => '190'],
  119. 'value' => function ($row) {
  120. return $row['BANK_NO'].' /';
  121. },
  122. ],
  123. 'MOBILE' => [
  124. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawMobile'), // 手机号
  125. 'headerOther' => ['width' => '150'],
  126. ],
  127. 'UPDATE_ADMIN_NAME' => [
  128. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawUpdateAdminName'), // 操作管理员
  129. 'headerOther' => ['width' => '200'],
  130. ],
  131. 'REMARK' => [
  132. 'header' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListRemark'), // 备注
  133. 'headerOther' => [
  134. 'width' => '200',
  135. ],
  136. ],
  137. 'BACK_REMARK' => [
  138. 'header' => \Yii::t('ctx', 'modelListFinanceWithdrawBackRemark'), // 退回备注
  139. 'headerOther' => [
  140. 'width' => '200',
  141. ],
  142. ],
  143. ];
  144. }
  145. return $this->columns;
  146. }
  147. /**
  148. * 前台用于筛选的类型集合
  149. * @return mixed
  150. */
  151. public function getFilterTypes() {
  152. if (!$this->filterTypes) {
  153. $this->filterTypes = [
  154. 'SN' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceWithdrawSn')], // 提现流水号
  155. 'USER_NAME' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName')], // 会员编号
  156. 'WITHDRAW_PERIOD_NUM' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceWithdrawPeriod')], // 提现期数
  157. 'CREATED_AT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceWithdrawWithdrawalTime'), 'other' => 'date'], // 申请时间
  158. 'REAL_AMOUNT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceWithdrawRealAmount')] // 实际到账金额
  159. ];
  160. }
  161. return $this->filterTypes;
  162. }
  163. }