theo 2 лет назад
Родитель
Сommit
9503fb6d6c

+ 7 - 7
common/models/DeclarationLevel.php

@@ -117,10 +117,10 @@ class DeclarationLevel extends \common\components\ActiveRecord
     // 获取下一级业绩数据
     public static function getNextDecPref($perf) {
         $data = static::find()
-        ->where('PERF>:PERF', 
+        ->where('PERF>:PERF',
             [
-                'PERF'=>$perf, 
-                
+                'PERF'=>$perf,
+
             ]
         )
         ->orderBy('PERF ASC')
@@ -133,10 +133,10 @@ class DeclarationLevel extends \common\components\ActiveRecord
 
     public static function getNextAll($perf){
         $data = static::find()
-        ->where('PERF>:PERF', 
+        ->where('PERF>:PERF',
             [
-                'PERF'=>$perf, 
-                
+                'PERF'=>$perf,
+
             ]
         )
         ->indexBy('ID')
@@ -257,4 +257,4 @@ class DeclarationLevel extends \common\components\ActiveRecord
         }
         return $data;
     }
-}
+}

+ 9 - 5
common/models/forms/ApproachDeclarationForm.php

@@ -681,10 +681,11 @@ class ApproachDeclarationForm extends Model
                             }
                         }
                     }
-                    if ($hasInstalment){ // 如果买了分期付款商品,则不判断总pv
-                        $allData['hasInstalment'] = 1;
-                    }else if($totalPv<$decLevel['PERF']){
-                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
+                    if($totalPv<$decLevel['PERF']){
+                        if ($hasInstalment && $decLevel['LEVEL_NAME'] == 'Elite'){
+                        }else{
+                            throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
+                        }
                     }
                     foreach ($decLevelConfig as $key => $val) {
                         if ($totalPv >= $val['PERF']) {
@@ -692,7 +693,10 @@ class ApproachDeclarationForm extends Model
                         }
                     }
                     if ($this->decLv != $toDecLevel) {
-                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
+                        if ($hasInstalment && $decLevel['LEVEL_NAME'] == 'Elite'){
+                        }else{
+                            throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
+                        }
                     }
                     $this->_decAmount = $totalAmount;
                     $this->_decPv = $totalPv;

+ 10 - 6
common/models/forms/DeclarationForm.php

@@ -710,18 +710,22 @@ class DeclarationForm extends Model
                         }
                     }
                 }
-                if ($hasInstalment){ // 如果买了分期付款商品,则不判断总pv
-                    $allData['hasInstalment'] = 1;
-                }else if($totalPv<$decLevel['PERF']){
-                    throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
+                if($totalPv<$decLevel['PERF']){
+                    if ($hasInstalment && $decLevel['LEVEL_NAME'] == 'Elite'){
+                    }else{
+                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanSelectedBV'));
+                    }
                 }
                 foreach ($decLevelConfig as $key=>$val){
                     if($totalPv>=$val['PERF']){
                         $toDecLevel = $key;
                     }
                 }
-                if($this->decLv!=$toDecLevel){
-                    throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
+                if ($this->decLv != $toDecLevel) {
+                    if ($hasInstalment && $decLevel['LEVEL_NAME'] == 'Elite'){
+                    }else{
+                        throw new Exception(Yii::t('app', 'totalBVCanNotLessThanNextSelectedLevelBV'));
+                    }
                 }
                 $this->_decAmount = $totalAmount;
                 $this->_decPv = $totalPv;