Эх сурвалжийг харах

工单->取消拦截->承运商批量处理

loustwo 4 жил өмнө
parent
commit
893ae9ebfe

+ 7 - 6
app/Http/Controllers/WorkOrderCancelInterceptController.php

@@ -84,14 +84,15 @@ class WorkOrderCancelInterceptController extends Controller
         if (count($detail_ids) == 0)
             return ['success' => false,'message' => '参数异常'];
 
-        $details = WorkOrderDetail::query()->find($detail_ids);
-
-        if (count($details) ==0 || count($details) < count($detail_ids))
-            return ['success' => false,'message' => '参数异常'];
+        $details = WorkOrderDetail::query()->where('status', 3)->find($detail_ids);
+        if (count($details) < count($detail_ids))
+            return ['success' => false,'message' => '参数异常,刷新后重试'];
 
         $this->service->logisticBatchHandler($details,$request->all());
-        $data = $this->service->getDefaultWith($detail_ids);
-        return ['success' => true,$data => $data];
+        $data = $this->service->getDefaultWith($details->map(function($item){
+            return $item->work_order_id;
+        }));
+        return ['success' => true,'data' => $data];
     }
 
     public function baoShiReviewApi(Request $request): array

+ 2 - 0
resources/views/order/workOrder/index.blade.php

@@ -3027,7 +3027,9 @@
                             this.successTempTip('修改成功');
                             this.replaceWorkOrder(res.data.data);
                             this.dialogLogisticBatchHandlerVisible = false;
+                            return;
                         }
+                        this.waitingTempTip(res.data.message ? res.data.message : '处理异常刷新后重试');
                     }).catch(err=>{
                         window.tempTip.cancelWaitingTip();
                         this.errorTempTip(err);