| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <?php
- namespace backendApi\modules\v1\models\lists\finance;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\Audit;
- use common\helpers\Cache;
- use common\helpers\Tool;
- use common\helpers\user\Info;
- use common\helpers\user\Reconsume;
- use common\libs\dataList\column\DateTime;
- use common\libs\dataList\column\YesNo;
- use common\libs\dataList\DataListInterface;
- use common\models\BalanceAudit;
- use common\models\DealType;
- use common\models\forms\ReconsumeForm;
- use common\models\ReconsumeAudit;
- use common\models\ReconsumePool;
- use common\models\DecRole;
- use common\models\User;
- use common\models\UserInfo;
- use common\models\YearHighestEmpLv;
- use Yii;
- class BalanceAuditList extends \common\libs\dataList\DataList implements DataListInterface {
- /**
- * 列表名称
- * @return string
- */
- public function getListName() {
- return '会员余额调整列表';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle() {
- $this->listData = BalanceAudit::lists($this->condition, $this->params, [
- 'select' => 'BA.*,U.USER_NAME,U.REAL_NAME,ADMC.ADMIN_NAME CREATE_ADMIN_NAME,ADMU.ADMIN_NAME AUDIT_ADMIN_NAME',
- 'orderBy' => 'BA.CREATED_AT DESC, BA.ID DESC',
- 'from' => BalanceAudit::tableName() . ' AS BA',
- 'join' => [
- ['LEFT JOIN', User::tableName() . ' AS U', 'BA.USER_ID=U.ID'],
- ['LEFT JOIN', Admin::tableName() . ' AS ADMC', 'BA.UPDATE_ADMIN_ID=ADMC.ID'],
- ['LEFT JOIN', Admin::tableName() . ' AS ADMU', 'BA.AUDIT_ADMIN_ID=ADMU.ID'],
- ],
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- $auditStatus = array_column(Tool::paramConvert(\Yii::$app->params['auditStatus']), null, 'value');
- $dealTypes = DealType::getAllTypesForShow();
- foreach ($this->listData['list'] as $key => $value) {
- $this->listData['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['LAST_DEC_LV']]['LEVEL_NAME'] ?? '';
- $this->listData['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['LAST_EMP_LV']]['LEVEL_NAME'] ?? '';
- $this->listData['list'][$key]['LAST_DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['LAST_DEC_ROLE_ID']);
- $this->listData['list'][$key]['TYPE_NAME'] = BalanceAudit::getBalanceAuditType()[$value['TYPE']]['label'];
- $this->listData['list'][$key]['DEAL_TYPE_NAME'] = $dealTypes[$value['DEAL_TYPE']]['TYPE_NAME'];
- $this->listData['list'][$key]['AUDIT_STATUS_NAME'] = $auditStatus[$value['AUDIT_STATUS']]['label'];
- }
- $this->listData['dealTypes'] = $dealTypes;
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn() {
- if (!$this->columns) {
- $this->columns = [
- 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
- 'AUDIT_STATUS' => null,
- 'USER_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName'), // 会员编号
- 'headerOther' => ['width' => '150'],
- ],
- 'REAL_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRealName'), //会员姓名
- 'headerOther' => [
- 'width' => '120',
- ],
- ],
- 'LAST_DEC_LV_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListMemberLevel'), // 会员级别
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- 'LAST_DEC_ROLE_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListStockistLevel'), // 报单中心级别
- 'headerOther' => [
- 'width' => '170',
- ],
- ],
- 'LAST_EMP_LV_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListEmpLevel'),//聘级
- 'headerOther' => [
- 'width' => '130',
- ],
- ],
- 'TYPE_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListTypeName'), // 账户类型
- 'headerOther' => [
- 'width' => '140',
- ],
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- 'DEAL_TYPE_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListDealType'), // 交易类型
- 'headerOther' => [
- 'width' => '200',
- ],
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- 'AMOUNT' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAmount'), // 调整金额
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function ($row) {
- return Tool::formatPrice($row['AMOUNT']);
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- 'CREATE_REMARK' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemark'), // 备注
- 'headerOther' => [
- 'width' => '180',
- ],
- ],
- 'REMARK_IS_SHOW' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemarkIsShow'), // 前台是否显示备注
- 'value' => function ($row) {
- return (new YesNo([
- 'value' => $row['REMARK_IS_SHOW'],
- ]))->result();
- },
- 'headerOther' => [
- 'width' => '160',
- ],
- ],
- 'AUDIT_STATUS_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditStatusName'), // 审核状态
- 'headerOther' => [
- 'width' => '100',
- ],
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => Tool::statusType($row['AUDIT_STATUS']), 'size' => 'small']
- ];
- },
- ],
- 'CREATE_ADMIN_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListApplicant'), // 申请人
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- 'CREATED_AT' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListCreatedAt'), // 申请时间
- 'value' => function ($row) {
- return (new DateTime([
- 'value' => $row['CREATED_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '190'],
- ],
- 'AUDIT_ADMIN_NAME' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditName'), // 审核人
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- 'AUDITED_AT' => [
- 'header' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditTime'), // 审核时间
- 'value' => function ($row) {
- return (new DateTime([
- 'value' => $row['AUDITED_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '190'],
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes() {
- if (!$this->filterTypes) {
- $this->filterTypes = [
- 'USER_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListUserName')], //会员编号
- 'REAL_NAME' => ['isUserTable' => false, 'name' => Yii::t('ctx', 'memberName')], //会员姓名
- 'LAST_DEC_LV_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListMemberLevel'),
- 'other' => 'decLevel'
- ], // 会员级别
- 'LAST_DEC_ROLE_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListStockistLevel'),
- 'other' => 'decRole'
- ], // 报单中心级别
- 'LAST_EMP_LV_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListEmpLevel'),
- 'other' => 'empLevel'
- ], // 聘级
- 'TYPE_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListTypeName'),
- 'other' => 'select',
- 'selectData' => Tool::formatFilter(BalanceAudit::getBalanceAuditType(), 'name', 'label')
- ], // 账户类型
- 'DEAL_TYPE_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListDealType'),
- 'other' => 'select',
- 'selectData' => Tool::formatFilter(DealType::getAllTypesForShow(), 'ID', 'TYPE_NAME')
- ], // 交易类型
- 'AMOUNT' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAmount')
- ], // 调整金额
- 'CREATE_REMARK' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemark')
- ], // 备注
- 'REMARK_IS_SHOW' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListRemarkIsShow'),
- 'other' => 'yesOrNo'
- ], // 前台是否显示备注
- 'CREATE_ADMIN_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListApplicant')
- ], // 申请人
- 'CREATED_AT' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListCreatedAt'),
- 'other' => 'date'
- ], // 申请时间
- 'AUDIT_ADMIN_NAME' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditName')
- ], // 审核人
- 'AUDITED_AT' => [
- 'isUserTable' => false,
- 'name' => Yii::t('ctx', 'modelListFinanceBalanceAuditListAuditTime'),
- 'other' => 'date'
- ], // 审核时间
- ];
- }
- return $this->filterTypes;
- }
- }
|