Explorar el Código

包裹管理
批量修改状态
客服备注添加权限:包裹管理-快递-客服备注

ANG YU hace 5 años
padre
commit
da8c6ef13e

+ 10 - 6
app/Http/Controllers/PackageLogisticController.php

@@ -54,16 +54,20 @@ class PackageLogisticController extends Controller
 
     public function batchUpdate(Request $request)
     {
-        if ('无' == $request->input('exception_type')) {
-            $data['exception_type'] = $request->input('exception_type');
-            $data['exception'] = "否";
-        } else {
-            $data['exception_type'] = $request->input('exception_type');
+        $data = [];
+        if (array_key_exists('exception_type',$request->all())) {
+            if ('无' == $request->input('exception_type')) {
+                $data['exception_type'] = $request->input('exception_type');
+                $data['exception'] = "否";
+            } else {
+                $data['exception_type'] = $request->input('exception_type');
+            }
+        }else if (array_key_exists('status',$request->all())) {
+            $data['status'] = $request->input('status');
         }
         $logistic_numbers = $request->input('logistic_numbers');
         OrderPackage::query()->whereIn('logistic_number', $logistic_numbers)->update($data);
         //更新统计数据
         event(new UpdateOrderPackageExceptionListenerEvent($logistic_numbers));
-
     }
 }

+ 30 - 0
database/migrations/2021_05_18_151348_add_authority_order_package_remark.php

@@ -0,0 +1,30 @@
+<?php
+
+use App\Authority;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthorityOrderPackageRemark extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Authority::query()->firstOrCreate(["name" => "包裹管理-快递-客服备注"],["alias_name"=>"包裹管理-快递-客服备注"]);
+
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::query()->where('name', '包裹管理-快递-客服备注')->delete();
+    }
+}

+ 36 - 5
resources/views/package/logistic/index.blade.php

@@ -8,7 +8,7 @@
     <div id="list" class="d-none">
         <div class="container-fluid">
             <div id="form_div"></div>
-            <div class="ml-3 form-inline" id="btn">
+            <div class="form-inline" id="btn">
                 @can('包裹管理-快递-异常类型-编辑')
                     <select class="form-control-sm" v-model="batchExceptionType">
                         <option v-for="(value,index) in exception_types" :value="value"
@@ -18,6 +18,14 @@
                     <button @click="batchExceptionTypeUpdate()" type="button"
                             class="btn btn-sm ml-2 btn-outline-primary">批量异常状态修改
                     </button>
+                    <select class="form-control-sm ml-2" v-model="batchStatus">
+                        <option v-for="(value,index) in statuses" :value="value"
+                                :name="value" :key="index">@{{ value }}
+                        </option>
+                    </select>
+                    <button @click="batchStatusUpdate()" type="button"
+                            class="btn btn-sm ml-2 btn-outline-danger">批量状态修改
+                    </button>
                 @endcan
             </div>
             <table class="table table-striped table-sm text-nowrap table-hover" id="table">
@@ -67,6 +75,7 @@
                         </div>
                     </td>
                     <td @mouseover="remarkHover = package.id" @mouseleave="remarkHover=null;remark=null;isShowRemarkInput = false">
+                        @can('包裹管理-快递-客服备注')
                         <button @click="isShowRemarkInput = true" v-if="remarkHover===package.id">新增</button>
                         <input @keydown.enter="submitRemark(package)" v-if="isShowRemarkInput && remarkHover===package.id" type="text" v-model="remark">
                         <div v-if="package.remark && package.remark.length>0" :id="'remark-'+i">
@@ -87,6 +96,7 @@
                                     v-else>展开</span>&nbsp;@{{ package.remark.length }} 条
                             </label>
                         </div>
+                        @endcan
                     </td>
                     <td class="text-overflow-warp-200"><span v-if="package.order && package.order.issue">@{{ package.order.issue.result_explain }}</span>
                     </td>
@@ -148,9 +158,14 @@
                     '其他',
                     '无',
                 ],
+                statuses: [
+                  '已揽收',
+                  '无',
+                ],
                 exception_editable: @can('包裹管理-快递-异常类型-编辑') true @else false  @endcan,
                 selectedExceptionType: '修改异常类型',
                 batchExceptionType: null,
+                batchStatus: null,
                 remarkHover: null,
                 remark: null,
                 isShowRemarkInput: false
@@ -286,9 +301,6 @@
                     restorationColumn: 'addtime',
                     fixedTop:($('#form_div').height())+($('#btn').height())+1,
                 }).init();
-            },
-            computed:{
-
             },
             methods: {
                 showRoute(id) {
@@ -329,7 +341,21 @@
                         logistic_numbers: checkData
                     }).then(() => {
                         tempTip.setDuration(1000);
-                        tempTip.showSuccess('批量更新异常类型成功');
+                        tempTip.showSuccess('批量更新异常状态成功');
+                    })
+                },
+                batchStatusUpdate() {
+                    let _this = this;
+                    if (checkData.length === 0) {
+                        tempTip.show('没有勾选记录');
+                        return
+                    }
+                    axios.put('{{url('package/logistic/batchUpdate')}}', {
+                        status: this.batchStatus,
+                        logistic_numbers: checkData
+                    }).then(() => {
+                        tempTip.setDuration(1000);
+                        tempTip.showSuccess('批量状态成功');
                     })
                 },
                 submitRemark(orderPackage) {
@@ -352,6 +378,11 @@
                         tempTip.show("网络错误:"+err)
                     });
                 },
+                {{--orderPackageExport(checkAllSign){--}}
+                {{--    let url = '{{url('package/logistic/export')}}';--}}
+                {{--    let token='{{ csrf_token() }}';--}}
+                {{--    excelExport(checkAllSign,checkData,url,this.packages.length,token,{is_merge : this.is_merge});--}}
+                {{--},--}}
             },
             filters: {
                 toObjected: function (value) {