Forráskód Böngészése

Merge branch 'zzd'

LD 5 éve
szülő
commit
bcef4fef09

+ 30 - 2
app/Http/Controllers/TestController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 
 use App\Authority;
 use App\Batch;
+use App\City;
 use App\Events\CancelOrder;
 use App\Events\WmsReceiveNewEvent;
 use App\Http\Controllers\Api\thirdPart\flux\WaybillController;
@@ -203,9 +204,36 @@ class TestController extends Controller
             $authority->delete();
         });
     }
-    /*1*/
-    function test(){
 
+    /*1*/
+    function test()
+    {/**/
+        $data=[];
+        $data['destination_city_id']=1;
+        $data['destination']="陕西省零鲁区鲱鱼大街404号260";
+        $waybill=Waybill::find(1);
+        if ($data['destination_city_id'] && $waybill->destination_city_id != $data['destination_city_id']){
+            $city=City::find($data['destination_city_id']);
+            if ($city && (mb_strpos($data['destination'],$city->name)===false || mb_strpos($data['destination'],$city->province_name)===false)){
+                if (mb_strpos($data['destination'],$city->name)===false && mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$city->name.$data['destination'];
+                    goto sign;
+                }
+                if (mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$data['destination'];
+                }
+                if (mb_strpos($data['destination'],$city->name)===false){var_dump(3);
+                    $province_name=$city->province_name;
+                    $start_index=mb_strpos($data['destination'],$city->province_name.'省');
+                    if ($start_index===false)$start_index=mb_strpos($data['destination'],$city->province_name);
+                    else $province_name=$province_name.'省';
+                    $strBefore=mb_substr($data['destination'],$start_index,mb_strlen($province_name));
+                    $strAfter=mb_substr($data['destination'],$start_index+mb_strlen($province_name));
+                    $data['destination']=$strBefore.$city->name.$strAfter;
+                }
+            }
+        }
+        sign:
     }
 
 }

+ 29 - 42
app/Http/Controllers/WaybillsController.php

@@ -33,7 +33,7 @@ class WaybillsController extends Controller
     public function preciseQuery(string $column,Request $request,$waybills){
         $today=Carbon::now()->subDays(15);
         $waybillsTem=clone $waybills;
-        $waybillsTem=$waybillsTem->where($column,'like','%'.$request->input($column).'%')->where('created_at','>',$today->format('Y-m-d'));
+        $waybillsTem=$waybillsTem->where($column,'like','%'.$request->input($column).'%')->where('waybills.created_at','>',$today->format('Y-m-d'));
         if($waybillsTem->count()==0
             ||$waybillsTem->first()[$column]==$request->input($column)){
             $waybills=$waybills->where($column,$request->input($column));
@@ -77,11 +77,11 @@ class WaybillsController extends Controller
         }
         if ($request->input('created_at_start')){
             $created_at_start=$request->input('created_at_start')." 00:00:00";
-            $waybills=$waybills->where('created_at','>=',$created_at_start);
+            $waybills=$waybills->where('waybills.created_at','>=',$created_at_start);
         }
         if ($request->input('created_at_end')){
             $created_at_end=$request->input('created_at_end')." 23:59:59";
-            $waybills=$waybills->where('created_at','<=',$created_at_end);
+            $waybills=$waybills->where('waybills.created_at','<=',$created_at_end);
         }
         if ($request->input('status')){
             $waybills=$waybills->where('status',$request->input('status'));
@@ -112,52 +112,16 @@ class WaybillsController extends Controller
         })->all();
         $waybills = $this->getWaybills();
         $waybills=$waybills->whereIn('owner_id',$ownerIds);
+        if ($request->uriType=='ZF')$waybills=$waybills->where('type','直发车');
+        if ($request->uriType=='ZX')$waybills=$waybills->where('type','专线');
         if ($data != null ) {
             $waybills=$this->conditionQuery($request,$waybills);
         } else {
             $waybills = $waybills->paginate(50);
         }
