Преглед на файлове

合并了运输模块的修改

LD преди 6 години
родител
ревизия
d644fcec1a
променени са 36 файла, в които са добавени 1580 реда и са изтрити 135 реда
  1. 22 0
      app/AuditLog.php
  2. 29 0
      app/BillingModel.php
  3. 107 0
      app/Http/Controllers/BillingModelsController.php
  4. 1 1
      app/Http/Controllers/CarTypesController.php
  5. 1 1
      app/Http/Controllers/CarriersController.php
  6. 1 1
      app/Http/Controllers/CitiesController.php
  7. 1 1
      app/Http/Controllers/ProvincesController.php
  8. 2 2
      app/Http/Controllers/RejectedBillItemController.php
  9. 2 2
      app/Http/Controllers/TestController.php
  10. 2 2
      app/Http/Controllers/WaybillFinancialSnapshotsController.php
  11. 6 6
      app/Http/Controllers/WaybillPriceModelsController.php
  12. 74 37
      app/Http/Controllers/WaybillsController.php
  13. 12 1
      app/Waybill.php
  14. 17 0
      app/WaybillCalculate.php
  15. 1 1
      config/database.php
  16. 1 1
      config/users.php
  17. 38 0
      database/migrations/2019_12_23_175345_add_waybill_unit.php
  18. 4 0
      resources/sass/text.scss
  19. 4 0
      resources/views/maintenance/menu.blade.php
  20. 189 0
      resources/views/maintenance/waybillPriceModel/create.blade.php
  21. 200 0
      resources/views/maintenance/waybillPriceModel/edit.blade.php
  22. 57 0
      resources/views/maintenance/waybillPriceModel/import.blade.php
  23. 167 0
      resources/views/maintenance/waybillPriceModel/index.blade.php
  24. 19 0
      resources/views/maintenance/waybillPriceModel/menu.blade.php
  25. 9 3
      resources/views/rejected/create.blade.php
  26. 166 0
      resources/views/waybill/billingModel/create.blade.php
  27. 176 0
      resources/views/waybill/billingModel/edit.blade.php
  28. 99 0
      resources/views/waybill/billingModel/index.blade.php
  29. 16 0
      resources/views/waybill/billingModel/menu.blade.php
  30. 11 6
      resources/views/waybill/create.blade.php
  31. 62 26
      resources/views/waybill/edit.blade.php
  32. 58 35
      resources/views/waybill/index.blade.php
  33. 3 4
      resources/views/waybill/menu.blade.php
  34. 18 0
      resources/views/waybill/menuWaybill.blade.php
  35. 2 2
      resources/views/waybill/waybillFinancialSnapshot/index.blade.php
  36. 3 3
      routes/web.php

+ 22 - 0
app/AuditLog.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class AuditLog extends Model
+{
+    use SoftDeletes;
+    protected $table='audit_logs';
+    protected $fillable=[
+        'waybill_id','audit_stage','user_id'
+    ];
+
+    public function waybill(){
+        return $this->belongsTo('App\Waybill','waybill_id','id');
+    }
+    public function user(){
+        return $this->belongsTo('App\User','user_id','id');
+    }
+}

+ 29 - 0
app/BillingModel.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class BillingModel extends Model
+{
+
+    protected $fillable=[
+        'carrier_id','province_id','city_id','unit_id','range_min','range_max','unit_price','initial_weight'
+    ];
+
+    public function carrier(){
+        return $this->belongsTo('App\Carrier','carrier_id','id');
+    }
+
+    public  function province(){
+        return $this->belongsTo('App\Province','province_id','id');
+    }
+
+    public  function city(){
+        return $this->belongsTo('App\City','city_id','id');
+    }
+
+    public function unit(){
+        return $this->belongsTo('App\Unit','unit_id','id');
+    }
+}

+ 107 - 0
app/Http/Controllers/BillingModelsController.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\BillingModel;
+use App\Carrier;
+use App\Province;
+use App\Unit;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
+
+class BillingModelsController extends Controller
+{
+    public function index()
+    {
+        if(!Gate::allows('计费模型-查询')){ return redirect(url('/'));  }
+        $billingModels= BillingModel::paginate(50);
+        return view('waybill.billingModel.index',['billingModels'=>$billingModels]);
+    }
+
+
+    public function create()
+    {
+        if(!Gate::allows('计费模型-录入')){ return redirect(url('/'));  }
+        $carriers=Carrier::get();
+        $provinces=Province::with('cities')->get();
+        $units=Unit::get();
+        return view('waybill.billingModel.create',['carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units]);
+    }
+
+
+    public function store(Request $request)
+    {
+        if(!Gate::allows('计费模型-录入')){ return redirect(url('/'));  }
+        $this->validateBillingModel($request)->validate();
+        $billingModel=$request->input('BillingModel');
+        BillingModel::create($billingModel);
+        $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+        return redirect('billingModel')->with('successTip','新计费模型录入成功');
+    }
+
+
+
+    public function edit($id)
+    {
+        if(!Gate::allows('计费模型-编辑')){ return redirect(url('/'));  }
+        $billingModel=BillingModel::find($id);
+        $carriers=Carrier::get();
+        $provinces=Province::with('cities')->get();
+        $units=Unit::get();
+        return view('waybill.billingModel.edit',['billingModel'=>$billingModel,'carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units]);
+    }
+
+
+    public function update(Request $request, $id)
+    {
+        if(!Gate::allows('计费模型-编辑')){ return redirect(url('/'));  }
+        $this->validateBillingModel($request)->validate();
+        $billingModel=BillingModel::find($id);
+        $billingModel->fill($request->input('BillingModel'));
+        if ($billingModel->save()){
+            $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+            return redirect('billingModel')->with('successTip','新计费模型修改成功');
+        }
+    }
+
+    public function destroy($id)
+    {
+        if(!Gate::allows('计费模型-删除')){ return redirect(url('/'));  }
+        $billingModel=BillingModel::find($id);
+        $this->log(__METHOD__,__FUNCTION__,json_encode($billingModel),Auth::user()['id']);
+        $result=$billingModel->delete();
+        return ['success'=>$result];
+    }
+
+    protected function validateBillingModel(Request $request){
+        $min = $request->input('BillingModel.range_min');
+        $validator= Validator::make($request->input(),[
+            'BillingModel.province_id'=>'required|integer',
+            'BillingModel.carrier_id'=>'required|integer',
+            'BillingModel.unit_id'=>'required|integer',
+            'BillingModel.city_id'=>'required|Integer',
+            'BillingModel.range_min'=> 'required|min:0|numeric',
+            'BillingModel.range_max'=> "required|min:{$min}|numeric",
+            'BillingModel.unit_price'=>'required|min:0|numeric',
+            'BillingModel.initial_weight'=>'required|min:0|numeric',
+        ],[
+            'required'=>':attribute 为必填项',
+            'min'     =>':attribute 数值过小',
+            'max'      => ':attribute 数值过大',
+            'numeric' =>':attribute 应为数字',
+            'integer'=> ':attribute 选择错误',
+        ],[
+            'BillingModel.province_id'=>'省份',
+            'BillingModel.carrier_id'=>'承运商',
+            'BillingModel.unit_id'=>'计重单位',
+            'BillingModel.city_id'=>'城市',
+            'BillingModel.range_min'=>'价格区间最小值',
+            'BillingModel.range_max'=>'价格区间最大值',
+            'BillingModel.unit_price'=>'单价',
+            'BillingModel.initial_weight'=>'始重',
+        ]);
+        return $validator;
+    }
+}

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

@@ -14,7 +14,7 @@ class CarTypesController extends Controller
     public function index()
     {
         if(!Gate::allows('车型-查询')){ return redirect(url('/'));  }
-        $carTypes=CarType::paginate(50);
+        $carTypes=CarType::orderBy('id', 'DESC')->paginate(50);
         return view('maintenance.carType.index',['carTypes'=>$carTypes]);
     }
 

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

@@ -14,7 +14,7 @@ class CarriersController extends Controller
     public function index()
     {
         if(!Gate::allows('承运商-查询')){ return redirect(url('/'));  }
-            $carriers=Carrier::paginate(50);
+            $carriers=Carrier::orderBy('id', 'DESC')->paginate(50);
             return view('maintenance.carrier.index',['carriers'=>$carriers]);
     }
 

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

@@ -14,7 +14,7 @@ class CitiesController extends Controller
     public function index()
     {
         if(!Gate::allows('城市-查询')){ return redirect(url('/'));  }
-        $cities=City::paginate(50);
+        $cities=City::orderBy('id', 'DESC')->paginate(50);
         return view('maintenance.city.index',['cities'=>$cities]);
     }
 

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

@@ -13,7 +13,7 @@ class ProvincesController extends Controller
     public function index()
     {
         if(!Gate::allows('省份-查询')){ return redirect(url('/'));  }
-        $provinces=Province::paginate(50);
+        $provinces=Province::orderBy('id', 'DESC')->paginate(50);
         return view('maintenance.province.index',['provinces'=>$provinces]);
     }
 

+ 2 - 2
app/Http/Controllers/RejectedBillItemController.php

@@ -137,7 +137,7 @@ class RejectedBillItemController extends Controller
     public function apiPackConfirm(Request $request)
     {
         if(!Gate::allows('退货管理-录入')){
-            return ['success'=>'false','failure_info'=>'没有权限'];
+            return ['success'=>'false','fail_info'=>'没有权限'];
         }
         $ids=$request->input('ids');
         if(!$ids)return ['success'=>'false','fail_info'=>'没有内容'];
@@ -168,7 +168,7 @@ class RejectedBillItemController extends Controller
                 }
             });
 
-        if($havingFail>0)return ['success'=>'false','failure_info'=>"$havingFail/{$rejectedBillItems->count()} 条记录没有发送成功"];
+        if($havingFail>0)return ['success'=>'false','fail_info'=>"$havingFail/{$rejectedBillItems->count()} 条记录没有发送成功"];
         $this->log(__METHOD__,__FUNCTION__.'_'.$rejectedBill['id'],json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>'true'];
     }

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

@@ -28,7 +28,7 @@ class TestController extends Controller
     {
         return call_user_func([$this, $method],$request);
     }
-    function t1(Request $request){
+    function t1(Request $request){ //x
     }
     function tj(Request $request){
 
@@ -37,7 +37,7 @@ class TestController extends Controller
     function injectJS(Request $request){
         $items=RejectedBillItem::whereHas('rejectedBill',function($query){
             return $query->where('id_owner',2);
-        })->where('created_at','>','2019-12-09 13:00:00')->where('created_at','<','2019-12-09 18:00:00')->get();
+        })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get();
         (new RejectedBillItemController())->collectionsToPackConfirm($items);
     }
     public function tj2(Request $request)

+ 2 - 2
app/Http/Controllers/WaybillFinancialSnapshotsController.php

@@ -70,9 +70,9 @@ class WaybillFinancialSnapshotsController extends Controller
             'carrier_bill'=>'承运商单号',
             'origination_city'=>'始发市',
             'destination_city'=>'目的市',
-            'warehouse_weight'=>'仓库计(抛)',
+            'warehouse_weight'=>'仓库计(抛)',
             'warehouse_weight_unit'=>'仓库计重单位	',
-            'carrier_weight'=>'承运商计(抛)',
+            'carrier_weight'=>'承运商计(抛)',
             'carrier_weight_unit'=>'承运商计重单位',
             'carType'=>'车型',
             'car_owner_info'=>'车型',

+ 6 - 6
app/Http/Controllers/WaybillPriceModelsController.php

@@ -34,10 +34,10 @@ class WaybillPriceModelsController extends Controller
                 $waybillPriceModels=$waybillPriceModels->where('province_id',$request->input('province_id'));
             }
             $waybillPriceModels=$waybillPriceModels->paginate($request->input('paginate')?$request->input('paginate'):50);
