kevin_zhangl 3 tahun lalu
induk
melakukan
e33e01a095

+ 1 - 0
frontendApi/config/menu.php

@@ -78,6 +78,7 @@ return [
             ['name'=>'My account', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'index', 'routePath'=>'bonus/index', 'show'=>1,],//我的账户
 //            ['name'=>'最新奖金', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'new', 'routePath'=>'bonus/new', 'show'=>1,'allow'=>'newBonusSwitch'],
             ['name'=>'My bonus', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'other', 'routePath'=>'bonus/other', 'show'=>1,'allow'=>'pastBonusSwitch'],//往期奖金
+            ['name'=>'Historical cumulative bonus', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'other', 'routePath'=>'bonus/historical-cumulative-bonus', 'show'=>1,'allow'=>'pastBonusSwitch'],//历史累积奖金
             //['name'=>'实时业绩', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'real-time-perf', 'routePath'=>'bonus/real-time-perf', 'show'=>1,],
            // ['name'=>'房产积分', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'fc-point', 'routePath'=>'bonus/fc-point', 'show'=>1,],
 //            ['name'=>'报单中心补助明细查询', 'class'=>'', 'icon'=>'', 'controller'=>'bonus', 'action'=>'flow-bt', 'routePath'=>'bonus/flow-bt', 'show'=>1,],

+ 1 - 0
frontendApi/config/urlManagerRules.php

@@ -127,6 +127,7 @@ return [
             'GET trace-fl' => 'trace-fl',
             'GET dec-period' => 'dec-period',
             'GET fc-point' => 'fc-point',
+            'GET historical-cumulative-bonus' => 'historical-cumulative-bonus',
         ],
     ],
     [

+ 51 - 0
frontendApi/modules/v1/controllers/BonusController.php

@@ -508,6 +508,57 @@ class BonusController extends BaseController {
         return static::notice(['tableData' => $calcBonus, 'tableKey' => '', 'bonusSwitch' => $bonusSwitch]);
     }
 
+    /**
+     * 历史累积奖金
+     * @return mixed
+     * @throws \yii\web\HttpException
+     */
+    public function actionHistoricalCumulativeBonus()
+    {
+        $calcBonus = CalcBonus::find()->where('USER_ID=:USER_ID AND IS_SENT=1', [':USER_ID' => \Yii::$app->user->id])
+            ->select([
+                'SUM(ORI_BONUS_TG) AS ORI_BONUS_TG',
+                'SUM(ORI_BONUS_QY) AS ORI_BONUS_QY',
+                'SUM(ORI_BONUS_BD) AS ORI_BONUS_BD',
+                'SUM(ORI_BONUS_BS) AS ORI_BONUS_BS',
+                'SUM(ORI_BONUS_QUARTER) AS ORI_BONUS_QUARTER',
+                'SUM(BONUS_TOTAL) AS BONUS_TOTAL'
+            ])
+            ->asArray()
+            ->one();
+
+        // 增加明细开关控制(0 只显示总奖金 1 全部显示)
+        $flowBonusSwitch = Cache::getSystemConfig()['flowBonusSwitch']['VALUE'];
+
+        $sysConfig = Cache::getSystemConfig();
+        $bonusSwitch = [
+            'welcomeBonusSwitch' => intval($sysConfig['openTG']['VALUE']),
+            'teamBonusSwitch' => intval($sysConfig['openQY']['VALUE']),
+            'stockistCommissionSwitch' => intval($sysConfig['openFW']['VALUE']),
+        ];
+
+        if ($calcBonus) {
+            if ($flowBonusSwitch) {
+                if ($sysConfig['openTG']['VALUE']) {
+                    $calcBonus['BONUS_TG'] = ['name' => '销售奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_TG'])];
+                }
+                if ($sysConfig['openQY']['VALUE']) {
+                    $calcBonus['ORI_BONUS_QY'] = ['name' => '业绩奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_QY'])];
+                }
+                if ($sysConfig['openFW']['VALUE']) {
+                    $calcBonus['BONUS_BD'] = ['name' => '服务奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_BD'])];
+                }
+
+                $calcBonus['ORI_BONUS_BS'] = ['name' => '蓝星奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_BS'])];
+                $calcBonus['ORI_BONUS_QUARTER'] = ['name' => '季度奖金', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_QUARTER'])];
+            }
+
+            $calcBonus['BONUS_TOTAL'] = ['name' => '总奖金', 'value' => Tool::formatPrice($calcBonus['BONUS_TOTAL'])];
+        }
+
+        return static::notice(['tableData' => [$calcBonus], 'bonusSwitch' => $bonusSwitch]);
+    }
+
     /**
      * 实时业绩
      * @return mixed

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

@@ -306,6 +306,18 @@ export const constantRouterMap = [
           ],
         },
       },
+      {
+        path: '/bonus/historical-cumulative-bonus',
+        component: _import('bonus/historical-cumulative-bonus'),
+        name: 'historical-cumulative-bonus',
+        meta: {
+          title: 'Historical cumulative bonus',//往期历史奖金累积
+          breadcrumb: [
+            {title: 'Dashboard', path: '/dashboard/index'},//Dashboard
+            {title: 'Bonus management', path: '/bonus/index'},//奖金管理
+          ],
+        },
+      },
       {
         path: '/bonus/real-time-perf',
         component: _import('bonus/real-time-perf'),

+ 57 - 0
frontendEle/src/views/bonus/historical-cumulative-bonus.vue

@@ -0,0 +1,57 @@
+<template>
+  <div v-loading="loading">
+    <div class="white-box">
+      <el-table class="table-box" :data="tableData" style="width: 100%;">
+        <el-table-column label="Welcome Bonus" prop="BONUS_TG.value" v-if="welcomeBonusSwitch === 1"></el-table-column><!-- 销售奖金 -->
+        <el-table-column label="Team Bonus" prop="ORI_BONUS_QY.value" v-if="teamBonusSwitch === 1"></el-table-column><!-- 绩效奖 -->
+        <el-table-column label="Director Bonus" prop="ORI_BONUS_BS.value"></el-table-column><!-- 蓝星奖金/管理奖 -->
+        <el-table-column label="Quarterly Bonus" prop="ORI_BONUS_QUARTER.value"></el-table-column><!-- 季度分红 -->
+        <el-table-column label="Stockist Commission" prop="BONUS_BD.value" v-if="stockistCommissionSwitch === 1"></el-table-column><!-- 服务中心 -->
+         <el-table-column label="Total Bonus" prop="BONUS_TOTAL.value"></el-table-column>  <!--合计-->
+      </el-table>
+    </div>
+  </div>
+</template>
+
+<script>
+  import network from '@/utils/network'
+  import tool from '@/utils/tool'
+
+  export default {
+    name: 'historical-cumulative-bonus',
+    components: {},
+    mounted() {
+      this.getData()
+    },
+    data() {
+      return {
+        loading: true,
+        tableData: null,
+        welcomeBonusSwitch: false,
+        teamBonusSwitch: false,
+        stockistCommissionSwitch: false,
+      }
+    },
+    methods: {
+      getData() {
+        let vueObj = this
+        vueObj.loading = true
+        network.getData('bonus/historical-cumulative-bonus').then(response => {
+          vueObj.tableData = response.tableData
+          vueObj.welcomeBonusSwitch = response.bonusSwitch.welcomeBonusSwitch
+          vueObj.teamBonusSwitch = response.bonusSwitch.teamBonusSwitch
+          vueObj.stockistCommissionSwitch = response.bonusSwitch.stockistCommissionSwitch
+          vueObj.loading = false
+        }).catch(_ => {
+           vueObj.loading = false
+        })
+      },
+    }
+  }
+</script>
+<style>
+  .other-table-box .el-table__header-wrapper{display: none;}
+  .other-table-box .el-table__body tr:hover>td{background-color: #fff!important;}
+  .other-table-box .el-table__body tr td:not(:last-child):hover{background-color: #f5f5f5!important;}
+  .bonus-list .bonus-item{float: left;width: 33.333%;background: #fff;height:36px;line-height:36px;border: 1px solid #ddd;margin: -1px 0 0 -1px;box-sizing: border-box;}
+</style>