|
|
|
@ -133,18 +133,21 @@ class OrderOnlineService implements OrderOnlineServiceInterface |
|
|
|
|
|
|
|
$currentTime = time(); |
|
|
|
bcscale(6); |
|
|
|
// 用户收货地址
|
|
|
|
// 获取配送费用
|
|
|
|
$userAddrAndDPrice = $this->userAddressService->getAddressAndDistributionPrice($userAddrId, $marketId); |
|
|
|
$userAddr = $userAddrAndDPrice['address']['address']; |
|
|
|
$deliveryAmount = $userAddrAndDPrice['distribution_price']; |
|
|
|
$deliveryDistance = $userAddrAndDPrice['delivery_distance']; |
|
|
|
|
|
|
|
// 配送方式,默认是服务站配送
|
|
|
|
$shippingType = Shipping::TYPE_LANZU; |
|
|
|
|
|
|
|
if ($selfTake == 1) { |
|
|
|
$shippingType = Shipping::TYPE_SELF_TAKE; |
|
|
|
|
|
|
|
$userAddr = (object)[]; |
|
|
|
$deliveryAmount = 0; |
|
|
|
$deliveryDistance = 0; |
|
|
|
$shippingType = Shipping::TYPE_SELF_TAKE; |
|
|
|
|
|
|
|
// 如果非自提,则通过用户地址计算相关数据和费用
|
|
|
|
if ($selfTake != 1) { |
|
|
|
// 用户收货地址
|
|
|
|
// 获取配送费用
|
|
|
|
$userAddrAndDPrice = $this->userAddressService->getAddressAndDistributionPrice($userAddrId, $marketId); |
|
|
|
$userAddr = $userAddrAndDPrice['address']['address']; |
|
|
|
$deliveryAmount = $userAddrAndDPrice['distribution_price']; |
|
|
|
$deliveryDistance = $userAddrAndDPrice['delivery_distance']; |
|
|
|
$shippingType = Shipping::TYPE_LANZU; |
|
|
|
} |
|
|
|
|
|
|
|
// 优惠券数据,当前订单可用个优惠券
|
|
|
|
@ -190,7 +193,6 @@ class OrderOnlineService implements OrderOnlineServiceInterface |
|
|
|
$cartIds = explode(',', $storeItem->cart_ids); |
|
|
|
$carts = ShoppingCart::query()->whereIn('id', $cartIds)->where(['market_id' => $marketId, 'user_id' => $userId])->get(); |
|
|
|
foreach ($carts as $k => &$cart) { |
|
|
|
|
|
|
|
// 查个商品,做商品有效的判断检查
|
|
|
|
$goods = []; |
|
|
|
if ($cart->activity_type == 1) { |
|
|
|
@ -322,11 +324,11 @@ class OrderOnlineService implements OrderOnlineServiceInterface |
|
|
|
'delivery_money' => $deliveryAmount, |
|
|
|
'delivery_distance' => $deliveryDistance, |
|
|
|
'state' => OrderState::UNPAID, |
|
|
|
'tel' => $userAddr->tel, |
|
|
|
'address' => $userAddr->address.$userAddr->doorplate, |
|
|
|
'lat' => $userAddr->lat, |
|
|
|
'lng' => $userAddr->lng, |
|
|
|
'name' => $userAddr->user_name, |
|
|
|
'tel' => $userAddr->tel ?? '', |
|
|
|
'address' => ($userAddr->address ?? '').($userAddr->doorplate ?? ''), |
|
|
|
'lat' => $userAddr->lat ?? '', |
|
|
|
'lng' => $userAddr->lng ?? '', |
|
|
|
'name' => $userAddr->user_name ?? '', |
|
|
|
'plat' => $plat, |
|
|
|
'delivery_time_note' => $deliveryTimeNote |
|
|
|
]; |
|
|
|
|