-            return view('waybill.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
+            return view('maintenance.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
         }else{
             $waybillPriceModels= WaybillPriceModel::paginate(50);
-            return view('waybill.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
+            return view('maintenance.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
         }
     }
 
@@ -48,7 +48,7 @@ class WaybillPriceModelsController extends Controller
         $carriers=Carrier::get();
         $provinces=Province::get();
         $units=Unit::get();
-        return view('waybill.waybillPriceModel.create',['carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units]);
+        return view('maintenance.waybillPriceModel.create',['carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units]);
     }
 
     public function getCities($province_id){
@@ -90,7 +90,7 @@ class WaybillPriceModelsController extends Controller
             $waybillPriceModel=WaybillPriceModel::create($waybillPriceModel);
             event(new WaybillPriceModelEvent($waybillPriceModel));
             $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-            return redirect('waybill/waybillPriceModel')->with('successTip','新计费模型录入成功');
+            return redirect('maintenance/waybillPriceModel')->with('successTip','新计费模型录入成功');
         }else{
             return redirect()->back()->with('successTip','该计费模型已存在');
         }
@@ -106,7 +106,7 @@ class WaybillPriceModelsController extends Controller
         $provinces=Province::get();
         $cities=City::where('province_id',$waybillPriceModel->province_id)->get();
         $units=Unit::get();
-        return view('waybill.waybillPriceModel.edit',['waybillPriceModel'=>$waybillPriceModel,'carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units,'cities'=>$cities]);
+        return view('maintenance.waybillPriceModel.edit',['waybillPriceModel'=>$waybillPriceModel,'carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units,'cities'=>$cities]);
     }
 
 
@@ -122,7 +122,7 @@ class WaybillPriceModelsController extends Controller
         if ($waybillPriceModel->save()){
             event(new WaybillPriceModelEvent($waybillPriceModel));
             $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-            return redirect('waybill/waybillPriceModel')->with('successTip','新计费模型修改成功');
+            return redirect('maintenance/waybillPriceModel')->with('successTip','新计费模型修改成功');
         }
     }
 

+ 74 - 37
app/Http/Controllers/WaybillsController.php

@@ -55,6 +55,9 @@ class WaybillsController extends Controller
             if ($request->input('created_at_end')){
                 $waybills=$waybills->where('created_at','<',$request->input('created_at_end'));
             }
+            if ($request->input('state')){
+                $waybills=$waybills->where('state',$request->input('state'));
+            }
             $waybills=$waybills->paginate($request->input('paginate')?$request->input('paginate'):50);
             if (!$waybills&&$request->input('waybill_number')){
                 $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
@@ -68,7 +71,7 @@ class WaybillsController extends Controller
         } else {
             $waybills = Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
                 return $query->with('user');
-            }])->paginate(50);
+            }])->orderBy('id', 'DESC')->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
@@ -105,6 +108,9 @@ class WaybillsController extends Controller
             if ($request->input('created_at_end')){
                 $waybills=$waybills->where('created_at','<',$request->input('created_at_end'));
             }
+            if ($request->input('state')){
+                $waybills=$waybills->where('state',$request->input('state'));
+            }
             $waybills=$waybills->paginate($request->input('paginate')?$request->input('paginate'):50);
             if (!$waybills&&$request->input('waybill_number')){
                 $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
@@ -118,7 +124,7 @@ class WaybillsController extends Controller
         } else {
             $waybills = Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
                 return $query->with('user');
-            }])->where('type','直发车')->paginate(50);
+            }])->where('type','直发车')->orderBy('id', 'DESC')->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
@@ -155,6 +161,9 @@ class WaybillsController extends Controller
             if ($request->input('created_at_end')){
                 $waybills=$waybills->where('created_at','<',$request->input('created_at_end'));
             }
+            if ($request->input('state')){
+                $waybills=$waybills->where('state',$request->input('state'));
+            }
             $waybills=$waybills->paginate($request->input('paginate')?$request->input('paginate'):50);
             if (!$waybills&&$request->input('waybill_number')){
                 $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
@@ -168,7 +177,7 @@ class WaybillsController extends Controller
         } else {
             $waybills = Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
                 return $query->with('user');
-            }])->where('type','专线')->paginate(50);
+            }])->where('type','专线')->orderBy('id', 'DESC')->paginate(50);
             $carries = Carrier::get();
             $owners = Owner::get();
             return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
