WithdrawList.php 7.7 KB

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