|
|
@@ -114,7 +114,19 @@ class BonusController extends BaseController {
|
|
|
$period = Period::instance();
|
|
|
$periodNum = $period->getNowPeriodNum();
|
|
|
$month = $period->getNowYearMonth();
|
|
|
+ // 判断此业绩期是否已经完成生成了预计算业绩单,生成完毕才能看到
|
|
|
+ $isPerfed = Period::checkPerf($periodNum);
|
|
|
+ if (!$isPerfed) {
|
|
|
+ return static::notice(['user' => [],'team'=>[]]);
|
|
|
+ }
|
|
|
+ // 判断当前时间,是否临近封期,否则隐藏
|
|
|
+ $nowTs = time();
|
|
|
+ $currentPeriodEnd = Period::getEndTime($periodNum);
|
|
|
+ if ($nowTs + 432000 <= $currentPeriodEnd || $currentPeriodEnd < $nowTs) {
|
|
|
+ return static::notice(['user' => [],'team'=>[]]);
|
|
|
+ }
|
|
|
$userInfo = User::getEnCodeInfo($userId);
|
|
|
+ $data = PerfMonth::fetchMonthPerf($month, $userId);
|
|
|
$user[0] = [
|
|
|
'number' => $userInfo['USER_NAME'],
|
|
|
'name' => $userInfo['REAL_NAME'],
|
|
|
@@ -124,6 +136,14 @@ class BonusController extends BaseController {
|
|
|
'team_perf' => 0, // 团队新增累计业绩
|
|
|
'total_perf' => 0 // 合计业绩
|
|
|
];
|
|
|
+ if (!empty($data)) {
|
|
|
+ $userCheck = PerfMonth::checkStatus($data['PV_PCS']+$data['PV_PSS']);
|
|
|
+ $user[0]['user_perf'] = $data['PV_PCS'];
|
|
|
+ $user[0]['team_perf'] = $userCheck ? '' : $data['PV_PSS'];
|
|
|
+ $user[0]['total_perf'] = $userCheck ? '' : $data['PV_PCS']+$data['PV_PSS'];
|
|
|
+ $user[0]['perf_status'] = $userCheck ? '1' : $user[0]['perf_status'];
|
|
|
+ $user[0]['perf_status_name'] = $userCheck ? '达标' : $user[0]['perf_status_name'];
|
|
|
+ }
|
|
|
$teamInfo = [];
|
|
|
$calcAt = PerfMonth::find()->select(['CREATED_AT'])->where('CALC_MONTH=:CALC_MONTH', ['CALC_MONTH'=>$month])->asArray()->one();
|
|
|
|
|
|
@@ -138,7 +158,7 @@ class BonusController extends BaseController {
|
|
|
// 循环一级开拓用户
|
|
|
foreach($relation as $k=>$v) {
|
|
|
// 获取此用户预计算月业绩
|
|
|
- $relationPerf = PerfMonth::getMonthPerf($month, $v['USER_ID']);
|
|
|
+ $relationPerf = PerfMonth::fetchMonthPerf($month, $v['USER_ID']);
|
|
|
if (empty($relationPerf)) {
|
|
|
$relationPerf['PV_PCS'] = 0;
|
|
|
$relationPerf['PV_PSS'] = 0;
|
|
|
@@ -162,14 +182,14 @@ class BonusController extends BaseController {
|
|
|
$teamInfo[$k]['total_perf'] = $relationPerf['PV_PCS']+$relationPerf['PV_PSS'];
|
|
|
$teamInfo[$k]['perf_status'] = '0';
|
|
|
$teamInfo[$k]['perf_status_name'] = '不达标';
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ($userStatusFlag === true) {
|
|
|
$user[0]['perf_status'] = '1';
|
|
|
$user[0]['perf_status_name'] = '达标';
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return static::notice(['user' => $user,'team'=>$teamInfo,'calcAt' => $calcAt['CREATED_AT']]);
|
|
|
}
|
|
|
|
|
|
@@ -396,19 +416,19 @@ class BonusController extends BaseController {
|
|
|
// if ($sysConfig['openVIP']['VALUE']) {
|
|
|
// $data[] = ['name' => 'VIP奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_VIP'])];
|
|
|
// }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// if ($sysConfig['openXF']['VALUE']) {
|
|
|
// $data[] = ['name' => '消费奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_XF'])];
|
|
|
// }
|
|
|
// if ($sysConfig['openYJ']['VALUE']) {
|
|
|
// $data[] = ['name' => '业绩奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_YJ'])];
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
// if ($sysConfig['openGL']['VALUE']) {
|
|
|
// $data[] = ['name' => '管理奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_GL'])];
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
// if ($sysConfig['openJXS']['VALUE']) {
|
|
|
// $data[] = ['name' => '团队成长奖', 'value' => Tool::formatPrice($calcBonus['ORI_BONUS_STANDARD'])];
|
|
|
// }
|
|
|
@@ -416,14 +436,14 @@ class BonusController extends BaseController {
|
|
|
// $data[] = ['name' => '零售奖', 'value' => Tool::formatPrice($calcBonus['BONUS_LS'])];
|
|
|
// }
|
|
|
// $data[]=['name'=>'责任业绩扣除','value'=>Tool::formatPrice($calcBonus['DEDUCT_ZR'])];
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// $data[]=['name'=>'总奖金','value'=>Tool::formatPrice($calcBonus['BONUS_TOTAL'])];
|
|
|
-
|
|
|
+
|
|
|
// if($sysConfig['openLX']['VALUE']) {
|
|
|
// $data[] = ['name' => '福利积分二', 'value' => Tool::formatPrice($calcBonus['BONUS_LX'])];
|
|
|
// }
|
|
|
-
|
|
|
+
|
|
|
// $data[]=['name'=>'四市场新增业绩','value'=>Tool::formatFrontPerf($calcBonus['PV_4L'])];
|
|
|
// $data[]=['name'=>'五市场新增业绩','value'=>Tool::formatFrontPerf($calcBonus['PV_5L'])];
|
|
|
// $data[]=['name'=>'虚拟市场新增业绩','value'=>Tool::formatFrontPerf($calcBonus['PV_LS_TOUCH'])];
|
|
|
@@ -1113,4 +1133,4 @@ class BonusController extends BaseController {
|
|
|
]);
|
|
|
return static::notice($data);
|
|
|
}
|
|
|
-}
|
|
|
+}
|