Browse Source

工单->可编辑的退单状态,处理日志,表头问题,拦截失败不自动审核,快递异常已签收自动审核

loustwo 4 years ago
parent
commit
b2ff8efc2e

+ 1 - 1
app/Filters/WorkOrderFilters.php

@@ -339,7 +339,7 @@ class WorkOrderFilters
 
     public function order_issue_type($order_issue_type)
     {
-        $this->queryBuilder->where('order_issue_type_id', $order_issue_type);
+        $this->searchWay($this->queryBuilder,$order_issue_type,'order_issue_type_id');
     }
 
     // 快递单号

+ 1 - 1
app/Http/Controllers/WorkOrderController.php

@@ -340,7 +340,7 @@ class WorkOrderController extends Controller
     public function customRejectedStatusApi(Request $request): array
     {
         $result = $this->service->customRejectedStatus($request->input('ids'),$request->input('rejectedStatus'));
-        if($result){
+        if($result>0){
             return ['success' => true,];
         }
         return ['success' => false,'message' => '操作异常请稍后重试'];

+ 23 - 8
app/Services/WorkOrderExpressAbnormalService.php

@@ -156,6 +156,12 @@ class WorkOrderExpressAbnormalService extends WorkOrderService
             'type' => '处理',
         ]);
         $this->logService->createLog($detail, '处理', $process_progress . '-承运商处理');
+
+        if($process_progress == '已签收'){
+            $this->review($detail,'已签收');
+            $this->endOrderIssueAndSyncProcessLogs($detail);
+            $this->logService->createLog($detail, '终审', $process_progress . '-自动审核');
+        }
     }
 
     /**
@@ -168,6 +174,22 @@ class WorkOrderExpressAbnormalService extends WorkOrderService
         $this->detailService->updateDetail($detail, $params);
         $process_progress= $params['process_progress'];
 
+        $this->review($detail, $process_progress);
+        $this->endOrderIssueAndSyncProcessLogs($detail);
+        $this->logService->createLog($detail, '终审', $process_progress . '-宝时终审');
+    }
+
+    public function autoReview(WorkOrderDetail $detail, $process_progress,$endContext = null)
+    {
+
+    }
+
+    /**
+     * @param WorkOrderDetail $detail
+     * @param $process_progress
+     */
+    public function review(WorkOrderDetail $detail, $process_progress): void
+    {
         $detail->update([
             'status' => WorkOrder::$TO_BO_OWNER_END_STATUS,
             'process_progress' => $process_progress,
@@ -186,17 +208,10 @@ class WorkOrderExpressAbnormalService extends WorkOrderService
             'work_order_id' => $detail->work_order_id,
             'work_order_detail_id' => $detail->id,
             'user_id' => Auth::id(),
-            'content' => $process_progress.'-完结',
+            'content' => $process_progress . '-完结',
             'status' => '未同步',
             'type' => '结束',
         ]);
-        $this->endOrderIssueAndSyncProcessLogs($detail);
-        $this->logService->createLog($detail, '终审', $process_progress . '-宝时终审');
-    }
-
-    public function autoReview(WorkOrderDetail $detail, $process_progress,$endContext = null)
-    {
-
     }
 
 }

+ 2 - 3
app/Services/WorkOrderInterceptService.php

@@ -148,9 +148,8 @@ class WorkOrderInterceptService extends WorkOrderService
             'type' => '处理',
         ]);
         $this->logService->createLog($detail, '处理', '承运商处理-' . $process_progress);
-        if( $process_progress == '拦截失败'){
-            $this->logService->createLog($detail, '终审', '承运商无法拦截,自动终审-无法拦截');
-            $this->review($detail,'无法拦截','无法拦截-自动完结');
+        if( $process_progress !== '拦截失败'){
+            $detail->workOrder()->update(['custom_rejected_status' => '退回中']);
         }
     }
 

+ 8 - 5
resources/views/order/workOrder/_custom_rejected_status.blade.php

@@ -3,15 +3,18 @@
         退回状态
     </div>
     <div class="form-group row">
-        <select class="form-control col-sm-10" id="customRejectedStatus">
-            <option value="无"></option>
-            <option value="待退回"></option>
-            <option value="退回中"></option>
+        <label class="col-sm-2 col-form-label text-right text-primary">
+            状态
+        </label>
+        <select class="form-control col-sm-9" id="customRejectedStatus">
+            <option value="无">无</option>
+            <option value="待退回">待退回</option>
+            <option value="退回中">退回中</option>
         </select>
     </div>
     <div slot="footer" class="dialog-footer">
         <el-button @click="dialogCostomRejectedStatusVisible = false">关 闭</el-button>
