Procházet zdrojové kódy

Merge branch 'master' of http://16.162.42.175:8014/guanli/ngds

kevin_zhangl před 2 roky
rodič
revize
8c4b4b2855

+ 2 - 2
common/models/ApproachOrder.php

@@ -73,8 +73,8 @@ class ApproachOrder extends \common\components\ActiveRecord
             [['USER_ID',  'ORDER_TYPE', 'CREATE_USER'], 'required'],
             [['ORDER_AMOUNT', 'PV', 'PAY_AMOUNT', 'PAY_PV', 'FREIGHT', 'PAY_FREIGHT'], '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','DEC_USER_ID'], 'string', 'max' => 16],
+            [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE','DEC_USER_ID'], 'string', 'max' => 32],
+            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
             [['ORDER_TYPE'], 'string', 'max' => 12],
             [['EXPRESS_COMPANY'], 'string', 'max' => 128],
             [['FRONT_REMARK'], 'string', 'max' => 1000],

+ 3 - 2
common/models/Order.php

@@ -12,6 +12,7 @@ use Yii;
  * @property string $DEC_SN 报单编号
  * @property string $USER_ID 用户ID
  * @property string $USER_NAME 会员编号
+ * @property string $DEC_USER_ID  会员编号
  * @property string $ORDER_TYPE 订货类型
  * @property string $ORDER_AMOUNT 订单总价格(n)
  * @property string $ORDER_AMOUNT_STANDARD 订单总价格($)
@@ -73,8 +74,8 @@ class Order extends \common\components\ActiveRecord
             [['USER_ID', 'ORDER_TYPE', 'CREATE_USER'/*, 'EMAIL'*/], 'required'],
             [['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','DEC_USER_ID'], 'string', 'max' => 16],
+            [['ID','SN', 'DEC_SN', 'USER_ID', 'ORDER_TRACK_NO','PAY_TYPE','DEC_USER_ID'], 'string', 'max' => 32],
+            [['USER_NAME', 'TEL', 'CREATE_USER', 'UPDATER', 'WAREHOUSE'], 'string', 'max' => 16],
             [['ORDER_TYPE'], 'string', 'max' => 12],
             [['EXPRESS_COMPANY'], 'string', 'max' => 128],
             [['FRONT_REMARK'], 'string', 'max' => 1000],

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

@@ -209,11 +209,11 @@ class ApproachDeclarationForm extends Model
                     //反转数组,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 (!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'];

+ 1 - 0
common/models/forms/ApproachDeclarationLoopForm.php

@@ -193,6 +193,7 @@ class ApproachDeclarationLoopForm extends Model
                     }
 
                     $result = $model->add($this->data);
+                    
                     if(!$result){
                         throw new Exception(Form::formatErrorsForApi($model->getErrors()));
                     }

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

@@ -464,7 +464,7 @@ class ApproachOrderForm extends Model
 
                     $userStage = Instalment::getStage($loginUserId);
                     // 分期的总期数
-                    $instalment = floatval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                    $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
                     if ($userStage==0 || $userStage == $instalment){
 
                     }else{

+ 1 - 1
common/models/forms/ApproachReconsumeOrderForm.php

@@ -465,7 +465,7 @@ class ApproachReconsumeOrderForm extends Model
 
                     $userStage = Instalment::getStage($loginUserId);
                     // 分期的总期数
-                    $instalment = floatval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                    $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
                     if ($userStage==0 || $userStage == $instalment){
 
                     }else{

+ 5 - 5
common/models/forms/DeclarationForm.php

@@ -210,11 +210,11 @@ class DeclarationForm extends Model
 //            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'];
             }

+ 1 - 1
common/models/forms/DeclarationUpgradeForm.php

@@ -191,7 +191,7 @@ class DeclarationUpgradeForm extends Model
                             }
 
                             // 分期的总期数
