cqp 2 minggu lalu
induk
melakukan
cb4f1207ad
1 mengubah file dengan 35 tambahan dan 22 penghapusan
  1. 35 22
      app/Service/TPlusServerService.php

+ 35 - 22
app/Service/TPlusServerService.php

@@ -1247,33 +1247,46 @@ class TPlusServerService extends Service
                         $min_freight = $tmp['min_freight_fee'];
                     }
                     $dataArray[$key]['freight_unit_price'] = $freight;
-                    //配送费金额
-                    $freight_amount = bcmul($weight, $freight,4);
-                    $dataArray[$key]['freight_amount'] = $freight_amount;
-                    //结算金额 记录的是每一条的
-                    $dataArray[$key]['js_single_amount'] = $freight_amount;
                     //地区最低运价
                     $dataArray[$key]['min_freight_amount'] = $min_freight;
-                    //门店卸货费
-                    $customer_store_price = 0;
-                    if(! empty($value['customer_store_price']) && is_numeric($value['customer_store_price']) && $value['customer_store_price'] > 0){
-                        $customer_store_price = bcmul($value['customer_store_price'], $xs,4);
+
+                    //纯自提不计算-------------------------------------------------------
+                    if($value['delivery_mode'] == FreightFee::deliveryModeNormal){
+                        //配送费金额
+                        $dataArray[$key]['freight_amount'] = 0;
+                        //结算金额 记录的是每一条的
+                        $dataArray[$key]['js_single_amount'] = 0;
+                        //门店卸货费
+                        $dataArray[$key]['customer_store_zx_fee'] = 0;
+                        //到货装卸费
+                        $dataArray[$key]['dh_fee'] = 0;
                     }else{
-                        if(! empty($value['product_store_price']) && is_numeric($value['product_store_price']) && $value['product_store_price'] > 0){
-                            $customer_store_price = bcmul($value['product_store_price'], $xs,4);
+                        //配送费金额
+                        $freight_amount = bcmul($weight, $freight,4);
+                        $dataArray[$key]['freight_amount'] = $freight_amount;
+                        //结算金额 记录的是每一条的
+                        $dataArray[$key]['js_single_amount'] = $freight_amount;
+                        //门店卸货费
+                        $customer_store_price = 0;
+                        if(! empty($value['customer_store_price']) && is_numeric($value['customer_store_price']) && $value['customer_store_price'] > 0){
+                            $customer_store_price = bcmul($value['customer_store_price'], $xs,4);
+                        }else{
+                            if(! empty($value['product_store_price']) && is_numeric($value['product_store_price']) && $value['product_store_price'] > 0){
+                                $customer_store_price = bcmul($value['product_store_price'], $xs,4);
+                            }
                         }
+                        $dataArray[$key]['customer_store_zx_fee'] = $customer_store_price;
+                        //到货装卸费
+                        $product_store_price2 = 0;
+                        if(! empty($value['product_store_price2']) && is_numeric($value['product_store_price2']))  $product_store_price2 = $value['product_store_price2'];
+                        if(! empty($value['product_category']) && $value['product_category'] == "礼盒"){
+                            $dh_fee = bcmul($xs, $product_store_price2,4);
+                        }else{
+                            $dh_fee = bcmul($weight, $product_store_price2,4);
+                        }
+                        if($value['business_type_id'] == FreightFee::businessTypeReturn) $dh_fee = bcmul($dh_fee,2,4);
+                        $dataArray[$key]['dh_fee'] = $dh_fee;
                     }
-                    $dataArray[$key]['customer_store_zx_fee'] = $customer_store_price;
-                    //到货装卸费
-                    $product_store_price2 = 0;
-                    if(! empty($value['product_store_price2']) && is_numeric($value['product_store_price2']))  $product_store_price2 = $value['product_store_price2'];
-                    if(! empty($value['product_category']) && $value['product_category'] == "礼盒"){
-                        $dh_fee = bcmul($xs, $product_store_price2,4);
-                    }else{
-                        $dh_fee = bcmul($weight, $product_store_price2,4);
-                    }
-                    if($value['business_type_id'] == FreightFee::businessTypeReturn) $dh_fee = bcmul($dh_fee,2,4);
-                    $dataArray[$key]['dh_fee'] = $dh_fee;
                 }
 
                 DB::table($table)->insert($dataArray);