shish hace 4 años
padre
commit
fb13b2ebed
Se han modificado 1 ficheros con 19 adiciones y 18 borrados
  1. 19 18
      biz-hd/order/services/OrderService.php

+ 19 - 18
biz-hd/order/services/OrderService.php

@@ -99,7 +99,7 @@ class OrderService extends BaseService
             $itemInfo = \bizGhs\item\classes\ItemClass::getByIds($currentItemIds, null, 'id');
         }
 
-        $totalPrice = 0;
+        $goodsPrice = 0;
 
         //组合的花材和商品数据
         $groupGoodsData = [];
@@ -110,7 +110,7 @@ class OrderService extends BaseService
                 util::fail('没有找到产品属性');
             }
             $currentPrice = $val['price'] ?? 0;
-            $totalPrice = bcadd($totalPrice, $currentPrice, 2);
+            $goodsPrice = bcadd($goodsPrice, $currentPrice, 2);
             $property = $val['property'];
             $unitPrice = $val['unitPrice'] ?? 0;
             $unitType = $val['unitType'] ?? 0;
@@ -137,7 +137,7 @@ class OrderService extends BaseService
                     'cover' => $cover,
                     'unitPrice' => $unitPrice,
                     'num' => $num,
-                    'totalPrice' => $totalPrice,
+                    'totalPrice' => 0,
                     'mainId' => $mainId,
                 ];
                 //库存变化在这里
@@ -183,7 +183,7 @@ class OrderService extends BaseService
                     'itemId' => $currentId,
                     'ptItemId' => $ptItemId,
                     'totalNum' => $totalNum,
-                    'totalPrice' => $totalPrice,
+                    'totalPrice' => 0,
                     'customId' => $customId,
                     'hdId' => $hdId,
                     'sjId' => $sjId,
@@ -205,7 +205,7 @@ class OrderService extends BaseService
         }
 
         $sendCost = $data['sendCost'] ?? 0;
-        $totalPrice = bcadd($totalPrice, $sendCost, 2);
+        $totalPrice = bcadd($goodsPrice, $sendCost, 2);
         $modifyPrice = $data['modifyPrice'] ?? 0;
         if ($modifyPrice > $totalPrice) {
             //人工资材包装费
@@ -239,20 +239,21 @@ class OrderService extends BaseService
             }
         }
 
-        $addData = [
-            'prePrice' => $totalPrice,
-            'actPrice' => $modifyPrice,
-            'realPrice' => $modifyPrice,
-            'customId' => $customId,
-            'hdId' => $hdId,
-            'sjId' => $sjId,
-            'shopId' => $shopId,
-            'mainId' => $mainId,
-            'payWay' => $payWay,
-            'status' => OrderClass::ORDER_STATUS_UN_PAY
-        ];
+        $data['goodsPrice'] = $goodsPrice;
+        $data['prePrice'] = $totalPrice;
+        $data['orderPrice'] = $modifyPrice;
+        $data['actPrice'] = $modifyPrice;
+        $data['realPrice'] = $modifyPrice;
+        $data['customId'] = $customId;
+        $data['hdId'] = $hdId;
+        $data['sjId'] = $sjId;
+        $data['shopId'] = $shopId;
+        $data['mainId'] = $mainId;
+        $data['payWay'] = $payWay;
+        $data['status'] = OrderClass::ORDER_STATUS_UN_PAY;
+
         //保存订单
-        $returnOrder = OrderClass::addOrder($addData);
+        $returnOrder = OrderClass::addOrder($data);
 
         //欠款和已付款的直接完成
         if (in_array($hasPay, [dict::getDict('hasPay', 'payed'), dict::getDict('hasPay', 'debt')])) {