RechargeList.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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\Tool;
  6. use common\libs\dataList\column\DateTime;
  7. use common\libs\dataList\DataListInterface;
  8. use common\models\OpenBank;
  9. use common\models\Recharge;
  10. use common\models\UserInfo;
  11. class RechargeList extends \common\libs\dataList\DataList implements DataListInterface {
  12. /**
  13. * 列表名称
  14. * @return string
  15. */
  16. public function getListName() {
  17. return '充值申请列表';
  18. }
  19. /**
  20. * 列表筛选到的数据
  21. */
  22. public function dataHandle() {
  23. $this->listData = Recharge::lists($this->condition, $this->params, [
  24. 'select' => 'R.*,UI.USER_NAME,OB.BANK_NAME OPEN_BANK_NAME,ADMA.ADMIN_NAME AUDIT_ADMIN_NAME',
  25. 'orderBy' => 'R.CREATED_AT DESC, R.ID DESC',
  26. 'from' => Recharge::tableName() . ' AS R',
  27. 'join' => [
  28. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'UI.USER_ID=R.USER_ID'],
  29. ['LEFT JOIN', OpenBank::tableName() . ' AS OB', 'OB.BANK_CODE=R.OPEN_BANK'],
  30. ['LEFT JOIN', Admin::tableName() . ' AS ADMA', 'ADMA.ID=R.AUDIT_ADMIN'],
  31. ],
  32. 'page' => $this->page,
  33. 'pageSize' => $this->pageSize,
  34. ]);
  35. }
  36. /**
  37. * 要展示和导出的所有字段
  38. * @return array
  39. */
  40. public function getColumn() {
  41. if (!$this->columns) {
  42. $this->columns = [
  43. 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  44. 'SN' => [
  45. 'header' => '充值申请流水号',
  46. 'headerOther' => [
  47. 'width' => '250',
  48. ],
  49. 'valueOther' => function ($row) {
  50. return [
  51. 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
  52. ];
  53. },
  54. ],
  55. 'USER_NAME' => [
  56. 'header' => '会员编号',
  57. 'headerOther' => ['width' => '150'],
  58. ],
  59. 'OPEN_BANK_NAME' => [
  60. 'header' => '汇款银行',
  61. 'headerOther' => ['width' => '150'],
  62. ],
  63. 'BANK_NO' => [
  64. 'header' => '汇款账号',
  65. 'headerOther' => ['width' => '150'],
  66. ],
  67. 'BANK_PROVE' => null,
  68. 'AUDIT_STATUS' => [
  69. 'header' => '审核状态',
  70. 'value' => function ($row) {
  71. return Recharge::STATUS_NAME[$row['AUDIT_STATUS']];
  72. },
  73. 'headerOther' => [
  74. 'width' => '120',
  75. ],
  76. ],
  77. 'AMOUNT' => [
  78. 'header' => '充值金额',
  79. 'value' => function ($row) {
  80. return Tool::formatPrice($row['AMOUNT']);
  81. },
  82. 'headerOther' => [
  83. 'width' => '150',
  84. ],
  85. 'valueOther' => function ($row) {
  86. return [
  87. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  88. ];
  89. },
  90. ],
  91. 'CREATED_AT' => [
  92. 'header' => '申请时间',
  93. 'value' => function ($row) {
  94. return (new DateTime([
  95. 'value' => $row['CREATED_AT'],
  96. ]))->result();
  97. },
  98. 'headerOther' => ['width' => '190'],
  99. ],
  100. 'REMARK' => [
  101. 'header' => '备注',
  102. 'headerOther' => [
  103. 'width' => '200',
  104. ],
  105. ],
  106. ];
  107. }
  108. return $this->columns;
  109. }
  110. /**
  111. * 前台用于筛选的类型集合
  112. * @return mixed
  113. */
  114. public function getFilterTypes() {
  115. if (!$this->filterTypes) {
  116. $this->filterTypes = [
  117. 'SN' => ['isUserTable' => false, 'name' => '充值记录流水号'],
  118. 'USER_NAME' => ['isUserTable' => false, 'name' => '会员编号'],
  119. 'AUDIT_STATUS' => ['isUserTable' => false, 'name' => '审核状态', 'other' => 'select', 'selectData' => [['id' =>0, 'name' => '待审核'], ['id' => 1, 'name' => '已上传凭证'], ['id' => 2, 'name' => '已审核']]],
  120. 'RECHARGE_STATUS' => ['isUserTable' => false, 'name' => '充值状态', 'other' => 'select', 'selectData' => [['id' =>0, 'name' => 'New'], ['id' => 1, 'name' => 'Processing'], ['id' => 2, 'name' => 'Success']]],
  121. 'BANK_NO' => ['isUserTable' => false, 'name' => '汇款账号'],
  122. 'AMOUNT' => ['isUserTable' => false, 'name' => '充值金额'],
  123. 'CREATED_AT' => ['isUserTable' => false, 'name' => '申请时间', 'other' => 'date'],
  124. ];
  125. }
  126. return $this->filterTypes;
  127. }
  128. }