|
|
@@ -256,12 +256,15 @@ class PurchaseController extends BaseController
|
|
|
if (isset($ghsShopInfo->pfLevel) && $ghsShopInfo->pfLevel == 1) {
|
|
|
//昆明发货包装费和运费的计算
|
|
|
$totalWeight = 0;
|
|
|
+ $totalItemNum = 0;
|
|
|
foreach ($productList as $itemData) {
|
|
|
$bigNum = $itemData['bigNum'] ?? 0;
|
|
|
$thisWeight = $itemData['weight'] ?? 0;
|
|
|
$currentWeight = bcmul($thisWeight, $bigNum, 2);
|
|
|
$totalWeight = bcadd($currentWeight, $totalWeight, 2);
|
|
|
+ $totalItemNum = bcadd($totalItemNum, $bigNum, 2);
|
|
|
}
|
|
|
+ $totalItemNum = floatval($totalItemNum);
|
|
|
$kmPackCost = dict::getDict('kmPackCost');
|
|
|
$packCost = 0;
|
|
|
if (!empty($kmPackCost)) {
|
|
|
@@ -282,18 +285,30 @@ class PurchaseController extends BaseController
|
|
|
$sign = $trans['sign'] ?? 0;
|
|
|
if ($sign == $transType) {
|
|
|
if ($sign == 2) {
|
|
|
+ //冷链物流
|
|
|
$llOption = $trans['option'] ?? [];
|
|
|
if (!empty($llOption)) {
|
|
|
- foreach ($llOption as $llOp) {
|
|
|
- $llNum = $llOp['num'] ?? 0;
|
|
|
- if ($llNum >= $totalWeight) {
|
|
|
- $sendCost = $llOp['amount'] ?? 0;
|
|
|
- $sendCost = round($sendCost, 2);
|
|
|
+ $largeInfo = end($llOption);
|
|
|
+ $largeNum = $largeInfo['num'] ?? 0;
|
|
|
+ $largeAmount = $largeInfo['amount'] ?? 0;
|
|
|
+ $bs = intval($totalItemNum / $largeNum);
|
|
|
+ if ($bs > 0) {
|
|
|
+ $addSendCost = bcmul($bs, $largeAmount, 2);
|
|
|
+ $sendCost = bcadd($sendCost, $addSendCost, 2);
|
|
|
+ $subNum = bcmul($bs, $largeNum, 2);
|
|
|
+ $subNum = floatval($subNum);
|
|
|
+ $totalItemNum = bcsub($totalItemNum, $subNum, 2);
|
|
|
+ $totalItemNum = floatval($totalItemNum);
|
|
|
+ }
|
|
|
+ foreach ($llOption as $miniItem) {
|
|
|
+ if ($miniItem['num'] >= $totalItemNum) {
|
|
|
+ $sendCost = bcadd($sendCost, $miniItem['amount'], 2);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
+ //其它物流
|
|
|
$perKiloCost = $trans['perKiloCost'] ?? 0;
|
|
|
$sendCost = bcmul($perKiloCost, $totalWeight, 3);
|
|
|
$sendCost = round($sendCost, 2);
|