feat: 新增派单详情接口

This commit is contained in:
苟川东 2025-04-13 23:04:55 +08:00
parent b06ae1a1ae
commit 293b737246
3 changed files with 36 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -19,5 +19,6 @@ class OrderDispatch extends Validate
protected $scene = [
'orderConfirm' => ['type', 'order_dispatch_id'],
'workbenchOrderList' => ['workbench_type'],
'info' => ['order_dispatch_id'],
];
}