RechargeList.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnSn'), // 充值申请流水号
  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' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName'), // 会员编号
  57. 'headerOther' => ['width' => '150'],
  58. ],
  59. 'OPEN_BANK_NAME' => [
  60. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBank'), // 汇款银行
  61. 'headerOther' => ['width' => '150'],
  62. ],
  63. 'BANK_NO' => [
  64. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBankNo'), // 汇款账号
  65. 'headerOther' => ['width' => '150'],
  66. ],
  67. 'BANK_PROVE' => null,
  68. 'AUDIT_STATUS' => [
  69. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAuditStatus'), // 审核状态
  70. 'value' => function ($row) {
  71. // return Recharge::STATUS_NAME[$row['AUDIT_STATUS']];
  72. return Recharge::getStatusName()[$row['AUDIT_STATUS']];
  73. },
  74. 'headerOther' => [
  75. 'width' => '120',
  76. ],
  77. ],
  78. 'AMOUNT' => [
  79. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAmount'), // 充值金额
  80. 'value' => function ($row) {
  81. return Tool::formatPrice($row['AMOUNT']);
  82. },
  83. 'headerOther' => [
  84. 'width' => '150',
  85. ],
  86. 'valueOther' => function ($row) {
  87. return [
  88. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  89. ];
  90. },
  91. ],
  92. 'CREATED_AT' => [
  93. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnCreatedAt'), // 申请时间
  94. 'value' => function ($row) {
  95. return (new DateTime([
  96. 'value' => $row['CREATED_AT'],
  97. ]))->result();
  98. },
  99. 'headerOther' => ['width' => '190'],
  100. ],
  101. 'REMARK' => [
  102. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnRemark'), // 备注
  103. 'headerOther' => [
  104. 'width' => '200',
  105. ],
  106. ],
  107. ];
  108. }
  109. return $this->columns;
  110. }
  111. /**
  112. * 前台用于筛选的类型集合
  113. * @return mixed
  114. */
  115. public function getFilterTypes() {
  116. if (!$this->filterTypes) {
  117. $this->filterTypes = [
  118. 'SN' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRecordSerialNumber')],// 充值记录流水号
  119. 'USER_NAME' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName')], // 会员编号modelListFinanceBalanceAuditListUserName
  120. 'AUDIT_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditStatusName'), 'other' => 'select', 'selectData' => [
  121. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeAuditStatusToBeReviewed')],
  122. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeAuditStatusVoucherUploaded')],
  123. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeAuditStatusAudited')]
  124. ]
  125. ], // 审核状态 待审核 已上传凭证 已审核
  126. 'RECHARGE_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRechargeState'), 'other' => 'select', 'selectData' => [
  127. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeRechargeStateNew')],
  128. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeRechargeStateProcessing')],
  129. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeRechargeStateSuccess')]
  130. ]
  131. ], // 充值状态
  132. 'BANK_NO' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBankNo')],// 汇款账号
  133. 'AMOUNT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAmount')],// 充值金额
  134. 'CREATED_AT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnCreatedAt'), 'other' => 'date'],// 申请时间
  135. ];
  136. }
  137. return $this->filterTypes;
  138. }
  139. }