-        <el-button type="primary" @click="batchCustomRejectedStatus">
+        <el-button type="primary" @click="batchChangeCustomRejectedStatus">
             提交
         </el-button>
     </div>

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

@@ -66,45 +66,53 @@
                         </button>
                     @endcan
 
+                    @can('订单管理-工单处理-宝时编辑')
+                        <button type="button" class="ml-1 btn btn-outline-primary btn-sm"
+                                v-show="checkData.length > 0"
+                                @click="showBatchCustomRejectedStatus">
+                            批量修改退回状态
+                        </button>
+                    @endcan
+
                 </div>
                 <div>
                     <table class="table table-sm table-striped table-hover table-bordered td-min-width-80 " id="table">
                         <thead>
                         <tr>
-                            <th></th>
-                            <th>工单号</th>
-                            <th>操作</th>
+                            <th style="min-width: 100px"></th>
+                            <th style="min-width: 120px">工单号</th>
+                            <th style="min-width: 120px">操作</th>
                             <th style="min-width: 200px">创建时间</th>
-                            <th>工单类型</th>
+                            <th style="min-width: 120px">工单类型</th>
                             <th style="min-width: 200px">当前进度</th>
-                            <th>客户</th>
+                            <th style="min-width: 120px">客户</th>
                             <th style="min-width: 200px">店铺名称</th>
                             <th style="min-width: 200px">客户单号</th>
-                            <th>承运人</th>
-                            <th>快递单号</th>
+                            <th style="min-width: 120px">承运人</th>
+                            <th style="min-width: 120px">快递单号</th>
                             <th style="min-width: 120px">当前处理人</th>
-                            <th>创建人</th>
+                            <th style="min-width: 120px">创建人</th>
                             <th style="min-width: 150px">情况说明</th>
-                            <th style="min-width: 50px;max-width: 50px" v-text="hideRejectedBills ? '隐藏' :'展开' " >展开</th>
+                            <th style="min-width: 50px;max-width: 50px" v-text="hideRejectedBills ? '隐藏' :'展开' ">展开</th>
 
                             <th v-if="hideRejectedBills" style="min-width: 220px">退回单号</th>
                             @if( \Illuminate\Support\Facades\Gate::check('订单管理-工单处理-宝时编辑') || \Illuminate\Support\Facades\Gate::check('订单管理-工单处理-商家编辑') )
-                            <th v-if="hideRejectedBills" style="min-width: 450px">退回商品详情</th>
+                                <th v-if="hideRejectedBills" style="min-width: 450px">退回商品详情</th>
                             @endif
-                            <th>处理日志</th>
+                            <th style="min-width: 120px">处理日志</th>
                             @can('订单管理-工单处理-宝时编辑')
-                            <th style="min-width: 120px">问题件处理结果</th>
+                                <th style="min-width: 120px">问题件处理结果</th>
                             @endcan
                             @can('订单管理-工单处理-宝时编辑')
-                            <th style="min-width: 120px">承运商赔偿金额</th>
-                            <th style="min-width: 120px">承运商快递减免</th>
-                            <th style="min-width: 100px">宝时赔偿金额</th>
-                            <th style="min-width: 120px">宝时快递减免</th>
-                            <th style="min-width: 200px">仓库组责任方</th>
-                            <th style="min-width: 200px">项目组责任方</th>
+                                <th style="min-width: 120px">承运商赔偿金额</th>
+                                <th style="min-width: 120px">承运商快递减免</th>
+                                <th style="min-width: 100px">宝时赔偿金额</th>
+                                <th style="min-width: 120px">宝时快递减免</th>
+                                <th style="min-width: 200px">仓库组责任方</th>
+                                <th style="min-width: 200px">项目组责任方</th>
                             @endcan
                             @can('订单管理-工单处理-删除')
-                            <th style="min-width: 75px">删除</th>
+                                <th style="min-width: 75px">删除</th>
                             @endcan
                             <th style="min-width: 300px">资料</th>
                         </tr>
@@ -148,6 +156,17 @@
                                         <span class="badge  badge-light"
                                               v-text="item.order_detail ? item.order_detail.rejecting_status : ''"></span>
                                     </template>
+
+                                    <template>
+                                        @can('订单管理-工单处理-宝时编辑')
+                                            <select class="form-control form-control-sm" v-model="item.custom_rejected_status"
+                                                    @change="changeCustomRejectedStatus(item,$event)">
+                                                <option value="无">无</option>
+                                                <option value="待退回">待退回</option>
+                                                <option value="退回中">退回中</option>
+                                            </select>
+                                        @endcan
+                                    </template>
                                 </td>
                                 <td>
                                     <span v-text="item.id"></span>
