|
@@ -645,6 +645,7 @@ class PurchaseController extends BaseController
|
|
|
$perKmPrice = $shCurrentConfig['perKmPrice'] ?? 0;//超出起步,每公里加收金额
|
|
$perKmPrice = $shCurrentConfig['perKmPrice'] ?? 0;//超出起步,每公里加收金额
|
|
|
$changeRate = $shCurrentConfig['changeRate'] ?? 0;//负值时为降价百分比,正值时为涨价百分比
|
|
$changeRate = $shCurrentConfig['changeRate'] ?? 0;//负值时为降价百分比,正值时为涨价百分比
|
|
|
if ($startKm <= 0 || $startPrice <= 0 || $perKmPrice <= 0) {
|
|
if ($startKm <= 0 || $startPrice <= 0 || $perKmPrice <= 0) {
|
|
|
|
|
+ noticeUtil::push("算运费失败,请更换配送方式 startKm {$startKm} startPrice {$startPrice} perKmPrice {$perKmPrice}", '15280215347');
|
|
|
util::fail('算运费失败,请更换配送方式');
|
|
util::fail('算运费失败,请更换配送方式');
|
|
|
}
|
|
}
|
|
|
//计算客户到店的距离,骑电动车
|
|
//计算客户到店的距离,骑电动车
|
|
@@ -666,6 +667,20 @@ class PurchaseController extends BaseController
|
|
|
$sendCost = bcmul($sendCost, $rate, 2);
|
|
$sendCost = bcmul($sendCost, $rate, 2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 自定义计费也要套满减,否则确认页按规则免了 15 元、下单仍按起步价落库
|
|
|
|
|
+ $distanceMeters = floatval($distanceRespond['distance'] ?? 0);
|
|
|
|
|
+ if ($distanceMeters <= 0 && $sendDistance > 0) {
|
|
|
|
|
+ $distanceMeters = floatval(bcmul($sendDistance, 1000, 2));
|
|
|
|
|
+ }
|
|
|
|
|
+ $discountRespond = DeliveryQuoteUtil::applyReduceRules(
|
|
|
|
|
+ $shCurrentConfig,
|
|
|
|
|
+ $sendCost,
|
|
|
|
|
+ $distanceMeters,
|
|
|
|
|
+ $shMethodItemAmount,
|
|
|
|
|
+ $productCount
|
|
|
|
|
+ );
|
|
|
|
|
+ $sendCost = $discountRespond['sendCost'] ?? $sendCost;
|
|
|
|
|
+
|
|
|
$post['sendCost'] = bcadd($post['sendCost'] ?? 0, $sendCost, 2);
|
|
$post['sendCost'] = bcadd($post['sendCost'] ?? 0, $sendCost, 2);
|
|
|
$post['sendDistance'] = $sendDistance;
|
|
$post['sendDistance'] = $sendDistance;
|
|
|
|
|
|