RechargeList.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. 'PAY_DATE' => [
  110. 'header' => \Yii::t('ctx', 'modelListFinancePaidAt'), // 申请时间
  111. 'value' => function ($row) {
  112. return date('Y-m-d',$row['PAY_DATE'])."\t";
  113. },
  114. 'headerOther' => ['width' => '190'],
  115. ],
  116. 'RECHARGE_REMARK' => [
  117. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnRechargeRemark'), // 会员备注
  118. 'headerOther' => ['width' => '190'],
  119. ],
  120. 'REMARK' => [
  121. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnRemark'), // 备注
  122. 'headerOther' => [
  123. 'width' => '200',
  124. ],
  125. ],
  126. 'TYPE' => [
  127. 'header' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnType'), // 类型
  128. 'headerOther' => [
  129. 'width' => '150',
  130. ],
  131. ],
  132. ];
  133. }
  134. return $this->columns;
  135. }
  136. /**
  137. * 前台用于筛选的类型集合
  138. * @return mixed
  139. */
  140. public function getFilterTypes() {
  141. if (!$this->filterTypes) {
  142. $this->filterTypes = [
  143. 'SN' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRecordSerialNumber')],// 充值记录流水号
  144. 'USER_NAME' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName')], // 会员编号modelListFinanceBalanceAuditListUserName
  145. 'AUDIT_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditStatusName'), 'other' => 'select', 'selectData' => [
  146. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeAuditStatusToBeReviewed')],
  147. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeAuditStatusVoucherUploaded')],
  148. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeAuditStatusAudited')]
  149. ]
  150. ], // 审核状态 待审核 已上传凭证 已审核
  151. 'RECHARGE_STATUS' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'rechargeRechargeState'), 'other' => 'select', 'selectData' => [
  152. ['id' =>0, 'name' => \Yii::t('ctx', 'rechargeRechargeStateNew')],
  153. ['id' => 1, 'name' => \Yii::t('ctx', 'rechargeRechargeStateProcessing')],
  154. ['id' => 2, 'name' => \Yii::t('ctx', 'rechargeRechargeStateSuccess')]
  155. ]
  156. ], // 充值状态
  157. 'BANK_NO' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnBankNo')],// 汇款账号
  158. 'AMOUNT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnAmount')],// 充值金额
  159. 'CREATED_AT' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelsListsFinanceRechargeListgetColumnCreatedAt'), 'other' => 'date'],// 申请时间
  160. 'PAY_DATE' => ['isUserTable' => false, 'name' => \Yii::t('ctx', 'modelListFinancePaidAt'), 'other' => 'date'],// 申请时间
  161. //4047 (2026/3/24 16:54 Ryan)
  162. 'COUNTRY_NAME' => [
  163. 'name' => \Yii::t('ctx', 'modelListFinanceBalanceAuditListCountryName'), // 国家
  164. 'other'=> 'select',
  165. 'selectData'=> self::getCountry()
  166. ],
  167. ];
  168. }
  169. return $this->filterTypes;
  170. }
  171. public function getCountry()
  172. {
  173. $countries = Countries::getFromCache();
  174. $data = [];
  175. foreach ($countries as $country) {
  176. $data[] = [
  177. 'id' => $country['ID'],
  178. 'name' => $country['NAME'],
  179. ];
  180. }
  181. return $data;
  182. }
  183. }