From 698f5166f48b6ab49d772d19372ed4fb37186f89 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Thu, 12 Oct 2023 14:35:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BD=93=E7=A7=AF?= =?UTF-8?q?=E9=87=8D=20=E9=87=8D=E9=87=8F=E5=8D=95=E4=BD=8D=E6=9C=AA?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E5=AF=BC=E8=87=B4=E8=BF=90=E8=B4=B9=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E9=94=99=E8=AF=AF=20=E6=B7=BB=E5=8A=A0=EF=BC=9A?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E7=89=A9=E6=B5=81=E6=97=B6=20=E6=8C=89?= =?UTF-8?q?=E7=85=A7=E7=89=A9=E6=B5=81=E8=B4=B9=E7=94=A8=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Shop/Http/Controllers/ProductController.php | 12 +++++++++--- .../Shop/Services/TotalServices/ShippingService.php | 1 + themes/default/product/product.blade.php | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) 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 @@