zxiansheng 3 лет назад
Родитель
Сommit
812526f952

+ 5 - 0
common/helpers/Tool.php

@@ -71,6 +71,11 @@ class Tool {
         }
     }
 
+    // 格式化业绩期
+    public static function formatPreparePerf($perf) {
+        return number_format($perf,2);
+    }
+
     /**
      * 前台业绩格式化
      * @param $perf

+ 9 - 0
common/models/PerfMonthPrepare.php

@@ -163,6 +163,15 @@ class PerfMonthPrepare extends \common\components\ActiveRecord
         return $result;
     }
 
+    // 校验业绩状态
+    public static function checkPrepareStatus($pv) {
+        if ($pv >= 10000) {
+            return true;
+        }
+
+        return false;
+    }
+
     /**
      * 操作日志记录条件
      * @return array

+ 1 - 1
frontendApi/config/menu.php

@@ -73,7 +73,7 @@ return [
         'show'=>1,
         'child'=>[
             ['name'=>'我的账户', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'index', 'routePath'=>'bonus/index', 'show'=>1,],
-            ['name'=>'团队查询', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'search', 'routePath'=>'bonus/search', 'show'=>1,],
+            ['name'=>'团队查询', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'teams', 'routePath'=>'bonus/teams', 'show'=>1,],
             ['name'=>'最新奖金', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'new', 'routePath'=>'bonus/new', 'show'=>1,'allow'=>'newBonusSwitch'],
             ['name'=>'往期奖金', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'other', 'routePath'=>'bonus/other', 'show'=>1,'allow'=>'pastBonusSwitch'],
             //['name'=>'实时业绩', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'real-time-perf', 'routePath'=>'bonus/real-time-perf', 'show'=>1,],

+ 1 - 0
frontendApi/config/urlManagerRules.php

@@ -113,6 +113,7 @@ return [
             'GET index' => 'index',
             'GET wallet-flow' => 'wallet-flow',
             'GET new' => 'new',
+            'GET teams' => 'teams',
             'GET other' => 'other',
             'GET real-time-perf' => 'real-time-perf',
             'GET flow-bt' => 'flow-bt',

+ 46 - 26
frontendApi/modules/v1/controllers/BonusController.php

@@ -101,33 +101,43 @@ class BonusController extends BaseController {
      * @return mixed
      * @throws \yii\web\HttpException
      */
