joway пре 2 година
родитељ
комит
97ac87b376

+ 1 - 0
common/models/ApproachOrder.php

@@ -97,6 +97,7 @@ class ApproachOrder extends \common\components\ActiveRecord
             'DEC_SN' => '报单编号',
             'USER_ID' => '用户ID',
             'USER_NAME' => '会员编号',
+            //'DEC_USER_ID' => '报单中心编号',
             'ORDER_TYPE' => '订货类型',
             'ORDER_AMOUNT' => '订单总价格',
             'PV' => '订货BV',

+ 2 - 1
common/models/Order.php

@@ -74,7 +74,7 @@ class Order extends \common\components\ActiveRecord
             [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT', 'ORDER_AMOUNT_STANDARD', 'PAY_AMOUNT_STANDARD', 'EXCHANGE_RATE'], 'number'],
             [['PAY_AT', 'DELIVERY_STATUS', 'DELIVERY_PERIOD', 'DELIVERY_AT', 'EXPRESS_TYPE', 'PERIOD_NUM', 'STATUS', 'PROVINCE', /*'CITY', 'COUNTY', */'CREATED_AT', 'UPDATED_AT', 'IS_DELETE', 'DELETED_AT'], 'integer'],
             [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE'], 'string', 'max' => 32],
-            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
+            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE','DEC_USER_ID'], 'string', 'max' => 16],
             [['ORDER_TYPE'], 'string', 'max' => 12],
             [['EXPRESS_COMPANY'], 'string', 'max' => 128],
             [['FRONT_REMARK'], 'string', 'max' => 1000],
@@ -97,6 +97,7 @@ class Order extends \common\components\ActiveRecord
             'DEC_SN' => '报单编号',
             'USER_ID' => '用户ID',
             'USER_NAME' => '会员编号',
+            'DEC_USER_ID' => '报单中心编号',
             'ORDER_TYPE' => '订货类型',
             'ORDER_AMOUNT' => '订单总价格',
             'PV' => '订货BV',

+ 20 - 16
common/models/forms/ApproachDeclarationForm.php

@@ -130,7 +130,7 @@ class ApproachDeclarationForm extends Model
             [['type','decLv','decWay','insertUserName',/* 'insertUserIdCard',*/'password','payPassword'], 'required'],
             [['type'], 'isType', 'on'=>['userDec', 'canDec']],
             [['insertUserName'], 'isCanAddUser'],
-//            [['decUserName', 'decType'], 'issetDec'],
+            [['decUserName', 'decType'], 'issetDec'],
             [['conUserName'], 'isConUserName'],
             [['recUserName'], 'isRecUserName'],
             [['location'], 'isLocation'],
@@ -196,24 +196,28 @@ class ApproachDeclarationForm extends Model
      * @param $attribute
      */
     public function issetDec($attribute){
-        if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
-            $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
-            return false;
+        if(!$this->decUserName){
+            $this->_decId = '';
         } else {
-            if ($this->decType !== 'ba') {
-                // 判断报单中心是否在新加入会员的安置网上级中
-                $this->loopFindParentToNetwork($this->insertUserName);
-                //反转数组,in_array搜索错误
-                //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
-                $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
-                if (!isset($flipParent[$this->decUserName])) {
-                    //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
-                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
-                    return ;
+            if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
+                $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
+                return false;
+            } else {
+                if ($this->decType !== 'ba') {
+                    // 判断报单中心是否在新加入会员的安置网上级中
+                    $this->loopFindParentToNetwork($this->insertUserName);
+                    //反转数组,in_array搜索错误
+                    //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
+                    $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
+                    if (!isset($flipParent[$this->decUserName])) {
+                        //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                        $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
+                        return ;
+                    }
                 }
-            }
 
-            $this->_decId = $decUser['ID'];
+                $this->_decId = $decUser['ID'];
+            }
         }
     }
 

+ 2 - 1
common/models/forms/ApproachOrderForm.php

@@ -554,7 +554,8 @@ class ApproachOrderForm extends Model
         $orderModel->DEC_SN = 'DS' . $ordNo;
         $orderModel->ORDER_TYPE = $this->type;
         $orderModel->USER_ID = $userId;
-        $orderModel->USER_NAME = $this->decUserName;
+        $orderModel->USER_NAME = $userName;
+        $orderModel->DEC_USER_ID = $this->decUserName;
         $orderModel->ORDER_AMOUNT = $this->_decAmount;
         $orderModel->PV = $_hasPV;
         $orderModel->PAY_AMOUNT = $this->_payAmount;

+ 22 - 16
common/models/forms/DeclarationForm.php

@@ -126,7 +126,7 @@ class DeclarationForm extends Model
             [['type','decLv','decWay','insertUserName',/* 'insertUserIdCard',*/'password','payPassword'], 'required'],
             [['type'], 'isType', 'on'=>['userDec', 'canDec']],
             [['insertUserName'], 'isCanAddUser'],
-//            [['decUserName'], 'issetDec'],
+            [['decUserName'], 'issetDec'],
             [['conUserName'], 'isConUserName'],
             [['recUserName'], 'isRecUserName'],
             [['location'], 'isLocation'],
@@ -180,7 +180,7 @@ class DeclarationForm extends Model
     {
         $parentScenarios =  parent::scenarios();
         $customScenarios = [
-            'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName',/*'decUserName',*/ 'location', 'email'],
+            'userDec' => ['type','allData', 'decLv','decWay','insertUserName','password','payPassword', 'realName',/* 'insertUserIdCard',*/ 'mobile', 'address', 'openBank', 'bankAddress', 'bankNo', 'bankProvince','bankCity','bankCounty', 'consignee','acceptMobile','province',/*'city','county',*/ 'conUserName', 'recUserName','decUserName', 'location', 'email'],
             'canDec' => ['type', 'insertUserName',/* 'insertUserIdCard',*/ 'conUserName', 'recUserName', 'location'],
             'notFull' => ['type', 'insertUserName', 'conUserName', 'recUserName', 'location'],
         ];
@@ -192,26 +192,32 @@ class DeclarationForm extends Model
      * @param $attribute
      */
     public function issetDec($attribute){
-        if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
-            $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
-            return false;
+        if(!$this->decUserName){
+            $this->_decId = '';
         } else {
-            if ($this->decType !== 'ba') {
-                // 判断报单中心是否在新加入会员的安置网上级中
-                $this->loopFindParentToNetwork($this->insertUserName);
-                //反转数组,in_array搜索错误
-                //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
-                $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
+
+
+            if (!$decUser = User::find()->select('ID')->where('IS_DEC=1 AND USER_NAME=:USER_NAME', [':USER_NAME' => $this->decUserName])->asArray()->one()) {
+                $this->addError($attribute, Yii::t('app', 'stockistDoesNotExist'));
+                return false;
+            } else {
+                if ($this->decType !== 'ba') {
+                    // 判断报单中心是否在新加入会员的安置网上级中
+                    $this->loopFindParentToNetwork($this->insertUserName);
+                    //反转数组,in_array搜索错误
+                    //in_array($this->decUserName, $this->_tempNetworkParentUser[$this->insertUserName]);
+                    $flipParent = array_flip(array_filter($this->_tempNetworkParentUser[$this->insertUserName]));
 //            var_dump($flipParent);
 //            echo $this->insertUserName.'=='.$this->decUserName;
 //            exit;
-                if (!isset($flipParent[$this->decUserName])) {
-                    //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
-                    $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
-                    return ;
+                    if (!isset($flipParent[$this->decUserName])) {
+                        //$this->addError($attribute, '为' . $this->insertUserName . '报单,报单中心' . $this->decUserName . '不在' . $this->insertUserName . '的安置网上级中');
+                        $this->addError($attribute, 'To' . $this->insertUserName . 'Entry, Stockist' . $this->decUserName . 'not in exist' . $this->insertUserName . 'in the placement superiors');
+                        return;
+                    }
                 }
+                $this->_decId = $decUser['ID'];
             }
-            $this->_decId = $decUser['ID'];
         }
     }
 

+ 2 - 1
common/models/forms/OrderForm.php

@@ -711,7 +711,8 @@ class OrderForm extends Model
         $orderModel->DEC_SN = 'DS'.$ordNo;
         $orderModel->ORDER_TYPE = $this->type;
         $orderModel->USER_ID = $userId;
-        $orderModel->USER_NAME = $this->decUserName;;
+        $orderModel->USER_NAME = $userName;
+        $orderModel->DEC_USER_ID = $this->decUserName;;
         $orderModel->ORDER_AMOUNT = $this->_decAmount;
         $orderModel->PV = $_hasPV;
         $orderModel->PAY_AMOUNT = $this->_payAmount;

+ 0 - 2
frontendApi/runtime/.gitignore

@@ -1,2 +0,0 @@
-*
-!.gitignore