| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- <?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\HistoryBonus;
- use common\models\PerfAudit;
- use common\models\ReconsumeAudit;
- use common\models\ReconsumePool;
- use common\models\DecRole;
- use common\models\Region;
- use common\models\Transfer;
- use common\models\UserInfo;
- use common\models\UserSystem;
- use common\models\YearHighestEmpLv;
- use Yii;
- class HistoryBonusList extends \common\libs\dataList\DataList implements DataListInterface {
- /**
- * 列表名称
- * @return string
- */
- public function getListName() {
- return 'Historical bonus balance';//历史奖金余额
- }
- /**
- * 列表筛选到的数据
- */
- public function dataHandle() {
- $this->listData = HistoryBonus::lists($this->condition, $this->params, [
- 'orderBy' => 'BACKUP_AT DESC, ID DESC',
- 'from' => HistoryBonus::tableName(),
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- $auditStatus = array_column(\Yii::$app->params['userStatus'], null, 'value');
- foreach ($this->listData['list'] as $key => $value) {
- $this->listData['list'][$key]['USER_STATUS_NAME'] = $auditStatus[$value['USER_STATUS']]['label'];
- $this->listData['list'][$key]['DEC_LV_NAME'] = Cache::getDecLevelConfig()[$value['DEC_LV']]['LEVEL_NAME'] ?? '';
- $this->listData['list'][$key]['EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['EMP_LV']]['LEVEL_NAME'] ?? '';
- $this->listData['list'][$key]['DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['DEC_ROLE_ID']);
- $this->listData['list'][$key]['HIGHEST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$value['HIGHEST_EMP_LV']]['LEVEL_NAME'] ?? '';
- $this->listData['list'][$key]['DEC_DEC_ROLE_NAME'] = DecRole::getRoleNameId($value['DEC_DEC_ROLE_ID']);
- $this->listData['list'][$key]['PROVINCE_NAME'] = $value['PROVINCE'] ? Region::getCnName($value['PROVINCE']) : '';
- $this->listData['list'][$key]['CITY_NAME'] = $value['CITY'] ? Region::getCnName($value['CITY']) : '';
- $this->listData['list'][$key]['COUNTY_NAME'] = $value['COUNTY'] ? Region::getCnName($value['COUNTY']) : '';
- $this->listData['list'][$key]['SUB_COM_NAME'] = '';
- }
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn() {
- if (!$this->columns) {
- $this->columns = [
- 'ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
- 'USER_NAME' => [
- 'header' => 'Member code',//会员编号
- 'headerOther' => ['width' => '150'],
- ],
- 'REAL_NAME' => [
- 'header' => 'Member name',//会员姓名
- 'headerOther' => [
- 'width' => '120',
- ],
- ],
- 'DEC_LV_NAME' => [
- 'header' => 'Member level',//会员级别
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- 'EMP_LV_NAME' => [
- 'header' => 'Rank',//聘级
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- 'IS_DEC' => [
- 'header' => 'Whether distributor',//是否报单中心
- 'value' => function ($row) {
- return (new YesNo([
- 'value' => $row['IS_DEC'],
- ]))->result();
- },
- 'headerOther' => function ($row) {
- return [
- 'width' => '120',
- ];
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => (isset($row['IS_DEC']) && $row['IS_DEC']) ? 'success' : 'info', 'size' => 'small']
- ];
- },
- ],
- // 'DEC_ROLE_NAME' => [
- // 'header' => '报单中心级别',
- // 'headerOther' => [
- // 'width' => '150',
- // ],
- // ],
- // 'SYSTEM_NAME' => [
- // 'header' => '体系名称',
- // 'headerOther' => [
- // 'width' => '200',
- // ],
- // ],
- 'BONUS' => [
- 'header' => 'Member bonus',//会员账户余额
- 'value' => function ($row) {
- return Tool::formatPrice($row['BONUS']);
- },
- 'headerOther' => function ($row) {
- return [
- 'width' => '150',
- ];
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- // 'CF' => [
- // 'header' => '车房养老余额',
- // 'value' => function ($row) {
- // return Tool::formatPrice($row['CF']);
- // },
- // 'headerOther' => function ($row) {
- // return [
- // 'width' => '150',
- // ];
- // },
- // 'valueOther' => function ($row) {
- // return [
- // 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
- // ];
- // },
- // ],
- // 'LX' => [
- // 'header' => '领袖分红余额',
- // 'value' => function ($row) {
- // return Tool::formatPrice($row['LX']);
- // },
- // 'headerOther' => function ($row) {
- // return [
- // 'width' => '150',
- // ];
- // },
- // 'valueOther' => function ($row) {
- // return [
- // 'tag' => ['type' => 'danger', 'size' => 'small', 'class' => 'no-border']
- // ];
- // },
- // ],
- 'WITHDRAW' => [
- 'header' => 'Withdrawal amount',//提现金额
- 'value' => function ($row) {
- return Tool::formatPrice($row['WITHDRAW']);
- },
- 'headerOther' => function ($row) {
- return [
- 'width' => '150',
- ];
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- // 'WITHDRAW_TAX' => [
- // 'header' => '个税',
- // 'value' => function ($row) {
- // return Tool::formatPrice($row['WITHDRAW_TAX']);
- // },
- // 'headerOther' => function ($row) {
- // return [
- // 'width' => '150',
- // ];
- // },
- // 'valueOther' => function ($row) {
- // return [
- // 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- // ];
- // },
- // ],
- // 'WITHDRAW_DEDUCT' => [
- // 'header' => '扣款',
- // 'value' => function ($row) {
- // return Tool::formatPrice($row['WITHDRAW_DEDUCT']);
- // },
- // 'headerOther' => function ($row) {
- // return [
- // 'width' => '150',
- // ];
- // },
- // 'valueOther' => function ($row) {
- // return [
- // 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- // ];
- // },
- // ],
- 'WITHDRAW_REAL' => [
- 'header' => 'Real amount',//实付金额
- 'value' => function ($row) {
- return Tool::formatPrice($row['WITHDRAW_REAL']);
- },
- 'headerOther' => function ($row) {
- return [
- 'width' => '150',
- ];
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- 'WITHDRAW_FAIL' => [
- 'header' => 'Actual payment of failed amount',//实付失败金额
- 'value' => function ($row) {
- return Tool::formatPrice($row['WITHDRAW_FAIL']);
- },
- 'headerOther' => function ($row) {
- return [
- 'width' => '150',
- ];
- },
- 'valueOther' => function ($row) {
- return [
- 'tag' => ['type' => 'warning', 'size' => 'small', 'class' => 'no-border']
- ];
- },
- ],
- 'USER_STATUS_NAME' => [
- 'header' => 'Member status',//会员状态
- 'headerOther' => ['width' => '150'],
- ],
- 'USER_STATUS_AT' => [
- 'header' => 'Member status change time',//会员状态变更时间
- 'value' => function ($row) {
- return (new DateTime([
- 'value' => $row['USER_STATUS_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '190'],
- ],
- // 'HIGHEST_EMP_LV_NAME' => [
- // 'header' => '历史最高聘级',
- // 'headerOther' => ['width' => '150'],
- // ],
- 'PERIOD_AT' => [
- 'header' => 'Join periods',//加入期数
- 'headerOther' => ['width' => '150'],
- ],
- // 'DEC_DEC_ROLE_NAME' => [
- // 'header' => '所属报单中心级别',
- // 'headerOther' => ['width' => '150'],
- // ],
- 'DEC_USER_NAME' => [
- 'header' => 'Code of distributor',//所属报单中心编号
- 'headerOther' => ['width' => '150'],
- ],
- 'DEC_REAL_NAME' => [
- 'header' => 'Name of distributor',//所属报单中心姓名
- 'headerOther' => ['width' => '150'],
- ],
- 'MOBILE' => [
- 'header' => 'Phone number',//手机号码
- 'value' => function($row) {
- return "\t".$row['MOBILE'];
- },
- 'headerOther' => ['width' => '150'],
- ],
- 'TEL' => [
- 'header' => 'Alternate phone number',//备用手机号码
- 'value' => function($row) {
- return "\t".$row['TEL'];
- },
- 'headerOther' => ['width' => '150'],
- ],
- 'AREA' => [
- 'header' => 'Commonly used address',//常用地址
- 'value' => function ($row) {
- return $row['PROVINCE_NAME'] . $row['CITY_NAME'] . $row['COUNTY_NAME'];
- },
- 'showValue' => function ($row) {
- return '<div class="addr" title=' . $row['PROVINCE_NAME'] . $row['CITY_NAME'] . $row['COUNTY_NAME'] . '>' . $row['PROVINCE_NAME'] . $row['CITY_NAME'] . $row['COUNTY_NAME'] . '</div>';
- },
- 'headerOther' => [
- 'width' => '200'
- ],
- ],
- // 'SUB_COM_NAME' => [
- // 'header' => '所属分公司',
- // 'headerOther' => ['width' => '150'],
- // ],
- // 'IS_DIRECT_SELLER' => [
- // 'header' => '是否直销员',
- // 'value' => function ($row) {
- // return (new YesNo([
- // 'value' => $row['IS_DIRECT_SELLER'],
- // ]))->result();
- // },
- // 'headerOther' => function ($row) {
- // return [
- // 'width' => '120',
- // ];
- // },
- // 'valueOther' => function ($row) {
- // return [
- // 'tag' => ['type' => (isset($row['IS_DIRECT_SELLER']) && $row['IS_DIRECT_SELLER']) ? 'success' : 'info', 'size' => 'small']
- // ];
- // },
- // ],
- 'BACKUP_AT' => [
- 'header' => 'Backup time',//备份时间
- 'value' => function ($row) {
- return (new DateTime([
- 'value' => $row['BACKUP_AT'],
- ]))->result();
- },
- 'headerOther' => ['width' => '190'],
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes() {
- if (!$this->filterTypes) {
- $this->filterTypes = [
- 'USER_NAME' => ['isUserTable' => false, 'name' => 'Member code'],//会员编号
- 'REAL_NAME' => ['isUserTable' => false, 'name' => 'Member name'],//会员姓名
- 'DEC_LV_NAME' => ['isUserTable' => false, 'name' => 'Member level', 'other' => 'decLevel'],//会员级别
- 'EMP_LV_NAME' => ['isUserTable' => false, 'name' => 'Rank', 'other' => 'empLevel'],//聘级
- 'IS_DEC' => ['isUserTable' => false, 'name' => 'Whether distributor', 'other' => 'yesOrNo'],//是否报单中心
- // 'DEC_ROLE_NAME' => ['isUserTable' => false, 'name' => '报单中心级别', 'other' => 'decRole'],
- // 'SYSTEM_NAME' => ['isUserTable' => false, 'name' => '体系名称'],
- 'BONUS' => ['isUserTable' => false, 'name' => 'Member Bonus'],// 会员账户余额
- // 'CF' => ['isUserTable' => false, 'name' => '车房养老余额'],
- // 'LX' => ['isUserTable' => false, 'name' => '领袖分红余额'],
- 'WITHDRAW' => ['isUserTable' => false, 'name' => 'Withdrawal amount'],//提现金额
- // 'WITHDRAW_TAX' => ['isUserTable' => false, 'name' => '个税'],
- // 'WITHDRAW_DEDUCT' => ['isUserTable' => false, 'name' => '扣款'],
- 'WITHDRAW_REAL' => ['isUserTable' => false, 'name' => 'Real amount'],//实付金额
- 'WITHDRAW_FAIL' => ['isUserTable' => false, 'name' => 'Actual payment of failed amount'],//实付失败金额
- 'USER_STATUS_NAME' => ['isUserTable' => false, 'name' => 'Member status', 'other' => 'status'],//会员状态
- 'USER_STATUS_AT' => ['isUserTable' => false, 'name' => 'Member status change time', 'other' => 'date'],//会员状态变更时间
- // 'HIGHEST_EMP_LV_NAME' => ['isUserTable' => false, 'name' => '历史最高聘级', 'other' => 'empLevel'],
- 'PERIOD_AT' => ['isUserTable' => false, 'name' => 'Join periods'],//加入期数
- // 'DEC_DEC_ROLE_NAME' => ['isUserTable' => false, 'name' => '所属报单中心级别', 'other' => 'decRole'],
- 'DEC_USER_NAME' => ['isUserTable' => false, 'name' => 'Code of distributor'],//所属报单中心编号
- 'DEC_REAL_NAME' => ['isUserTable' => false, 'name' => 'Name of distributor'],//所属报单中心姓名
- 'MOBILE' => ['isUserTable' => false, 'name' => 'Phone number'],//手机号码
- 'TEL' => ['isUserTable' => false, 'name' => 'Alternate phone number'],//备用手机号码
- 'AREA' => ['isUserTable' => false, 'name' => 'Commonly used address', 'other' => 'area'],//常用地址
- // 'SUB_COM_NAME' => ['isUserTable' => false, 'name' => '所属分公司', 'other' => 'subCompany'],
- // 'IS_DIRECT_SELLER' => ['isUserTable' => false, 'name' => '是否直销员', 'other' => 'yesOrNo'],
- 'BACKUP_AT' => ['isUserTable' => false, 'name' => 'Backup time', 'other' => 'date'],//备份时间
- ];
- }
- return $this->filterTypes;
- }
- }
|