diff --git a/beike/Shop/Http/Controllers/ProductController.php b/beike/Shop/Http/Controllers/ProductController.php index 34ac928b..7f93c076 100644 --- a/beike/Shop/Http/Controllers/ProductController.php +++ b/beike/Shop/Http/Controllers/ProductController.php @@ -200,11 +200,17 @@ class ProductController extends Controller $totals = $this->computeOrderMoney($request); $shipping = array_column($totals['data'],null,'code')['shipping'] ?? []; // $logisticsItem['shipping_fee'] = $shipping['show_tips'] == 0 ? $shipping['amount_format'] : trans('shop/carts.to_be_negotiated'); - if($shipping['show_tips'] == 0) $logisticsItem['shipping_fee'] = $shipping['amount_format']; - else $logisticsItem = []; + if($shipping['show_tips'] == 0) { + $logisticsItem['shipping_fee'] = $shipping['amount_format']; + $logisticsItem['amount'] = $shipping['amount']; + }else $logisticsItem = []; } } - + // 存在多个物流 根据物流费用进行排序 + if(count($data['list']) > 1){ + $amounts = array_column($data['list'],'amount'); + if($amounts) array_multisort($amounts,SORT_ASC,$data['list']); + } $data['list'] = array_filter($data['list']); return json_success(trans('common.success'),$data); diff --git a/beike/Shop/Services/TotalServices/ShippingService.php b/beike/Shop/Services/TotalServices/ShippingService.php index 1dfd6ba9..00c5b42c 100644 --- a/beike/Shop/Services/TotalServices/ShippingService.php +++ b/beike/Shop/Services/TotalServices/ShippingService.php @@ -198,6 +198,7 @@ class ShippingService{ foreach(self::$productsList as $productInfo){ // 计算体积重 并且取数值大的作为重量计算 $volumeWeight = $productInfo['volume_weight'] / $logisticsInfo['throwing_ratio']; + $volumeWeight = (float)sprintf("%.2f",Weight::convert($volumeWeight,$productInfo['weight_class'])); $sumWeight = $productInfo['sum_weight'] > $volumeWeight ? $productInfo['sum_weight'] : $volumeWeight; // 首重运费 $amount += (float)sprintf("%.2f",$firstWeightFee); diff --git a/themes/default/product/product.blade.php b/themes/default/product/product.blade.php index 26fd2620..27dc432c 100644 --- a/themes/default/product/product.blade.php +++ b/themes/default/product/product.blade.php @@ -233,10 +233,10 @@