-                            $instalment = floatval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                            $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
                             $userStage = Instalment::getStage($userId);
                             $userInstalmentInfo = Instalment::getInfo($userId);
                             if (!$userInstalmentInfo){ // 如果没有分期付款记录

+ 15 - 3
common/models/forms/OrderForm.php

@@ -5,6 +5,7 @@ use common\helpers\Cache;
 use common\helpers\Date;
 use common\components\Model;
 use common\helpers\Form;
+use common\helpers\LoggerTool;
 use common\helpers\PayStack;
 use common\helpers\user\Balance;
 use common\helpers\user\Cash;
@@ -544,7 +545,8 @@ class OrderForm extends Model
                     $userInstalmentInfo = Instalment::getInfo($loginUserId);
 
                     // 分期的总期数
-                    $instalment = floatval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                    $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                    LoggerTool::debug(['instalment']);
                     if ($userStage != $instalment){
                         if($userInstalmentInfo){
                             if($userInstalmentInfo['STAGE']>0 && $userInstalmentInfo['ORDER_TYPE']!='FX'){
@@ -841,6 +843,7 @@ class OrderForm extends Model
         $goodsType = ShopGoods::getGoodType();
         $hasInstalment = 0;
         $userId = Info::getUserIdByUserName($this->userName);
+        $exchangeRate = floatval(Cache::getSystemConfig()['exchangeRate']['VALUE'] ?? 0); // 汇率
         foreach ($this->goodsNum as $k => $v) {
             if ($v) {
                 $goods = ShopGoods::findOneAsArray('ID=:ID AND STATUS=1',[':ID'=> $ids[$k]]);
@@ -852,10 +855,12 @@ class OrderForm extends Model
                         $discount = $goodsType[$goods['TYPE']]['discount'];
                         $realPrice = $goods['SELL_PRICE'] * $discount/100;
                         $realPv = $goods['PRICE_PV'] * $discount/100;
+                        $realPriceStandard = $goods['SELL_PRICE_STANDARD'] * $discount/100;
                     } else {
                         $discount = $goods['SELL_DISCOUNT'];
                         $realPrice = $goods['SELL_PRICE'] * $discount;
                         $realPv = $goods['PRICE_PV'] * $discount;
+                        $realPriceStandard = $goods['SELL_PRICE_STANDARD'] * $discount;
                     }
                     $totalAmount += $realPrice * intval($v);
                     $totalPv += $realPv * intval($v);
@@ -868,7 +873,14 @@ class OrderForm extends Model
                         'POINT' => $goods['POINT'],
                         'BUY_NUMS' => intval($v),
                         'SKU_CODE' => $goods['GOODS_NO'],
-                        'GOODS_TITLE' => $goods['GOODS_NAME']
+                        'GOODS_TITLE' => $goods['GOODS_NAME'],
+                        'STANDARD_PRICE' => $goods['SELL_PRICE_STANDARD'],
+                        'TAX_RATE' => $goods['TAX_RATE'],
+                        'CATEGORY_TYPE' => $goods['CATEGORY_TYPE'],
+                        'PAY_TYPE' => $this->payType ?? '',
+                        'EMAIL' => $this->email ?? '',
+                        'REAL_STANDARD_PRICE' => $realPriceStandard,
+                        'EXCHANGE_RATE' => $exchangeRate,
                     ];
                 }
                 if($goods['INSTALMENT']>0){ // 如果有分期付款商品,检查用户的分期付款状态
@@ -879,7 +891,7 @@ class OrderForm extends Model
                     $userStage = Instalment::getStage($userId);
                     $userInstalmentInfo = Instalment::getInfo($userId);
                     // 分期的总期数
-                    $instalment = floatval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
+                    $instalment = intval(Cache::getSystemConfig()['instalment']['VALUE'] ?? 3);
                     if ($userStage == $instalment){
 
                     }else{

+ 1 - 1
common/models/forms/OrderPeriodAdjustForm.php

@@ -148,7 +148,7 @@ class OrderPeriodAdjustForm extends Model
             // 写入调整记录
             $orderModel = new OrderPeriodAdjust();
             $orderModel->ORDER_SN = $this->orderSn;
-            $orderModel->DEC_SN = $this->order->DEC_SN ?? '';
+            //$orderModel->DEC_SN = $this->order->DEC_SN ?? '';
             $orderModel->ORIGIN_PERIOD = $this->order->PERIOD_NUM;
             $orderModel->MODERN_PERIOD = $this->modernPeriod;
             $orderModel->ADMIN_ID = Admin::getAdminNameById(\Yii::$app->user->id);