@@ -425,13 +444,13 @@
                                     </td>
                                 @endcan
                                 @can('订单管理-工单处理-删除')
-                                <td >
-                                    <button type="button"
-                                            class="btn btn-sm btn-outline-danger"
-                                            @click="destroy(item,i)">
-                                        删除
-                                    </button>
-                                </td>
+                                    <td>
+                                        <button type="button"
+                                                class="btn btn-sm btn-outline-danger"
+                                                @click="destroy(item,i)">
+                                            删除
+                                        </button>
+                                    </td>
                                 @endcan
                                 <td class="container" style="min-width: 500px">
                                     @include('order.workOrder._work_order_details')
@@ -768,7 +787,8 @@
                 ], [
                     {name: 'review_at_start', type: 'time', tip: ['终审开始日期', '时间']},
                     {name: 'review_at_end', type: 'time', tip: ['终审结束日期', '时间']},
-                    {name: 'order_issue_type', type: 'select', placeholder: '问题件类型', data: this.orderIssueTypes},
+                    {name: 'order_issue_type', type: 'select_multiple_select',tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的问题件类型'],
+                        placeholder: ['问题件类型', '定位或多选问题件类型'], data: this.orderIssueTypes},
                     {name: 'client_code', type: 'input', placeholder: '客户订单号'},
                     {
                         name: 'status', type: 'select', placeholder: '工单当前处理人',
@@ -981,7 +1001,7 @@
                     workOrder.pending_detail = this.groupPendingDetail(workOrder);
                     workOrder.logistic_numbers = this.groupLogisticNumber(workOrder);
                     workOrder.orderno = workOrder.order ? workOrder.order.code : '';
-                    workOrder.process_logs = this.groupProcess_logs(workOrder.pending_detail);
+                    workOrder.process_logs = this.groupProcess_logs(workOrder);
                     workOrder.log_is_show = false;
                     workOrder.shop_name = workOrder.order ? (workOrder.order.shop ? workOrder.order.shop.name : '') : '';
                     workOrder.owner_name = workOrder.owner ? workOrder.owner.name : '';
@@ -1159,11 +1179,8 @@
                     }
                     return new Array(...logistic_numbers);
                 },
-                groupProcess_logs(pending_detail) {
-                    return pending_detail.process_logs ? pending_detail.process_logs.map(e => {
-                        e.log_is_show = false;
-                        return e;
-                    }) : [];
+                groupProcess_logs(workOrder) {
+                    return workOrder.details.map(e=>e.process_logs ? e.process_logs : [] ).reduce((a,b)=> a=[...a,...b],[]);
                 },
                 createOrderIssue(item, tag) { // 生成问题件
                     let url = '{{route('workOrder.buildOrderIssueApi')}}';
@@ -3682,11 +3699,19 @@
                         excelExport(false, this.checkData, url, null, token);
                     }
                 },
-                toggleRejectedBill(){
+                toggleRejectedBill() {
                     this.hideRejectedBills = !this.hideRejectedBills;
                 },
                 showBatchCustomRejectedStatus() {
-
+                    if (this.checkData.length === 0) {
+                        this.errorTempTip('请勾选需要修改的工单')
+                        return;
+                    }
+                    this.dialogCustomRejectedStatusVisible = true
+                },
+                batchChangeCustomRejectedStatus() {
+                    let dom = document.getElementById('customRejectedStatus');
+                    this.batchCustomRejectedStatus(this.checkData, dom.value)
                 },
                 batchCustomRejectedStatus(ids, rejectedStatus) {
                     let url = "{{route('workOrder.customRejectedStatusApi')}}";
@@ -3700,7 +3725,12 @@
                     axios.post(url, data).then(res => {
                         window.tempTip.cancelWaitingTip();
                         if (res.data.success) {
-
+                            this.workOrders.forEach(e => {
+                                if (ids.includes(e.id)) {
+                                    e.custom_rejected_status = rejectedStatus
+                                }
+                            });
+                            this.dialogCustomRejectedStatusVisible = false;
                         } else {
                             this.errorTempTip(res.data.message)
                         }
@@ -3708,6 +3738,9 @@
                         window.tempTip.cancelWaitingTip();
                         this.errorTempTip(err)
                     })
+                },
+                changeCustomRejectedStatus({id}, event) {
+                    this.batchCustomRejectedStatus([id], event.target.value)
                 }
             },
         });