mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
按照重量和体积计算运费问题修复
This commit is contained in:
parent
23c96d9453
commit
6a785ae7cb
@ -482,25 +482,27 @@ class StoreOrderComputedServices extends BaseServices
|
||||
$tempNumber = $temp_num[$tempId]['number'] ?? 0;
|
||||
if (!$tempId || !$tempPostage || !$tempNumber) continue;
|
||||
$type = $temp_num[$tempId]['type'];
|
||||
$cartNumber = $item['cart_num'];
|
||||
if ((($cartAlready[$tempId]['number'] ?? 0) + $cartNumber) >= $tempNumber) {
|
||||
|
||||
|
||||
if ($type == 1) {
|
||||
$num = $item['cart_num'];
|
||||
} elseif ($type == 2) {
|
||||
$num = $item['cart_num'] * $item['productInfo']['attrInfo']['weight'];
|
||||
} else {
|
||||
$num = $item['cart_num'] * $item['productInfo']['attrInfo']['volume'];
|
||||
}
|
||||
if ((($cartAlready[$tempId]['number'] ?? 0) + $num) >= $tempNumber) {
|
||||
$price = isset($cartAlready[$tempId]['price']) ? bcsub((string)$tempPostage, (string)$cartAlready[$tempId]['price'], 6) : $tempPostage;
|
||||
} else {
|
||||
$price = bcmul((string)$tempPostage, bcdiv((string)$cartNumber, (string)$tempNumber, 6), 6);
|
||||
$price = bcmul((string)$tempPostage, bcdiv((string)$num, (string)$tempNumber, 6), 6);
|
||||
}
|
||||
$cartAlready[$tempId]['number'] = bcadd((string)($cartNumber[$tempId]['number'] ?? 0), (string)$cartNumber, 4);
|
||||
$cartAlready[$tempId]['price'] = bcadd((string)($cartNumber[$tempId]['price'] ?? 0.00), (string)$price, 4);
|
||||
$cartAlready[$tempId]['number'] = bcadd((string)($cartAlready[$tempId]['number'] ?? 0), (string)$num, 4);
|
||||
$cartAlready[$tempId]['price'] = bcadd((string)($cartAlready[$tempId]['price'] ?? 0.00), (string)$price, 4);
|
||||
|
||||
if ($express_rule_number && $express_rule_number < 100) {
|
||||
$price = bcmul($price, $discountRate, 4);
|
||||
}
|
||||
if ($type == 2) {
|
||||
$price = bcmul($price, $item['productInfo']['attrInfo']['weight'], 6);
|
||||
} elseif ($type == 3) {
|
||||
$price = bcmul($price, $item['productInfo']['attrInfo']['volume'], 6);
|
||||
}
|
||||
$price = sprintf("%.2f", $price);
|
||||
$item['postage_price'] = $price;
|
||||
$item['postage_price'] = sprintf("%.2f", $price);
|
||||
}
|
||||
if ($express_rule_number && $express_rule_number < 100) {
|
||||
$storePostageDiscount = $storePostage;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user