RechargeList.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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\Countries;
  9. use common\models\OpenBank;
  10. use common\models\Recharge;
  11. use common\models\User;
  12. use common\models\UserInfo;
  13. class RechargeList 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 = Recharge::lists($this->condition, $this->params, [
  26. 'select' => 'R.*,UI.USER_NAME,OB.BANK_NAME OPEN_BANK_NAME,ADMA.ADMIN_NAME AUDIT_ADMIN_NAME,CN.NAME COUNTRY_NAME',
  27. 'orderBy' => 'R.CREATED_AT DESC, R.ID DESC',
  28. 'from' => Recharge::tableName() . ' AS R',
  29. 'join' => [
  30. ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'UI.USER_ID=R.USER_ID'],
  31. ['INNER JOIN', USER::tableName() . ' AS U', 'U.ID=R.USER_ID'],
  32. ['LEFT JOIN', OpenBank::tableName() . ' AS OB', 'OB.BANK_CODE=R.OPEN_BANK'],
  33. ['LEFT JOIN', Admin::tableName() . ' AS ADMA', 'ADMA.ID=R.AUDIT_ADMIN'],
  34. ['LEFT JOIN', Countries::tableName() . ' AS CN', 'U.COUNTRY_ID=CN.ID'],
  35. ],
  36. 'page' => $this->page,
  37. 'pageSize' => $this->pageSize,
  38. ]);
  39. }
  40. /**
  41. * 要展示和导出的所有字段
  42. * @return array
  43. */
  44. public function getColumn() {
  45. if (!$this->columns) {
  46. $this->columns = [
  47. 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  48. 'SN' => [
  49. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnSn'), // 充值申请流水号
  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. 'USER_NAME' => [
  60. 'header' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName'), // 会员编号
  61. 'headerOther' => ['width' => '150'],
  62. ],
  63. 'COUNTRY_NAME' => [
  64. 'header' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListCountryName'), // 国家
  65. 'headerOther' => ['width' => '150'],
  66. ],
  67. 'OPEN_BANK_NAME' => [
  68. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBank'), // 汇款银行
  69. 'headerOther' => ['width' => '150'],
  70. ],
  71. 'BANK_NO' => [
  72. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBankNo'), // 汇款账号
  73. 'headerOther' => ['width' => '150'],
  74. ],
  75. 'BANK_PROVE' => null,
  76. 'AUDIT_STATUS' => [
  77. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAuditStatus'), // 审核状态
  78. 'value' => function ($row) {
  79. // return Recharge::STATUS_NAME[$row['AUDIT_STATUS']];
  80. return Recharge::getStatusName()[$row['AUDIT_STATUS']];
  81. },
  82. 'headerOther' => [
  83. 'width' => '120',
  84. ],
  85. ],
  86. 'AMOUNT' => [
  87. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAmount'), // 充值金额
  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. 'CREATED_AT' => [
  101. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnCreatedAt'), // 申请时间
  102. 'value' => function ($row) {
  103. return (new DateTime([
  104. 'value' => $row['CREATED_AT'],
  105. ]))->result();
  106. },
  107. 'headerOther' => ['width' => '190'],
  108. ],
  109. 'REMARK' => [
  110. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnRemark'), // 备注
  111. 'headerOther' => [
  112. 'width' => '200',
  113. ],
  114. ],
  115. ];
  116. }
  117. return $this->columns;
  118. }
  119. /**
  120. * 前台用于筛选的类型集合
  121. * @return mixed
  122. */
  123. public function getFilterTypes() {
  124. if (!$this->filterTypes) {
  125. $this->filterTypes = [
  126. 'SN' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRecordSerialNumber')],// 充值记录流水号
  127. 'USER_NAME' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName')], // 会员编号modelListFinanceBalanceAuditListUserName
  128. 'AUDIT_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditStatusName'), 'other' => 'select', 'selectData' => [
  129. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeAuditStatusToBeReviewed')],
  130. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeAuditStatusVoucherUploaded')],
  131. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeAuditStatusAudited')]
  132. ]
  133. ], // 审核状态 待审核 已上传凭证 已审核
  134. 'RECHARGE_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRechargeState'), 'other' => 'select', 'selectData' => [
  135. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeRechargeStateNew')],
  136. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeRechargeStateProcessing')],
  137. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeRechargeStateSuccess')]
  138. ]
  139. ], // 充值状态
  140. 'BANK_NO' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBankNo')],// 汇款账号
  141. 'AMOUNT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAmount')],// 充值金额
  142. 'CREATED_AT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnCreatedAt'), 'other' => 'date'],// 申请时间
  143. ];
  144. }
  145. return $this->filterTypes;
  146. }
  147. }