|
|
|
|
@ -541,6 +541,7 @@ class OrdersController extends CommonController
|
|
|
|
|
* @OA\Parameter(name="from_date", in="query", @OA\Schema(type="string"), required=true, description="开始日期"),
|
|
|
|
|
* @OA\Parameter(name="to_date", in="query", @OA\Schema(type="string"), required=true, description="结束日期"),
|
|
|
|
|
* @OA\Parameter(name="price", in="query", @OA\Schema(type="number"), required=true, description="协商价格"),
|
|
|
|
|
* @OA\Parameter(name="available_day", in="query", @OA\Schema(type="number"), required=true, description="生效日期,仅当值为today表示同步更新当日子订单价格,为其他值表示次日起生效"),
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
* response="200",
|
|
|
|
|
* description="订单修改",
|
|
|
|
|
@ -562,7 +563,7 @@ class OrdersController extends CommonController
|
|
|
|
|
* property="order.*",
|
|
|
|
|
* type="array",
|
|
|
|
|
* description="订单实体"
|
|
|
|
|
* )
|
|
|
|
|
* ),
|
|
|
|
|
* @OA\Property(
|
|
|
|
|
* property="affected_orders",
|
|
|
|
|
* type="array",
|
|
|
|
|
@ -579,12 +580,6 @@ class OrdersController extends CommonController
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$order = Orders::with(["customer", "patient", "product", "productItem", "productParamedicLevel"])->find($id);
|
|
|
|
|
if ($order->isOngoing() && $order->paramedic_id != request()->paramedic_id) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "103",
|
|
|
|
|
"errormsg" => "修改订单不包含护工更改,更换护工请移步"
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$product_paramedic_level = request()->has("product_paramedic_level_id") ? (new ProductParamedicLevel())->find(request()->product_paramedic_level_id) : $order->productParamedicLevel;
|
|
|
|
|
$product_item = request()->has("product_item_id") ? (new ProductItems())->find(request()->product_item_id) : $order->productItem;
|
|
|
|
|
@ -597,7 +592,6 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$price += collect($factors)->sum("price");
|
|
|
|
|
|
|
|
|
|
if (request()->has("price") && request()->price < $price) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "102",
|
|
|
|
|
@ -615,8 +609,8 @@ class OrdersController extends CommonController
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新订单
|
|
|
|
|
$update = (new Orders())->filterRequestColumns(request(), ["id"]);
|
|
|
|
|
//更新订单基本信息
|
|
|
|
|
$update = (new Orders())->filterRequestColumns(request(), ["id", "paramedic_id"]);
|
|
|
|
|
if (request()->has("contact", "patient_name") && !request()->contact) {
|
|
|
|
|
$update["contact"] = request()->patient_name;
|
|
|
|
|
}
|
|
|
|
|
@ -628,6 +622,14 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
$order->update($update);
|
|
|
|
|
|
|
|
|
|
//更换护工的处理
|
|
|
|
|
if ($order->isOngoing()) {
|
|
|
|
|
return response()->json([
|
|
|
|
|
"errorcode" => "103",
|
|
|
|
|
"errormsg" => request()->available_day
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果原本的护工id为空且新提交了护工id,视同为派单
|
|
|
|
|
if ($order->isPending() && request()->paramedic_id) {
|
|
|
|
|
$order->update([
|
|
|
|
|
|