feat: 预约上门时间
This commit is contained in:
parent
e986fc8dbd
commit
e25a2c29ea
|
|
@ -166,6 +166,11 @@ class OrderDispatchService extends BaseService
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 派单详情
|
||||||
|
* @param int $workerId 师傅id
|
||||||
|
* @param int $orderDispatchId 派单id
|
||||||
|
*/
|
||||||
public function dispatchInfo(int $workerId, int $orderDispatchId)
|
public function dispatchInfo(int $workerId, int $orderDispatchId)
|
||||||
{
|
{
|
||||||
$res = $this->getOrderDispatchModel()
|
$res = $this->getOrderDispatchModel()
|
||||||
|
|
@ -176,7 +181,7 @@ class OrderDispatchService extends BaseService
|
||||||
}])
|
}])
|
||||||
->where('id', $orderDispatchId)
|
->where('id', $orderDispatchId)
|
||||||
->where('worker_id', $workerId)
|
->where('worker_id', $workerId)
|
||||||
->field(['id', 'order_id', 'status', 'remark', 'create_time', 'total', 'online_total', 'is_receipt'])
|
->field(['id', 'order_id', 'status', 'remark', 'create_time', 'total', 'online_total', 'is_receipt', 'plan_time'])
|
||||||
->find();
|
->find();
|
||||||
if (!$res) {
|
if (!$res) {
|
||||||
$this->apiError('订单不存在');
|
$this->apiError('订单不存在');
|
||||||
|
|
@ -184,6 +189,36 @@ class OrderDispatchService extends BaseService
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交预约上门时间
|
||||||
|
* @param int $workerId 师傅id
|
||||||
|
* @param int $orderDispatchId 派单id
|
||||||
|
* @param string $planTime 预约时间
|
||||||
|
* @return true
|
||||||
|
*/
|
||||||
|
public function appointmentTime(int $workerId, int $orderDispatchId, string $planTime)
|
||||||
|
{
|
||||||
|
$orderDispatch = $this->getOrderDispatchModel()
|
||||||
|
->where('id', $orderDispatchId)
|
||||||
|
->where('worker_id', $workerId)
|
||||||
|
->find();
|
||||||
|
if (!$orderDispatch) {
|
||||||
|
$this->apiError('订单不存在');
|
||||||
|
}
|
||||||
|
|
||||||
|
$orderDispatch->status = OrderDispatch::STATUS_PLANIT;
|
||||||
|
$orderDispatch->plan_time = $planTime;
|
||||||
|
$orderDispatch->save();
|
||||||
|
|
||||||
|
$orderDispatchChangeParams = [
|
||||||
|
'dispatch' => $orderDispatch,
|
||||||
|
'remark' => '师傅已和客户预约,预约时间:' . $planTime,
|
||||||
|
];
|
||||||
|
Hook::listen('order_dispatch_change', $orderDispatchChangeParams);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class OrderDispatch extends WorkerApi
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单详情
|
* 派单详情
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function info()
|
public function info()
|
||||||
|
|
@ -76,4 +76,31 @@ class OrderDispatch extends WorkerApi
|
||||||
$res = $this->getOrderDispatchService()->orderConfirm($this->user['id'], $params['order_dispatch_id'], $params['type']);
|
$res = $this->getOrderDispatchService()->orderConfirm($this->user['id'], $params['order_dispatch_id'], $params['type']);
|
||||||
$this->success('操作成功', $res);
|
$this->success('操作成功', $res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交预约上门时间
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function appointmentTime()
|
||||||
|
{
|
||||||
|
$params = $this->request->request();
|
||||||
|
$validate = $this->validate($params, \app\worker\validate\OrderDispatch::class . '.appointmentTime');
|
||||||
|
if ($validate !== true) {
|
||||||
|
$this->error($validate);
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $this->getOrderDispatchService()->appointmentTime($this->user['id'], $params['order_dispatch_id'], $params['plan_time']);
|
||||||
|
$this->success('操作成功', $res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class OrderDispatch extends Validate
|
||||||
'type|确认类型' => 'require|in:accept,reject',
|
'type|确认类型' => 'require|in:accept,reject',
|
||||||
'order_dispatch_id|订单派单id' => 'require|number',
|
'order_dispatch_id|订单派单id' => 'require|number',
|
||||||
'workbench_type|工作台类型' => 'require|in:ongoing,today,tomorrow,all',
|
'workbench_type|工作台类型' => 'require|in:ongoing,today,tomorrow,all',
|
||||||
|
'plan_time|预约时间' => 'require|date',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $message = [
|
protected $message = [
|
||||||
|
|
@ -20,5 +21,6 @@ class OrderDispatch extends Validate
|
||||||
'orderConfirm' => ['type', 'order_dispatch_id'],
|
'orderConfirm' => ['type', 'order_dispatch_id'],
|
||||||
'workbenchOrderList' => ['workbench_type'],
|
'workbenchOrderList' => ['workbench_type'],
|
||||||
'info' => ['order_dispatch_id'],
|
'info' => ['order_dispatch_id'],
|
||||||
|
'appointmentTime' => ['order_dispatch_id', 'plan_time'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user