Pārlūkot izejas kodu

花束不包邮处理

shizhongqi 7 mēneši atpakaļ
vecāks
revīzija
1d2df6f550

+ 7 - 7
app-mall/controllers/OrderController.php

@@ -528,14 +528,10 @@ class OrderController extends BaseController
             $sendDistance = 0;
             $sendCost = 0;
 
-            if ($sendType == dict::getDict('sendType', 'thirdSend')) {
-
-                $mapSet = ShopClass::hasIntraCity($shop);
-                $openIntraCity = $mapSet['openIntraCity'] ?? 0;
-                if ($openIntraCity == 2) {
-                    util::fail('不能使用跑腿');
-                }
+            $mapSet = ShopClass::hasIntraCity($shop);
+            $openIntraCity = $mapSet['openIntraCity'] ?? 0;
 
+            if ($sendType == dict::getDict('sendType', 'thirdSend') && $openIntraCity == 1) {
                 // if (dict::getDict('hasMap') == 0) {
                 //     util::fail('不能使用跑腿,请选其它方式');
                 // }
@@ -636,6 +632,9 @@ class OrderController extends BaseController
 
                 // 使用 DeliveryQuoteUtil 获取配送报价
                 try {
+                    if($goodsInfo->weight > 5){
+                        $goodsInfo->weight = 5;
+                    }
                     $quoteResult = DeliveryQuoteUtil::getDeliveryQuote([
                         'productList' => [['bigNum' => $goodsNum, 'weight' => $goodsInfo->weight]],
                         'deliveryPlatform' => $post['deliveryPlatform'],
@@ -647,6 +646,7 @@ class OrderController extends BaseController
                             'goodsType' => 0, //商品类型:0花束 1花材
                             'itemTotalAmount' => $post['itemTotalAmount'] ?? 0,
                             'remark' => $post['remark'] ?? '',
+                            'freightType' => $goodsInfo->freightType,
                         ],
                         'mainId' => $this->mainId,
                         'productCount' => $goodsNum,

+ 23 - 13
common/components/delivery/util/DeliveryQuoteUtil.php

@@ -110,16 +110,20 @@ class DeliveryQuoteUtil
         $sendDistance = $result['distance'] ?? 0;
 
         // 11. 应用免费配送规则
-        $finalSendCost = self::applyFreeDeliveryRules(
-            $sendCost,
-            $sendDistance,
-            $params['ghsInfo']['shopId'],
-            $params['productCount'] ?? 0,
-            $params['order']['itemTotalAmount'] ?? 0,
-            $params['ghsInfo']['mainId'],
-            $order['orderSn'],
-            $order['goodsType']
-        );
+        if(isset($order['freightType']) && $order['freightType'] == 0) {
+            $finalSendCost= $sendCost;
+        }else{
+            $finalSendCost = self::applyFreeDeliveryRules(
+                $sendCost,
+                $sendDistance,
+                $params['ghsInfo']['shopId'],
+                $params['productCount'] ?? 0,
+                $params['order']['itemTotalAmount'] ?? 0,
+                $params['ghsInfo']['mainId'],
+                $order['orderSn'],
+                $order['goodsType']
+            );
+        }
 
         return [
             'sendCost' => $finalSendCost,
@@ -162,7 +166,7 @@ class DeliveryQuoteUtil
         $custom = $params['custom'];
         $orderInfo = $params['order'];
 
-        return [
+        $order = [
             'orderSn' => $orderInfo['orderSn'],
             'customName' => $custom->name,
             'customMobile' => $custom->mobile,
@@ -177,7 +181,14 @@ class DeliveryQuoteUtil
             'remark' => $orderInfo['remark'] ?? '',
             'prePrice' => $orderInfo['itemTotalAmount'] ?? 0,
             'actPrice' => $orderInfo['itemTotalAmount'] ?? 0,
+            'goodsType' => $orderInfo['goodsType'],
         ];
+
+        if(isset($orderInfo['freightType'])){
+            $order['freightType'] = $orderInfo['freightType'];
+        }
+
+        return $order;
     }
 
     /**
@@ -202,8 +213,7 @@ class DeliveryQuoteUtil
         $ghsMainId,
         $orderSn,
         $goodsType
-    )
-    {
+    ){
         // 获取店铺扩展信息(免费配送设置)
         $shopExt = ShopExtClass::getByCondition(['shopId' => $shopId], false, null, 'id,hcFreeKm,hcMap,hsFreeKm,hsAddFee');
         if (empty($shopExt)) {