shish il y a 9 mois
Parent
commit
544622ea3f

+ 2 - 2
biz-ghs/cg/classes/CgRefundItemClass.php

@@ -22,14 +22,14 @@ class CgRefundItemClass extends BaseClass
         $refundSn = $data['refundSn'] ?? '';
         $ptItemId = $data['ptItemId'] ?? 0;
         $name = $data['name'] ?? '';
-        $unitPrice = $data['unitPrice'] ?? 0;
+        $unitCost = $data['unitCost'] ?? 0;
 
         $mainId = $order->mainId ?? 0;
         $shopId = $order->shopId ?? 0;
         $sjId = $order->sjId ?? 0;
         $ghsName = $order->ghsName ?? '';
 
-        $stockInfo = ProductClass::decreaseStock($productId, $bigNum, $smallNum, false, true, ['cost' => $unitPrice]);
+        $stockInfo = ProductClass::decreaseStock($productId, $bigNum, $smallNum, false, true, ['cost' => $unitCost]);
         $oldStock = $stockInfo['oldStock'] ?? 0;
         $newStock = $stockInfo['newStock'] ?? 0;
         if ($newStock < 0) {

+ 2 - 0
biz-ghs/cg/services/CgRefundService.php

@@ -91,6 +91,7 @@ class CgRefundService extends BaseService
                 $totalNum = $currentCgItem->itemNum ?? 0;
                 $unitPrice = $currentCgItem->bigPrice ?? 0;
                 $unitName = $currentCgItem->bigUnit ?? '';
+                $unitCost = $currentCgItem->cost ?? 0;
 
                 //已退数量增加
                 $currentRefundNum = bcadd($currentCgItem->refundNum, $num);
@@ -117,6 +118,7 @@ class CgRefundService extends BaseService
                     'unitType' => 0,
                     'unitPrice' => $unitPrice,
                     'price' => $totalPrice,
+                    'unitCost' => $unitCost
                 ];
                 CgRefundItemClass::addData($refundItemData, $order);