fix bug 22/4 2
This commit is contained in:
@@ -116,7 +116,7 @@ class SingleOrderController extends Controller
|
||||
$data['service_charge_percentage'] = isset($data['fee_free']) && $data['fee_free'] === true ? 0 : ($data['product']['percent_fee_buy']) * $data['number'];
|
||||
$data['difference'] = $data['fee'] = $this->resolveCashPriceDiff($config, $data['product'], 1);
|
||||
$data['total_fee'] = $data['number'] * $data['fee'];
|
||||
$data['price_original'] = $data['product']['price'] + $data['product']['price_profit'];
|
||||
$data['price_original'] = $this->resolveProductUnitBasePrice($data['product']);
|
||||
$data['total_price_original'] = $data['product']['amount'] * ($data['price_original'] ?? 0);
|
||||
|
||||
// Check if the method is cash
|
||||
@@ -134,7 +134,7 @@ class SingleOrderController extends Controller
|
||||
$data['service_charge_percentage'] = isset($data['fee_free']) && $data['fee_free'] === true ? 0 : ($data['product']['percent_fee_sell']) * $data['number'];
|
||||
$data['difference'] = $data['fee'] = $this->resolveCashPriceDiff($config, $data['product'], 2);
|
||||
$data['total_fee'] = $data['number'] * $data['fee'];
|
||||
$data['price_original'] = $data['product']['price'] + $data['product']['price_profit'];
|
||||
$data['price_original'] = $this->resolveProductUnitBasePrice($data['product']);
|
||||
$data['total_price_original'] = $data['product']['amount'] * ($data['price_original'] ?? 0);
|
||||
|
||||
$this->assertMinimumSellCash($data);
|
||||
@@ -1171,6 +1171,22 @@ class SingleOrderController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* قیمت پایهٔ هر واحد محصول (بدون ضرب در وزن — وزن در total_price_original اعمال میشود).
|
||||
* محصول با پرچم «قیمت اپ» → قیمت زندهٔ هر گرم اپ (با تعدیل درصدی)؛
|
||||
* بقیه → همان قیمت ذخیرهشدهٔ محصول.
|
||||
*/
|
||||
private function resolveProductUnitBasePrice(Product $product): int
|
||||
{
|
||||
$display = app(ProductDisplayPriceService::class);
|
||||
|
||||
if ($display->usesFlaggedAppPrice($product)) {
|
||||
return (int) round($display->resolveOrderBasePrice($product));
|
||||
}
|
||||
|
||||
return (int) (($product->price ?? 0) + ($product->price_profit ?? 0));
|
||||
}
|
||||
|
||||
private function bonusGift($customer, $referrer)
|
||||
{
|
||||
$bonus = Setting::where('key', 'referral_bonus_amount')->where('is_active', 1)->first();
|
||||
|
||||
Reference in New Issue
Block a user