|
|
@ -82,39 +82,39 @@ class OrderOnlineController extends BaseController |
|
|
$shopcartIds = $this->request->input('shopcart_ids'); |
|
|
$shopcartIds = $this->request->input('shopcart_ids'); |
|
|
|
|
|
|
|
|
//判断用户有没有绑定手机
|
|
|
//判断用户有没有绑定手机
|
|
|
$telExists = $this->userBindTelService->check($userId); |
|
|
|
|
|
if(!$telExists){ |
|
|
|
|
|
throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR); |
|
|
|
|
|
} |
|
|
|
|
|
//获取用户收货地址
|
|
|
|
|
|
$address = UserAddress::query()->where('user_id',$userId) |
|
|
|
|
|
->orderByDesc('is_default') |
|
|
|
|
|
->orderByDesc('updated_at') |
|
|
|
|
|
->first(); |
|
|
|
|
|
$res['location'] = [ |
|
|
|
|
|
'address' => $address, |
|
|
|
|
|
'distribution_price' => 0 |
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
// $telExists = $this->userBindTelService->check($userId);
|
|
|
|
|
|
// if(!$telExists){
|
|
|
|
|
|
// throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// //获取用户收货地址
|
|
|
|
|
|
// $address = UserAddress::query()->where('user_id',$userId)
|
|
|
|
|
|
// ->orderByDesc('is_default')
|
|
|
|
|
|
// ->orderByDesc('updated_at')
|
|
|
|
|
|
// ->first();
|
|
|
|
|
|
// $res['location'] = [
|
|
|
|
|
|
// 'address' => $address,
|
|
|
|
|
|
// 'distribution_price' => 0
|
|
|
|
|
|
// ];
|
|
|
//返回预约送达时间 数组
|
|
|
//返回预约送达时间 数组
|
|
|
$res['appointment_time'] = $this->appointmentTimeService->do(); |
|
|
|
|
|
|
|
|
$res['appointment_time'] = $this->appointmentTimeService->get($shopcartIds); |
|
|
//
|
|
|
//
|
|
|
$res['store_list'] = $this->shopCartService->getGoodsByShopcartId($shopcartIds); |
|
|
|
|
|
//获取用户优惠券
|
|
|
|
|
|
$res['coupon'] = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId); |
|
|
|
|
|
//增值服务接口
|
|
|
|
|
|
$res['value_added_service'] = [ |
|
|
|
|
|
'text' => '买鸡买鸭,免费帮杀;买瓜买黇,包熟包甜', |
|
|
|
|
|
'select' => 1, |
|
|
|
|
|
'price' => 3.50 |
|
|
|
|
|
]; |
|
|
|
|
|
$total = 0; |
|
|
|
|
|
foreach ($res['store_list'] as $store) |
|
|
|
|
|
{ |
|
|
|
|
|
$total = bcadd($total,$store['subtotal'],2); |
|
|
|
|
|
} |
|
|
|
|
|
$total = bcadd($total,$res['value_added_service']['price'],2); |
|
|
|
|
|
$total = bcadd($total,$res['location']['distribution_price'],2); |
|
|
|
|
|
$res['total'] = $total; |
|
|
|
|
|
|
|
|
// $res['store_list'] = $this->shopCartService->getGoodsByShopcartId($shopcartIds);
|
|
|
|
|
|
// //获取用户优惠券
|
|
|
|
|
|
// $res['coupon'] = $this->couponRecService->allForOnlineOrderAvailable($userId, $marketId);
|
|
|
|
|
|
// //增值服务接口
|
|
|
|
|
|
// $res['value_added_service'] = [
|
|
|
|
|
|
// 'text' => '买鸡买鸭,免费帮杀;买瓜买黇,包熟包甜',
|
|
|
|
|
|
// 'select' => 1,
|
|
|
|
|
|
// 'price' => 3.50
|
|
|
|
|
|
// ];
|
|
|
|
|
|
// $total = 0;
|
|
|
|
|
|
// foreach ($res['store_list'] as $store)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// $total = bcadd($total,$store['subtotal'],2);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// $total = bcadd($total,$res['value_added_service']['price'],2);
|
|
|
|
|
|
// $total = bcadd($total,$res['location']['distribution_price'],2);
|
|
|
|
|
|
// $res['total'] = $total;
|
|
|
return $this->success($res); |
|
|
return $this->success($res); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|