|
|
@@ -371,6 +371,15 @@ class PurchaseController extends BaseController
|
|
|
public function actionFreight()
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
+
|
|
|
+ $shop = $this->shop;
|
|
|
+ $shopLat = isset($shop->lat) ? $shop->lat : '';
|
|
|
+ $shopLong = isset($shop->long) ? $shop->long : '';
|
|
|
+
|
|
|
+ if (empty($shopLat) || empty($shopLong)) {
|
|
|
+ util::fail('请完善门店地址');
|
|
|
+ }
|
|
|
+
|
|
|
$ghsId = $get['ghsId'] ?? 0;
|
|
|
$ghs = GhsClass::getById($ghsId, true);
|
|
|
if (empty($ghs)) {
|
|
|
@@ -381,6 +390,13 @@ class PurchaseController extends BaseController
|
|
|
if (empty($ghsShop)) {
|
|
|
util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|
|
|
}
|
|
|
+
|
|
|
+ $ghsShopLat = isset($ghsShop->lat) ? $ghsShop->lat : '';
|
|
|
+ $ghsShopLong = isset($ghsShop->long) ? $ghsShop->long : '';
|
|
|
+ if (empty($ghsShopLat) || empty($ghsShopLong)) {
|
|
|
+ util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|
|
|
+ }
|
|
|
+
|
|
|
$weight = $get['weight'] ?? 0;
|
|
|
if (empty($weight)) {
|
|
|
util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);
|