| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307 |
- <?php
- namespace backendApi\modules\v1\models\lists\bonus;
- use backendApi\modules\v1\models\Admin;
- use common\helpers\bonus\CalcCache;
- use common\helpers\Cache;
- use common\helpers\Tool;
- 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\CalcBonus;
- use common\models\PerfOrder;
- use common\models\PerfPeriod;
- use common\models\Period;
- use common\models\Region;
- use common\models\UserBind;
- use common\models\UserBonus;
- use common\models\UserInfo;
- use common\libs\dataList\column\DateTime;
- use common\models\UserNetwork;
- use common\models\UserSystem;
- use common\models\Withdraw;
- use Yii;
- class TraceUpQyList extends \common\libs\dataList\DataList implements DataListInterface
- {
- /**
- * 列表名称
- * @return string
- */
- public function getListName(){
- return '团队奖向上追溯';
- }
- /**
- * 列表筛选到的数据
- * @throws \yii\base\Exception
- */
- public function dataHandle()
- {
- $userId = $this->others['userId'];
- $periodNum = $this->others['periodNum'];
- $data = UserNetwork::getAllParentFromPeriodWithPage($userId, $periodNum);
- if (isset($data['list']) && $data['list']) {
- $decTotal = CalcCache::nowPeriodPerf($userId, $periodNum);
- foreach ($data['list'] as $key => $value) {
- $perfPeriod = PerfPeriod::findOneAsArray('USER_ID=:USER_ID AND PERIOD_NUM=:PERIOD_NUM',[':USER_ID'=>$value['USER_ID'],':PERIOD_NUM'=>$periodNum]);
- $data['list'][$key]['PERIOD_NUM'] = $perfPeriod['PERIOD_NUM'];
- $data['list'][$key]['DEC_TOTAL'] = $decTotal['PV_PCS_ZC'] + $decTotal['PV_PCS_ZG'] +$decTotal['PV_LS_TOUCH'];
- $data['list'][$key]['USER_NAME'] = Info::getUserNameByUserId($value['USER_ID']);
- $data['list'][$key]['REAL_NAME'] = Info::getUserRealNameByUserId($value['USER_ID']);
- $data['list'][$key]['LAST_DEC_LV_NAME'] = Cache::getDecLevelConfig()[$perfPeriod['LAST_DEC_LV']]['LEVEL_NAME'] ?? '';
- $data['list'][$key]['LAST_EMP_LV_NAME'] = Cache::getEmpLevelConfig()[$perfPeriod['LAST_EMP_LV']]['LEVEL_NAME'] ?? '';
- $data['list'][$key]['LAST_STATUS_NAME'] = Tool::paramConvert(Yii::$app->params['userStatus'])[$perfPeriod['LAST_STATUS']]['label'] ?? '';
- $data['list'][$key]['PV_1L_TOUCH'] = $perfPeriod['PV_1L_TOUCH'];
- $data['list'][$key]['PV_2L_TOUCH'] = $perfPeriod['PV_2L_TOUCH'];
- $data['list'][$key]['PV_3L_TOUCH'] = $perfPeriod['PV_3L_TOUCH'];
- $data['list'][$key]['PV_4L_TOUCH'] = $perfPeriod['PV_4L_TOUCH'];
- $data['list'][$key]['PV_5L_TOUCH'] = $perfPeriod['PV_5L_TOUCH'];
- $data['list'][$key]['SURPLUS_1L'] = $perfPeriod['SURPLUS_1L'];
- $data['list'][$key]['SURPLUS_2L'] = $perfPeriod['SURPLUS_2L'];
- $data['list'][$key]['SURPLUS_3L'] = $perfPeriod['SURPLUS_3L'];
- $data['list'][$key]['SURPLUS_4L'] = $perfPeriod['SURPLUS_4L'];
- $data['list'][$key]['SURPLUS_5L'] = $perfPeriod['SURPLUS_5L'];
- $data['list'][$key]['CALC_MONTH'] = $perfPeriod['CALC_MONTH'];
- //区域业绩
- $pervSurplusPerf = CalcCache::surplusPerf($value['USER_ID'], $periodNum);
- $data['list'][$key]['QY_1L'] = $data['list'][$key]['PV_1L_TOUCH'] + $pervSurplusPerf['SURPLUS_1L'];
- $data['list'][$key]['QY_2L'] = $data['list'][$key]['PV_2L_TOUCH'] + $pervSurplusPerf['SURPLUS_2L'];
- $data['list'][$key]['QY_3L'] = $data['list'][$key]['PV_3L_TOUCH'] + $pervSurplusPerf['SURPLUS_3L'];
- $data['list'][$key]['QY_4L'] = $data['list'][$key]['PV_4L_TOUCH'] + $pervSurplusPerf['SURPLUS_4L'];
- $data['list'][$key]['QY_5L'] = $data['list'][$key]['PV_5L_TOUCH'] + $pervSurplusPerf['SURPLUS_5L'];
- unset($bonus,$bigLocation);
- }
- } else {
- $data['list'] = [];
- }
- $this->listData = $data;
- }
- /**
- * 要展示和导出的所有字段
- * @return array
- */
- public function getColumn(){
- if(!$this->columns){
- $this->columns = [
- 'PERIOD_NUM' => [
- 'header' => '期数',
- 'headerOther' => [
- 'width' => '150',
- ],
- ],
- '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']
- ],
- ],
- 'LOCATION' => [
- 'header' => '市场',
- 'headerOther' => [
- 'width' => '100',
- ],
- ],
- 'LAST_STATUS_NAME' => [
- 'header' => '结算时状态',
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- 'LAST_DEC_LV_NAME' => [
- 'header' => '结算时会员级别',
- 'headerOther' => [
- 'width' => '120',
- ],
- ],
- 'LAST_EMP_LV_NAME' => [
- 'header' => '结算时会员聘级',
- 'headerOther' => [
- 'width' => '140',
- ],
- ],
- 'DEC_TOTAL' => [
- 'header' => '报单总积分',
- 'headerOther' => [
- 'width' => '110',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['DEC_TOTAL'],
- ]))->result();
- },
- ],
- 'PV_1L_TOUCH' => [
- 'header' => '一市场新增业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['PV_1L_TOUCH'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'QY_1L' => [
- 'header' => '一市场区域业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['QY_1L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'SURPLUS_1L' => [
- 'header' => '一市场结余业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['SURPLUS_1L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'PV_2L_TOUCH' => [
- 'header' => '二市场新增业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['PV_2L_TOUCH'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'QY_2L' => [
- 'header' => '二市场区域业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['QY_2L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'SURPLUS_2L' => [
- 'header' => '二市场结余业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['SURPLUS_2L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'PV_3L_TOUCH' => [
- 'header' => '三市场新增业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['PV_3L_TOUCH'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'QY_3L' => [
- 'header' => '三市场区域业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['QY_3L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'SURPLUS_3L' => [
- 'header' => '三市场结余业绩',
- 'headerOther' => [
- 'width' => '150',
- ],
- 'value' => function($row) {
- return (new Price([
- 'value' => $row['SURPLUS_3L'],
- ]))->result();
- },
- 'valueOther' => [
- 'tag'=>['type'=>'info', 'size' => 'small', 'class'=>'no-border'],
- ]
- ],
- 'CALC_MONTH' => [
- 'header' => '结算月',
- 'headerOther' => [
- 'width' => '110',
- ],
- ],
- ];
- }
- return $this->columns;
- }
- /**
- * 前台用于筛选的类型集合
- * @return mixed
- */
- public function getFilterTypes()
- {
- if(!$this->filterTypes){
- $this->filterTypes = [];
- }
- return $this->filterTypes;
- }
- /**
- * 校验大区
- * @param $big
- * @param $loc
- * @param $num
- * @return bool
- */
- private function _chkBig($big, $loc, $num){
- return $loc == $num && $big != $loc;
- }
- }
|