shish 8 hónapja
szülő
commit
0adff3f70b

+ 6 - 0
app-ghs/controllers/OrderController.php

@@ -1942,6 +1942,12 @@ class OrderController extends BaseController
         $superInfo = ShopAdminClass::getManager($mainId);
         $info['customSuper'] = $superInfo;
 
+        //没有财务权限不能看到利润 ssh 20251117
+        $staff = $this->shopAdmin;
+        if ($staff->finance == 0) {
+            $info['profit'] = 0;
+        }
+
         util::success($info);
     }
 

+ 13 - 2
biz-ghs/order/classes/OrderClass.php

@@ -851,8 +851,8 @@ class OrderClass extends BaseClass
         //记录订单的总成本
         $totalCost = $respond['totalCost'] ?? 0;
         $packCost = $data['packCost'] ?? 0;
-        $totalCost = bcadd($totalCost, $packCost,2);
-        $totalCost = bcadd($totalCost, $sendCost,2);
+        $totalCost = bcadd($totalCost, $packCost, 2);
+        $totalCost = bcadd($totalCost, $sendCost, 2);
         $data['totalCost'] = $totalCost;
         $data['remainCost'] = $totalCost;
 
@@ -1424,6 +1424,17 @@ class OrderClass extends BaseClass
 
             $list[$key]['debtAmount'] = $debtAmount;
             $list[$key]['customShopId'] = $customInfoList[$customId]['shopId'] ?? 0;
+
+            //计算利润
+            $actPrice = $val['actPrice'] ?? 0;
+            $remainCost = $val['remainCost'] ?? 0;
+            $profit = 0;
+            if ($actPrice > $remainCost) {
+                $profit = bcsub($actPrice, $remainCost, 2);
+            }
+            $profit = floatval($profit);
+            $list[$key]['profit'] = $profit;
+
         }
         return $list;
     }