shish před 5 roky
rodič
revize
f5d0a85838
1 změnil soubory, kde provedl 23 přidání a 21 odebrání
  1. 23 21
      app-hd/controllers/PurchaseController.php

+ 23 - 21
app-hd/controllers/PurchaseController.php

@@ -57,10 +57,12 @@ class PurchaseController extends BaseController
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
             $orderSn = $respond->orderSn ?? '';
             $actPrice = $respond->actPrice ?? '';
+            $realPrice = $respond->realPrice ?? '';
             $transaction->commit();
             $data = [
                 'orderSn' => $orderSn,
                 'actPrice' => $actPrice,
+                'realPrice' => $realPrice,
                 'hasBalancePay' => 1,
                 'hasPayPassword' => 0,
                 'hasDebtPay' => 1,
@@ -287,12 +289,12 @@ class PurchaseController extends BaseController
             //售卖价格
             $itemPrice = $productData[$productId]['price'] ?? 0;
             //合计价格
-            $price = bcadd($price,bcmul($itemNum, $itemPrice, 2),2);
+            $price = bcadd($price, bcmul($itemNum, $itemPrice, 2), 2);
         }
-        $ghsShopId = $ghsInfo['shopId']??0;
-        $ghsSjId = $ghsInfo['sjId']??0;
+        $ghsShopId = $ghsInfo['shopId'] ?? 0;
+        $ghsSjId = $ghsInfo['sjId'] ?? 0;
 
-        $sendTime = $post['sendTime']??'';
+        $sendTime = $post['sendTime'] ?? '';
         if (!empty($sendTime)) {
             //配送时间不为空
             // 预约发单时间(预约时间unix时间戳(10位),精确到分;整分钟为间隔,并且需要至少提前5分钟预约
@@ -304,8 +306,8 @@ class PurchaseController extends BaseController
                 util::fail('配送时间至少提前6分钟');
             }
             $sendTime = date('Y-m-d H:i', strtotime($sendTime));
-        }else{
-            $sendTime = date('Y-m-d H:i',strtotime("+30 minute"));
+        } else {
+            $sendTime = date('Y-m-d H:i', strtotime("+30 minute"));
         }
 
         //找供货商的客户信息,用里面的配送相关地址信息
@@ -316,32 +318,32 @@ class PurchaseController extends BaseController
         }
 
         //判断商家是否开启达达,若未开启,则使用自定义运费计算
-        $shopNo = ShopExpressClass::getShopNo($ghsSjId,$ghsShopId);
-        if(!$shopNo){
+        $shopNo = ShopExpressClass::getShopNo($ghsSjId, $ghsShopId);
+        if (!$shopNo) {
             //使用自定义运费
-            $cost = freight::getCost($ghsInfo['lat'],$ghsInfo['long'],$customInfo['lat'],$customInfo['long'],$weight);
+            $cost = freight::getCost($ghsInfo['lat'], $ghsInfo['long'], $customInfo['lat'], $customInfo['long'], $weight);
             util::success(['sedCost' => $cost]);
         }
         //组装订单信息
         $info = [];
         //发送放的商家信息,即供货商的相关信息
-        $info['sjId'] =$ghsSjId;
-        $info['shopId'] =$ghsShopId;
+        $info['sjId'] = $ghsSjId;
+        $info['shopId'] = $ghsShopId;
         $info['actPrice'] = $price;//价格
         $info['weight'] = $weight;
         $info['orderSn'] = \common\components\orderSn::getGhsOrderSn();
-        $info['bigNum'] =$bigNum;
+        $info['bigNum'] = $bigNum;
 
         //配送地址,当前零售端的门店地址
-        $info['customName'] = $customInfo['name']??'';
-        $info['customMobile'] = $customInfo['mobile']??'';
-        $info['province'] = $customInfo['province']??'';
-        $info['city'] = $customInfo['city']??'';;
-        $info['address'] = $customInfo['address']??'';;
-        $info['floor'] = $customInfo['floor']??'';;
-        $info['fullAddress'] = $customInfo['fullAddress']??'';;
-        $info['lat'] = $customInfo['lat']??'';;
-        $info['long'] = $customInfo['long']??'';;
+        $info['customName'] = $customInfo['name'] ?? '';
+        $info['customMobile'] = $customInfo['mobile'] ?? '';
+        $info['province'] = $customInfo['province'] ?? '';
+        $info['city'] = $customInfo['city'] ?? '';;
+        $info['address'] = $customInfo['address'] ?? '';;
+        $info['floor'] = $customInfo['floor'] ?? '';;
+        $info['fullAddress'] = $customInfo['fullAddress'] ?? '';;
+        $info['lat'] = $customInfo['lat'] ?? '';;
+        $info['long'] = $customInfo['long'] ?? '';;
         $info['sendTime'] = $sendTime;
 
         $res = DadaExpressServices::queryDeliverFee($info);