diff --git a/app/common/service/StockOrdersService.php b/app/common/service/StockOrdersService.php index 0929703..ad21787 100644 --- a/app/common/service/StockOrdersService.php +++ b/app/common/service/StockOrdersService.php @@ -485,12 +485,12 @@ class StockOrdersService $this->processVehiclePrices($item, $veh); // 计算利润 - $profit = $this->calculateProfit($veh, $item->mileage, $order); - $item->addMoney('profit', $order->settlement_currency, $profit, $order->contract_exchange_rate, '利润'); + // $profit = $this->calculateProfit($veh, $item->mileage, $order); + // $item->addMoney('profit', $order->settlement_currency, $profit, $order->contract_exchange_rate, '利润'); // 累计到岸价 $cifTotalAmount += $veh['total_price']['amount'] ?? 0; - $profitTotalAmount += $profit; + $profitTotalAmount += $veh['profit']['amount'] ?? 0; // 处理改装项 $this->processModificationItems($item->id, $veh['modify_list'] ?? []); @@ -525,17 +525,18 @@ class StockOrdersService { // 基础费用 $priceFields = [ - 'unit_price' => '单价', - 'total_price' => '总价', - 'handling_fee' => '手续费', + 'unit_price' => '单价', + 'total_price' => '总价', + 'handling_fee' => '手续费', 'fob_transport_fee' => 'FOB运输费', - 'port_misc_fee' => '港杂', - 'retrofit_fee' => '改装费', - 'ocean_freight' => '海运费', - 'commission' => '佣金', - 'purchase_tax' => '购置税', - 'tax_refund' => '预估退税', - 'clearance_price' => '报关价', + 'port_misc_fee' => '港杂', + 'retrofit_fee' => '改装费', + 'ocean_freight' => '海运费', + 'commission' => '佣金', + 'purchase_tax' => '购置税', + 'tax_refund' => '预估退税', + 'clearance_price' => '报关价', + 'profit' => '利润' ]; foreach ($priceFields as $field => $description) { @@ -813,7 +814,9 @@ class StockOrdersService $modificationText = $this->getModificationText($v->options); // 计算单项利润 - $itemProfit = $this->calculateProfit($moneyValues, $v->mileage, $item); + // $itemProfit = $this->calculateProfit($moneyValues, $v->mileage, $item); + // var_dump($moneyValues); + $itemProfit = empty($moneyValues['profit']['amount']) ? 0 : $moneyValues['profit']['amount']; // 构建车辆信息 $vehList[$v->unique_id] = [