Просмотр исходного кода

Merge branch 'zengjun'

# Conflicts:
#	app/Http/Controllers/RejectedController.php
#	app/Providers/AuthServiceProvider.php
#	resources/views/waybill/index.blade.php
LD 5 лет назад
Родитель
Сommit
eaf925dc27

+ 103 - 20
app/Http/Controllers/WaybillsController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 
 use App\UploadFile;
 use App\WaybillAuditLog;
+use App\WaybillOnTop;
 use App\WaybillPriceModel;
 use App\Carrier;
 use App\CarType;
@@ -105,17 +106,13 @@ class WaybillsController extends Controller
         if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
         $data=$request->input();
         if ($data != null ) {
-            $waybills=Waybill::with(['owner','wmsCommodities','waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->orderBy('id','DESC');
+            $waybills = $this->getWaybills();
             $waybills=$this->conditionQuery($request,$waybills);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
         } else {
-            $waybills = Waybill::with(['owner','waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->orderBy('id', 'DESC')->paginate(50);
+            $waybills = $this->getWaybills()->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
@@ -126,17 +123,15 @@ class WaybillsController extends Controller
         if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
         $data=$request->input();
         if ($data != null ) {
-            $waybills=Waybill::with(['owner','wmsCommodities', 'waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->orderBy('id','DESC')->where('type','直发车');
+
+            $waybills = $this->getWaybills()->where('type','直发车');
+
             $waybills=$this->conditionQuery($request,$waybills);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
         } else {
-            $waybills = Waybill::with(['owner','wmsCommodities', 'waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->where('type','直发车')->orderBy('id', 'DESC')->paginate(50);
+            $waybills = $this->getWaybills()->where('type','直发车')->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
@@ -148,17 +143,14 @@ class WaybillsController extends Controller
         if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
         $data=$request->input();
         if ($data != null ) {
-            $waybills=Waybill::with(['owner','wmsCommodities', 'waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->orderBy('id','DESC')->where('type','专线');
+            $waybills = $this->getWaybills()->where('type','专线');
+
             $waybills=$this->conditionQuery($request,$waybills);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
         } else {
-            $waybills = Waybill::with(['owner','wmsCommodities', 'waybillAuditLogs' => function ($query) {
-                return $query->with('user');
-            }])->where('type','专线')->orderBy('id', 'DESC')->paginate(50);
+            $waybills = $this->getWaybills()->where('type','专线')->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
@@ -884,7 +876,7 @@ class WaybillsController extends Controller
         if ($request->input('type')=='直发车'){
             $validator=Validator::make($request->input(),[
                 'carrier_bill'=>"nullable|max:50|unique:waybills,carrier_bill,$id",
-                'fee'=>'required|min:0|numeric|max:999999',
+               // 'fee'=>'required|min:0|numeric|max:999999',
                 'other_fee'=>'nullable|min:0|numeric|max:999999',
                 'charge'=>'nullable|min:0|numeric|max:999999',
                 'mileage'=>'nullable|numeric',
@@ -898,7 +890,7 @@ class WaybillsController extends Controller
                 'unique'=>':attribute 已存在',
             ],[
                 'carrier_bill'=>'承运商单号',
-                'fee'=>'运费',
+               //'fee'=>'运费',
                 'other_fee'=>'其他费用',
                 'charge'=>'收费',
                 'mileage'=>'里程数',
@@ -975,4 +967,95 @@ class WaybillsController extends Controller
         $city->save();
         return $city;
     }
+
+    // 运单删除 软删除
+    public function destroy(int $id){
+        if(!GAte::allows('运输管理-删除')){return['success'=>0,'status'=>'没有权限'];}
+        if(is_null($id)){return ['success'=>'0','status'=>'传入id为空'];}
+        $result =  Waybill::where('id',$id)->delete();
+        return ['success'=>$result,'status'=>$result];
+    }
+
+    // 回收站
+    public function recycle(Request $request){
+        if(!Gate::allows('运输管理-删除')){return redirect('/');}
+        $user = Auth::user();
+        $paginate = $request->input('paginate')??50;
+        $waybills = Waybill::with(['owner','waybillAuditLogs' => function ($query) {
+            return $query->with('user');
+        }])->orderBy('deleted_at', 'DESC')->withTrashed()->whereNotNull('deleted_at')->paginate(50);
+        $total = $waybills->count();
+        $paginateParams = [];
+        $paginateParams['paginate'] = $paginate;
+        return view('waybill.recycle',compact('waybills','total','paginateParams'));
+    }
+
+    // 软删除恢复
+    public function apiRestoreSelected(Request $request){
+        DB::enableQueryLog();
+        if(!Gate::allows('运输管理-删除')){return ['success'=>'false','fail_info'=>'没有权限'];}
+        $ids = $request->input('ids')??'';
+        if($ids == ''){return ['success'=>'false','fail_info'=>'没有可恢复对象'];}
+        $waybills =  Waybill::withTrashed()->whereIn('id',$ids)->get();
+        $result = '';
+        $waybills->each(function (Waybill $waybill){
+            $waybill->restore();
+        });
+        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        return ['success'=>'true','waybills'=>$waybills];
+    }
+    // 修改运费
+    public function changeFee(Request $request){
+        if(!Gate::allows('运输管理-运费')){return ['success'=>'false','fail_info'=>'没有权限'];}
+        $wayBillId = $request->input('id');
+        $waybillFee = $request->input('fee');
+        if(is_null($wayBillId) or is_null($waybillFee)){
+            return ['success'=>'false','fail_info'=>'参数异常'];
+        }
+        $result = Waybill::where('id',$wayBillId)->update(['fee'=>$waybillFee]);
+        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        return ['success'=>$result,'status'=>$result];
+    }
+    // 置顶
+    public function waybillOnTop(Request $request){
+        $id =  $request->input('id');
+        $detail =  $request->input('detail');
+        if(!Gate::allows('运输管理-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
+        if(is_null($id)){
+            return  ['success'=>'false','fail_info'=>'传参错误'];
+        }
+        $wayontop = WaybillOnTop::withTrashed()->where('waybill_id',$id);
+        $result = '';
+        if(count($wayontop->get()) == 0){
+            $wayontop = WaybillOnTop::create(['waybill_id'=>$id,'remark'=>$detail]);
+            $result = $wayontop->save();
+        }else{
+            $wayontop = WaybillOnTop::withTrashed()->where('waybill_id',$id);
+            $result = WaybillOnTop::withTrashed()->where('waybill_id',$id)->restore();
+        }
+        return ['success'=>$result,'status'=>$result];
+    }
+    // 取消置顶
+    public function cancelOnTop(Request $request){
+        $id =  $request->input('id');
+        if(!Gate::allows('运输管理-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
+        if(is_null($id)){
+            return  ['success'=>'false','fail_info'=>'传参错误'];
+        }
+        $result = WaybillOnTop::where('waybill_id',$id)->forceDelete();
+        return ['success'=>$result,'status'=>$result];
+    }
+
+    // 获取所有运单信息
+    public function getWaybills(){
+        $waybills = Waybill::with(['owner','wmsCommodities','waybillAuditLogs' => function ($query) {
+            return $query->with('user');
+        }])->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
+            ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
+            ->whereNull('waybill_on_tops.deleted_at')
+            ->orderBy('waybill_on_tops.updated_at','desc')
+            ->orderBy('waybills.id','desc');
+        return $waybills;
+    }
+
 }

+ 10 - 1
app/Waybill.php

@@ -4,11 +4,12 @@ namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\SoftDeletes;
 
 class Waybill extends Model
 {
     use ModelTimeFormat;
-
+    use SoftDeletes;
     protected $fillable=[
         'status','type','waybill_number','owner_id','wms_bill_number','origination','destination','recipient','recipient_mobile','charge','ordering_remark',
         'carrier_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id',
@@ -74,6 +75,13 @@ class Waybill extends Model
         return $this->hasOne('App\UploadFile','table_id','id')->where('table_name','waybills');
     }
 
+    public function waybill_on_top(){
+        return $this->belongsTo('App\WaybillOnTop','waybill_id','id');
+    }
+
+//    public function getWaybillOnTopAttribute(){
+//        return $this->hasOne('App\WaybillOnTop','id','id');
+//    }
 
     public function getUploadFileUrlAttribute(){
         return $this['uploadFile']? asset('/storage'.$this['uploadFile']['url']):null;
@@ -106,4 +114,5 @@ class Waybill extends Model
         return $this['carrier_weight_unit_other']? $this['carrier_weight_unit_other']['name']:null;
     }
 
+
 }

+ 20 - 0
app/WaybillOnTop.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class WaybillOnTop extends Model
+{
+    //
+    use ModelTimeFormat;
+    use SoftDeletes;
+
+    protected $fillable = ['remark','waybill_id'];
+
+    public function waybill(){
+        return $this->hasOne('App/Waybill','id','waybill_id');
+    }
+}

+ 12 - 0
database/factories/WaybillOnTopFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\WaybillOnTop;
+use Faker\Generator as Faker;
+
+$factory->define(WaybillOnTop::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 32 - 0
database/migrations/2020_06_16_130808_change_waybill_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeWaybillTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('waybills',function (Blueprint $table){
+            $table->softDeletes()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('waybills',function (Blueprint $table){
+            $table->dropSoftDeletes();
+        });
+    }
+}

+ 37 - 0
database/migrations/2020_06_16_173559_add_authorrities_waybillmanagement_freigt.php

@@ -0,0 +1,37 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthorritiesWaybillmanagementFreigt extends Migration
+{
+    protected $authNames=[
+        "运输管理-运费",
+        '运输管理-置顶'
+    ];
+
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->authNames as $name){
+            \App\Authority::create(['name'=>$name,'alias_name'=>$name,'permission'=>'允许']);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->authNames as $name){
+            \App\Authority::where(['name'=>$name,'alias_name'=>$name])->destroy();
+        }
+    }
+}

+ 34 - 0
database/migrations/2020_06_19_114513_create_waybill_on_tops_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateWaybillOnTopsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('waybill_on_tops', function (Blueprint $table) {
+            $table->id();
+            $table->timestamps();
+            $table->integer('waybill_id')->index();
+            $table->string('remark');
+            $table->softDeletes()->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('waybill_on_tops');
+    }
+}

+ 16 - 0
database/seeds/WaybillOnTopSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class WaybillOnTopSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 78 - 0
database/seeds/faker_data.php

@@ -0,0 +1,78 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class faker_data extends Seeder
+{
+
+    public static $status =[
+        '未审核', '已审核', '待重审', '待终审', '已完结', '无模型'];
+    public static $type =['直发车', '专线'];
+
+    public static $recipients = ['11','22','33','44','55','66','77','88'];
+    /**
+     * Run the database seeds.
+     *s
+     * @return void
+     */
+    public function run()
+    {
+        //
+        dump(123);
+        $fake = app(Faker\Generator::class);
+
+        for ($i = 0;$i<5;$i++){
+            \App\Owner::create([
+                'code'=>\Illuminate\Support\Str::random(4),
+                'name'=>\Illuminate\Support\Str::random(5),
+
+            ]);
+        }
+
+        for ($i = 0;$i<5;$i++){
+            \App\Carrier::create([
+                'name'=>$fake->name,
+                'mobile'=>rand(1300000000,19999999999),
+                'remark'=>\Illuminate\Support\Str::random(13),
+                'delivery_fee'=>rand(0,100),
+            ]);
+        }
+
+        for ($i = 0;$i<5;$i++){
+             \App\CarType::create([
+                 'name'=>$fake->name,
+                 'model'=>\Illuminate\Support\Str::random(3).rand(10,100),
+                 'length'=>rand(1,10),
+                 'load'=>rand(1,5),
+             ]);
+        }
+
+        for ($i = 0;$i<100;$i++){
+            \App\Waybill::create([
+                'status'=>faker_data::$status[rand(0,5)],
+                'type'=>faker_data::$type[rand(0,1)],
+                'waybill_number'=>\Illuminate\Support\Str::random(3).rand(100000000,9999999999),
+                'source_bill'=>\Illuminate\Support\Str::random(4).rand(100000000,9999999999),
+                'wms_bill_number'=>\Illuminate\Support\Str::random(3).rand(100000000,9999999999),
+                'origination'=>\Illuminate\Support\Str::random(20),
+                'destination'=>\Illuminate\Support\Str::random(20),
+                'recipient'=>faker_data::$recipients[rand(0,7)],
+                'recipient_mobile'=>rand(1300000000,19999999999),
+                'charge'=>rand(0,200),
+                'collect_fee'=>rand(0,200),
+                'ordering_remark'=>\Illuminate\Support\Str::random(20),
+                'carrier_bill'=>'STS'.rand(0000000,9999999),
+                'origination_city_id'=>rand(1,345),
+                'destination_city_id'=>rand(1,345),
+                'warehouse_weight'=>rand(0,100)/10,
+                'warehouse_weight_unit_id'=>rand(0,6),
+                'carrier_weight'=>rand(0,12),
+                'carrier_weight_unit_id'=>rand(0,10),
+                'carType_id'=>rand(0,5),
+                'fee'=>rand(1,15),
+                'pick_up_fee'=>rand(0,4),
+            ]);
+        }
+
+    }
+}

Разница между файлами не показана из-за своего большого размера
+ 216 - 342
public/js/app.js


+ 2 - 0
resources/views/rejected/search/menu.blade.php

@@ -12,3 +12,5 @@
         </ul>
     </div>
 </div>
+<script>
+</script>

+ 4 - 0
resources/views/waybill/create.blade.php

@@ -106,6 +106,8 @@
                             @enderror
                         </div>
                     </div>
+                    {{--zengjun start--}}
+                    @can('运输管理-运费')
                     <div class="form-group row">
                         <label for="charge" class="col-2 col-form-label text-right ">收费(元)</label>
                         <div class="col-8">
@@ -118,6 +120,8 @@
                             @enderror
                         </div>
                     </div>
+                    @endcan
+                    {{--zengjun end--}}
                     <div class="form-group row">
                         <label for="collect_fee" class="col-2 col-form-label text-right text-muted">到付金额(元)</label>
                         <div class="col-8">

+ 2 - 0
resources/views/waybill/edit.blade.php

@@ -263,6 +263,7 @@
                                        name="car_owner_info" autocomplete="off" value="@if(old('car_owner_info')){{ old('car_owner_info') }}@else{{$waybill->car_owner_info}}@endif"  >
                             </div>
                         </div>
+                        @can('运输管理-运费')
                         <div class="form-group row">
                             <label for="fee" class="col-2 col-form-label text-right text-primary">运费(元) *</label>
                             <div class="col-8">
@@ -275,6 +276,7 @@
                                 @enderror
                             </div>
                         </div>
+                        @endcan
                     </div>
                     <div v-if="type=='专线'">
                         <div class="form-group row">

+ 203 - 9
resources/views/waybill/index.blade.php

@@ -133,17 +133,21 @@
                     <th class="table-header-layer-1" :colspan="elementCount('th.td-operation')"></th>
                     <th class="table-header-layer-1" :colspan="elementCount('th.td-bill')"><span class="fa fa-file-text-o"></span> 运单信息</th>
                     <th class="table-header-layer-1" :colspan="elementCount('th.td-transit')"><span class="fa fa-truck"></span> 运输信息</th>
-                    <th class="table-header-layer-1" :colspan="elementCount('th.td-fee')"><span class="fa fa-rmb"></span> 费用信息</th>
+                    <th class="table-header-layer-1" :colspan="elementCount('th.td-fee')"><span class="fa fa-rmb"></span> 费用信息
+                    @can('运输管理-删除')
+                    <th class="table-header-layer-1" :colspan="elementCount('th.td-delete')"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
+                    @endcan
                 </tr>
                 <tr>
                     <th class="td-operation">
                         <label for="all">
-                            <input id="all" type="checkbox" @click="checkAll($event)">全选
+                            <input id="all" type="checkbox" @click="checkAll($event)">
                         </label>
                     </th>
-                    @can('运输管理-编辑','运输管理-运单审核','运输管理-调度','运输管理-编辑','运输管理-删除')
+                    @can('运输管理-编辑','运输管理-运单审核','运输管理-调度','运输管理-编辑')
                         <th class="td-operation">操作</th>
                     @endcan
+                    <th class="td-operation">置顶</th>
                     <th class="td-operation">状态</th>
                     <th class="td-bill">ID</th>
                     <th class="td-bill">创建时间</th>
@@ -169,6 +173,9 @@
                     <th class="td-fee">提货费</th>
                     <th class="td-fee">其他费用</th>
                     <th class="td-fee">调度备注</th>
+                    @can('运输管理-删除')
+                        <th class="td-delete">操作</th>
+                    @endcan
                     {{--                    <th>WMS单号</th>--}}
                     {{--                    <th>收件人</th>--}}
                     {{--                    <th>收件人电话</th>--}}
@@ -184,7 +191,7 @@
                 </tr>
 
                 <tr v-for="waybill in waybills" :style="[{color:waybill.status=='待重审'?'red':''||waybill.status=='已完结'?'green':''},{'font-weight': waybill.id==selectedStyle?'bold':''}]"
-                    :id="'waybill'+waybill.id" @click="selectedColor(waybill.id)">
+                    :id="'waybill'+waybill.id" @click="selectedColor(waybill.id)" position="static" v-on:mouseover="hidetop($event)" v-on:mouseleave="showtop($event)">
                     <td>
                         <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
                     </td>
@@ -212,13 +219,21 @@
                             @endcan
                         </span>
                     </td>
+                    @can('运输管理-置顶')
+                    <td class=" text-muted toptd" >
+                        <div v-if="waybill.remark" class="bg-dark  text-warning top"  data-toggle="tooltip" style="opacity: 0.1"
+                        >@{{  waybill.remark }}</div>
+                        <a v-if="waybill.remark" class="text-muted" @click="cancelOnTop($event)" :data_id="waybill.id" href="javascript:0">取消<br>置顶</a>
+                        <a v-else @click="waybillOnTop($event)" :data_id="waybill.id" class="text-danger" href="javascript:0">置顶</a>
+                    </td>
+                    @endcan
                     <td :class="[waybill.status=='已审核'?'text-success':'']">@{{waybill.status}}</td>
                     <td class="td-bill text-muted">@{{waybill.id}}</td>
                     <td class="td-bill text-muted">@{{waybill.created_at}}</td>
                     <td class="td-bill">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee">到付</span></td>
                     <td class="td-bill">@{{waybill.owner}}</td>
-                    <td class="td-bill">@{{waybill.source_bill}}</td>
-                    <td class="td-bill">@{{waybill.wms_bill_number}}</td>
+                    <td class="td-bill toptd" :title="waybill.remark">@{{waybill.source_bill}}</td>
+                    <td class="td-bill" >@{{waybill.wms_bill_number}}</td>
                     <td class="td-bill">@{{waybill.waybill_number}}</td>
                     <td class="td-bill">
                         <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.url,waybill.suffix)">
@@ -245,12 +260,21 @@
                     <td class="td-transit">@{{waybill.amount}} </td>
                     <td class="td-transit">@{{waybill.mileage|km}} </td>
                     @can('运输管理-可见费用项')
-                        <td class="td-fee"><span v-if="waybill.type=='专线'"></span><span v-else>@{{waybill.fee}}</span></td>
+                        {{--zengjun start--}}
+                        @can('运输管理-运费')
+                            <td class="td-fee">
+                                <span v-if="waybill.type=='专线'"></span><span v-else class="btn-sm btn-light btn" @click="waybillFeeCheck($event)" :data_id="waybill.id">@{{waybill.fee}}</span>
+                                <input type="number" class="form-control form-control-sm"  @blur="udpateWaybillFee($event)" :value="waybill.fee" :data_id="waybill.id" style="min-width:65px;display: none">
+                            </td>
+                        @endcan
+                        {{--zengjun end--}}
                         <td class="td-fee">@{{waybill.pick_up_fee}}</td>
                         <td class="td-fee">@{{waybill.other_fee}}</td>
                     @endcan
                     <td class="td-fee">@{{waybill.dispatch_remark}}</td>
-
+                    @can('运输管理-删除')
+                        <td class="td-operation btn-outline-danger" @click="waybillDestroy(waybill.id,waybill.waybill_number)">删除</td>
+                    @endcan
                     {{--                    <td>@{{waybill.wms_bill_number}}</td>--}}
                     {{--                    <td>@{{waybill.recipient}}</td>--}}
                     {{--                    <td>@{{waybill.recipient_mobile}}</td>--}}
@@ -326,6 +350,47 @@
 
 
 @section('lastScript')
+    <style type="text/css">
+        @keyframes anima
+        {
+            0%{opacity:0.1}
+            60%{opacity:0.4}
+            80%{opacity:0.6}
+            100%{opacity:0.75}
+        }
+        @-webkit-keyframes anima
+        {
+            from {
+                opacity:0.75;
+            }
+            to{
+                opacity:0.1;
+            }
+        }
+        .top{
+            padding-top: 0px;
+            padding-left: 10px;
+            margin-left: 88px;
+            margin-top: -4px;
+            line-height: 55px;
+
+            position: absolute;
+            animation: anima;
+            animation-duration: 2s;
+            animation-timing-function: linear;
+            animation-delay: 0.5s;
+            animation-direction: alternate;
+            animation-play-state: running;
+
+            -webkit-animation-name: anima;
+            -webkit-animation-duration: 2s;
+            -webkit-animation-timing-function: linear;
+            -webkit-animation-delay: 0.5s;
+            -webkit-animation-iteration-count: infinite;
+            -webkit-animation-direction: alternate;
+            -webkit-animation-play-state: running;
+        }
+    </style>
     <script>
         let vueList=new Vue({
             el:'#list',
@@ -349,7 +414,8 @@
                         @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
                         pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
                         collect_fee:'{{$waybill->collect_fee}}', @endcan dispatch_remark:'{{$waybill->dispatch_remark}}',isBtn:false,
-                        waybillAuditLogs:{!! $waybill->waybillAuditLogs !!}
+                        waybillAuditLogs:{!! $waybill->waybillAuditLogs !!},
+                        @if($waybill->remark)remark:'{{$waybill->remark}}', @else remark:'', @endif
                     },
                     @endforeach
                 ],
@@ -396,11 +462,15 @@
                     },
                     deep:true
                 },
+
             },
             mounted:function(){
                 this.initInputs();
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
                 $('#list').removeClass('d-none');
+                 let waybill =  $('.table-header-layer-1')[1];
+                $('.top').css('min-width', waybill.scrollWidth);
+
                 this.imgs=Array.from(document.getElementById('list').querySelectorAll('img'));
                 this.lazy();
                 if (this.imgs&&this.imgs.length>0){
@@ -475,6 +545,31 @@
                 waybillUpdate(id){
                     location.href="{{url('waybill/waybillEdit')}}/"+id;
                 },
+                // 软删除
+                waybillDestroy(id,waybill_number){
+                    if(!confirm('确定要删除运单号为:“'+waybill_number+'”的运单吗?')){return};
+                    let _this = this;
+                    let url = '{{url('waybill')}}/'+id;
+                    axios.delete(url).then(
+                        function (response) {
+                            if(!response.data.success){
+                                tempTip.setDuration(3000);
+                                tempTip.show('运单:'+waybill_number+'删除失败!');
+                            }else {
+                                tempTip.setDuration(3000);
+                                tempTip.showSuccess('运单:'+waybill_number+'删除成功!');
+                                setInterval(function () {
+                                    window.location.reload();
+                                    form.submit();
+                                },1000)
+                            }
+                        }
+                    ).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show('删除失败,网络链接错误!'+err);
+                    });
+
+                },
                 waybillRetreatAudit(id,waybill_number){
                     if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
                     let _this=this;
@@ -741,6 +836,105 @@
                             tempTip.setDuration(4000);
                             tempTip.show("网络错误:"+err);
                         });
+                },
+                // 运费修改
+                waybillFeeCheck:function (e) {
+                    let target = $(e.target);
+                    target.hide();
+                    let input = target.next();
+                    input.show();
+                    input.focus();
+                },
+                // 失焦事件
+                udpateWaybillFee:function (e) {
+                    let _this = this;
+                    let target = $(e.target);
+                    let span = target.prev();
+                    let id = target.attr('data_id');
+                    let fee = target.val();
+                    if(fee !== span.text()){
+                        let ajaxUrl= '{{url("apiLocal/waybill/changeFee")}}';
+                        axios.post(ajaxUrl,{'id':id,'fee':fee}).then(function (response) {
+                            if(response.data.success){
+                                tempTip.setDuration(2000);
+                                tempTip.showSuccess('运单运费修改成功');
+                                span.text(fee);
+                            }else{
+                                tempTip.setDuration(3000);
+                                tempTip.show('运单运费修改失败!'+response.data.fail_info);
+                            }
+                        }).catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('运单运费修改失败!'+response.data.fail_info);
+                        });
+                    }
+                    span.show();
+                    target.hide();
+                },
+                // 置顶操作
+                waybillOnTop:function(e){
+                    let target = $(e.target);
+                    let id = target.attr('data_id');
+                    let ajaxUrl = '{{url('waybill/ontop/top')}}';
+                    alert(ajaxUrl);
+                    let detail = '';
+                    tempTip.inputVal('输入置顶备注',function (detail) {
+                        if(id !== null && detail!=null){
+                            axios.post(ajaxUrl,{'id':id,'detail':detail}).then(function (response) {
+                                if(response.data.success){
+                                    tempTip.setDuration(3000);
+                                    tempTip.showSuccess('置顶成功');
+                                    setTimeout(function(){
+                                        window.location.reload();
+                                        }
+                                    ,1000);
+                                }else{
+                                    tempTip.setDuration(3000);
+                                    tempTip.show('置顶失败!'+response.fail_info);
+                                }
+                            }).catch(function (err) {
+                                tempTip.setDuration(30000);
+                                tempTip.show('置顶失败,网络连接错误!'+err);
+                            });
+                        }
+                    });
+                },
+                cancelOnTop:function (e) {
+                    let target = $(e.target);
+                    let id = target.attr('data_id');
+                    let ajaxUrl='{{url('waybill/ontop/cancel')}}';
+                    if(id !== null){
+                        axios.post(ajaxUrl,{'id':id}).then(function (response) {
+                            if(response.data.success){
+                                tempTip.setDuration(30000);
+                                tempTip.showSuccess('取消置顶成功');
+                                setTimeout(function(){
+                                        window.location.reload();
+                                    }
+                                    ,1000);
+                            }else{
+                                tempTip.setDuration(3000);
+                                tempTip.show('取消置顶失败!'+response.fail_info);
+                            }
+                        }).catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('取消置顶失败,网络连接错误!'+err);
+                        });
+                    }
+                },
+                hidetop:function(e) {
+                    let target = $(e.target);
+                    let top = target.parent().find('.top');
+                    let tip = target.parent().find('.toptd');
+                    top.hide();
+                    tip.tooltip('show');
+                },
+                showtop:function(e){
+                    let target = $(e.target);
+                    let top = target.parent().find('.top');
+                    let tip = target.parent().find('.toptd');
+                    top.show();
+                    tip.tooltip('hide');
                 }
             },
             filters:{

+ 5 - 0
resources/views/waybill/menu.blade.php

@@ -25,6 +25,11 @@
             <li class="nav-item">
                 <a class="nav-link text-dark" href="{{url('waybill/waybillFinancialExcepted')}}" :class="{active:isActive('waybillFinancialExcepted',2)}">异常报表</a>
             </li>@endcan
+            @can('运输管理-删除')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('waybill/recycle')}}">回收站</a>
+            </li>
+            @endcan
         </ul>
     </div>
 </div>

+ 213 - 0
resources/views/waybill/recycle.blade.php

@@ -0,0 +1,213 @@
+@extends('layouts.app')
+@section('title')已删除@endsection
+
+@section('content')
+    <div id="nav2">
+    @component('waybill.menu')@endcomponent
+    </div>
+
+    <div class=container-fluid">
+        <div class="card" style="min-width: 2000px;">
+            <div class="card-body" id="list">
+                <div class="card">
+                    <div class="card-body">
+                        <div class="row">
+                            <table class="table mb-n3 table-sm table-bordered">
+                                <tr>
+                                    <td>
+                                        <span class="text-muted">每页显示记录:</span>
+                                    </td>
+                                    <td colspan="9">
+                                        <select name="" id="setPaginate" class="tooltipTarget form-control-sm" v-model="filterParams.paginate" >
+                                            <option value="50">50条</option>
+                                            <option value="100">100条</option>
+                                            <option value="200">200条</option>
+                                            <option value="500">500条</option>
+                                            <option value="1000">1000条</option>
+                                        </select>
+                                    </td>
+                                    <td width="80%"></td>
+                                </tr>
+                                <tr>
+                                    <td class="text-muted">选定操作记录:</td>
+                                    <td colspan="9">
+                                        @can('运输管理-删除')
+                                            <span class="btn btn-sm" @click="restoreSelected" style="cursor: pointer"
+                                                     :class="[waybills_checkBoxes.length > 0?'btn-danger':'btn-outline-danger']">
+                                            恢复
+                                        </span>
+                                        @endcan
+                                    </td>
+                                </tr>
+                            </table>
+
+                        </div>
+                    </div>
+                </div>
+
+                <table class="table table-striped table-sm table-bordered table-hover"  style="background: #fff;">
+                    <tr>
+                        <th class="td-operation">
+                            <label for="all">
+                                <input id="all" type="checkbox" @click="checkAll($event)">
+                            </label>
+                        </th>
+                        <th class="td-operation">状态</th>
+                        <th >ID</th>
+                        <th >创建时间</th>
+                        <th >运单类型</th>
+                        <th >货主</th>
+                        <th >上游单号</th>
+                        <th >WMS订单号</th>
+                        <th >运单号</th>
+                        <th >收件人</th>
+                        <th >收件人电话</th>
+                        <th >始发地</th>
+                        <th >目的地</th>
+                        <th >承运商</th>
+                        <th >单号/车型</th>
+                        <th >仓库计抛</th>
+                        <th >承运商计抛</th>
+                        <th >仓库计重</th>
+                        <th >承运商计重</th>
+                        <th >计数</th>
+                        <th >里程</th>
+                        <th >运费</th>
+                        <th >提货费</th>
+                        <th >其他费用</th>
+                        <th >调度备注</th>
+                    </tr>
+                    <tr v-for="waybill in waybills" :id="'waybill'+waybill.id">
+                        <td>
+                            <input class="checkItem" type="checkbox" :value="waybill.id" v-model="waybills_checkBoxes" >
+                        </td>
+                        <td :class="[waybill.status=='已审核'?'text-success':'']">@{{waybill.status}}</td>
+                        <td class="text-muted">@{{waybill.id}}</td>
+                        <td class="text-muted">@{{waybill.created_at}}
+                        <td >@{{waybill.type}} </td>
+                        <td >@{{waybill.owner}}</td>
+                        <td >@{{waybill.source_bill}}</td>
+                        <td class="">@{{waybill.wms_bill_number}}</td>
+                        <td class="">@{{waybill.waybill_number}}</td>
+                        <td class="">@{{waybill.recipient}}</td>
+                        <td class="">@{{waybill.recipient_mobile}}</td>
+                        <td class="text-muted">@{{waybill.origination}}</td>
+                        <td class="text-muted">@{{waybill.destination}}</td>
+                        <td >@{{waybill.carrier}}</td>
+                        <td ><span v-if="waybill.type=='专线'">@{{waybill.carrier_bill}}</span>
+                            <span v-if="waybill.type=='直发车'">
+                            <span v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span></span></td>
+                        <td ><span v-if="waybill.warehouse_weight">@{{waybill.warehouse_weight}}  @{{waybill.warehouse_weight_unit}}</span></td>
+                        <td ><span v-if="waybill.carrier_weight">@{{waybill.carrier_weight}}  @{{waybill.carrier_weight_unit}}</span></td>
+                        <td ><span v-if="waybill.warehouse_weight_other">@{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</span></td>
+                        <td ><span v-if="waybill.carrier_weight_other">@{{waybill.carrier_weight_other}}  @{{waybill.carrier_weight_unit_other}}</span></td>
+                        <td >@{{waybill.amount}} </td>
+                        <td >@{{waybill.mileage}} |km</td>
+                        @can('运输管理-可见费用项')
+                            <td ><span v-if="waybill.type=='专线'"></span><span v-else>@{{waybill.fee}}</span></td>
+                            <td >@{{waybill.pick_up_fee}}</td>
+                            <td >@{{waybill.other_fee}}</td>
+                        @endcan
+                        <td >@{{waybill.dispatch_remark}}</td>
+                    </tr>
+                </table>
+                <div class="text-info h5 btn btn">{{$waybills->count()}}/{{$total}}</div>
+                {{$waybills->appends($paginateParams)->links()}}
+            </div>
+
+        </div>
+
+
+    </div>
+@endsection
+@section('lastScript')
+    <script>
+        let vueList = new Vue({
+            el:'#list',
+            data:{
+                filterParams:{
+                    paginate:'{{$paginateParams['paginate']}}',
+                },
+                waybills_checkBoxes:[],
+                waybills:[
+                        @foreach($waybills as $waybill)
+                    {
+                        id:'{{$waybill->id}}',created_at:'{{$waybill->created_at}}',updated_at:'{{$waybill->updated_at}}',
+                        status:'{{$waybill->status}}',type:'{{$waybill->type}}',waybill_number:'{{$waybill->waybill_number}}',
+                        owner:'{{$waybill->owner_name}}',source_bill:'{{$waybill->source_bill}}',wms_bill_number:'{{$waybill->wms_bill_number}}',origination:'{{$waybill->origination}}',
+                        destination:'{{$waybill->destination}}',recipient:'{{$waybill->recipient}}',recipient_mobile:'{{$waybill->recipient_mobile}}',
+                        charge:'{{$waybill->charge}}',ordering_remark:'{{$waybill->ordering_remark}}',carrier:'{{$waybill->carrier_name}}',
+                        carrier_bill:'{{$waybill->carrier_bill}}',origination_city:'{{$waybill->origination_city_name}}',
+                        destination_city:'{{$waybill->destination_city_name}}',warehouse_weight:'{{$waybill->warehouse_weight}}',
+                        warehouse_weight_unit:'{{$waybill->warehouse_weight_unit_name}}',carrier_weight:'{{$waybill->carrier_weight}}',
+                        carrier_weight_unit:'{{$waybill->carrier_weight_unit_name}}',
+                        warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
+                        warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other_name}}',carrier_weight_other:'{{$waybill->carrier_weight_other}}',
+                        carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other_name}}',
+                        mileage:'{{$waybill->mileage}}',amount:'{{$waybill->amount}}',
+                        @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
+                        pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
+                        collect_fee:'{{$waybill->collect_fee}}', @endcan dispatch_remark:'{{$waybill->dispatch_remark}}',isBtn:false,
+                        waybillAuditLogs:{!! $waybill->waybillAuditLogs !!}
+                    },
+                    @endforeach
+                ],
+            },
+            watch:{
+                waybills_checkBoxes:{
+                    handler(){
+                        if (this.waybills_checkBoxes.length === this.waybills.length){
+                            document.querySelector('#all').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                        }
+                    },
+                    deep:true
+                },
+            },
+            mounted:function(){
+            },
+            methods:{
+                restoreSelected:function(){
+                    let _this = this;
+                    if(_this.waybills_checkBoxes.length === 0){
+                        tempTip.show("没有勾选记录");
+                        return;
+                    }
+                    if(!confirm("确定要恢复所有勾选的内容为'未删除'吗?")){return;}
+                    let ajaxUrl = '{{url('apiLocal/waybill/recoverSelected')}}';
+                    axios.post(ajaxUrl,{ids:_this.waybills_checkBoxes}).then(function (response) {
+                        if(response.data.success){
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess('恢复勾选内容成功!');
+                            window.setTimeout(function () {
+                                window.location.href='{{url('waybill/recycle')}}';
+                            },2000);
+                        }else{
+                            tempTip.setDuration(2500);
+                            tempTip.show('恢复勾选内容失败,错误:'+response.data.fail_info);
+                            setTimeout(function () {
+                                window.location.reload();
+                            },1000);
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(2500);
+                        tempTip.show('恢复勾选内容失败,错误:'+err);
+                    });
+                },
+                checkAll(e){
+                    if (e.target.checked){
+                        this.waybills.forEach((el,i)=>{
+                            if (this.waybills_checkBoxes.indexOf(el.id) == '-1'){
+                                this.waybills_checkBoxes.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.waybills_checkBoxes = [];
+                    }
+
+                },
+            }
+        })
+    </script>
+@endsection

+ 3 - 0
routes/apiLocal.php

@@ -24,3 +24,6 @@ Route::post('logistic/logisticNumberReturnIsUnique', 'RejectedBillController@api
 
 Route::post('commodity/getCommodityByBarcode', 'CommodityController@apiGetCommodityByBarcode');
 
+Route::post('waybill/recoverSelected', 'WaybillsController@apiRestoreSelected');
+Route::post('waybill/changeFee', 'WaybillsController@changeFee');
+

+ 4 - 0
routes/web.php

@@ -79,6 +79,10 @@ Route::get('waybill/waybillFinancialExcepted/ZX','WaybillFinancialExceptedContro
 Route::resource('waybill/waybillFinancialSnapshot','WaybillFinancialSnapshotsController');
 Route::resource('waybill/waybillFinancialExcepted','WaybillFinancialExceptedController');
 
+Route::get('waybill/recycle', 'WaybillsController@recycle');   //回收站
+Route::any('waybill/ontop/top','WaybillsController@waybillOnTop');
+Route::any('waybill/ontop/cancel','WaybillsController@cancelOnTop');
+
 Route::any('waybill/create/ZF','WaybillsController@createZF');
 Route::any('waybill/create/ZX','WaybillsController@createZX');
 Route::get('waybill/index','WaybillsController@index');

Некоторые файлы не были показаны из-за большого количества измененных файлов