| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <?php
- namespace backendApi\modules\v1\models\lists\bonus;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\user\Info;
- use common\libs\dataList\column\Price;
- use common\libs\dataList\column\YesNo;
- use common\libs\dataList\DataListInterface;
- use common\models\User;
- use common\models\UserBind;
- use common\models\UserBonus;
- use common\models\UserInfo;
- use common\libs\dataList\column\DateTime;
- use common\models\UserWallet;
- use common\models\Withdraw;
- use Yii;
- class BalanceList extends \common\libs\dataList\DataList implements DataListInterface
- {
- /**
- * 列表名称
- * @return string
- */
- public function getListName(){
- return '会员奖金余额列表';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle()
- {
- $this->condition .= ' AND UI.STATUS=1 AND I.LAST_LOGIN_AT>=1620748800';
- $this->listData = UserBonus::lists($this->condition, $this->params, [
- 'select' => 'UB.*,UI.*,UW.CASH',
- 'from' => UserBonus::tableName() . ' AS UB',
- 'join' => [
- // ['LEFT JOIN', UserInfo::tableName() . ' AS UI', 'UI.USER_ID=UB.USER_ID'],
- ['LEFT JOIN', User::tableName() . ' AS UI', 'UI.ID=UB.USER_ID'],
- ['LEFT JOIN', UserWallet::tableName() . ' AS UW', 'UW.USER_ID=UB.USER_ID'],
- ['LEFT JOIN', UserInfo::tableName() . ' AS I', 'I.USER_ID=UB.USER_ID']
- ],
- 'orderBy' => 'UB.CREATED_AT ASC, UB.ID ASC',
- 'page' => $this->page,
- 'pageSize' => $this->pageSize,
- ]);
- // foreach ($this->listData['list'] as $key => $value) {
- // $userInfo = Info::baseInfo($value['USER_ID']);
- // $this->listData['list'][$key] = array_merge($value, $userInfo);
- // $this->listData['list'][$key]['WITHDRAW_WAIT'] = Withdraw::getWithdrawTotal($value['USER_ID'], Withdraw::STATUS_WAIT_PAID);
- // $this->listData['list'][$key]['WITHDRAW_FAIL'] = Withdraw::getWithdrawTotal($value['USER_ID'], Withdraw::STATUS_PAID_FALSE);
- // }
- //总计
- // $sumData = UserBonus::find()->select('SUM(BONUS) AS SUM_BONUS,SUM(CF) AS SUM_CF,SUM(LX) AS SUM_LX')
- // ->from(UserBonus::tableName() . ' AS UB')
- // ->leftJoin(UserInfo::tableName() . ' AS UI', 'UI.USER_ID=UB.USER_ID')
- // ->where('1=1 ' . $this->condition, $this->params)->asArray()->one();
- // $sumData['SUM_WITHDRAW_WAIT'] = Withdraw::getAllWithdrawTotal(Withdraw::STATUS_WAIT_PAID);
- // $sumData['SUM_WITHDRAW_FAIL'] = Withdraw::getAllWithdrawTotal(Withdraw::STATUS_PAID_FALSE);
- // $this->listData['sumData'] = $sumData;
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn(){
- if(!$this->columns){
- $this->columns = [
- 'USER_ID' => null, // 这种传输方式主要是用于索引,因为过滤后的字段可能没有这种ID,但是一些功能的操作还需要用这种ID去关联,例如前台会员列表中的勾选批量状态管理,这里需要的就是USER_ID
- 'USER_NAME' => [
- 'header' => '会员编号',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- 'REAL_NAME' => [
- 'header' => '会员姓名',
- 'headerOther' => [
- 'width' => '120',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'success', 'size' => 'small', 'class'=>'no-border']
- ],
- ],
- // 'DEC_LV_NAME' => [
- // 'header' => '会员级别',
- // 'headerOther' => [
- // 'width' => '110',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- // ],
- // ],
- // 'EMP_LV_NAME' => [
- // 'header' => '聘级',
- // 'headerOther' => [
- // 'width' => '130',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border']
- // ],
- // ],
- 'IS_DEC' => [
- 'header' => '是否报单中心',
- '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' => '110'],
- // ],
- // 'SYSTEM_NAME' => [
- // 'header' => '体系名称',
- // 'headerOther' => ['width' => '150'],
- // ],
- 'BONUS' => [
- 'header' => '会员奖金余额',
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['BONUS'],
- ]))->result();
- },
- 'headerOther' => [
- 'width' => '150',
- 'prop'=>'BONUS',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
- ],
- ],
- 'RECONSUME_POINTS' => [
- 'header' => '会员复消积分',
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['RECONSUME_POINTS'],
- ]))->result();
- },
- 'headerOther' => [
- 'width' => '150',
- 'prop'=>'BONUS',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
- ],
- ],
- 'CASH' => [
- 'header' => '会员余额',
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['CASH'],
- ]))->result();
- },
- 'headerOther' => [
- 'width' => '150',
- 'prop'=>'BONUS',
- ],
- 'valueOther' => [
- 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
- ],
- ],
- // 'CF' => [
- // 'header' => '车房养老余额',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['CF'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'CF',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'LX' => [
- // 'header' => '领袖分红余额',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['LX'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'LX',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'danger', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'WITHDRAW_WAIT' => [
- // 'header' => '提现金额',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['WITHDRAW_WAIT'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'WITHDRAW_WAIT',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'TAX' => [
- // 'header' => '个税',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['WITHDRAW_WAIT'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'TAX',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'DEDUCT' => [
- // 'header' => '扣款',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['WITHDRAW_WAIT'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'DEDUCT',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'REAL_PAID' => [
- // 'header' => '实付金额',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['WITHDRAW_WAIT'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'REAL_PAID',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'WITHDRAW_FAIL' => [
- // 'header' => '实付失败金额',
- // 'value' => function($row) {
- // return (new Price([
- // 'value' => $row['WITHDRAW_FAIL'],
- // ]))->result();
- // },
- // 'headerOther' => [
- // 'width' => '150',
- // 'prop'=>'WITHDRAW_FAIL',
- // ],
- // 'valueOther' => [
- // 'tag'=>['type'=>'warning', 'size' => 'small', 'class'=>'no-border'],
- // ],
- // ],
- // 'STATUS' => [
- // 'header' => '会员状态',
- // 'value' => function($row){
- // return Yii::$app->params['userStatus'][$row['STATUS']]['label'];
- // },
- // 'headerOther' => ['width' => '110'],
- // ],
- // 'STATUS_AT' => [
- // 'header' => '会员状态变更时间',
- // 'value' => function($row) {
- // return (new DateTime([
- // 'value' => $row['STATUS_AT'],
- // ]))->result();
- // },
- // 'headerOther' => ['width' => '170'],
- // ],
- // 'HIGHEST_EMP_LV_NAME' => [
- // 'header' => '历史最高聘级',
- // 'headerOther' => ['width' => '130'],
- // ],
- 'PERIOD_AT' => '加入期数',
- // 'DEC_DEC_ROLE_NAME' => [
- // 'header' => '所属报单中心级别',
- // 'headerOther' => ['width' => '150'],
- // ],
- // 'DEC_USER_NAME' => [
- // 'header' => '所属报单中心编号',
- // 'headerOther' => ['width' => '150'],
- // ],
- // 'DEC_REAL_NAME' => [
- // 'header' => '所属报单中心姓名',
- // 'headerOther' => ['width' => '150'],
- // ],
- 'MOBILE' => [
- 'header' => '手机号码',
- 'value' => function($row) {
- return "\t".$row['MOBILE'];
- },
- 'headerOther' => ['width' => '120'],
- ],
- 'TEL' => [
- 'header' => '备用手机号码',
- 'value' => function($row) {
- return "\t".$row['TEL'];
- },
- 'headerOther' => ['width' => '120'],
- ],
- // 'AREA' => [
- // 'header' => '常用地址',
- // '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' => '100'],
- // ],
- // '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']
- // ];
- // },
- // ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes()
- {
- if(!$this->filterTypes){
- $this->filterTypes = [
- 'USER_NAME'=> ['isUserTable'=> false, 'name'=> '会员编号'],
- 'REAL_NAME'=> ['isUserTable'=> false, 'name'=> '会员姓名'],
- // 'DEC_LV_NAME'=> ['isUserTable'=> true, 'name'=> '会员级别', 'other'=> 'decLevel'],
- // 'EMP_LV_NAME'=> ['isUserTable'=> true, 'name'=> '聘级', 'other'=> 'empLevel'],
- 'IS_DEC'=> ['isUserTable'=> false, 'name'=> '是否报单中心', 'other'=> 'yesOrNo'],
- // 'DEC_ROLE_NAME'=> ['isUserTable'=> true, 'name'=> '报单中心级别', 'other'=> 'decRole'],
- // 'SYSTEM_NAME'=> ['isUserTable'=> false, 'name'=> '体系名称', 'other'=> 'systems'],
- 'BONUS'=> ['isUserTable'=> false, 'name'=> '会员奖金余额'],
- 'RECONSUME_POINTS'=> ['isUserTable'=> false, 'name'=> '会员复消积分'],
- 'CASH'=> ['isUserTable'=> false, 'name'=> '会员余额'],
- // 'CF'=> ['isUserTable'=> false, 'name'=> '车房养老余额'],
- // 'LX'=> ['isUserTable'=> false, 'name'=> '领袖分红余额'],
- // 'STATUS'=> ['isUserTable'=> true, 'name'=> '会员状态', 'other'=> 'status'],
- // 'STATUS_AT'=> ['isUserTable'=> true, 'name'=> '会员状态变更时间', 'other'=> 'date'],
- // 'HIGHEST_EMP_LV_NAME'=> ['isUserTable'=> false, 'name'=> '历史最高聘级', 'other'=> 'empLevel'],
- 'PERIOD_AT'=> ['isUserTable'=> false, 'name'=> '加入期数'],
- // 'DEC_DEC_ROLE_NAME'=> ['isUserTable'=> true, 'name'=> '所属报单中心级别', 'other'=> 'decRole'],
- // 'DEC_USER_NAME'=> ['isUserTable'=> true, 'name'=> '所属报单中心编号'],
- // 'DEC_REAL_NAME'=> ['isUserTable'=> true, 'name'=> '所属报单中心姓名'],
- 'MOBILE'=> ['isUserTable'=> false, 'name'=> '手机号码'],
- 'TEL'=> ['isUserTable'=> false, 'name'=> '备用手机号码'],
- // 'AREA'=> ['isUserTable'=> true, 'name'=> '常用地址', 'other'=> 'area'],
- // 'SUB_COM_NAME'=> ['isUserTable'=> true, 'name'=> '所属分公司', 'other'=> 'subCompany'],
- // 'IS_DIRECT_SELLER'=> ['isUserTable'=> true, 'name'=> '是否直销员', 'other'=> 'yesOrNo'],
- ];
- }
- return $this->filterTypes;
- }
- }
|