shish 4 ani în urmă
părinte
comite
cc5b535fa7
1 a modificat fișierele cu 5 adăugiri și 6 ștergeri
  1. 5 6
      biz-hd/order/services/OrderService.php

+ 5 - 6
biz-hd/order/services/OrderService.php

@@ -154,7 +154,7 @@ class OrderService extends BaseService
                     'mainId' => $mainId,
                 ];
                 OrderGoodsClass::addData($currentGoodsData);
-                $groupGoodsData[] = ['goodsId' => $currentId,'num' => $num,'name' => $name,'unitPrice' => $unitPrice];
+                $groupGoodsData[] = ['goodsId' => $currentId, 'num' => $num, 'name' => $name, 'unitPrice' => $unitPrice];
             }
             if ($property == dict::getDict('property', 'item')) {
                 $name = $itemInfo[$currentId]['name'] ?? '';
@@ -213,13 +213,12 @@ class OrderService extends BaseService
         }
         $data['sendCost'] = isset($data['sendCost']) && $data['sendCost'] > 0 ? $data['sendCost'] : 0;
         $totalPrice = bcadd($goodsPrice, $data['sendCost'], 2);
+        //人工资材包装费
+        $labourCost = isset($data['labourCost']) && $data['labourCost'] > 0 ? $data['labourCost'] : 0;
+        $totalPrice = bcadd($totalPrice, $labourCost, 2);
         $modifyPrice = isset($data['modifyPrice']) && $data['modifyPrice'] > 0 ? $data['modifyPrice'] : 0;
-        if ($modifyPrice > $totalPrice) {
-            //人工资材包装费
-            $data['labourCost'] = bcsub($modifyPrice, $totalPrice, 2);
-        }
+        //优惠
         if ($modifyPrice < $totalPrice) {
-            //优惠
             $data['discountType'] = dict::getDict('discountType', 'discount');
             $discountAmount = bcsub($totalPrice, $modifyPrice, 2);
             $data['discountAmount'] = $discountAmount;