-        return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
+        return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>$request->uriType??'']);
     }
 
-    public function indexZF(Request $request){
-        if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
-        $data=$request->input();
-        if ($data != null ) {
-
-            $waybills = $this->getWaybills()->where('type','直发车');
-
-            $waybills=$this->conditionQuery($request,$waybills);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
-        } else {
-            $waybills = $this->getWaybills()->where('type','直发车')->paginate(50);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
-
-        }
-    }
-
-    public function indexZX(Request $request){
-        if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
-        $data=$request->input();
-        if ($data != null ) {
-            $waybills = $this->getWaybills()->where('type','专线');
-
-            $waybills=$this->conditionQuery($request,$waybills);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
-        } else {
-            $waybills = $this->getWaybills()->where('type','专线')->paginate(50);
-            $carries = Carrier::get();
-            $owners = Owner::filterAuthorities()->get();
-            return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
-
-        }
-    }
 
     public function create()
     {
@@ -245,6 +209,29 @@ class WaybillsController extends Controller
         $this->validatorWaybillDispatch($request,$id)->validate();
 
         $data=$request->input();
+        if (!isset($data['destination']))$data['destination']=$waybill->destination;
+        if ($data['destination_city_id'] && $waybill->destination_city_id != $data['destination_city_id']){
+            $city=City::find($data['destination_city_id']);
+            if ($city && (mb_strpos($data['destination'],$city->name)===false || mb_strpos($data['destination'],$city->province_name)===false)){
+                if (mb_strpos($data['destination'],$city->name)===false && mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$city->name.$data['destination'];
+                    goto sign;
+                }
+                if (mb_strpos($data['destination'],$city->province_name)===false){
+                    $data['destination']=$city->province_name.$data['destination'];
+                }
+                if (mb_strpos($data['destination'],$city->name)===false){var_dump(3);
+                    $province_name=$city->province_name;
+                    $start_index=mb_strpos($data['destination'],$city->province_name.'省');
+                    if ($start_index===false)$start_index=mb_strpos($data['destination'],$city->province_name);
+                    else $province_name=$province_name.'省';
+                    $strBefore=mb_substr($data['destination'],$start_index,mb_strlen($province_name));
+                    $strAfter=mb_substr($data['destination'],$start_index+mb_strlen($province_name));
+                    $data['destination']=$strBefore.$city->name.$strAfter;
+                }
+            }
+        }
+        sign:
         $total_receivable=0;
         $waybill->fill($data);
         if ($waybill->save()){

+ 5 - 1
app/Waybill.php

@@ -14,7 +14,7 @@ class Waybill extends Model
         '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',
         'car_owner_info','fee','pick_up_fee','other_fee','collect_fee','dispatch_remark','waybill_price_model_id','warehouse_weight_other','warehouse_weight_unit_id_other'
-        ,'carrier_weight_other','carrier_weight_unit_id_other','source_bill','mileage','amount','inquire_tel','amount_unit_id',
+        ,'carrier_weight_other','carrier_weight_unit_id_other','source_bill','mileage','amount','inquire_tel','amount_unit_id','other_charge','other_charge_remark'
     ];
     protected $appends=[
         'origination_city_name',
@@ -28,6 +28,7 @@ class Waybill extends Model
         'amount_unit_name',
         'upload_file_url',
         'upload_file_type',
+        'destination_province_name'
     ];
 
     public function owner(){
@@ -105,6 +106,9 @@ class Waybill extends Model
     public  function  getDestinationCityNameAttribute(){
         return $this['destination_city']? $this['destination_city']['name']:null;
     }
+    function getDestinationProvinceNameAttribute(){
+        return $this['destination_city'] ? $this['destination_city']['province_name']:null;
+    }
     public function getWarehouseWeightUnitNameAttribute(){
         return $this['warehouse_weight_unit']? $this['warehouse_weight_unit']['name']:null;
     }

+ 2 - 2
database/migrations/2019_11_22_094253_create_cities_table.php

@@ -53,7 +53,7 @@ class CreateCitiesTable extends Migration
         $Henan=['郑州','开封','洛阳','平顶山','安阳','鹤壁','新乡','焦作','濮阳','许昌','漯河','三门峡','商丘','周口','驻马店','南阳','信阳','济源'];
         $Hainan=['海口','三亚'];
         $ShangHai=['上海'];
-        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
+        $provinces=['陕西','甘肃','宁夏','青海','新疆','江苏','江','安徽','江西','福建','重庆','四川','云南',
             '贵州','西藏','黑龙江','吉林','辽宁','山东','北京','天津','广西','广东','河北','山西','内蒙古',
             '湖北','湖南','河南','海南','香港','澳门','台湾','上海'];
         for ($i=0;$i<count($provinces);$i++){
@@ -111,7 +111,7 @@ class CreateCitiesTable extends Migration
                     ]);
                 }
             }
