diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index 4374bdf..0ffe136 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -165,6 +165,25 @@ class OrderDispatchService extends BaseService return true; } + + public function dispatchInfo(int $workerId, int $orderDispatchId) + { + $res = $this->getOrderDispatchModel() + ->with(['orderInfo' => function ($query) { + $query->with(['area' => function ($query) { + $query->field('id,area_code,merge_name'); + }])->field('id,order_no,item_id,item_title,receive_type,address,lng,lat,plan_time,online_amount,discount_amount,area_id,customer,tel'); + }]) + ->where('id', $orderDispatchId) + ->where('worker_id', $workerId) + ->field(['id', 'order_id', 'status', 'remark', 'create_time']) + ->find(); + if (!$res) { + $this->apiError('订单不存在'); + } + + return $res; + } } diff --git a/application/worker/controller/OrderDispatch.php b/application/worker/controller/OrderDispatch.php index aca2ede..0a560c6 100644 --- a/application/worker/controller/OrderDispatch.php +++ b/application/worker/controller/OrderDispatch.php @@ -18,6 +18,22 @@ class OrderDispatch extends WorkerApi $this->success('获取成功', $res); } + /** + * 订单详情 + * @return void + */ + public function info() + { + $params = $this->request->request(); + $validate = $this->validate($params, \app\worker\validate\OrderDispatch::class . '.info'); + if ($validate !== true) { + $this->error($validate); + } + + $res = $this->getOrderDispatchService()->dispatchInfo($this->user['id'], $this->request->request('order_dispatch_id')); + $this->success('获取成功', $res); + } + /** * 工作台订单列表 * @return void diff --git a/application/worker/validate/OrderDispatch.php b/application/worker/validate/OrderDispatch.php index 0f2efe1..c0b875a 100644 --- a/application/worker/validate/OrderDispatch.php +++ b/application/worker/validate/OrderDispatch.php @@ -19,5 +19,6 @@ class OrderDispatch extends Validate protected $scene = [ 'orderConfirm' => ['type', 'order_dispatch_id'], 'workbenchOrderList' => ['workbench_type'], + 'info' => ['order_dispatch_id'], ]; }