-    public function actionSearch() {
+    public function actionTeams() {
         $userId = \Yii::$app->user->id;
-        // 查询此用户,月业绩
-        //期数显示
-        // 达标规则,小组底下有一个大于等于一万.或者个人情况里的合计大于等于一万
         $period = Period::instance();
         $periodNum = $period->getNowPeriodNum();
-        $month = $period->getNowMonth();
+        $month = $period->getNowYearMonth();
+        // 判断是否是周日,并且是否是月结节点
+        // 判断是否是月节点
+        $isCalcMonth = $period->isCalcMonth($periodNum);
+        $w = date('w', time());
+        // if ($w != '0' || $isCalcMonth != 1) {
+        //     return static::notice(['user' => [],'team'=>[]]);
+        // }
+        
+        // 达标规则,小组底下有一个大于等于一万.或者个人情况里的合计大于等于一万
+        $month = '202203';
         $data = PerfMonthPrepare::getMonthPerfPrepare($userId, $month);
         // PV_PCS 个人业绩  PV_PSS 月新增团队业绩  PV_PSS_TOTAL月累计团队业绩
         // 其中页面使用的是月新增团队业绩
         // 获取用信息
         $userInfo = User::getEnCodeInfo($userId);
-        $user = [
+        $user[0] = [
             'number' => $userInfo['USER_NAME'],
             'name' => $userInfo['REAL_NAME'],
             'perf_status' => '0', // 0  未达标  1为已达标
+            'perf_status_name' => '不达标',
             'user_perf' => 0, // 个人业绩
             'team_perf' => 0, // 团队新增累计业绩
             'total_perf' => 0 // 合计业绩
         ];
         if (!empty($data)) {
-            $user['user_perf'] = $data['PV_PCS'];
-            $user['team_perf'] = $data['PV_PSS'];
-            $user['total_perf'] = $data['PV_PCS']+$data['PV_PSS'];
-            if ($user['total_perf'] >= 10000) {
-                $user['perf_status'] = '1';
+            $user[0]['user_perf'] = Tool::formatPreparePerf($data['PV_PCS']);
+            $user[0]['team_perf'] = Tool::formatPreparePerf($data['PV_PSS']);
+            $user[0]['total_perf'] = Tool::formatPreparePerf($data['PV_PCS']+$data['PV_PSS']);
+            $userCheck = PerfMonthPrepare::checkPrepareStatus($user[0]['total_perf']);
+            if ($userCheck) {
+                $user[0]['perf_status'] = '1';
+                $user[0]['perf_status_name'] = '达标';
             }
         }
         $teamInfo = [];
@@ -136,28 +146,38 @@ class BonusController extends BaseController {
         $userStatusFlag = false;
         if ($relation) {
             // 循环一级开拓用户
-            foreach($relation as $v) {
+            foreach($relation as $k=>$v) {
                 // 获取此用户预计算月业绩
                 $relationPerf = PerfMonthPrepare::getMonthPerfPrepare($v['USER_ID'], $month);
-                $teamInfo[]['perf_status'] = $relationPerf['PV_PCS'] >= 10000 ? 1 : 0;
-                if ($relationPerf['PV_PCS'] >= 10000) {
-                    $userStatusFlag = true;
-                    $teamInfo[]['number'] = '';
-                    $teamInfo[]['name'] = '';
-                    $teamInfo[]['user_perf'] = '';
-                    $teamInfo[]['team_perf'] = '';
-                    $teamInfo[]['total_perf'] = '';
+                if (empty($relationPerf)) {
+                    $relationPerf['PV_PCS'] = 0;
+                    $relationPerf['PV_PSS'] = 0;
+                }
+                $relationCheck = PerfMonthPrepare::checkPrepareStatus($relationPerf['PV_PCS']+$relationPerf['PV_PSS']);
+                $teamInfo[]['perf_status'] = $relationCheck ? 1 : 0;
+                if ($relationCheck) {
+                    $userStatusFlag = true; // 只要有一个达标,则个人就达标
+                    $teamInfo[$k]['number'] = '';
+                    $teamInfo[$k]['name'] = '';
+                    $teamInfo[$k]['user_perf'] = '';
+                    $teamInfo[$k]['team_perf'] = '';
+                    $teamInfo[$k]['total_perf'] = '';
+                    $teamInfo[$k]['perf_status'] = '1';
+                    $teamInfo[$k]['perf_status_name'] = '达标';
                 } else {
-                    $teamInfo[]['number'] = $v['USER_NAME'];
-                    $teamInfo[]['name'] = $v['REAL_NAME'];
-                    $teamInfo[]['user_perf'] = $relationPerf['PV_PCS'];
-                    $teamInfo[]['team_perf'] = $relationPerf['PV_PSS'];
-                    $teamInfo[]['total_perf'] = $relationPerf['PV_PCS']+$relationPerf['PV_PSS'];
+                    $teamInfo[$k]['number'] = $v['USER_NAME'];
+                    $teamInfo[$k]['name'] = $v['REAL_NAME'];
+                    $teamInfo[$k]['user_perf'] = Tool::formatPreparePerf($relationPerf['PV_PCS']);
+                    $teamInfo[$k]['team_perf'] = Tool::formatPreparePerf($relationPerf['PV_PSS']);
+                    $teamInfo[$k]['total_perf'] = Tool::formatPreparePerf($relationPerf['PV_PCS']+$relationPerf['PV_PSS']);
+                    $teamInfo[$k]['perf_status'] = '0';
+                    $teamInfo[$k]['perf_status_name'] = '不达标';
                 } 
             }
         }
         if ($userStatusFlag === true) {
-            $user['perf_status'] = 1;
+            $user[0]['perf_status'] = 1;
+            $user[0]['perf_status_name'] = '达标';
         }
         
         return static::notice(['user' => $user,'team'=>$teamInfo]);

+ 12 - 0
frontendEle/src/router/index.js

@@ -305,6 +305,18 @@ export const constantRouterMap = [
           ],
         },
       },
+      {
+        path: '/bonus/teams',
+        component: _import('bonus/teams'),
+        name: 'bonus_teams',
+        meta: {
+          title: '团队查询',
+          breadcrumb: [
+            {title: '首页', path: '/dashboard/index'},
+            {title: '奖金管理', path: '/bonus/index'},
+          ],
+        },
+      },
 
     ]
   },

+ 232 - 0
frontendEle/src/views/bonus/teams.vue

@@ -0,0 +1,232 @@
+<template>
+  <div v-loading="loading">
+    <el-table
+    border
+    :data="userData"
+    style="width: 100%"
+    :cell-style="tableCellStyle"
+    >
+    <el-table-column label="个人情况">
+      <el-table-column
+      type="index"
+      :index="indexMethod"
+          width="60px"
+          label=""
+          >
+        </el-table-column>
+        <el-table-column
+          prop="number"
+          label="会员编号"
+          >
+        </el-table-column>
+        <el-table-column
+          prop="name"
+          label="会员姓名"
+          >
+        </el-table-column>
+        <el-table-column
+          prop="perf_status_name"
+          label="状态"
+          >
+        </el-table-column>
+        <el-table-column
+          prop="user_perf"
+          label="业绩"
+          >
+        </el-table-column>
+         <el-table-column
+          prop="team_perf"
+          label="累计业绩"
+          >
+        </el-table-column>
+         <el-table-column
+          prop="total_perf"
+          label="合计"
+          >
+        </el-table-column>
+      </el-table-column>
+
+  </el-table>
+
+  <el-table
+    border
+    :data="tableData"
+    style="width: 100%;margin-top:20px;"
+    :cell-style="tableCellStyle"
+   >
+    <el-table-column label="团队情况">
+      <el-table-column
+      type="index"
+      :index="indexMethod"
+          width="60px"
+          label=""
+          >
+        </el-table-column>
+         <el-table-column
+          prop="number"
+          label="会员编号"
+          >
+        </el-table-column>
+        <el-table-column
+          prop="name"
+          label="会员姓名"
+          >
+        </el-table-column>
+        <el-table-column
+          class="dsdd"
+          prop="perf_status_name"
+          label="状态"
+          >
+        </el-table-column>
+        <el-table-column
+          prop="user_perf"
+          label="业绩"
+          >
+        </el-table-column>
+         <el-table-column
+          prop="team_perf"
+          label="累计业绩"
+          >
+        </el-table-column>
+         <el-table-column
+          prop="total_perf"
+          label="合计"
+          >
+        </el-table-column>
+      </el-table-column>
+
+  </el-table>
+  </div>
+</template>
+
+<script>
+  import network from '@/utils/network'
+  import tool from '@/utils/tool'
+  import Pagination from '@/components/Pagination'
+
+  export default {
+    name: 'bonus_teams',
+    components: {Pagination},
+    mounted() {
+      this.getData()
+    },
+    data() {
+      return {
+        userData:[],
+        tableData: [],
+        allData: null,
+        walletData: null,
+        dealSwitch: null,
+        loading: true,
+        dialogFlowVisible:false,
+        currentPage: 1,
+        totalPages: 1,
+        totalCount: 1,
+        pageSize: 20,
+        walletType: 'bonus',
+        walletName: '',
+        dialogLoading: false,
+        tool: tool,
+        createAt: '',
+        dealType: null,
+        remark: '',
+        dealTypes: [],
+      }
+    },
+    methods: {
+      tableCellStyle({row,column,rowIndex,columnIndex}) {
+        // console.log(row,column,rowIndex,columnIndex)
+        if (row.perf_status == '0' && columnIndex == '3') {
+            return "background-color:rgb(225, 25, 98);font-weight:bold";
+        } else if (row.perf_status == '1' && columnIndex == '3') {
+            return "background-color:rgb(31, 156, 18);font-weight:bold";
+        }
+        
+      },
+      indexMethod(index) {
+        return index + 1;
+      },
+      getData() {
+        let vueObj = this
+        vueObj.loading = true
+        network.getData('bonus/teams').then(response => {
+          this.userData = response.user
+          this.tableData = response.team
+          vueObj.loading = false
+        }).catch(response => {
+          vueObj.loading = false
+        })
+      },
+      showFlow(walletType,walletName){
+        let vueObj = this
+        this.$message({
+          message: '正在获取数据',
+          type: 'info'
+        })
+        this.walletType = walletType
+        this.walletName = walletName
+        vueObj.dialogFlowVisible = true
+        vueObj.dialogLoading = true
+        this.handleFilterClear()
+      },
+    }
+  }
+
+</script>
+<style scoped>
+  .leo-filter {
+    padding: 0 0 15px 0;
+  }
+
+  .leo-filter .filter-hidden {
+    display: none;
+  }
+
+  .filter-item {
+    margin-right: 10px;
+  }
+
+  @media (min-width: 768px) {
+    .leo-filter {
+    }
+
+    .leo-filter .filter-item {
+      display: inline-block;
+      max-width: 200px;
+    }
+
+    .leo-filter .filter-item.filter-date-month-picker {
+      display: inline-block;
+      max-width: 220px;
+    }
+
+    .leo-filter .filter-item.filter-date-range-picker {
+      display: inline-block;
+      max-width: 380px;
+    }
+
+    .leo-filter .filter-item.filter-filter-btn {
+      height: 38px;
+      width: 80px;
+    }
+
+    .leo-filter .filter-hidden {
+      display: none;
+    }
+  }
+</style>
+<style scoped>
+  .dialog-footer:after{content: '';
+    clear: both;display: table;}
+
+ 
+  .el-table .warning-row {
+    background: oldlace;
+  }
+
+  .el-table .success-row {
+    background: #f0f9eb;
+      /* color:rgb(225, 25, 98)   */
+  }
+
+</style>