Jelajahi Sumber

修改工单处理日志

ajun 4 tahun lalu
induk
melakukan
01f00e4f1e

+ 34 - 5
app/Services/WorkOrderProcessLogService.php

@@ -28,13 +28,26 @@ class WorkOrderProcessLogService
 
     public function createLogisticProcessLog($params)
     {
+        // 赔偿方  是否赔偿
+        if ($params['is_indemnity'] == 1) {  // 赔偿
+            $params = [
+                'work_order_id' => $params['work_order_id'],
+                'is_indemnity' => $params['is_indemnity'],
+                'indemnitor' => 1,
+                'remark' => $params['remark'],
+                'type' => 2,
+            ];
+        } else if ($params['is_indemnity'] == 2){ // 不赔偿
+            $params = [
+                'work_order_id' => $params['work_order_id'],
+                'is_indemnity' => $params['is_indemnity'],
+                'remark' => $params['remark'],
+                'indemnitor' => 0,
+            ];
+        }
+
         $params['creator_id'] = Auth::user()['id'];
         $params['type'] = '2';
-
-        // 赔偿方
-        if ($params['is_indemnity'] == 1) $params['indemnitor']  = 1;
-        else $params['indemnitor']  = 0;
-
         $log = WorkOrderProcessLog::query()->create($params);
         $log->workOrder()->update(['work_order_status' => '3']);
         $log->loadMissing('creator');
@@ -43,8 +56,24 @@ class WorkOrderProcessLogService
 
     public function createBaoShiProcessLog($params)
     {
+        if ($params['is_indemnity'] == 1){  // 赔偿
+            $params = [
+                'work_order_id' => $params['work_order_id'],
+                'is_indemnity' => $params['is_indemnity'],
+                'indemnitor' => $params['indemnitor'],
+                'indemnity' => $params['indemnity'],
+            ];
+        } else if ($params['is_indemnity'] == 2){ // 不赔偿
+            $params = [
+                'work_order_id' => $params['work_order_id'],
+                'is_indemnity' => $params['is_indemnity'],
+                'remark' => $params['remark'],
+                'indemnity' => $params['indemnity'],
+            ];
+        }
         $params['creator_id'] = Auth::user()['id'];
         $params['type'] = 1;
+        if ($params['is_indemnity'] == 2) $params['indemnity'] = 0;
         $log = WorkOrderProcessLog::query()->create($params);
         $log->loadMissing('creator');
         return $log;

+ 36 - 25
resources/views/order/workOrder/index.blade.php

@@ -121,25 +121,35 @@
                                 </td>
                                 <td>
                                     {{--  承运商处理日志   --}}
-                                    <div v-if="item.logistic_log" class="bg-light-khaki">
+                                    <div v-if="item['logistic_log']" class="bg-light-khaki">
                                             <span class="mr-3 text-nowrap">承运商处理:</span><br>
-                                            <span class="mr-3 text-nowrap" v-text="'是否赔偿:'+ item['logistic_log']['is_indemnity']"></span>
-                                            <span class="mr-3 text-nowrap" v-if="item['logistic_log']['is_indemnity'] === '是'" v-text="'赔偿金额:'+item['logistic_log']['indemnity']"></span>
-                                            <span
-                                                v-if="item['logistic_log']['is_indemnity'] === '否'"
-                                                type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top"
-                                                :title="item['logsitic_log']['remark']">
-                                            不赔偿缘由
-                                        </span>
+                                        是否赔偿:<span class="mr-3 text-nowrap" v-text="item['logistic_log']['is_indemnity']"></span>
+                                        <template v-if="item['logistic_log']['is_indemnity'] === '是'">
+                                            赔偿金额:<span class="mr-3 text-nowrap"  v-text="item['logistic_log']['indemnity']"></span>
+                                        </template>
+                                        <template v-if="item['logistic_log']['is_indemnity'] === '否'">
+                                            不赔偿理由:<span  class="mr-3 text-nowrap"   v-text="item['logistic_log']['remark']">
+                                            </span>
+                                        </template>
                                     </div>
+
                                     {{--  宝时处理日志   --}}
-                                    <div v-if="item.process_log" class="bg-light-info mt-1" >
+                                    <div v-if="item['process_log']" class="bg-light-info mt-1">
                                         <span class="mr-3 text-nowrap" >宝时处理:</span><br>
-                                        <span class="mr-3 text-nowrap" v-text="'是否赔偿:'+ item['logistic_log']['is_indemnity']"></span>
-                                        <span class="mr-3 text-nowrap" v-if="item['logistic_log']['is_indemnity'] === '是'" v-text="'赔偿方:'+item['process_log']['indemnitor']"></span>
-                                        <span class="mr-3 text-nowrap" v-if="item['logistic_log']['is_indemnity'] === '是'" v-text="'赔偿金额:'+item['process_log']['indemnity']"></span>
-                                        <span class="mr-3 text-nowrap" v-if="item['logistic_log']['is_indemnity'] === '否'" v-text="'理由:'+ item['process_log']['remark'] "></span>
+                                        是否赔偿:<span class="mr-3 text-nowrap" v-text="item['process_log']['is_indemnity']"></span>
+                                        <template v-if="item['process_log']['is_indemnity'] === '是'">
+                                            赔偿方:<span class="mr-3 text-nowrap"  v-text="item['process_log']['indemnitor']"></span>
+                                        </template>
+                                        <template v-if="item['process_log']['is_indemnity'] === '是'">
+                                            赔偿金额:<span  class="mr-3 text-nowrap"  v-text="item['process_log']['indemnity']">
+                                            </span>
+                                        </template>
+                                        <template v-if="item['process_log']['is_indemnity'] === '否'">
+                                            不赔偿理由:<span  class="mr-3 text-nowrap"   v-text=" item['process_log']['remark']">
+                                            </span>
+                                        </template>
                                     </div>
+
                                 </td>
                                 <td class="text-center">
                                     @can('订单管理-工单处理-审核')
@@ -783,10 +793,10 @@
                 storeLogisticProcessLog(){
                     let url = "{{route('workOrderProcessLog.logisticLogApi')}}";
                     let data = {
-                        'indemnity':this.processLog.indemnity,
-                        'work_order_id':this.processLog.work_order_id,
-                        'is_indemnity':this.processLog.is_indemnity,
-                        'remark':this.processLog.remark,
+                        indemnity:this.processLog.indemnity,
+                        work_order_id:this.processLog.work_order_id,
+                        is_indemnity:this.processLog.is_indemnity,
+                        remark:this.processLog.remark,
                     };
                     if(!this.verifiedProcessLog())return;
                     window.tempTip.setDuration(9999);
@@ -798,7 +808,8 @@
                         window.tempTip.setDuration(2000);
                         if (res.data.success){
                             window.tempTip.showSuccess('创建成功');
-                            this.$set(this.workOrders[this.processLog.index],'logisticLog',res.data.data);
+                            this.$set(this.workOrders[this.processLog.index],'logistic_log',res.data.data);
+                            $('#work-order-process-log-modal').modal('hide');
                         } else{
                             window.tempTip.show(res.data.message ? res.data.message : '创建异常,刷新页面重试');
                         }
@@ -811,10 +822,10 @@
                 storeProcessLog(){
                     let url = "{{route('workOrderProcessLog.LogApi')}}";
                     let data = {
-                        'indemnity':this.processLog.indemnity,
-                        'work_order_id':this.processLog.work_order_id,
-                        'is_indemnity':this.processLog.is_indemnity,
-                        'remark':this.processLog.remark,
+                        indemnity:this.processLog.indemnity,
+                        work_order_id:this.processLog.work_order_id,
+                        is_indemnity:this.processLog.is_indemnity,
+                        remark:this.processLog.remark,
                         indemnitor:this.processLog.indemnitor,
                     };
                     if(!this.verifiedProcessLog())return;
@@ -826,7 +837,8 @@
                         window.tempTip.setDuration(2000);
                         if (res.data.success){
                             window.tempTip.showSuccess('创建成功');
-                            this.$set(this.workOrders[this.processLog.index],'processLog',res.data.data);
+                            this.$set(this.workOrders[this.processLog.index],'process_log',res.data.data);
+                            $('#work-order-process-log-modal').modal('hide');
                         } else{
                             window.tempTip.show(res.data.message ? res.data.message : '创建异常,刷新页面重试');
                         }
@@ -878,7 +890,6 @@
                             return false;
                         }
                     }
-
                     return true;
                 }
             },