|
|
@@ -4,6 +4,7 @@ namespace hd\controllers;
|
|
|
|
|
|
use biz\admin\classes\AdminClass;
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
+use biz\shop\classes\ShopExpressClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\custom\services\CustomService;
|
|
|
use bizGhs\express\services\DadaExpressServices;
|
|
|
@@ -14,6 +15,7 @@ use bizHd\purchase\services\PurchaseService;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use bizHd\wx\classes\WxOpenClass;
|
|
|
use common\components\dict;
|
|
|
+use common\components\freight;
|
|
|
use common\components\httpUtil;
|
|
|
use Yii;
|
|
|
use common\components\util;
|
|
|
@@ -251,9 +253,11 @@ class PurchaseController extends BaseController
|
|
|
public function actionFreight()
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $ghsId = $post['ghsId'] ?? 0;
|
|
|
+ //$ghsId = $post['ghsId'] ?? 0;
|
|
|
+ $ghsId = 31;
|
|
|
//供货商
|
|
|
$ghsInfo = GhsClass::getById($ghsId);
|
|
|
+
|
|
|
if (empty($ghsInfo)) {
|
|
|
util::fail('没有找到供货商');
|
|
|
}
|
|
|
@@ -311,6 +315,14 @@ class PurchaseController extends BaseController
|
|
|
if (empty($customInfo)) {
|
|
|
util::fail('没有找到客户');
|
|
|
}
|
|
|
+
|
|
|
+ //判断商家是否开启达达,若未开启,则使用自定义运费计算
|
|
|
+ $shopNo = ShopExpressClass::getShopNo($ghsSjId,$ghsShopId);
|
|
|
+ if(!$shopNo){
|
|
|
+ //使用自定义运费
|
|
|
+ $cost = freight::getCost($ghsInfo['lat'],$ghsInfo['long'],$customInfo['lat'],$customInfo['long'],$weight);
|
|
|
+ util::success(['sedCost' => $cost]);
|
|
|
+ }
|
|
|
//组装订单信息
|
|
|
$info = [];
|
|
|
//发送放的商家信息,即供货商的相关信息
|
|
|
@@ -336,7 +348,6 @@ class PurchaseController extends BaseController
|
|
|
$res = DadaExpressServices::queryDeliverFee($info);
|
|
|
util::success(['sedCost' => $res['fee']]);
|
|
|
|
|
|
- util::success(['sedCost' => 10]);
|
|
|
}
|
|
|
|
|
|
}
|