-            if ($provinces[$i]=="江"){
+            if ($provinces[$i]=="江"){
                 $province=\App\Province::where('name','=',$provinces[$i])->first();
                 for ($j=0;$j<count($ZheJiang);$j++){
                     \App\City::create([

+ 8 - 0
database/migrations/2020_07_02_135957_add_authority_table_process_rollback.php

@@ -23,6 +23,10 @@ class AddAuthorityTableProcessRollback extends Migration
         Schema::table('processes',function (Blueprint $table){
             $table->softDeletes();
         });
+        Schema::table('waybills',function (Blueprint $table){
+            $table->decimal('other_charge',7,3)->nullable()->comment('其他收费,原其他费用为其他支出');
+            $table->text('other_charge_remark')->nullable()->comment('其他费用备注');
+        });
     }
 
     /**
@@ -38,5 +42,9 @@ class AddAuthorityTableProcessRollback extends Migration
         Schema::table('processes',function (Blueprint $table){
             $table->dropSoftDeletes();
         });
+        Schema::table('waybills',function (Blueprint $table){
+            $table->dropColumn('other_charge');
+            $table->dropColumn('other_charge_remark');
+        });
     }
 }

+ 25 - 1
resources/views/waybill/edit.blade.php

@@ -311,7 +311,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
+                        <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他支出(元)</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
                                    name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif"  >
@@ -322,6 +322,30 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="other_charge" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
+                                   name="other_charge" autocomplete="off" value="@if(old('other_charge')){{ old('other_charge') }}@else{{$waybill->other_charge}}@endif"  >
+                            @error('other_charge')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="other_charge_remark" class="col-2 col-form-label text-right text-muted">其他费用备注</label>
+                        <div class="col-8">
+                            <textarea class="form-control @error('other_charge_remark') is-invalid @enderror"
+                                      name="other_charge_remark" autocomplete="off"  >@if(old('other_charge_remark')){{ old('other_charge_remark') }}@else{{$waybill->other_charge_remark}}@endif</textarea>
+                            @error('other_charge_remark')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
                         <div class="col-8">

+ 27 - 23
resources/views/waybill/index.blade.php

@@ -5,28 +5,28 @@
     <div id="nav2">
         @component('waybill.menu')
         @endcomponent
-        <div class="container-fluid nav3">
-            <div class="card menu-third" >
-                <ul class="nav nav-pills">
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index')}}" :class="{active:isActive('',3)}">全部</a>
-                        </li> @endcan
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index/ZX')}}" :class="{active:isActive('ZX',3)}">专线</a>
-                        </li> @endcan
-                    @can('运输管理-查询')
-                        <li class="nav-item">
-                            <a class="nav-link" href="{{url('waybill/index/ZF')}}" :class="{active:isActive('ZF',3)}">直发车</a>
-                        </li> @endcan
-                </ul>
-            </div>
-        </div>
     </div>
     <div class="container-fluid" style="min-width: 1500px;">
         <div class="d-none" id="list">
-            <form  method="GET" action="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif" id="optionSubmit">
+            <div class="container-fluid nav3">
+                <div class="card menu-third" >
+                    <ul class="nav nav-pills">
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index')}}" :class="!filterData.uriType || filterData.uriType=='' ? 'active' :''">全部</a>
+                            </li> @endcan
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index?uriType=ZX')}}" :class="filterData.uriType=='ZX' ? 'active' :''">专线</a>
+                            </li> @endcan
+                        @can('运输管理-查询')
+                            <li class="nav-item">
+                                <a class="nav-link" href="{{url('waybill/index?uriType=ZF')}}" :class="filterData.uriType=='ZF' ? 'active' :''">直发车</a>
+                            </li> @endcan
+                    </ul>
+                </div>
+            </div>
+            <form  method="GET" action="@if($uriType=='ZF'){{url('waybill/index?uriType=ZF')}}@elseif($uriType=='ZX'){{url('waybill/index?uriType=ZX')}}@else{{url('waybill/index')}}@endif" id="optionSubmit">
                 <table class="table table-sm table-bordered  text-nowrap mb-0" style="background: #fff;">
                     <tr v-if="isBeingFilterConditions">
                         <td colspan="4"><div class="col" style="padding:0;">
@@ -162,6 +162,8 @@
                     <th class="td-warm">上游单号</th>
                     <th class="td-warm">WMS订单号</th>
                     <th class="td-warm">运单号</th>
+                    <th class="td-warm">其他费用</th>
+                    <th class="td-warm">其他费用备注</th>
                     @can('运输管理-图片上传')<th class="td-warm">照片</th>@endcan
                     <th class="td-cool">收件人</th>
                     <th class="td-cool">收件人电话</th>
@@ -179,7 +181,7 @@
                     <th class="td-helpful">运费</th>
                     @endcan
                     <th class="td-helpful">提货费</th>
-                    <th class="td-helpful">其他费用</th>
+                    <th class="td-helpful">其他支出</th>
                     <th class="td-helpful">调度备注</th>
                     @can('运输管理-删除')
                         <th class="td-delete">操作</th>
@@ -246,6 +248,8 @@
                     <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
                     <td class="td-warm" >@{{waybill.wms_bill_number}}</td>
                     <td class="td-warm">@{{waybill.waybill_number}}</td>
+                    <td class="td-warm">@{{waybill.other_charge}}</td>
+                    <td class="td-warm">@{{waybill.other_charge_remark}}</td>
                     <td class="td-warm">
                         <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.url,waybill.suffix)">
                             <img v-if="waybill.url" :id="'img_'+waybill.id"  :data-src="waybill.url+'-thumbnail.'+waybill.suffix" src="{{url('icon/img404-thumbnail.jpg')}}">
@@ -462,12 +466,13 @@
                         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}}',
+                        destination_province_name:'{{$waybill->destination_province_name}}',
                         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}}',
-                        amount_unit_name:'{{$waybill->amount_unit_name}}',
+                        amount_unit_name:'{{$waybill->amount_unit_name}}',other_charge:'{{$waybill->other_charge}}',other_charge_remark:'{{$waybill->other_charge_remark}}',
                         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}}',
@@ -482,7 +487,7 @@
                     {paginate:'50',waybill_number:''
                         ,carrier_bill:'',carrier_id:''
                         ,owner_id:'',wms_bill_number:''
-                        ,created_at_start:'',created_at_end:''
+                        ,created_at_start:'',created_at_end:'',uriType:''
                         ,type:'',status:'',origination:'',destination:'',owners:{}},
                 wmsCommodities:[],
                 selectedStyle:[],
@@ -529,7 +534,6 @@
                 $('#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){