TransferList.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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\helpers\user\Info;
  8. use common\helpers\user\Reconsume;
  9. use common\libs\dataList\column\DateTime;
  10. use common\libs\dataList\column\YesNo;
  11. use common\libs\dataList\DataListInterface;
  12. use common\models\BalanceAudit;
  13. use common\models\Countries;
  14. use common\models\DealType;
  15. use common\models\forms\ReconsumeForm;
  16. use common\models\PerfAudit;
  17. use common\models\ReconsumeAudit;
  18. use common\models\ReconsumePool;
  19. use common\models\DecRole;
  20. use common\models\Transfer;
  21. use common\models\User;
  22. use common\models\UserInfo;
  23. use common\models\UserSystem;
  24. use common\models\YearHighestEmpLv;
  25. use Yii;
  26. class TransferList extends \common\libs\dataList\DataList implements DataListInterface {
  27. /**
  28. * 列表名称
  29. * @return string
  30. */
  31. public function getListName() {
  32. return '转账记录列表';
  33. }
  34. /**
  35. * 列表筛选到的数据
  36. * @throws \yii\base\Exception
  37. */
  38. public function dataHandle() {
  39. $this->listData = Transfer::lists($this->condition, $this->params, [
  40. 'select' => 'BA.*, C.NAME AS COUNTRY',
  41. 'orderBy' => 'BA.CREATED_AT DESC, BA.ID DESC',
  42. 'from' => Transfer::tableName() . ' AS BA',
  43. 'join' => [
  44. ['INNER JOIN', User::tableName() . ' AS U', 'BA.OUT_UID=U.ID'],
  45. ['INNER JOIN', Countries::tableName() . ' AS C', 'U.COUNTRY_ID=C.ID'],
  46. ],
  47. 'page' => $this->page,
  48. 'pageSize' => $this->pageSize,
  49. ]);
  50. foreach ($this->listData['list'] as $key => $value) {
  51. $this->listData['list'][$key]['LAST_OUT_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_OUT_DEC_LV']]['LEVEL_NAME'] ?? '';;
  52. $this->listData['list'][$key]['LAST_IN_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_IN_DEC_LV']]['LEVEL_NAME'] ?? '';
  53. }
  54. }
  55. /**
  56. * 要展示和导出的所有字段
  57. * @return array
  58. */
  59. public function getColumn() {
  60. if (!$this->columns) {
  61. $this->columns = [
  62. 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
  63. 'TRANSFER_SN' => [
  64. 'header' => Yii::t('ctx', 'modelListFinanceTranserListTransferSn'), // 转账记录流水号
  65. 'headerOther' => [
  66. 'width' => '250',
  67. ],
  68. 'valueOther' => function ($row) {
  69. return [
  70. 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
  71. ];
  72. },
  73. ],
  74. 'LAST_OUT_USER_NAME' => [
  75. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastOutUserName'), // 转出会员编号
  76. 'headerOther' => ['width' => '150'],
  77. ],
  78. 'LAST_OUT_REAL_NAME' => [
  79. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastOutRealName'), // 转出会员姓名
  80. 'headerOther' => [
  81. 'width' => '120',
  82. ],
  83. ],
  84. 'COUNTRY' => [
  85. 'header' => Yii::t('ctx', 'country'),
  86. ],
  87. 'LAST_OUT_DEC_LV_NAME' => [
  88. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastOutDecLvName'), // 转出主体会员级别
  89. 'headerOther' => [
  90. 'width' => '150',
  91. ],
  92. ],
  93. 'OUT_WALLET' => [
  94. 'header' => Yii::t('ctx', 'modelListFinanceTranserListOutWallet'), //转出账户
  95. 'value' => function ($row) {
  96. return Transfer::WALLET_NAME[$row['OUT_WALLET']];
  97. },
  98. 'headerOther' => [
  99. 'width' => '150',
  100. ],
  101. ],
  102. 'LAST_IN_USER_NAME' => [
  103. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastInUserName'), // 转入会员编号
  104. 'headerOther' => ['width' => '150'],
  105. ],
  106. 'LAST_IN_REAL_NAME' => [
  107. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastInRealName'), // 转入会员姓名
  108. 'headerOther' => [
  109. 'width' => '120',
  110. ],
  111. ],
  112. 'LAST_IN_DEC_LV_NAME' => [
  113. 'header' => Yii::t('ctx', 'modelListFinanceTranserListLastInDecLvName'),//转入主体级别
  114. 'headerOther' => [
  115. 'width' => '150',
  116. ],
  117. ],
  118. 'IN_WALLET' => [
  119. 'header' => Yii::t('ctx', 'modelListFinanceTranserListInWallet'),//转入账户
  120. 'value' => function ($row) {
  121. return Transfer::WALLET_NAME[$row['IN_WALLET']];
  122. },
  123. 'headerOther' => [
  124. 'width' => '150',
  125. ],
  126. ],
  127. 'ORI_AMOUNT' => [
  128. 'header' => Yii::t('ctx', 'modelListFinanceTranserListOriAmount'),//转账金额
  129. 'value' => function ($row) {
  130. return Tool::formatPrice($row['ORI_AMOUNT']);
  131. },
  132. 'headerOther' => [
  133. 'width' => '150',
  134. ],
  135. ],
  136. 'FEE' => [
  137. 'header' => Yii::t('ctx', 'modelListFinanceTranserListFee'),//手续费
  138. 'value' => function ($row) {
  139. return Tool::formatPrice($row['FEE']);
  140. },
  141. 'headerOther' => [
  142. 'width' => '150',
  143. ],
  144. ],
  145. 'AMOUNT' => [
  146. 'header' => Yii::t('ctx', 'modelListFinanceTranserListAmount'),//实际转入金额
  147. 'value' => function ($row) {
  148. return Tool::formatPrice($row['AMOUNT']);
  149. },
  150. 'headerOther' => [
  151. 'width' => '150',
  152. ],
  153. 'valueOther' => function ($row) {
  154. return [
  155. 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
  156. ];
  157. },
  158. ],
  159. 'CREATED_AT' => [
  160. 'header' => Yii::t('ctx', 'modelListFinanceTranserListCreatedAt'),//转账时间
  161. 'value' => function ($row) {
  162. return (new DateTime([
  163. 'value' => $row['CREATED_AT'],
  164. ]))->result();
  165. },
  166. 'headerOther' => ['width' => '190'],
  167. ],
  168. 'PERIOD_NUM' => [
  169. 'header' => Yii::t('ctx', 'modelListFinanceTranserListPeriodNum'),//转账期数
  170. 'headerOther' => [
  171. 'width' => '150',
  172. ],
  173. ],
  174. 'REMARK' => [
  175. 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemark'), // 备注
  176. 'headerOther' => [
  177. 'width' => '200',
  178. ],
  179. ],
  180. ];
  181. }
  182. return $this->columns;
  183. }
  184. /**
  185. * 前台用于筛选的类型集合
  186. * @return mixed
  187. */
  188. public function getFilterTypes() {
  189. if (!$this->filterTypes) {
  190. $this->filterTypes = [
  191. 'TRANSFER_SN' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListTransferSn')],
  192. 'LAST_OUT_USER_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastOutUserName')],
  193. 'LAST_OUT_REAL_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastOutRealName')],
  194. 'LAST_OUT_DEC_LV_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastOutDecLvName'), 'other' => 'decLevel'],
  195. // 'OUT_WALLET' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListOutWallet'), 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  196. 'LAST_IN_USER_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastInUserName')],
  197. 'LAST_IN_REAL_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastInRealName')],
  198. 'LAST_IN_DEC_LV_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListLastInDecLvName'), 'other' => 'decLevel'],
  199. // 'IN_WALLET' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListInWallet'), 'other' => 'select', 'selectData' => [['id' => 'bonus', 'name' => '会员账户'], ['id' => 'cash', 'name' => '现金钱包']]],
  200. 'ORI_AMOUNT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListOriAmount')],
  201. 'FEE' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListFee')],
  202. 'AMOUNT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListAmount')],
  203. 'CREATED_AT' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListCreatedAt'), 'other' => 'date'],
  204. 'PERIOD_NUM' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceTranserListPeriodNum')],
  205. 'REMARK' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemark')],
  206. ];
  207. }
  208. return $this->filterTypes;
  209. }
  210. }