@@ -243,14 +252,16 @@ class WaybillsController extends Controller
 
     public function update(Request $request, $id)
     {
+        $waybill=Waybill::find($id);
+       // if ($request->input('carrier_bill')==$waybill->carrier_bill){};
         if(!Gate::allows('运输管理-调度')){ return redirect(url('/'));  }
         $this->validatorWaybillDispatch($request)->validate();
         $data=$request->input();
-        $waybill=Waybill::find($id);
         $waybill->fill($data);
         if ($waybill->save()){
             if ($waybill->type=="直发车"){
-                $total_receivable=($waybill->charge);
+                if ($waybill->charge)$total_receivable=($waybill->charge);
+                elseif ($waybill->collect_fee)$total_receivable=($waybill->collect_fee);
                 $total_expense=($waybill->fee)+($waybill->other_fee)-($waybill->collect_fee);
             }else if ($waybill->type=="专线"){
                 $waybillPriceModel_id=$request->input('waybillPriceModel');
@@ -270,23 +281,25 @@ class WaybillsController extends Controller
                 $total_receivable=($waybill->charge);
                 $total_expense=($waybill->pick_up_fee)+($waybill->other_fee)+($waybill->fee);
             }
-            $waybillPayoff=WaybillPayoff::where('waybill_id','=',$id)->first();
-            if ($waybillPayoff){
-                $waybillPayoff->waybill_id=$id;
-                $waybillPayoff->total_expense=$total_expense;
-                $waybillPayoff->total_receivable=$total_receivable;
-                $waybillPayoff->gross_margin=$total_receivable-$total_expense;
-                $waybillPayoff->gross_profit_rate=(($total_receivable-$total_expense)/$total_receivable);
-                $waybillPayoff->save();
-            }else{
-                WaybillPayoff::create([
-                    'waybill_id'=>$id,
-                    'total_expense'=>$total_expense,
-                    'total_receivable'=>$total_receivable,
-                    'gross_margin'=>$total_receivable-$total_expense,
-                    'gross_profit_rate'=>(($total_receivable-$total_expense)/$total_receivable),
-                ]);
-            };
+            if ($waybill->waybill_price_models&&$total_receivable){
+                $waybillPayoff=WaybillPayoff::where('waybill_id','=',$id)->first();
+                if ($waybillPayoff){
+                    $waybillPayoff->waybill_id=$id;
+                    $waybillPayoff->total_expense=$total_expense;
+                    $waybillPayoff->total_receivable=$total_receivable;
+                    $waybillPayoff->gross_margin=$total_receivable-$total_expense;
+                    $waybillPayoff->gross_profit_rate=(($total_receivable-$total_expense)/$total_receivable);
+                    $waybillPayoff->save();
+                }else{
+                    WaybillPayoff::create([
+                        'waybill_id'=>$id,
+                        'total_expense'=>$total_expense,
+                        'total_receivable'=>$total_receivable,
+                        'gross_margin'=>$total_receivable-$total_expense,
+                        'gross_profit_rate'=>(($total_receivable-$total_expense)/$total_receivable),
+                    ]);
+                };
+            }
             $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
             return redirect('waybill')->with('successTip','运单“'.$waybill->waybill_number.'”调度成功');
         }
@@ -313,9 +326,28 @@ class WaybillsController extends Controller
         if ($waybillPriceModelProvince){return ['success'=>$waybillPriceModelProvince->id];}
         $waybillPriceModelProvinceRange=WaybillPriceModel::whereRaw('carrier_id = ? and province_id = ? and unit_id = ? and range_max is null and city_id is null',
             [$carrier_id,$city->province_id,$carrier_weight_unit_id])->first();
-        if ($waybillPriceModelProvinceRange){return ['success'=>$waybillPriceModelProvinceRange->id];}else{
-            return ['success'=>false];
+        if ($waybillPriceModelProvinceRange){return ['success'=>$waybillPriceModelProvinceRange->id];}
+        $unitKG=Unit::where('name','kg')->first();
+        $unitT=Unit::where('name','T')->first();
+        if ($carrier_weight_unit_id==$unitKG){
+            $waybillPriceModelUnit=WaybillPriceModel::whereRaw('carrier_id = ? and province_id = ? and unit_id = ? and range_max >= ? and range_min < ? and city_id is null',
+                [$carrier_id,$city->province_id,$unitT->id,$carrier_weight/1000,$carrier_weight/1000])->first();
+            if ($waybillPriceModelUnit)return ['success'=>$waybillPriceModelUnit->id];
+            $waybillPriceModel=WaybillPriceModel::where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
+                ->where('range_min','<',$carrier_weight/1000)->where('range_max','>=',$carrier_weight/1000)
+                ->where('unit_id',$unitT->id)->first();
+            if ($waybillPriceModel)return ['success'=>$waybillPriceModel->id];
+        }
+        if ($carrier_weight_unit_id==$unitT){
+            $waybillPriceModelUnit=WaybillPriceModel::whereRaw('carrier_id = ? and province_id = ? and unit_id = ? and range_max >= ? and range_min < ? and city_id is null',
+                [$carrier_id,$city->province_id,$unitT->id,$carrier_weight*1000,$carrier_weight*1000])->first();
+            if ($waybillPriceModelUnit)return ['success'=>$waybillPriceModelUnit->id];
+            $waybillPriceModel=WaybillPriceModel::where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
+                ->where('range_min','<',$carrier_weight*1000)->where('range_max','>=',$carrier_weight*1000)
+                ->where('unit_id',$unitKG->id)->first();
+            if ($waybillPriceModel)return ['success'=>$waybillPriceModel->id];
         }
+        return ['success'=>false];
     }
 
     public function waybillUpdate(Request $request, $id){
@@ -371,6 +403,10 @@ class WaybillsController extends Controller
         if(!Gate::allows('运输管理-调度审核')){ return redirect(url('/'));  }
         $id=$request->input('id');
         $waybill=Waybill::find($id);
+        if (!$waybill->charge&&!$waybill->collect_fee)return ['exception'=>'收费或到付费用未填!'];
+        if ($waybill->charge==0&&$waybill->collect_fee==0)return ['exception'=>'收费与到付费用都为0!'];
+        if (!$waybill->carrier_weight||$waybill->carrier_weight==0)return ['exception'=>'承运商计重未填或为0!'];
+        if (!$waybill->carrier_weight_unit_id)return ['exception'=>'承运商计重单位未选!'];
         $isAudit=WaybillAuditLog::whereRaw('waybill_id = ? and audit_stage = ?',[$id,"调度阶段"])->first();
         if (empty($isAudit)){
             $waybillAuditLog=new WaybillAuditLog([
@@ -381,7 +417,7 @@ class WaybillsController extends Controller
             $waybillAuditLog->save();
             $waybillAuditLog['user']=Auth::user();
             if ($waybill->waybill_price_model_id||$waybill->type=='直发车'){
-                $waybill->state='完结';
+                $waybill->state='完结';
                 $result=$waybill->save();
                 $waybillPayoff=WaybillPayoff::where('waybill_id','=',$id)->first();
                 $waybillPayoff->load(["waybill"]);
@@ -392,7 +428,6 @@ class WaybillsController extends Controller
                     'waybill_id'=>$id,
                     'json_content'=>$waybillPayoffJson,
                 ]);
-
             }else{
                 $waybill->state='未定义计费模型';
                 $result=$waybill->save();
@@ -429,9 +464,9 @@ class WaybillsController extends Controller
             'carrier_bill'=>'承运商单号',
             'origination_city'=>'始发市',
             'destination_city'=>'目的市',
-            'warehouse_weight'=>'仓库计(抛)',
+            'warehouse_weight'=>'仓库计(抛)',
             'warehouse_weight_unit'=>'仓库计重单位	',
-            'carrier_weight'=>'承运商计(抛)',
+            'carrier_weight'=>'承运商计(抛)',
             'carrier_weight_unit'=>'承运商计重单位',
             'carType'=>'车型',
             'car_owner_info'=>'车辆信息',
@@ -508,7 +543,7 @@ class WaybillsController extends Controller
     protected function validatorWaybill(Request $request){
         $validator=Validator::make($request->input(),[
             'owner_id'=>'required',
-            'wms_bill_number'=>'nullable|alpha_num|max:50|unique:waybills,wms_bill_number',
+            'wms_bill_number'=>'nullable|max:50|unique:waybills,wms_bill_number',
             'origination'=>'required|max:255',
             'destination'=>'required|max:255',
             'recipient'=>'required|max:50',
@@ -539,7 +574,7 @@ class WaybillsController extends Controller
     protected function validatorWaybillDispatch(Request $request){
         if ($request->input('type')=='直发车'){
             $validator=Validator::make($request->input(),[
-                'carrier_bill'=>'required|alpha_num|max:50|unique:waybills,carrier_bill',
+                'carrier_bill'=>'nullable|max:50|unique:waybills,carrier_bill',
                 'fee'=>'required|min:0|numeric|max:999999',
                 'other_fee'=>'nullable|min:0|numeric|max:999999',
                 'charge'=>'nullable|min:0|numeric|max:999999',
@@ -559,14 +594,15 @@ class WaybillsController extends Controller
             return $validator;
         }else if ($request->input('type')=='专线'){
             $validator=Validator::make($request->input(),[
-                'carrier_bill'=>'required|alpha_num|max:50|unique:waybills,carrier_bill',
-                'warehouse_weight'=>'required|min:0|numeric|max:999999',
-                'carrier_weight'=>'required|min:0|numeric|max:999999',
-                'pick_up_fee'=>'required|min:0|numeric|max:999999',
+                'carrier_bill'=>'nullable|max:50|unique:waybills,carrier_bill',
+                'warehouse_weight'=>'nullable|min:0|numeric|max:999999',
+                'carrier_weight'=>'nullable|min:0|numeric|max:999999',
+                'pick_up_fee'=>'nullable|min:0|numeric|max:999999',
                 'other_fee'=>'nullable|min:0|numeric|max:999999',
                 'carrier_id'=>'required|integer',
                 'destination_city_id'=>'required|integer',
-                'carrier_weight_unit_id'=>'required|integer',
+                'warehouse_weight_unit_id'=>'nullable|integer',
+                'carrier_weight_unit_id'=>'nullable|integer',
                 'charge'=>'nullable|min:0|numeric|max:999999',
             ],[
                 'required'=>':attribute 为必填项',
@@ -577,14 +613,15 @@ class WaybillsController extends Controller
                 'unique'=>':attribute 已存在',
             ],[
                 'carrier_bill'=>'承运商单号',
-                'warehouse_weight'=>'仓库计(抛)',
-                'carrier_weight'=>'承运商计(抛)',
+                'warehouse_weight'=>'仓库计(抛)',
+                'carrier_weight'=>'承运商计(抛)',
                 'pick_up_fee'=>'提货费',
                 'other_fee'=>'其他费用',
                 'carrier_id'=>'承运商',
                 'destination_city_id'=>'目的市',
                 'carrier_weight_unit_id'=>'承运商计重单位',
                 'charge'=>'收费',
+                'warehouse_weight_unit_id'=>'仓库计重单位',
             ]);
             return $validator;
         }else{

+ 12 - 1
app/Waybill.php

@@ -10,7 +10,8 @@ class Waybill extends Model
     protected $fillable=[
         'state','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'
+        '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',
     ];
     protected $appends=[
         'origination_city_name',
@@ -19,6 +20,8 @@ class Waybill extends Model
         'destination_city_name',
         'warehouse_weight_unit_name',
         'carrier_weight_unit_name',
+        'warehouse_weight_unit_other_name',
+        'carrier_weight_unit_other_name',
     ];
 
     public function owner(){
@@ -45,6 +48,14 @@ class Waybill extends Model
         return $this->belongsTo('App\Unit','carrier_weight_unit_id','id');
     }
 
+    public function warehouse_weight_unit_other(){
+        return $this->belongsTo('App\Unit','warehouse_weight_unit_other','id');
+    }
+
+    public function carrier_weight_unit_other(){
+        return $this->belongsTo('App\Unit','carrier_weight_unit_other','id');
+    }
+
     public function carType(){
         return $this->belongsTo('App\CarType','carType_id','id');
     }

+ 17 - 0
app/WaybillCalculate.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class WaybillCalculate extends Model
+{
+
+    protected $fillable=[
+        'waybill_id','total_expense','total_receivable','gross_margin','gross_profit_rate'
+    ];
+
+    public function waybill(){
+        return $this->belongsTo('App\Waybill','waybill_id','id');
+    }
+}

+ 1 - 1
config/database.php

@@ -56,7 +56,7 @@ return [
             'collation' => 'utf8mb4_unicode_ci',
             'prefix' => '',
             'prefix_indexes' => true,
-            'strict' => false,
+            'strict' => true,
             'engine' => null,
             'options' => extension_loaded('pdo_mysql') ? array_filter([
                 PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),

+ 1 - 1
config/users.php

@@ -3,6 +3,6 @@
 return [
 
 
-    'superAdmin' => ['ldaaww','baoshi56','zhouyaping','shiyao','admin'],
+    'superAdmin' => ['ldaaww','baoshi56','zhouyaping','shiyao'],
 
 ];

+ 38 - 0
database/migrations/2019_12_23_175345_add_waybill_unit.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddWaybillUnit extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('waybills',function (Blueprint $table){
+            $table->decimal('warehouse_weight_other')->nullable()->comment('仓库计数二');
+            $table->bigInteger('warehouse_weight_unit_id_other')->nullable()->index()->comment('仓库计数单位二');
+            $table->decimal('carrier_weight_other')->nullable()->comment('承运商计数二');
+            $table->bigInteger('carrier_weight_unit_id_other')->nullable()->index()->comment('承运商计数单位二');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->dropColumn('warehouse_weight_other');
+            $table->dropColumn('warehouse_weight_unit_id_other');
+            $table->dropColumn('carrier_weight_other');
+            $table->dropColumn('carrier_weight_unit_id_other');
+        });
+    }
+}

+ 4 - 0
resources/sass/text.scss

@@ -0,0 +1,4 @@
+//text
+.del{
+    text-decoration-line: line-through;
+}

+ 4 - 0
resources/views/maintenance/menu.blade.php

@@ -50,6 +50,10 @@
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/carType')}}" :class="{active:isActive('carType',2)}">车型</a>
                 </li> @endcan
+            @can('计费模型')
+                <li class="nav-item">
+                    <a class="nav-link text-dark" href="{{url('maintenance/waybillPriceModel')}}" :class="{active:isActive('waybillPriceModel',2)}">计费模型</a>
+                </li> @endcan
             @can('日志')
                 <li class="nav-item">
                     <a class="nav-link text-muted" href="{{url('maintenance/log')}}" :class="{active:isActive('log',2)}">日志</a>

+ 189 - 0
resources/views/maintenance/waybillPriceModel/create.blade.php

@@ -0,0 +1,189 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.waybillPriceModel.menu')@endcomponent
+    </div>
+    <div class="container mt-3" id="list">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                <form method="POST" action="{{ url('maintenance/waybillPriceModel') }}">
+                    @if(Session::has('successTip'))
+                        <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                    @endif
+                    @csrf
+                    <div class="form-group row">
+                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <div class="col-8">
+                            <select class="form-control" name="WaybillPriceModel[carrier_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.carrier_id">
+                                    <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.carrier_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="province_id"  class="col-2 col-form-label text-right">选择省份</label>
+                        <div class="col-8" >
+                            <select class="form-control" name="WaybillPriceModel[province_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.province_id" @change="changeProvince($event)">
+                                <option v-for="province in provinces" :value="province.id">@{{province.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.province_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="city_id"  class="col-2 col-form-label text-right">选择城市</label>
+                        <div class="col-8" >
+                            <select class="form-control" name="WaybillPriceModel[city_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.city_id">
+                                <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.city_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_id"  class="col-2 col-form-label text-right">货物单位</label>
+                        <div class="col-8" >
+                            <select class="form-control" name="WaybillPriceModel[unit_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.unit_id">
+                                <option v-for="unit in units" :value="unit.id">@{{unit.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.unit_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="range_min" class="col-2 col-form-label text-right">计价区间</label>
+                        <div class="col-8 form-inline">
+                            <input  type="text" style="width: 20%" class="form-control @error('WaybillPriceModel.range_min') is-invalid @enderror"
+                                   name="WaybillPriceModel[range_min]" autocomplete="off" value="{{ old('WaybillPriceModel')['range_min'] }}" >&nbsp;&nbsp;--&nbsp;&nbsp;
+                            <input type="text" style="width: 20%" class="form-control @error('WaybillPriceModel.range_max') is-invalid @enderror"
+                                   name="WaybillPriceModel[range_max]" autocomplete="off" value="{{ old('WaybillPriceModel')['range_max'] }}" >
+                            @error('WaybillPriceModel.range_min')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                            @error('WaybillPriceModel.range_max')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">单价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('WaybillPriceModel.unit_price') is-invalid @enderror"
+                                   name="WaybillPriceModel[unit_price]" autocomplete="off" value="{{ old('WaybillPriceModel')['unit_price'] }}" >
+                            @error('WaybillPriceModel.unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="base_fee" class="col-2 col-form-label text-right">起步费(元)</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('WaybillPriceModel.base_fee') is-invalid @enderror"
+                                   name="WaybillPriceModel[base_fee]" autocomplete="off" value="{{ old('WaybillPriceModel')['base_fee'] }}" >
+                            @error('WaybillPriceModel.base_fee')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="initial_weight" class="col-2 col-form-label text-right">最低计数</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('WaybillPriceModel.initial_weight') is-invalid @enderror"
+                                   name="WaybillPriceModel[initial_weight]" autocomplete="off" value="{{ old('WaybillPriceModel')['initial_weight'] }}" >
+                            @error('WaybillPriceModel.initial_weight')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let insertVue=new Vue({
+            el:'#list',
+            data:{
+                inputting:{
+                    WaybillPriceModel:{
+                        @if(isset(old('WaybillPriceModel')['province_id']))
+                        province_id:'{{old('WaybillPriceModel')['province_id']}}',
+                        @endif
+                        @if(isset(old('WaybillPriceModel')['city_id']))
+                        city_id:'{{old('WaybillPriceModel')['city_id']}}',
+                        @endif
+                        @if(isset(old('WaybillPriceModel')['carrier_id']))
+                        carrier_id:'{{old('WaybillPriceModel')['carrier_id']}}',
+                        @endif
+                        @if(isset(old('WaybillPriceModel')['unit_id']))
+                        unit_id:'{{old('WaybillPriceModel')['unit_id']}}',
+                        @endif
+                    }
+                },
+                provinces:[
+                    @foreach($provinces as $province)
+                        {id:'{{$province->id}}',name:'{{$province->name}}' },
+                    @endforeach
+                ],
+                cities:[
+                ],
+                carriers:[
+                    @foreach($carriers as $carrier)
+                        {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                units:[
+                    @foreach($units as $unit)
+                    {id:'{{$unit->id}}',name:'{{$unit->name}}'},
+                    @endforeach
+                ],
+            },
+           methods:{
+               changeProvince(e){
+                   let _this=this;
+                   let val=e.target.value;
+                   axios.get('cities/'+val).then(
+                        function (response) {
+                            _this.cities=response.data.cities;
+                        }
+                   );
+                   /*let _this=this;
+                   let province_id=this.inputting.WaybillPriceModel.province_id;
+                   this.provinces.forEach(function (province) {
+                       if(province.id+''===province_id+''){
+                           _this.cities=province.cities;
+                           return
+                       }
+                       return null
+                   })*/
+               }
+           },
+        });
+
+    </script>
+@endsection

+ 200 - 0
resources/views/maintenance/waybillPriceModel/edit.blade.php

@@ -0,0 +1,200 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.waybillPriceModel.menu')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">修改</a>
+                </li>
+        @endcomponent
+    </div>
+    <div class="container mt-3" id="list">
+        <div class="card">
+            <div class="card-body">
+                <form method="POST" action='{{url("maintenance/waybillPriceModel/{$waybillPriceModel->id}")}}'>
+                    @csrf
+                    @method('PUT')
+                    <div class="form-group row">
+                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <div class="col-8">
+                            <select name="WaybillPriceModel[carrier_id]" v-model="inputting.WaybillPriceModel.carrier_id" style="width: 30%;" class="form-control">
+                                <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.carrier_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="province_id"  class="col-2 col-form-label text-right">选择省份</label>
+                        <div class="col-8" >
+                            <select name="WaybillPriceModel[province_id]" v-model="inputting.WaybillPriceModel.province_id" @change="changeProvince($event)" style="width: 30%;"
+                            class="form-control">
+                                <option v-for="province in provinces" :value="province.id">@{{province.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.province_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="city_id"  class="col-2 col-form-label text-right">选择城市</label>
+                        <div class="col-8" >
+                            <select name="WaybillPriceModel[city_id]" v-model="inputting.WaybillPriceModel.city_id" style="width: 30%;" class="form-control">
+                                <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.city_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_id"  class="col-2 col-form-label text-right">货物单位</label>
+                        <div class="col-8" >
+                            <select name="WaybillPriceModel[unit_id]" v-model="inputting.WaybillPriceModel.unit_id" style="width: 30%;" class="form-control">
+                                <option v-for="unit in units" :value="unit.id" >@{{unit.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.unit_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="range_min" class="col-2 col-form-label text-right">计价区间</label>
+                        <div class="col-8 form-inline">
+                            <input type="text" style="width: 20%" class="form-control @error('WaybillPriceModel.range_min') is-invalid @enderror"
+                                   name="WaybillPriceModel[range_min]" autocomplete="off" value="{{old('WaybillPriceModel')['range_min']?old('WaybillPriceModel')['range_min']:$waybillPriceModel->range_min}}" >&nbsp;&nbsp;--&nbsp;&nbsp;
+                            <input type="text"  style="width: 20%" class="form-control @error('WaybillPriceModel.range_max') is-invalid @enderror"
+                                   name="WaybillPriceModel[range_max]" autocomplete="off" value="{{old('WaybillPriceModel')['range_max']?old('WaybillPriceModel')['range_max']:$waybillPriceModel->range_max}}" >
+                            @error('WaybillPriceModel.range_min')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                            @error('WaybillPriceModel.range_max')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">单价</label>
+                        <div class="col-8">
+                            <input type="text"  class="form-control @error('WaybillPriceModel.unit_price') is-invalid @enderror"
+                                   name="WaybillPriceModel[unit_price]" autocomplete="off" value="{{old('WaybillPriceModel')['unit_price']?old('WaybillPriceModel')['unit_price']:$waybillPriceModel->unit_price}}" >
+                            @error('WaybillPriceModel.unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="base_fee" class="col-2 col-form-label text-right">起步费(元)</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('WaybillPriceModel.base_fee') is-invalid @enderror"
+                                   name="WaybillPriceModel[base_fee]" autocomplete="off" value="{{old('WaybillPriceModel')['base_fee']?old('WaybillPriceModel')['base_fee']:$waybillPriceModel->base_fee}}" >
+                            @error('WaybillPriceModel.base_fee')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="initial_weight" class="col-2 col-form-label text-right">最低计数</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('WaybillPriceModel.initial_weight') is-invalid @enderror"
+                                   name="WaybillPriceModel[initial_weight]" autocomplete="off" value="{{old('WaybillPriceModel')['initial_weight']?old('WaybillPriceModel')['initial_weight']:$waybillPriceModel->initial_weight}}" >
+                            @error('WaybillPriceModel.initial_weight')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-outline-dark form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let insertVue=new Vue({
+            el:'#list',
+            data:{
+                inputting:{
+                    WaybillPriceModel:{
+                        carrier_id:'{{old('WaybillPriceModel')['carrier_id']?old('WaybillPriceModel')['carrier_id']:$waybillPriceModel->carrier_id}}',
+                        province_id:'{{old('WaybillPriceModel')['province_id']?old('WaybillPriceModel')['province_id']:$waybillPriceModel->province_id}}',
+                        city_id:'{{old('WaybillPriceModel')['city_id']?old('WaybillPriceModel')['city_id']:$waybillPriceModel->city_id}}',
+                        unit_id:'{{old('WaybillPriceModel')['unit_id']?old('WaybillPriceModel')['unit_id']:$waybillPriceModel->unit_id}}',
+                    }
+                },
+                provinces:[
+                    @foreach($provinces as $province)
+                    {id:'{{$province->id}}',name:'{{$province->name}}' },
+                    @endforeach
+                ],
+                cities:[
+                    @foreach($cities as $city)
+                    {id:'{{$city->id}}',name:'{{$city->name}}'},
+                    @endforeach
+                ],
+                carriers:[
+                     @foreach($carriers as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                units:[
+                    @foreach($units as $unit)
+                    {id:'{{$unit->id}}',name:'{{$unit->name}}'},
+                    @endforeach
+                ],
+                waybillPriceModel:[
+                        {id:'{{$waybillPriceModel->id}}',created_at:'{{$waybillPriceModel->created_at}}',
+                        carrier_id:'{{$waybillPriceModel->carrier_id}}',province_id:'{{$waybillPriceModel->province_id}}',
+                        city_id:'{{$waybillPriceModel->city_id}}',unit_id:'{{$waybillPriceModel->unit_id}}',
+                        section:'{{$waybillPriceModel->section}}',unit_price:'{{$waybillPriceModel->unit_price}}',initial_weight:'{{$waybillPriceModel->initial_weight}}'},
+                ]
+            },
+            mounted:function(){
+                this.inputting.WaybillPriceModel.city_id='{{$waybillPriceModel->city_id}}';
+            },
+            methods:{
+                changeProvince(e){
+                    let _this=this;
+                    let val=e.target.value;
+                    axios.get('../cities/'+val).then(
+                        function (response) {
+                            _this.cities=response.data.cities;
+                        }
+                    );
+                }
+            },
+/*                changeProvince(){
+                    let _this=this;
+                    let province_id=this.inputting.WaybillPriceModel.province_id;
+                    this.provinces.forEach(function (province) {
+                        if(province.id+''===province_id+''){
+                            _this.cities=province.cities;
+                            return
+                        }
+                        return null
+                    })
+                }*/
+        });
+
+    </script>
+@endsection

+ 57 - 0
resources/views/maintenance/waybillPriceModel/import.blade.php

@@ -0,0 +1,57 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.waybillPriceModel.menu')@endcomponent
+    </div>
+    <div class="container mt-3">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                <form method="POST" action="{{ url('waybillPriceModel/excel/import') }}" enctype="multipart/form-data" target="_blank">
+                    @csrf
+                    <div class="form-group row text-center">
+                        <div class="col-12 text-danger">
+
+                            注意:请保证表第一行有以下对应的字段名<br>(可不按顺序,承运商,计数单位,省份,单价为必填项,其余字段不填或填入错误数据则导入默认值0):<br>
+                            承运商,计数单位,计数区间,省份,单价,市,起步费,最低计数<br>
+                        </div>
+                        <div class="col-12 text-info ">
+                            导入时间随文件大小可能达数十分钟以上,请耐心等候
+                            <hr>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="sku" class="col-2 col-form-label text-right">选择EXCEL</label>
+                        <div class="col-8">
+                            <div class="form-control">
+                                <input type="file" class="form-control-file @error('file') is-invalid @enderror"
+                                       name="file" value="{{ old('file') }}" required>
+                                @error('file')
+                                <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                                @enderror
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="sku" class="col-2 col-form-label text-right">是否覆盖</label>
+                        <div class="col-8">
+                            <select name="isOverride" id="isOverride" class="form-control" >
+                                <option value="0">仅新增</option>
+                                <option value="1">新增且覆盖</option>
+                            </select>
+                            <p class="text-muted">覆盖会以承运商,计数单位,计数区间,省份为依据,覆盖其余字段</p>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control" value="执行导入">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection

+ 167 - 0
resources/views/maintenance/waybillPriceModel/index.blade.php

@@ -0,0 +1,167 @@
+
+@extends('layouts.app')
+
+@section('content')
+    <span id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.waybillPriceModel.menu')@endcomponent
+    </span>
+    <div id="list">
+    <div class="container mt-3">
+        <div class="card">
+            <div>
+                <form  method="GET" action="{{url('maintenance/waybillPriceModel')}}" style="margin-top: 1%" id="optionSubmit">
+                    <table class="table  table-sm table-bordered table-hover text-nowrap ">
+                        <tr>
+                            <td  > <label style="margin-left: 2%" class="form-inline">页显示条数:
+                                <select name="paginate" v-model="filterData.paginate" class="form-control" @change="setPaginate">
+                                    <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></label></td>
+                            <td > <label class="form-inline" style="margin-left: 2%">承运商:
+                                <select name="carrier_id" v-model="filterData.carrier_id" class="form-control"  @change="setCarrier">
+                                    <option >    </option>
+                                    @foreach($carriers as $carrier)
+                                        <option value="{{$carrier->id}}">{{$carrier->name}}</option>
+                                    @endforeach
+                                </select></label></td>
+                            <td><label class="form-inline" style="margin-left: 2%">省份:
+                                <select name="province_id" v-model="filterData.province_id" class="form-control" @change="setProvince">
+                                    <option>    </option>
+                                    @foreach($provinces as $province)
+                                        <option value="{{$province->id}}">{{$province->name}}</option>
+                                    @endforeach
+                                </select><input hidden type="submit" value="kk"></label></td>
+                        </tr>
+                    </table>
+                </form>
+            </div>
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <table class="table table-striped table-sm">
+                    <tr>
+                        <th>代码</th>
+                        <th>承运商名称</th>
+                        <th>省份</th>
+                        <th>城市</th>
+                        <th>计重单位</th>
+                        <th>区间</th>
+                        <th>单价(元)</th>
+                        <th>起步费(元)</th>
+                        <th>最低计数</th>
+                        <th>录入时间</th>
+                    </tr>
+                    <tr v-for="waybillPriceModel in waybillPriceModels">
+                        <td class="text-muted">@{{waybillPriceModel.id}}</td>
+                        <td>@{{waybillPriceModel.carrier}}</td>
+                        <td>@{{waybillPriceModel.province}}</td>
+                        <td>@{{waybillPriceModel.city}}</td>
+                        <td>@{{waybillPriceModel.unit}}</td>
+                        <td>@{{waybillPriceModel.range_min}}<a v-if="waybillPriceModel.range_min&&waybillPriceModel.range_max">&nbsp;&nbsp;--&nbsp;&nbsp;</a> @{{waybillPriceModel.range_max}}</td>
+                        <td>@{{waybillPriceModel.unit_price}}</td>
+                        <td>@{{waybillPriceModel.base_fee}}</td>
+                        <td>@{{waybillPriceModel.initial_weight}}</td>
+                        <td class="text-muted">@{{waybillPriceModel.created_at}}</td>
+                        <td>
+                            @can('计费模型-编辑')
+                                <button class="btn btn-sm btn-outline-primary" @click="edit(waybillPriceModel.id)">改</button> @endcan
+                            @can('计费模型-删除')
+                                <button class="btn btn-sm btn-outline-dark" @click="destroy(waybillPriceModel)">删</button> @endcan
+                        </td>
+                    </tr>
+                </table>
+                {{$waybillPriceModels->appends($filterData)->links()}}
+            </div>
+        </div>
+    </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#list",
+            data:{
+                waybillPriceModels:[
+                    @foreach( $waybillPriceModels as $waybillPriceModel )
+                        {id:'{{$waybillPriceModel->id}}',carrier:'{{$waybillPriceModel->carrier_name}}',
+                        province:'{{$waybillPriceModel->province_name}}',city:'{{$waybillPriceModel->city_name}}',
+                        unit:'{{$waybillPriceModel->unit_name}}',range_min:'{{$waybillPriceModel->range_min}}',range_max:'{{$waybillPriceModel->range_max}}',
+                        unit_price:'{{$waybillPriceModel->unit_price}}',base_fee:'{{$waybillPriceModel->base_fee}}',initial_weight:'{{$waybillPriceModel->initial_weight}}',
+                        created_at:'{{$waybillPriceModel->created_at}}'},
+                    @endforeach
+                ],
+                filterData:
+                    {paginate:'50',carrier_id:'',province_id: ''},
+            },
+            mounted:function(){
+                this.initInputs();
+            },
+            methods:{
+                edit:function(id){
+                    location.href = "{{url('maintenance/waybillPriceModel')}}/"+id+"/edit";
+                },
+                destroy:function(waybillPriceModel){
+                    if(!confirm('确定要删除该计费模型吗?')){return};
+                    let data=this;
+                    let url = "{{url('maintenance/waybillPriceModel')}}/"+waybillPriceModel.id;
+                    axios.delete(url,{id:waybillPriceModel.id})
+                        .then(function (response) {
+                            if(response.data.success){
+                                for (let i = 0; i < data.waybillPriceModels.length; i++) {
+                                    if (data.waybillPriceModels[i].id===waybillPriceModel.id){
+                                        data.waybillPriceModels.splice(i,1);
+                                        break;
+                                    }
+                                }
+                                tempTip.setDuration(1000);
+                                tempTip.showSuccess('删除计费模型成功!')
+                            }else{
+                                tempTip.setDuration(1000);
+                                tempTip.show('删除计费模型失败!')
+                            }
+                        })
+                        .catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('删除计费模型失败!'+'网络错误:' + err);
+                            console.log(err);
+                        });
+                },
+                initInputs:function(){
+                    let data=this;
+                    let uriParts =decodeURI(location.href).split("?");
+                    if(uriParts.length>1){
+                        let params = uriParts[1].split('&');
+                        params.forEach(function(paramPair){
+                            let pair=paramPair.split('=');
+                            let key = pair[0], val = pair[1];
+                            $('input[name="'+key+'"]').val(val);
+                            $('select[name="'+key+'"]').val(val);
+                            decodeURI(data.filterData[key]=val);
+                        });
+                    }
+                },
+                setPaginate:function(e){
+                    this.filterData.paginate=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+                setCarrier:function (e){
+                    this.filterData.carrier_id=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+                setProvince:function (e){
+                    this.filterData.province_id=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+            }
+        });
+    </script>
+@endsection

+ 19 - 0
resources/views/maintenance/waybillPriceModel/menu.blade.php

@@ -0,0 +1,19 @@
+<div class="container">
+    <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
+        <ul class="nav nav-pills">
+            @can('计费模型-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('maintenance/waybillPriceModel')}}" :class="{active:isActive('',3)}">查询</a>
+                </li> @endcan
+            @can('计费模型-录入')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('maintenance/waybillPriceModel/create')}}" :class="{active:isActive('create',3)}">录入</a>
+                </li> @endcan
+            @can('计费模型-录入')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('maintenance/waybillPriceModel/excel/goImport')}}" :class="{active:isActive('goImport',4)}">导入</a>
+                </li> @endcan
+            {{$slot}}
+        </ul>
+    </div>
+</div>

+ 9 - 3
resources/views/rejected/create.blade.php

@@ -695,7 +695,7 @@
                     let url='{{url('apiLocal/rejectedBillItem/packConfirm')}}';
                     axios.post(url,{'ids':ids}).then(function (response) {
                         _this.cleanError();
-                        if(response.data.success==='true'){
+                        if(response&&response.data&&response.data.success==='true'){
                             if(typeof(response.data.bill_is_loaded)!='undefined'){
                                 if(response.data.bill_is_loaded===true){
                                     _this.status.editingBill.is_loaded=1;
@@ -709,11 +709,17 @@
                             _this.cancelPackCommitEdit();
                         }else{
                             tempTip.setDuration(4000);
-                            tempTip.show('录入明细列表失败,请重试:'+response.data.fail_info)
+                            let fail_info='';
+                            if(response.data)
+                                fail_info=response.data.fail_info;
+                            tempTip.show('录入明细列表失败,请重试:'+fail_info)
                         }
                     }).catch(function (response) {
                         tempTip.setDuration(3000);
-                        tempTip.show('提交失败,请重试:'+response.data.fail_info);
+                        let fail_info='';
+                        if(response.data)
+                            fail_info=response.data.fail_info;
+                        tempTip.show('提交失败,请重试:'+fail_info);
                         alert('连接错误:'+response)
                     });
                 },

+ 166 - 0
resources/views/waybill/billingModel/create.blade.php

@@ -0,0 +1,166 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('waybill.billingModel.menu')@endcomponent
+    </div>
+    <div class="container mt-3" id="list">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                <form method="POST" action="{{ url('billingModel') }}">
+                    @csrf
+                    <div class="form-group row">
+                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <div class="col-8">
+                            <select name="BillingModel[carrier_id]" style="width: 30%;height: 30px" v-model="inputting.BillingModel.carrier_id">
+                                    <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.carrier_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="province_id"  class="col-2 col-form-label text-right">选择省份</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[province_id]" style="width: 30%;height: 30px" v-model="inputting.BillingModel.province_id" @change="changeProvince($event)">
+                                <option v-for="province in provinces" :value="province.id">@{{province.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.province_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="city_id"  class="col-2 col-form-label text-right">选择城市</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[city_id]" style="width: 30%;height: 30px" v-model="inputting.BillingModel.city_id">
+                                <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.city_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_id"  class="col-2 col-form-label text-right">货物单位</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[unit_id]" style="width: 30%;height: 30px" v-model="inputting.BillingModel.unit_id">
+                                <option v-for="unit in units" :value="unit.id">@{{unit.name}}</option>
+                            </select>
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.unit_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="range_min" class="col-2 col-form-label text-right">价格区间</label>
+                        <div class="col-8 form-inline">
+                            <input  type="text" style="width: 20%" class="form-control @error('BillingModel.range_min') is-invalid @enderror"
+                                   name="BillingModel[range_min]" autocomplete="off" value="{{ old('BillingModel')['range_min'] }}" >----
+                            <input type="text" style="width: 20%" class="form-control @error('BillingModel.range_max') is-invalid @enderror"
+                                   name="BillingModel[range_max]" autocomplete="off" value="{{ old('BillingModel')['range_max'] }}" >
+                            @error('BillingModel.range_min')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                            @error('BillingModel.range_max')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">单价</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('BillingModel.unit_price') is-invalid @enderror"
+                                   name="BillingModel[unit_price]" autocomplete="off" value="{{ old('BillingModel')['unit_price'] }}" >
+                            @error('BillingModel.unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="initial_weight" class="col-2 col-form-label text-right">始重</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('BillingModel.initial_weight') is-invalid @enderror"
+                                   name="BillingModel[initial_weight]" autocomplete="off" value="{{ old('BillingModel')['initial_weight'] }}" >
+                            @error('BillingModel.initial_weight')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let insertVue=new Vue({
+            el:'#list',
+            data:{
+                inputting:{
+                    BillingModel:{
+                        @if(isset(old('BillingModel')['province_id']))
+                        province_id:'{{old('BillingModel')['province_id']}}',
+                        @endif
+                        @if(isset(old('BillingModel')['city_id']))
+                        city_id:'{{old('BillingModel')['city_id']}}',
+                        @endif
+                        @if(isset(old('BillingModel')['carrier_id']))
+                        carrier_id:'{{old('BillingModel')['carrier_id']}}',
+                        @endif
+                        @if(isset(old('BillingModel')['unit_id']))
+                        unit_id:'{{old('BillingModel')['unit_id']}}',
+                        @endif
+                    }
+                },
+                provinces:[
+                    @foreach($provinces as $province)
+                        {id:'{{$province->id}}',name:'{{$province->name}}',cities:{!! $province->cities !!} },
+                    @endforeach
+                ],
+                cities:[
+                ],
+                carriers:[
+                    @foreach($carriers as $carrier)
+                        {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                units:[
+                    @foreach($units as $unit)
+                    {id:'{{$unit->id}}',name:'{{$unit->name}}'},
+                    @endforeach
+                ],
+            },
+           methods:{
+               changeProvince(){
+                   let _this=this;
+                   let province_id=this.inputting.BillingModel.province_id;
+                   this.provinces.forEach(function (province) {
+                       if(province.id+''===province_id+''){
+                           _this.cities=province.cities;
+                           return
+                       }
+                       return null
+                   })
+               }
+           },
+        });
+
+    </script>
+@endsection

+ 176 - 0
resources/views/waybill/billingModel/edit.blade.php

@@ -0,0 +1,176 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('waybill.billingModel.menu')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">修改</a>
+                </li>
+        @endcomponent
+    </div>
+    <div class="container mt-3" id="list">
+        <div class="card">
+            <div class="card-body">
+                <form method="POST" action='{{url("billingModel/{$billingModel->id}")}}'>
+                    @csrf
+                    @method('PUT')
+                    <div class="form-group row">
+                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <div class="col-8">
+                            <select name="BillingModel[carrier_id]" v-model="inputting.BillingModel.carrier_id" style="width: 30%;height: 30px">
+                                <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.carrier_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="province_id"  class="col-2 col-form-label text-right">选择省份</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[province_id]" v-model="inputting.BillingModel.province_id" @change="changeProvince($event)" style="width: 30%;height: 30px">
+                                <option v-for="province in provinces" :value="province.id">@{{province.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.province_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="city_id"  class="col-2 col-form-label text-right">选择城市</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[city_id]" v-model="inputting.BillingModel.city_id" style="width: 30%;height: 30px">
+                                <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.city_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_id"  class="col-2 col-form-label text-right">货物单位</label>
+                        <div class="col-8" >
+                            <select name="BillingModel[unit_id]" style="width: 30%;height: 30px">
+                                <option v-for="unit in units" :value="unit.id" v-model="inputting.BillingModel.unit_id">@{{unit.name}}</option>
+                            </select>
+
+                            <div class="col-sm-5">
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('BillingModel.unit_id') }}</p>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="range_min" class="col-2 col-form-label text-right">价格区间</label>
+                        <div class="col-8 form-inline">
+                            <input type="text" style="width: 20%" class="form-control @error('BillingModel.range_min') is-invalid @enderror"
+                                   name="BillingModel[range_min]" autocomplete="off" value="{{old('BillingModel')['range_min']?old('BillingModel')['range_min']:$billingModel->range_min}}" >---
+                            <input type="text"  style="width: 20%" class="form-control @error('BillingModel.range_max') is-invalid @enderror"
+                                   name="BillingModel[range_max]" autocomplete="off" value="{{old('BillingModel')['range_max']?old('BillingModel')['range_max']:$billingModel->range_max}}" >
+                            @error('BillingModel.range_min')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                            @error('BillingModel.range_max')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="unit_price" class="col-2 col-form-label text-right">单价</label>
+                        <div class="col-8">
+                            <input type="text"  class="form-control @error('BillingModel.unit_price') is-invalid @enderror"
+                                   name="BillingModel[unit_price]" autocomplete="off" value="{{old('BillingModel')['unit_price']?old('BillingModel')['unit_price']:$billingModel->unit_price}}" >
+                            @error('BillingModel.unit_price')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="initial_weight" class="col-2 col-form-label text-right">始重</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('BillingModel.initial_weight') is-invalid @enderror"
+                                   name="BillingModel[initial_weight]" autocomplete="off" value="{{old('BillingModel')['initial_weight']?old('BillingModel')['initial_weight']:$billingModel->initial_weight}}" >
+                            @error('BillingModel.initial_weight')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-outline-dark form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        let insertVue=new Vue({
+            el:'#list',
+            data:{
+                inputting:{
+                    BillingModel:{
+                        carrier_id:'{{old('BillingModel')['carrier_id']?old('BillingModel')['carrier_id']:$billingModel->carrier_id}}',
+                        province_id:'{{old('BillingModel')['province_id']?old('BillingModel')['province_id']:$billingModel->province_id}}',
+                        city_id:'{{old('BillingModel')['city_id']?old('BillingModel')['city_id']:$billingModel->city_id}}',
+                        unit_id:'{{old('BillingModel')['unit_id']?old('BillingModel')['unit_id']:$billingModel->unit_id}}',
+                    }
+                },
+                provinces:[
+                    @foreach($provinces as $province)
+                    {id:'{{$province->id}}',name:'{{$province->name}}',cities:{!! $province->cities !!} },
+                    @endforeach
+                ],
+                cities:[
+                ],
+                carriers:[
+                     @foreach($carriers as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                units:[
+                    @foreach($units as $unit)
+                    {id:'{{$unit->id}}',name:'{{$unit->name}}'},
+                    @endforeach
+                ],
+                billingModel:[
+                        {id:'{{$billingModel->id}}',created_at:'{{$billingModel->created_at}}',
+                        carrier_id:'{{$billingModel->carrier_id}}',province_id:'{{$billingModel->province_id}}',
+                        city_id:'{{$billingModel->city_id}}',unit_id:'{{$billingModel->unit_id}}',
+                        section:'{{$billingModel->section}}',unit_price:'{{$billingModel->unit_price}}',initial_weight:'{{$billingModel->initial_weight}}'},
+                ]
+            },
+            mounted:function(){
+                this.changeProvince();
+                this.inputting.BillingModel.city_id='{{$billingModel->city_id}}';
+            },
+            methods:{
+                changeProvince(){
+                    let _this=this;
+                    let province_id=this.inputting.BillingModel.province_id;
+                    this.provinces.forEach(function (province) {
+                        if(province.id+''===province_id+''){
+                            _this.cities=province.cities;
+                            return
+                        }
+                        return null
+                    })
+                }
+            },
+        });
+
+    </script>
+@endsection

+ 99 - 0
resources/views/waybill/billingModel/index.blade.php

@@ -0,0 +1,99 @@
+
+@extends('layouts.app')
+
+@section('content')
+    <span id="nav2">
+        @component('waybill.menu')@endcomponent
+        @component('waybill.billingModel.menu')@endcomponent
+    </span>
+    <div class="container mt-3">
+        <div class="card">
+            <div class="card-body">
+                @if(Session::has('successTip'))
+                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                @endif
+                <table class="table table-striped table-sm" id="list">
+                    <tr>
+                        <th>代码</th>
+                        <th>承运商名称</th>
+                        <th>省份</th>
+                        <th>城市</th>
+                        <th>计重单位</th>
+                        <th>区间</th>
+                        <th>单价(元)</th>
+                        <th>始重</th>
+                        <th>录入时间</th>
+                    </tr>
+                    <tr v-for="billingModel in billingModels">
+                        <td class="text-muted">@{{billingModel.id}}</td>
+                        <td>@{{billingModel.carrier}}</td>
+                        <td>@{{billingModel.province}}</td>
+                        <td>@{{billingModel.city}}</td>
+                        <td>@{{billingModel.unit}}</td>
+                        <td>@{{billingModel.range_min}} -- @{{billingModel.range_max}}</td>
+                        <td>@{{billingModel.unit_price}}</td>
+                        <td>@{{billingModel.initial_weight}}</td>
+                        <td class="text-muted">@{{billingModel.created_at}}</td>
+                        <td>
+                            @can('计费模型-编辑')
+                                <button class="btn btn-sm btn-outline-primary" @click="edit(billingModel.id)">改</button> @endcan
+                            @can('计费模型-删除')
+                                <button class="btn btn-sm btn-outline-dark" @click="destroy(billingModel)">删</button> @endcan
+                        </td>
+                    </tr>
+                </table>
+                {{$billingModels->links()}}
+            </div>
+        </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#list",
+            data:{
+                billingModels:[
+                    @foreach( $billingModels as $billingModel )
+                        {id:'{{$billingModel->id}}',carrier:'{{$billingModel->carrier->name}}',
+                        province:'{{$billingModel->province->name}}',city:'{{$billingModel->city->name}}',
+                        unit:'{{$billingModel->unit->name}}',range_min:'{{$billingModel->range_min}}',range_max:'{{$billingModel->range_max}}',
+                        unit_price:'{{$billingModel->unit_price}}',initial_weight:'{{$billingModel->initial_weight}}',
+                        created_at:'{{$billingModel->created_at}}'},
+                    @endforeach
+                ],
+            },
+            methods:{
+                edit:function(id){
+                    location.href = "{{url('billingModel')}}/"+id+"/edit";
+                },
+                destroy:function(billingModel){
+                    if(!confirm('确定要删除该计费模型吗?')){return};
+                    let data=this;
+                    let url = "{{url('billingModel')}}/"+billingModel.id;
+                    axios.delete(url,{id:billingModel.id})
+                        .then(function (response) {
+                            if(response.data.success){
+                                for (let i = 0; i < data.billingModels.length; i++) {
+                                    if (data.billingModels[i].id===billingModel.id){
+                                        data.billingModels.splice(i,1);
+                                        break;
+                                    }
+                                }
+                                tempTip.setDuration(1000);
+                                tempTip.showSuccess('删除计费模型成功!')
+                            }else{
+                                tempTip.setDuration(1000);
+                                tempTip.show('删除计费模型失败!')
+                            }
+                        })
+                        .catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('删除计费模型失败!'+'网络错误:' + err);
+                            console.log(err);
+                        });
+                },
+            }
+        });
+    </script>
+@endsection

+ 16 - 0
resources/views/waybill/billingModel/menu.blade.php

@@ -0,0 +1,16 @@
+
+<div class="container mt-3" id="nav2">
+    <div class="card">
+        <ul class="nav nav-pills">
+            @can('计费模型-查询')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('billingModel')}}" :class="{active:isActive('',2)}">查询</a>
+            </li> @endcan
+            @can('计费模型-录入')
+            <li class="nav-item">
+                <a class="nav-link" href="{{url('billingModel/create')}}" :class="{active:isActive('create',2)}">录入</a>
+            </li> @endcan
+            {{$slot}}
+        </ul>
+    </div>
+</div>

+ 11 - 6
resources/views/waybill/create.blade.php

@@ -25,9 +25,9 @@
                     @csrf
                     <input name="type" hidden value="{{$type}}">
                     <div class="form-group row">
-                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">货主 *</label>
+                        <label for="owner_id" class="col-2 col-form-label text-right text-primary">货主{{old('owner_id')}} *</label>
                         <div class="col-8 form-inline">
-                            <select name="owner_id" class="form-control @error('owner_id') is-invalid @enderror" v-model="owner_name"  style="width: 30%">
+                            <select name="owner_id" class="form-control @error('owner_id') is-invalid @enderror" v-model="owner_id"  style="width: 30%">
                                 <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
                             </select>
                             <input class="form-control-sm ml-2" placeholder="输入关键字定位" @input="owner_id">
@@ -48,11 +48,15 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="col-8" style="margin-left: 15%">
+                        <button class="btn btn-outline-primary btn-sm" @click="origination='上海市松江区泗砖路351号宝时松江仓'" style="transform: scale(0.9)">松江仓库</button>
+                        <button class="btn btn-outline-primary btn-sm" @click="origination='上海市嘉定区武乡路9号宝时嘉定仓'" style="transform: scale(0.9)">嘉定仓库</button>
+                    </div>
                     <div class="form-group row">
                         <label for="origination" class="col-2 col-form-label text-right text-primary">始发地址 *</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('origination') is-invalid @enderror"
-                                   name="origination" autocomplete="off" value="{{ old('origination') }}"  required>
+                                   name="origination" autocomplete="off" value="{{ old('origination') }}"  v-model="origination" required>
                             @error('origination')
                             <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
@@ -154,17 +158,18 @@
                     {id:'{{$owner->id}}',name:'{{$owner->name}}'},
                     @endforeach
                 ],
-                owner_name:'',
+                owner_id:'{{old('owner_id')}}',
+                origination:'{{old('origination')}}',
             },
             methods:{
                 owner_id:function (e) {
                     let _this=this;
                     let $val=e.target.value;
-                    if($val==='')_this.owner_name='';
+                    if($val==='')_this.owner_id='';
                     else
                         _this.owners.forEach(function (owner) {
                             if (owner.name.includes($val)){
-                                _this.owner_name=owner.id;
+                                _this.owner_id=owner.id;
                             }
                         });
                 },

+ 62 - 26
resources/views/waybill/edit.blade.php

@@ -99,7 +99,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="carrier_bill" class="col-2 col-form-label text-right text-primary">承运商单号 *</label>
+                        <label for="carrier_bill" class="col-2 col-form-label text-right">承运商单号</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('carrier_bill') is-invalid @enderror"
                                    name="carrier_bill" autocomplete="off" value="@if(old('carrier_bill')){{ old('carrier_bill') }}@else{{$waybill->carrier_bill}}@endif"  >
@@ -135,8 +135,8 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="warehouse_weight" class="col-2 col-form-label text-right text-primary">仓库计数(抛) *</label>
-                        <div class="col-8">
+                        <label for="warehouse_weight" class="col-2 col-form-label text-right ">仓库计数(抛)</label>
+                        <div class="col-2">
                             <input type="text"  class="form-control @error('warehouse_weight') is-invalid @enderror"
                                    name="warehouse_weight" autocomplete="off" value="@if(old('warehouse_weight')){{ old('warehouse_weight') }}@else{{$waybill->warehouse_weight}}@endif"  >
                             @error('warehouse_weight')
@@ -145,48 +145,74 @@
                                     </span>
                             @enderror
                         </div>
-                    </div>
-                    <div class="form-group row">
-                        <label for="warehouse_weight_unit_id" class="col-2 col-form-label text-right text-primary">仓库计数单位 *</label>
-                        <div class="col-8">
-                            <select class="form-control" name="warehouse_weight_unit_id" style="width: 30%; ">
+                        <label for="warehouse_weight_unit_id" class=" col-form-label text-right ">单位:</label>
+                        <div class="col-1.5">
+                            <select class="form-control" name="warehouse_weight_unit_id" v-model="waybillPriceModel.warehouse_weight_unit_id">
                                 @foreach($units as $unit)
-                                    @if($unit->id==$waybill->warehouse_weight_unit_id)
-                                        <option value="{{$unit->id}}" selected>{{$unit->name}}</option>
-                                    @else
-                                        <option value="{{$unit->id}}" selected>{{$unit->name}}</option>
-                                    @endif
+                                    <option value="{{$unit->id}}">{{$unit->name}}</option>
+                                @endforeach
+                            </select>
+                        </div>
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                        <label for="warehouse_weight_other" class="col-form-label text-right ">&nbsp;&nbsp;&nbsp;仓库计数二</label>
+                        <div class="col-2">
+                            <input type="text"  class="form-control @error('warehouse_weight_other') is-invalid @enderror"
+                                   name="warehouse_weight_other" autocomplete="off" value="@if(old('warehouse_weight_other')){{ old('warehouse_weight_other') }}@else{{$waybill->warehouse_weight_other}}@endif"  >
+                            @error('warehouse_weight_other')
+                            <span class="invalid-feedback" role="alert">
+                                        <strong>{{ $message }}</strong>
+                                    </span>
+                            @enderror
+                        </div>
+                        <label for="warehouse_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
+                        <div class="col-1.5">
+                            <select class="form-control" name="warehouse_weight_unit_id_other" v-model="waybillPriceModel.warehouse_weight_unit_id_other" >
+                                @foreach($units as $unit)
+                                    <option value="{{$unit->id}}">{{$unit->name}}</option>
                                 @endforeach
                             </select>
                         </div>
                     </div>
                     @endif
+                    {{--计费模型阶段保留--}}
                     <div class="form-group row">
-                        <label for="carrier_weight" class="col-2 col-form-label text-right text-primary">承运商计数(抛) *</label>
-                        <div class="col-8">
-                            <input type="text" id="carrier_weight" class="form-control @error('carrier_weight') is-invalid @enderror"
-                                   name="carrier_weight" autocomplete="off" v-model="waybillPriceModel.carrier_weight" @blur="isCarrier_weight($event)">
+                        <label for="carrier_weight" class="col-2 col-form-label text-right ">承运商计数(抛)</label>
+                        <div class="col-2">
+                            <input type="text"  class="form-control @error('carrier_weight') is-invalid @enderror"
+                                   name="carrier_weight" autocomplete="off" value="@if(old('carrier_weight')){{ old('carrier_weight') }}@else{{$waybill->carrier_weight}}@endif"  >
                             @error('carrier_weight')
                             <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
                             @enderror
                         </div>
-                    </div>
-                    <div class="form-group row">
-                        <label for="carrier_weight_unit_id" class="col-2 col-form-label text-right text-primary">承运商计数单位 *</label>
-                        <div class="col-8">
-                            <select class="form-control" name="carrier_weight_unit_id" id="carrier_weight_unit_id" v-model="waybillPriceModel.carrier_weight_unit_id" style="width: 30%;height: 30px" @change="isCarrier_weight_unit($event)">
+                        <label for="carrier_weight_unit_id" class=" col-form-label text-right ">单位:</label>
+                        <div class="col-1.5">
+                            <select class="form-control" name="carrier_weight_unit_id" v-model="waybillPriceModel.carrier_weight_unit_id">
                                 @foreach($units as $unit)
                                     <option value="{{$unit->id}}">{{$unit->name}}</option>
                                 @endforeach
                             </select>
-                            @error('carrier_weight_unit_id')
+                        </div>
+                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                        <label for="carrier_weight_other" class="col-form-label text-right ">承运商计数二</label>
+                        <div class="col-2">
+                            <input type="text"  class="form-control @error('carrier_weight_other') is-invalid @enderror"
+                                   name="carrier_weight_other" autocomplete="off" value="@if(old('carrier_weight_other')){{ old('carrier_weight_other') }}@else{{$waybill->carrier_weight_other}}@endif"  >
+                            @error('carrier_weight_other')
                             <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
                             @enderror
                         </div>
+                        <label for="carrier_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
+                        <div class="col-1.5">
+                            <select class="form-control" name="carrier_weight_unit_id_other" v-model="waybillPriceModel.carrier_weight_unit_id_other" >
+                                @foreach($units as $unit)
+                                    <option value="{{$unit->id}}">{{$unit->name}}</option>
+                                @endforeach
+                            </select>
+                        </div>
                     </div>
                     @if($waybill->type=="直发车")
                     <div class="form-group row">
@@ -227,7 +253,7 @@
                     @endif
                     @if($waybill->type=="专线")
                     <div class="form-group row">
-                        <label for="pick_up_fee" class="col-2 col-form-label text-right text-primary">提货费(元) *</label>
+                        <label for="pick_up_fee" class="col-2 col-form-label text-right">提货费(元)</label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('pick_up_fee') is-invalid @enderror"
                                    name="pick_up_fee" autocomplete="off" value="@if(old('pick_up_fee')){{ old('pick_up_fee') }}@else{{$waybill->pick_up_fee}}@endif"  >
@@ -284,7 +310,11 @@
                 waybillPriceModel: {
                     carrier_id:'{{$waybill->carrier_id}}',origination_city_id:'{{old('origination_city_id')?old('origination_city_id'):$waybill->origination_city_id}}',
                     destination_city_id:'{{old('destination_city_id')?old('destination_city_id'):$waybill->destination_city_id}}',
-                    carrier_weight:'{{old('carrier_weight')?old('carrier_weight'):$waybill->carrier_weight}}',carrier_weight_unit_id:'{{$waybill->carrier_weight_unit_id}}'
+                    carrier_weight:'{{old('carrier_weight')?old('carrier_weight'):$waybill->carrier_weight}}',carrier_weight_unit_id:'{{old('carrier_weight_unit_id')?old('carrier_weight_unit_id'):$waybill->carrier_weight_unit_id}}',
+                    warehouse_weight_unit_id:'{{old('warehouse_weight_unit_id')?old('warehouse_weight_unit_id'):$waybill->warehouse_weight_unit_id}}',
+                    carrier_weight_other:'{{old('carrier_weight_other')?old('carrier_weight_other'):$waybill->carrier_weight_other}}',
+                    carrier_weight_unit_id_other:'{{old('carrier_weight_unit_id_other')?old('carrier_weight_unit_id_other'):$waybill->carrier_weight_unit_id_other}}',
+                    warehouse_weight_unit_id_other:'{{old('warehouse_weight_unit_id_other')?old('warehouse_weight_unit_id_other'):$waybill->warehouse_weight_unit_id_other}}',
                 },
                 cities:[
                     @foreach($cities as $city)
@@ -294,8 +324,14 @@
                     @endforeach
                 ],
             },
+            mounted:function(){
+                    if (!this.waybillPriceModel.origination_city_id){
+                        this.waybillPriceModel.origination_city_id=348;
+                    };
+                },
             methods:{
-                isCarrier(e){
+                {{--计费模型阶段保留--}}
+               isCarrier(e){
                     let  carrier_id=e.target.value;
                     let carrier_weight=document.getElementById('carrier_weight').value;
                     let carrier_weight_unit_id=document.getElementById('carrier_weight_unit_id').value;

+ 58 - 35
resources/views/waybill/index.blade.php

@@ -24,6 +24,7 @@
             </div>
         </div>
     </div>
+<div class="card" style="min-width: 3500px;">
     <div id="list">
         <div class="card">
             <div class="card-body">
@@ -34,46 +35,54 @@
                                 <a  href="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
                             </div></td>
                     </tr>
-                    <tr>
+                    <tr >
                         <td> <label style="margin-left: 2%">页显示条数:</label>
-                            <select name="paginate" v-model="filterData.paginate" @change="setPaginate" class="rounded  " style="height: 30px;width: 80px">
+                            <select name="paginate" v-model="filterData.paginate" @change="setPaginate" class="form-control-sm" style="vertical-align: middle">
                                 <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><label style="margin-left: 2%">货主:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-                            <select name="owner_id" v-model="filterData.owner_id" class="rounded  " @change="setOwner" style="height: 30px;width: 80px">
+                        <td ><label style="margin-left: 2%">货主:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
+                            <select name="owner_id" v-model="filterData.owner_id" class="form-control-sm  "  @change="setOwner" style="vertical-align: middle">
                                 <option>    </option>
                                 @foreach($owners as $owner)
                                     <option value="{{$owner->id}}">{{$owner->name}}</option>
                                 @endforeach
                             </select></td>
-                        <td><label style="margin-left: 2%">承运商:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-                            <select name="carrier_id" v-model="filterData.carrier_id" class="rounded  " @change="setCarrier" style="height: 30px;width: 80px">
+                        <td ><label style="margin-left: 2%">承运商:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
+                            <select name="carrier_id" v-model="filterData.carrier_id" class="form-control-sm  " @change="setCarrier" style="vertical-align: middle">
                                 <option >    </option>
                                 @foreach($carriers as $carrier)
                                     <option value="{{$carrier->id}}">{{$carrier->name}}</option>
                                 @endforeach
                             </select></td>
-
                     </tr>
                     <tr>
-                        <td><label style="margin-left: 2%">运单号:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-                            <input type="text" name="waybill_number" class="rounded  " v-model="filterData.waybill_number"></td>
-                        <td><label style="margin-left: 2%">承运商单号:</label>
-                            <input type="text"  name="carrier_bill" class="rounded  " v-model="filterData.carrier_bill"></td>
-                        <td><label style="margin-left: 2%"> WMS单号:&nbsp;&nbsp;</label>
-                            <input type="text" name="wms_bill_number" class="rounded  " v-model="filterData.wms_bill_number"></td>
+                        <td  ><label style="margin-left: 2%">运单号:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
+                            <input type="text" name="waybill_number" class="form-control-sm  " v-model="filterData.waybill_number" style="vertical-align: middle"></td>
+                        <td  ><label style="margin-left: 2%">承运商单号:</label>
+                            <input type="text"  name="carrier_bill" class="form-control-sm  " v-model="filterData.carrier_bill" style="vertical-align: middle"></td>
+                        <td  ><label style="margin-left: 2%"> WMS单号:&nbsp;&nbsp;</label>
+                            <input type="text" name="wms_bill_number" class="form-control-sm  " v-model="filterData.wms_bill_number" style="vertical-align: middle"></td>
                     </tr>
                     <tr>
-                        <td><div><label style="margin-left: 2%"> 始发地:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-                                <input type="text" name="origination" class="rounded  " v-model="filterData.origination">
-                            <label style="margin-left: 2%"> 目的地:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
-                                <input type="text"  name="destination" class="rounded  " v-model="filterData.destination"></div></td>
-                        <td><div><label style="margin-left: 2%"> 开始日期:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="date" name="created_at_start" class="rounded"  v-model="filterData.created_at_start">
-                            <label style="margin-left: 1%"> 截至日期:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="date" class="rounded" name="created_at_end" v-model="filterData.created_at_end"></div></td>
+                        <td  style="width: 500px"><div><label style="margin-left: 2%"> 始发地:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
+                                <input type="text" name="origination" class="form-control-sm  " v-model="filterData.origination" style="vertical-align: middle">
+                            <label style="margin-left: 2%"> 目的地:&nbsp;&nbsp;</label>
+                                <input type="text" style="vertical-align: middle"  name="destination" class="form-control-sm  " v-model="filterData.destination"></div></td>
+                        <td  style="width: 500px"><div><label style="margin-left: 2%"> 开始日期:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="date" name="created_at_start" class="form-control-sm"  v-model="filterData.created_at_start">
+                            <label style="margin-left: 1%"> 截至日期:&nbsp;&nbsp;</label><input type="date" class="form-control-sm" name="created_at_end" v-model="filterData.created_at_end"></div></td>
+                        <td>
+                            <label style="margin-left: 2%">运单状态:&nbsp;&nbsp;&nbsp;&nbsp;</label>
+                            <select name="state" v-model="filterData.state" @change="setState" class="form-control-sm" style="vertical-align: middle">
+                                <option value="待审核">待审核</option>
+                                <option value="已审核">待调度</option>
+                                <option value="待终审">待终审</option>
+                                <option value="已完结">已完结</option>
+                            </select></td>
+                        </td>
                     </tr>
                     <tr>
                         <td colspan="5">
@@ -99,6 +108,7 @@
                         <input id="all" type="checkbox" @click="checkAll($event)">全选
                     </label>
                 </th>
+                <th>ID</th>
                 <th>运单类型</th>
                 <th>当前状态</th>
                 <th>运单号</th>
@@ -119,10 +129,10 @@
                 <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>
@@ -136,10 +146,11 @@
                 @endcan
             </tr>
 
-            <tr v-for="waybill in waybills" :style="{color:waybill.state=='待重审'?'red':''||waybill.state=='完结'?'green':''}">
+            <tr v-for="waybill in waybills" :style="{color:waybill.state=='待重审'?'red':''||waybill.state=='完结'?'green':''}">
                 <td>
                     <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
                 </td>
+                <td>@{{waybill.id}}</td>
                 <td>@{{waybill.type}}</td>
                 <td :style="{color:waybill.state=='已审核'?'blue':''}">@{{waybill.state}}</td>
                 <td>@{{waybill.waybill_number}}</td>
@@ -173,14 +184,14 @@
                 <td>@{{waybill.carrier_bill}}</td>
                 <td>@{{waybill.origination_city}}</td>
                 <td>@{{waybill.destination_city}}</td>
-                <td>@{{waybill.warehouse_weight}}</td>
-                <td>@{{waybill.warehouse_weight_unit}}</td>
-                <td>@{{waybill.carrier_weight}}</td>
-                <td>@{{waybill.carrier_weight_unit}}</td>
+                <td>@{{waybill.warehouse_weight}}  @{{waybill.warehouse_weight_unit}}</td>
+                <td>@{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</td>
+                <td>@{{waybill.carrier_weight}}  @{{waybill.carrier_weight_unit}}</td>
+                <td>@{{waybill.carrier_weight_other}}  @{{waybill.carrier_weight_unit_other}}</td>
                 <td><p v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></p></td>
                 <td>@{{waybill.car_owner_info}}</td>
                 @can('运输管理-可见费用项')
-                    <td><p v-if="waybill.type=='专线'">***</p><p v-else>@{{waybill.fee}}</p></td>
+                    <td><p v-if="waybill.type=='专线'"></p><p v-else>@{{waybill.fee}}</p></td>
                 <td>@{{waybill.pick_up_fee}}</td>
                 <td>@{{waybill.other_fee}}</td>
                 @endcan
@@ -191,7 +202,7 @@
                 <td>
                     <div v-if=waybill.state==="待终审">
                         @can('运输管理-调度审核')
-                            <button class="btn btn-outline-success" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">终审</button>
+                            <button class="btn btn-outline-success" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">完结</button>
                         @endcan
                         @can('运输管理-调度')
                             <button class="btn btn-outline-secondary" @click="job(waybill.id)">改调度</button>
@@ -202,6 +213,7 @@
         </table>
         {{$waybills->appends($filterData)->links()}}
     </div>
+</div>
 @endsection
 
 @section('lastScript')
@@ -220,9 +232,13 @@
                         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}}',@if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
+                        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}}',
+                        @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}}', @endif dispatch_remark:'{{$waybill->dispatch_remark}}',
+                        collect_fee:'{{$waybill->collect_fee}}', @endcan dispatch_remark:'{{$waybill->dispatch_remark}}',
                         waybillAuditLogs:{!! $waybill->waybillAuditLogs !!}
                     },
                     @endforeach
@@ -233,7 +249,7 @@
                         ,carrier_bill:'',carrier_id:''
                         ,owner_id:'',wms_bill_number:''
                         ,created_at_start:'',created_at_end:''
-                        ,type:''},
+                        ,type:'',state:'',},
 
             },
             computed:{
@@ -317,7 +333,8 @@
                     if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
                     let _this=this;
                     let w;
-                    axios.post(@if($uriType=='')'waybillRetreatAudit',@else'../waybillRetreatAudit',@endif {id:id})
+                    let url='{{url('waybill/waybillRetreatAudit')}}';
+                    axios.post(url,{id:id})
                         .then(
                             function (response) {
                                 if (response.data.success){
@@ -347,7 +364,8 @@
                     if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
                     let _this=this;
                     let w;
-                    axios.post(@if($uriType=='')'waybill/waybillEndAudit',@else'../waybillEndAudit',@endif {id:id})
+                    let url='{{url('waybill/waybillEndAudit')}}';
+                    axios.post(url, {id:id})
                         .then(
                             function (response) {
                                 if (response.data.success){
@@ -393,6 +411,11 @@
                     var form = document.getElementById("optionSubmit");
                     form.submit();
                 },
+                setState:function (e) {
+                    this.filterData.state=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
                 checkAll(e){
                     if (e.target.checked){
                         this.waybills.forEach((el,i)=>{

+ 3 - 4
resources/views/waybill/menu.blade.php

@@ -10,10 +10,10 @@
             <li class="nav-item">
                 <a class="nav-link" href="{{url('waybill/create/ZX')}}" :class="{active:isActive('create',2)}">运单录入</a>
             </li> @endcan
-            @can('计费模型')
+            {{$slot}}
             <li class="nav-item">
-                <a class="nav-link text-dark" href="{{url('waybill/waybillPriceModel')}}" :class="{active:isActive('waybillPriceModel',2)}">计费模型</a>
-            </li> @endcan
+                <a class="nav-link text-dark" href="{{url('waybill/correlation')}}" :class="{active:isActive('correlation',2)}">相关设置</a>
+            </li>
             @can('财务报表')
             <li class="nav-item">
                 <a class="nav-link text-dark" href="{{url('waybill/waybillFinancialSnapshot')}}" :class="{active:isActive('waybillFinancialSnapshot',2)}">财务报表</a>
@@ -21,7 +21,6 @@
             <li class="nav-item">
                 <a class="nav-link text-dark" href="{{url('waybill/waybillFinancialExcepted')}}" :class="{active:isActive('waybillFinancialExcepted',2)}">异常报表</a>
             </li>@endcan
-            {{$slot}}
         </ul>
     </div>
 </div>

+ 18 - 0
resources/views/waybill/menuWaybill.blade.php

@@ -0,0 +1,18 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('waybill.menu')
+        @endcomponent
+        <div class="container">
+            <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
+                <ul class="nav nav-pills">
+                    @can('计费模型')
+                        <li class="nav-item">
+                            <a class="nav-link text-dark" href="{{url('maintenance/waybillPriceModel')}}" :class="{active:isActive('waybillPriceModel',2)}">计费模型</a>
+                        </li> @endcan
+                </ul>
+            </div>
+        </div>
+    </div>
+@endsection

+ 2 - 2
resources/views/waybill/waybillFinancialSnapshot/index.blade.php

@@ -68,9 +68,9 @@
             <th>承运商单号</th>
             <th>始发市</th>
             <th>目的市</th>
-            <th>仓库计(抛)</th>
+            <th>仓库计(抛)</th>
             <th>仓库计重单位</th>
-            <th>承运商计(抛)</th>
+            <th>承运商计(抛)</th>
             <th>承运商计重单位</th>
             <th>车型</th>
             <th>车辆信息</th>

+ 3 - 3
routes/web.php

@@ -39,9 +39,9 @@ Route::resource('maintenance/province','ProvincesController');
 Route::resource('maintenance/city','CitiesController');
 Route::resource('maintenance/commodity', 'CommodityController');
 
-Route::resource('waybill/waybillPriceModel','WaybillPriceModelsController');
-Route::get('waybill/waybillPriceModel/excel/goImport',function (){return view('waybill.waybillPriceModel.import');});
-Route::get('waybill/waybillPriceModel/cities/{province_id}','WaybillPriceModelsController@getCities');
+Route::resource('maintenance/waybillPriceModel','WaybillPriceModelsController');
+Route::get('maintenance/waybillPriceModel/excel/goImport',function (){return view('maintenance.waybillPriceModel.import');});
+Route::get('maintenance/waybillPriceModel/cities/{province_id}','WaybillPriceModelsController@getCities');
 
 Route::get('waybill/waybillFinancialSnapshot/ZF','WaybillFinancialSnapshotsController@indexZF');
 Route::get('waybill/waybillFinancialSnapshot/ZX','WaybillFinancialSnapshotsController@indexZX');