|
|
@@ -5,6 +5,7 @@ namespace mall\controllers;
|
|
|
use biz\goods\services\CategoryService;
|
|
|
use biz\goods\services\GoodsCategoryService;
|
|
|
use biz\goods\services\GoodsService;
|
|
|
+use biz\merchant\services\ExpressService;
|
|
|
use biz\merchant\services\MerchantExtendService;
|
|
|
use biz\merchant\services\MerchantService;
|
|
|
use biz\merchant\services\ShopService;
|
|
|
@@ -47,7 +48,7 @@ class OrderController extends BaseController
|
|
|
}
|
|
|
//确认是否要配送的商品
|
|
|
$needSend = isset($goodsInfo['needSend']) && $goodsInfo['needSend'] == 1 ? 1 : 0;
|
|
|
-
|
|
|
+
|
|
|
$post['userId'] = $this->userId;
|
|
|
$user = $this->user;
|
|
|
$post['bookName'] = isset($user['userName']) ? $user['userName'] : '';
|
|
|
@@ -61,20 +62,20 @@ class OrderController extends BaseController
|
|
|
util::fail('没有找到门店');
|
|
|
}
|
|
|
$shopInfo = ShopService::getById($defaultShopId);
|
|
|
-
|
|
|
+
|
|
|
//计算运费
|
|
|
$post['sendDistance'] = isset($post['sendDistance']) ? $post['sendDistance'] : 0;
|
|
|
$sendCost = 0;
|
|
|
if ($needSend == 1) {
|
|
|
$lat = $post['receiveLat'];//收货人纬度
|
|
|
$lng = $post['receiveLong'];//收货人经度
|
|
|
- $jsStatDistance = $post['sendDistance'];
|
|
|
- $sendCost = ShopService::getSendCost($lat, $lng, $jsStatDistance, $shopInfo);
|
|
|
+ $respond = ExpressService::getUserDistance($lng, $lat, $defaultShopId, $this->merchantExtend);
|
|
|
+ $sendCost = isset($respond['fee']) ? $respond['fee'] : 0;
|
|
|
}
|
|
|
$post['sendCost'] = $sendCost;
|
|
|
$post['merchantId'] = $this->merchantId;
|
|
|
$post['shopId'] = $defaultShopId;
|
|
|
-
|
|
|
+
|
|
|
//计算总金额
|
|
|
$unitPrice = $goodsInfo['price'];
|
|
|
$goodsStyleList = isset($goodsInfo['goodsStyleList']) ? $goodsInfo['goodsStyleList'] : [];
|
|
|
@@ -104,7 +105,7 @@ class OrderController extends BaseController
|
|
|
$actPrice = $discountData['price'];
|
|
|
$post['discountType'] = $discountData['discountType'];
|
|
|
$post['discountAmount'] = $discountData['discountAmount'];
|
|
|
-
|
|
|
+
|
|
|
$now = time();
|
|
|
$expireTime = $now + 1800;//订单30分钟后过期
|
|
|
$post['deadline'] = $expireTime;
|