Browse Source

Merge branch 'mergeCarrier' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	app/Services/CacheService.php
	database/migrations/2020_09_20_142656_change_order_issue.php
LD 5 years ago
parent
commit
6fc7b9694a
50 changed files with 628 additions and 685 deletions
  1. 0 30
      app/BillingModel.php
  2. 1 1
      app/Http/Controllers/Auth/RegisterController.php
  3. 4 0
      app/Http/Controllers/LogisticController.php
  4. 0 2
      app/Http/Controllers/RejectedController.php
  5. 15 6
      app/Http/Controllers/TestController.php
  6. 12 24
      app/Http/Controllers/UserController.php
  7. 50 46
      app/Http/Controllers/WaybillController.php
  8. 17 18
      app/Http/Controllers/WaybillPriceModelsController.php
  9. 0 115
      app/Http/Controllers/api/thirdPart/flux/PackageController.php
  10. 5 5
      app/Http/Controllers/api/thirdPart/weixin/WxController.php
  11. 0 6
      app/Imports/PaperBoxesImport.php
  12. 0 2
      app/Imports/StoreCheckingReceiveImport.php
  13. 14 12
      app/Imports/WaybillPriceModelsImport.php
  14. 6 8
      app/Listeners/WaybillPriceModelListener.php
  15. 1 1
      app/Logistic.php
  16. 11 3
      app/Services/LogisticService.php
  17. 3 2
      app/Services/RejectedService.php
  18. 8 8
      app/Services/WaybillService.php
  19. 2 2
      app/User.php
  20. 3 3
      app/Waybill.php
  21. 3 3
      app/WaybillPriceModel.php
  22. 0 10
      database/migrations/2019_11_22_094024_create_waybills_table.php
  23. 0 6
      database/migrations/2019_11_22_094311_create_waybill_price_models_table.php
  24. 0 5
      database/migrations/2020_09_20_142656_change_order_issue.php
  25. 62 0
      database/migrations/2020_11_26_092308_add_column_carrier_table_logistic.php
  26. 16 0
      database/seeds/LogisticSeeder.php
  27. 16 0
      database/seeds/OwnerSeeder.php
  28. 0 78
      database/seeds/faker_data.php
  29. 48 3
      resources/views/maintenance/logistic/create.blade.php
  30. 48 3
      resources/views/maintenance/logistic/edit.blade.php
  31. 14 4
      resources/views/maintenance/logistic/index.blade.php
  32. 4 4
      resources/views/maintenance/menu.blade.php
  33. 9 9
      resources/views/maintenance/priceModel/waybillPriceModel/create.blade.php
  34. 10 10
      resources/views/maintenance/priceModel/waybillPriceModel/edit.blade.php
  35. 7 7
      resources/views/maintenance/priceModel/waybillPriceModel/index.blade.php
  36. 58 58
      resources/views/maintenance/user/create.blade.php
  37. 61 61
      resources/views/maintenance/user/edit.blade.php
  38. 3 3
      resources/views/maintenance/user/index.blade.php
  39. 7 7
      resources/views/waybill/create.blade.php
  40. 36 49
      resources/views/waybill/delivering.blade.php
  41. 22 21
      resources/views/waybill/edit.blade.php
  42. 5 6
      resources/views/waybill/index.blade.php
  43. 1 1
      resources/views/waybill/menuWaybill.blade.php
  44. 1 1
      resources/views/waybill/waybillFinancialSnapshot/index.blade.php
  45. 9 9
      resources/views/waybill/waybillPriceModel/create.blade.php
  46. 9 9
      resources/views/waybill/waybillPriceModel/edit.blade.php
  47. 5 5
      resources/views/waybill/waybillPriceModel/index.blade.php
  48. 3 0
      serves/excelExportGo/logs/2020-11-26.log
  49. 6 6
      tests/old/WaybillPriceModelTest.php
  50. 13 13
      tests/old/WaybillTest.php

+ 0 - 30
app/BillingModel.php

@@ -1,30 +0,0 @@
-<?php
-
-namespace App;
-
-use Illuminate\Database\Eloquent\Model;
-use App\Traits\ModelTimeFormat;
-
-class BillingModel extends Model
-{
-    use ModelTimeFormat;
-    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');
-    }
-}

+ 1 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -90,7 +90,7 @@ class RegisterController extends Controller
         $carrierIds=$request->input('carrier')??'';
         if ($carrierIds){
             $carrierIds=explode(',',$carrierIds);
-            $user->carriers()->sync($carrierIds);
+            $user->logistics()->sync($carrierIds);
         }
         $userWorkgroupId=$request->input('userWorkgroupID');
         if ($userWorkgroupId){

+ 4 - 0
app/Http/Controllers/LogisticController.php

@@ -54,15 +54,19 @@ class LogisticController extends Controller
     protected function validatorCreate(array $data)
     {
         return Validator::make($data, [
+            'type' => ["required"],
             'name' => ['required', 'string', 'max:50', 'unique:logistics'],
             'code' => ['nullable', 'string', 'max:50', 'unique:logistics,code'],
+            'delivery_fee' => ['nullable', 'numeric', 'min:0'],
         ]);
     }
     protected function validatorUpdate(array $data,$id)
     {
         return Validator::make($data, [
+            'type' => ["required"],
             'name' => ['required', 'string', 'max:50',"unique:logistics,name,$id"],
             'code' => ['nullable', 'string', 'max:50',"unique:logistics,code,$id"],
+            'delivery_fee' => ['nullable', 'numeric', 'min:0'],
         ]);
     }
     /**

+ 0 - 2
app/Http/Controllers/RejectedController.php

@@ -10,11 +10,9 @@ use App\Rejected;
 use App\RejectedAnalyzeOwner;
 use App\RejectedBill;
 use App\Services\LogisticService;
-use App\Services\OracleDocAsnHerderService;
 use App\Services\OwnerService;
 use App\Services\QualityLabelService;
 use App\Services\RejectedService;
-use App\Services\StoreService;
 use Carbon\Carbon;
 use Exception;
 use Illuminate\Contracts\Foundation\Application;

+ 15 - 6
app/Http/Controllers/TestController.php

@@ -45,6 +45,7 @@ use App\Services\OrderTrackingService;
 use App\Services\OwnerService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
+use App\StoreCheckingReceiveItem;
 use App\Unit;
 use App\User;
 use App\Warehouse;
@@ -54,6 +55,7 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Hash;
 use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Str;
 use Maatwebsite\Excel\Facades\Excel;
@@ -95,12 +97,19 @@ class TestController extends Controller
         }
     }
     public function test4(){
-        $units = Unit::get();
-        //dd($units);
-        foreach ($units as $index => $unit){
-            if ($index!=1)unset($units[$index]);
-        }
-        dd($units);
+        dd($this->dd());
+    }
+
+    private function dd()
+    {
+        StoreCheckingReceiveItem::query()->insert([[
+            "imported_amount" => 1,
+            "produced_at" => null,
+            "invalid_at" => null,
+            "batch_code" => null,
+            "unique_code" => null,
+            "commodity_id" => 36,
+            "store_checking_receive_id" => 2]]);
     }
 
     public function updateLaborRemark(){

+ 12 - 24
app/Http/Controllers/UserController.php

@@ -2,8 +2,6 @@
 
 namespace App\Http\Controllers;
 
-use App\Carrier;
-use App\Exports\UserExport;
 use App\Role;
 use App\User;
 use App\UserWorkgroup;
@@ -13,19 +11,19 @@ use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
-use Maatwebsite\Excel\Facades\Excel;
 
 class UserController extends Controller
 {
     /**
      * Display a listing of the resource.
      *
+     * @param Request $request
      * @return Response
      */
     public function index(Request $request)
     {
         if(!Gate::allows('用户-查询')){ return redirect(url('/'));  }
-        $query = User::with(['roles','carriers','userWorkgroups']);
+        $query = User::with(['roles','logistics','userWorkgroups']);
         if($request->has('user')){
            $query->where('name','like',$request->input('user'));
         }
@@ -51,9 +49,9 @@ class UserController extends Controller
     {
         if(!Gate::allows('用户-录入')){ return redirect(url('/'));  }
         $roles=Role::all();
-        $carriers=Carrier::select('id','name')->get();
-        $userWorkgroups=UserWorkgroup::get();
-        return view('maintenance.user.create',['rolesAll'=>$roles,'carriers'=>$carriers,'userWorkgroups'=>$userWorkgroups]);
+        $logistics=app('LogisticService')->getSelection(["id","name"],"logistic");
+        $userWorkgroups=UserWorkgroup::query()->get();
+        return view('maintenance.user.create',['rolesAll'=>$roles,'logistics'=>$logistics,'userWorkgroups'=>$userWorkgroups]);
     }
 
 
@@ -70,16 +68,6 @@ class UserController extends Controller
             'name' => ['required', 'string', 'max:50'],
         ]);
     }
-    /**
-     * Display the specified resource.
-     *
-     * @param User $user
-     * @return Response
-     */
-    public function show(User $user)
-    {
-        //
-    }
 
     /**
      * Show the form for editing the specified resource.
@@ -92,11 +80,11 @@ class UserController extends Controller
         if(!Gate::allows('用户-编辑')){ return redirect(url('/'));  }
         $rolesAll=Role::all();
         $roles=$user->roles()->get();
-        $carriers=Carrier::select('id','name')->get();
-        $carrierUser=$user->carriers()->get();
-        $userWorkgroups=UserWorkgroup::get();
+        $logistics=app('LogisticService')->getSelection(["id","name"],"logistic");
+        $logisticUser=$user->logistics()->get();
+        $userWorkgroups=UserWorkgroup::query()->get();
         $userWorkgroup=$user->userWorkgroups()->first();
-        return view('maintenance.user.edit',compact('user','rolesAll','roles','carriers','carrierUser','userWorkgroups','userWorkgroup'));
+        return view('maintenance.user.edit',compact('user','rolesAll','roles','logistics','logisticUser','userWorkgroups','userWorkgroup'));
     }
 
     /**
@@ -119,12 +107,12 @@ class UserController extends Controller
         }else{
             $user->roles()->sync([]);
         }
-        $carrierIds=$request->input('carrier')??'';
+        $carrierIds=$request->input('logistic')??'';
         if($carrierIds){
             $carrierIds=explode(',',$carrierIds);
-            $user->carriers()->sync($carrierIds);
+            $user->logistics()->sync($carrierIds);
         }else{
-            $user->carriers()->sync([]);
+            $user->logistics()->sync([]);
         }
         $userWorkgroupId=$request->input('userWorkgroupID');
         if($userWorkgroupId){

+ 50 - 46
app/Http/Controllers/WaybillController.php

@@ -3,9 +3,9 @@
 namespace App\Http\Controllers;
 
 
-use App\Services\CarrierService;
 use App\Services\CarTypeService;
 use App\Services\CityService;
+use App\Services\LogisticService;
 use App\Services\OwnerService;
 use App\Services\UnitService;
 use App\Services\WaybillPayoffService;
@@ -24,6 +24,8 @@ use App\WaybillFinancialExcepted;
 use App\WaybillFinancialSnapshot;
 use Carbon\Carbon;
 use Exception;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
@@ -43,17 +45,17 @@ class WaybillController extends Controller
     /**
      * @param Request $request
      * @param OwnerService $ownerService
-     * @param CarrierService $carrierService
+     * @param LogisticService $logisticService
      * @return void
      */
-    public function index(Request $request,OwnerService $ownerService,CarrierService $carrierService)
+    public function index(Request $request,OwnerService $ownerService,LogisticService $logisticService)
     {
         if(!Gate::allows('运输管理-查询')){ return view("waybill.authorityMenu");  }
         $paginateParams = $request->input();
         $waybills=app('waybillService')->paginate($request->input());
         return view('waybill.index', [
             'waybills' => $waybills,
-            'carriers' => $carrierService->getSelection(),
+            'logistics' => $logisticService->getSelection(["id","name"],"logistic"),
             'owners' => $ownerService->getSelection(),
             'paginateParams'=>$paginateParams,
             'uriType'=>$request->uriType??'']);
@@ -80,7 +82,7 @@ class WaybillController extends Controller
         return redirect('waybill/index')->with('successTip','新运单“'.$waybill->waybill_number.'”录入成功');
     }
 
-    public function edit($id,CarrierService $carrierService,CarTypeService $carTypeService,
+    public function edit($id,LogisticService $logisticService,CarTypeService $carTypeService,
                          CityService $cityService,UnitService $unitService)
     {
         if(!Gate::allows('运输管理-编辑')){ return redirect(url('/'));  }
@@ -93,11 +95,11 @@ class WaybillController extends Controller
         $cities=$cityService->getSelection();
         $units=$unitService->getSelection();
         $carTypes=$carTypeService->getSelection();
-        return view('waybill/edit',['waybill'=>$waybill,'carriers'=>$carrierService->getSelection(),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
+        return view('waybill/edit',['waybill'=>$waybill,'logistics'=>$logisticService->getSelection(["id","name"],"logistic"),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
     }
 
     public function update(Request $request, $id,WaybillPriceModelService $waybillPriceModelService,
-                           CarrierService $carrierService,WaybillPayoffService $waybillPayoffService)
+                           LogisticService $logisticService,WaybillPayoffService $waybillPayoffService)
     {
         if(!Gate::allows('运输管理-调度')){ return redirect(url('/'));  }
         if (!$request->warehouse_weight && $request->warehouse_weight_unit_id){
@@ -126,11 +128,11 @@ class WaybillController extends Controller
             if ($waybillPriceModel_id){
                 $carrier_weight=$request->input('carrier_weight');
                 $waybillPriceModel=$waybillPriceModelService->find($waybillPriceModel_id);
-                $carrier=$carrierService->find($waybill->carrier_id);
+                $logistic=$logisticService->find($waybill->logistic_id);
                 if ($carrier_weight<$waybillPriceModel->initial_weight){
-                    $fee=(($waybillPriceModel->unit_price)*($waybillPriceModel->initial_weight))+$carrier->delivery_fee;
+                    $fee=(($waybillPriceModel->unit_price)*($waybillPriceModel->initial_weight))+$logistic->delivery_fee;
                 }else{
-                    $fee=(($waybillPriceModel->unit_price)*$carrier_weight)+$carrier->delivery_fee;
+                    $fee=(($waybillPriceModel->unit_price)*$carrier_weight)+$logistic->delivery_fee;
                 }
                 if ($waybillPriceModel->base_fee&&$fee<$waybillPriceModel->base_fee){
                     $fee=$waybillPriceModel->base_fee;
@@ -155,19 +157,19 @@ class WaybillController extends Controller
         return redirect('waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”调度成功');
     }
 
-    public function checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id){
+    public function checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id){
         //确保承运商计数与计数单位为一个数组且长度2
-        if(!$carrier_id)return false;
+        if(!$logistic_id)return false;
         if(!$destination_city_id)return false;
         if(!$carrier_weight)return false;
         if(!$carrier_weight_unit_id)return false;
         //多个计数标准,计算价格,取最贵
         if ($carrier_weight[0]&&$carrier_weight[1]&&$carrier_weight_unit_id[0]&&$carrier_weight_unit_id[1]){
             //城市价格区间不为空
-            $waybillPriceModelOne=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
+            $waybillPriceModelOne=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
                 ->where('range_min','<',$carrier_weight[0])->where('range_max','>=',$carrier_weight[0])
                 ->where('unit_id',$carrier_weight_unit_id[0])->first();
-            $waybillPriceModelTwo=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
+            $waybillPriceModelTwo=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
                 ->where('range_min','<',$carrier_weight[1])->where('range_max','>=',$carrier_weight[1])
                 ->where('unit_id',$carrier_weight_unit_id[1])->first();
             if ($waybillPriceModelOne&&$waybillPriceModelTwo){
@@ -181,8 +183,8 @@ class WaybillController extends Controller
             if ($waybillPriceModelTwo)return $waybillPriceModelTwo->id;
 
             //价格区间为空
-            $waybillPriceModelRangeOne=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[0]])->first();
-            $waybillPriceModelRangeTwo=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[1]])->first();
+            $waybillPriceModelRangeOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[0]])->first();
+            $waybillPriceModelRangeTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[1]])->first();
             if ($waybillPriceModelRangeOne&&$waybillPriceModelRangeTwo){
                 if ($waybillPriceModelRangeOne->unit_price*$carrier_weight[0]>=$waybillPriceModelRangeTwo->unit_price*$carrier_weight[1]){
                     return $waybillPriceModelRangeOne->id;
@@ -195,10 +197,10 @@ class WaybillController extends Controller
 
             //城市为空
             $city=City::query()->where('id',$destination_city_id)->select('province_id')->first();
-            $waybillPriceModelProvinceOne=WaybillPriceModel::query()->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,$carrier_weight_unit_id[0],$carrier_weight[0],$carrier_weight[0]])->first();
-            $waybillPriceModelProvinceTwo=WaybillPriceModel::query()->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,$carrier_weight_unit_id[1],$carrier_weight[1],$carrier_weight[1]])->first();
+            $waybillPriceModelProvinceOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
+                [$logistic_id,$city->province_id,$carrier_weight_unit_id[0],$carrier_weight[0],$carrier_weight[0]])->first();
+            $waybillPriceModelProvinceTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
+                [$logistic_id,$city->province_id,$carrier_weight_unit_id[1],$carrier_weight[1],$carrier_weight[1]])->first();
             if ($waybillPriceModelProvinceOne&&$waybillPriceModelProvinceTwo){
                 if ($waybillPriceModelProvinceOne->unit_price*$carrier_weight[0]>=$waybillPriceModelProvinceTwo->unit_price*$carrier_weight[1]){
                     return $waybillPriceModelProvinceOne->id;
@@ -210,10 +212,10 @@ class WaybillController extends Controller
             if ($waybillPriceModelProvinceTwo)return $waybillPriceModelProvinceTwo->id;
 
             //城市价格区间都为空
-            $waybillPriceModelProvinceRangeOne=WaybillPriceModel::query()->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[0]])->first();
-            $waybillPriceModelProvinceRangeTwo=WaybillPriceModel::query()->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[1]])->first();
+            $waybillPriceModelProvinceRangeOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
+                [$logistic_id,$city->province_id,$carrier_weight_unit_id[0]])->first();
+            $waybillPriceModelProvinceRangeTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
+                [$logistic_id,$city->province_id,$carrier_weight_unit_id[1]])->first();
             if ($waybillPriceModelProvinceRangeOne&&$waybillPriceModelProvinceRangeTwo){
                 if ($waybillPriceModelProvinceRangeOne->unit_price*$carrier_weight[0]>=$waybillPriceModelProvinceRangeTwo->unit_price*$carrier_weight[1]){
                     return $waybillPriceModelProvinceRangeOne->id;
@@ -227,24 +229,24 @@ class WaybillController extends Controller
         for ($i=0;$i<count($carrier_weight);$i++){
             if ($carrier_weight[$i]&&$carrier_weight_unit_id[$i]){
                 //城市价格区间不为空
-                $waybillPriceModel=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
+                $waybillPriceModel=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
                     ->where('range_min','<',$carrier_weight[$i])->where('range_max','>=',$carrier_weight[$i])
                     ->where('unit_id',$carrier_weight_unit_id[$i])->first();
                 if($waybillPriceModel)return  $waybillPriceModel->id;
 
                 //价格区间为空
-                $waybillPriceModelRange=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[$i]])->first();
+                $waybillPriceModelRange=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[$i]])->first();
                 if ($waybillPriceModelRange){ return $waybillPriceModelRange->id;}
 
                 //城市为空
                 $city=City::where('id',$destination_city_id)->select('province_id')->first();
-                $waybillPriceModelProvince=WaybillPriceModel::query()->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,$carrier_weight_unit_id[$i],$carrier_weight[$i],$carrier_weight[$i]])->first();
+                $waybillPriceModelProvince=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
+                    [$logistic_id,$city->province_id,$carrier_weight_unit_id[$i],$carrier_weight[$i],$carrier_weight[$i]])->first();
                 if ($waybillPriceModelProvince){return $waybillPriceModelProvince->id;}
 
                 //城市价格区间都为空
-                $waybillPriceModelProvinceRange=WaybillPriceModel::query()->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[$i]])->first();
+                $waybillPriceModelProvinceRange=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
+                    [$logistic_id,$city->province_id,$carrier_weight_unit_id[$i]])->first();
                 if ($waybillPriceModelProvinceRange){return $waybillPriceModelProvinceRange->id;}
             }
         }
@@ -259,15 +261,15 @@ class WaybillController extends Controller
      *              城市价格区间不为空,城市价格区间都为空,城市为空,价格区间为空
      * */
     public function isWaybillPriceModel(Request $request){
-        $carrier_id=$request->input('carrier_id');
+        $logistic_id=$request->input('logistic_id');
         $destination_city_id=$request->input('destination_city_id');
         $carrier_weight=$request->input('carrier_weight');
         $carrier_weight_unit_id=$request->input('carrier_weight_unit_id');
-        $validatorData=["carrier_id"=>$carrier_id,"destination_city_id"=>$destination_city_id,
+        $validatorData=["logistic_id"=>$logistic_id,"destination_city_id"=>$destination_city_id,
             'carrier_weight'=>$carrier_weight[0],"carrier_weight_unit_id"=>$carrier_weight_unit_id[0],
             "carrier_weight_other"=>$carrier_weight[1],"carrier_weight_unit_id_other"=>$carrier_weight_unit_id[1]];
         $errors=Validator::make($validatorData,[
-            'carrier_id'=>'required|integer',
+            'logistic_id'=>'required|integer',
             'destination_city_id'=>'required|integer',
             'carrier_weight'=>'nullable|min:0|numeric|max:999999',
             'carrier_weight_unit_id'=>'required_with:carrier_weight',
@@ -283,14 +285,14 @@ class WaybillController extends Controller
             'integer'=>':attribute 必须为数字',
         ],[
             'carrier_weight'=>'承运商计数(抛)',
-            'carrier_id'=>'承运商',
+            'logistic_id'=>'承运商',
             'destination_city_id'=>'目的市',
             'carrier_weight_unit_id'=>'承运商计数单位',
             'carrier_weight_other'=>'承运商计数二',
             'carrier_weight_unit_id_other'=>'承运商计数单位二',
         ])->errors();
         if (count($errors)>0)return ['error'=>$errors];
-        $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
+        $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
         if (!$result){
             //单位为kg,T时
             $unitKG=Unit::query()->where('name','kg')->first();
@@ -298,25 +300,25 @@ class WaybillController extends Controller
             if ($carrier_weight_unit_id[0]==$unitKG->id){
                 $carrier_weight_unit_id[0]=$unitT->id;
                 $carrier_weight[0]=$carrier_weight[0]/1000;
-                $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
+                $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
                 if ($result)return ['success'=>$result];
             }
             if ($carrier_weight_unit_id[1]==$unitKG->id){
                 $carrier_weight_unit_id[1]=$unitT->id;
                 $carrier_weight[1]=$carrier_weight[1]/1000;
-                $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
+                $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
                 if ($result)return ['success'=>$result];
             }
             if ($carrier_weight_unit_id[0]==$unitT->id){
                 $carrier_weight_unit_id[0]=$unitKG->id;
                 $carrier_weight[0]=$carrier_weight[0]*1000;
-                $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
+                $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
                 if ($result)return ['success'=>$result];
             }
             if ($carrier_weight_unit_id[1]==$unitT->id){
                 $carrier_weight_unit_id[1]=$unitKG->id;
                 $carrier_weight[1]=$carrier_weight[1]*1000;
-                $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
+                $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
                 if ($result)return ['success'=>$result];
             }
         }
@@ -376,7 +378,7 @@ class WaybillController extends Controller
     public function waybillEndAudit(Request $request){
         if(!Gate::allows('运输管理-调度审核')){ return redirect(url('/'));  }
         $id=$request->input('id');
-        $waybill=Waybill::query()->with(["owner","carrier","originationCity","destinationCity","carType",'priceModel',"amountUnit",
+        $waybill=Waybill::query()->with(["owner","logistic","originationCity","destinationCity","carType",'priceModel',"amountUnit",
             "warehouseWeightUnit","carrierWeightUnit","warehouseWeightUnitOther","carrierWeightUnitOther"])->find($id);
         if (!$waybill->charge&&!$waybill->collect_fee)return ['exception'=>'收费或到付费用未填!'];
         if ($waybill->charge==0&&$waybill->collect_fee==0)return ['exception'=>'收费与到付费用都为0!'];
@@ -435,7 +437,7 @@ class WaybillController extends Controller
             "charge"=>$waybill->charge,
             "collect_fee"=>$waybill->collect_fee,
             "ordering_remark"=>$waybill->ordering_remark,
-            "carrier_name"=>$waybill->carrier ? $waybill->carrier->name : null,
+            "carrier_name"=>$waybill->logistic ? $waybill->logistic->name : null,
             "carrier_bill"=>$waybill->carrier_bill,
             "origination_city_name"=>$waybill->originationCity ? $waybill->originationCity->name : null,
             "destination_city_name"=>$waybill->destinationCity ? $waybill->destinationCity->name : null,
@@ -578,8 +580,8 @@ class WaybillController extends Controller
         $waybills= app('waybillService')->paginate($request->input());
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('carrier_user')->where('user_id',Auth::id())->get();
-            $carrierIds=array_column($carriersUsers->toArray(),'carrier_id');
-            $waybills=$waybills->whereIn("carrier_id",$carrierIds);
+            $carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
+            $waybills=$waybills->whereIn("logistic_id",$carrierIds);
         }
         return view('waybill.delivering',compact('waybills'));
     }
@@ -646,7 +648,7 @@ class WaybillController extends Controller
     }
     protected function validatorWaybillDispatch(Request $request,$id){
         $rule=[
-            'carrier_id'=>'required|integer',
+            'logistic_id'=>'required|integer',
             'carrier_bill'=>"sometimes|nullable|max:50|unique:waybills,carrier_bill,$id",
             'fee'=>'sometimes|nullable|min:0|numeric|max:999999',
             'other_fee'=>'sometimes|nullable|min:0|numeric|max:999999',
@@ -680,7 +682,7 @@ class WaybillController extends Controller
             'required_with'=>':attribute 未填',
             'integer'=>':attribute 必须为数字',
         ],[
-            'carrier_id'=>'承运商',
+            'logistic_id'=>'承运商',
             'carrier_bill'=>'承运商单号',
             'fee'=>'运费',
             'other_fee'=>'其他费用',
@@ -735,8 +737,10 @@ class WaybillController extends Controller
     public function recycle(Request $request){
         if(!Gate::allows('运输管理-删除')){return redirect('/');}
         $paginate = $request->input('paginate')??50;
-        $waybills = Waybill::with(['owner','carrier','amountUnit','warehouseWeightUnit','carrierWeightUnit',
+        /** @var Collection $waybills */
+        $waybills = Waybill::query()->with(['owner','logistic','amountUnit','warehouseWeightUnit','carrierWeightUnit',
             'warehouseWeightUnitOther','carrierWeightUnitOther','carType','waybillAuditLogs' => function ($query) {
+            /** @var Builder $query */
             $query->with('user');
         }])->orderBy('deleted_at', 'DESC')->withTrashed()->whereNotNull('deleted_at')->paginate(50);
         $total = $waybills->count();

+ 17 - 18
app/Http/Controllers/WaybillPriceModelsController.php

@@ -3,7 +3,6 @@
 namespace App\Http\Controllers;
 
 use App\WaybillPriceModel;
-use App\Carrier;
 use App\City;
 use App\Events\WaybillPriceModelEvent;
 use App\Imports\WaybillPriceModelsImport;
@@ -22,22 +21,22 @@ class WaybillPriceModelsController extends Controller
     public function index(Request $request)
     {
         if(!Gate::allows('计费模型-查询')){ return redirect(url('/'));  }
-        $carriers=Carrier::get();
-        $provinces=Province::get();
+        $logistics=app('LogisticService')->getSelection(["id","name"],"logistic");
+        $provinces=Province::query()->get();
         $data=$request->input();
-        $waybillPriceModels= WaybillPriceModel::orderBy('id', 'DESC');
+        $waybillPriceModels= WaybillPriceModel::query()->orderBy('id', 'DESC');
         if ($data){
-            if ($request->input('carrier_id')){
-                $waybillPriceModels=$waybillPriceModels->where('carrier_id',$request->input('carrier_id'));
+            if ($request->input('logistic_id')){
+                $waybillPriceModels=$waybillPriceModels->where('logistic_id',$request->input('logistic_id'));
             }
             if ($request->input('province_id')){
                 $waybillPriceModels=$waybillPriceModels->where('province_id',$request->input('province_id'));
             }
             $waybillPriceModels=$waybillPriceModels->paginate($request->input('paginate')?$request->input('paginate'):50);
-            return view('maintenance.priceModel.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
+            return view('maintenance.priceModel.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'logistics'=>$logistics,'provinces'=>$provinces,'filterData'=>$data]);
         }else{
             $waybillPriceModels= $waybillPriceModels->paginate(50);
-            return view('maintenance.priceModel.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'carriers'=>$carriers,'provinces'=>$provinces,'filterData'=>$data]);
+            return view('maintenance.priceModel.waybillPriceModel.index',['waybillPriceModels'=>$waybillPriceModels,'logistics'=>$logistics,'provinces'=>$provinces,'filterData'=>$data]);
         }
     }
 
@@ -45,10 +44,10 @@ class WaybillPriceModelsController extends Controller
     public function create()
     {
         if(!Gate::allows('计费模型-录入')){ return redirect(url('/'));  }
-        $carriers=Carrier::get();
+        $logistics=app('LogisticService')->getSelection(["id","name"],"logistic");
         $provinces=Province::get();
         $units=Unit::get();
-        return view('maintenance.priceModel.waybillPriceModel.create',['carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units]);
+        return view('maintenance.priceModel.waybillPriceModel.create',['logistics'=>$logistics,'provinces'=>$provinces,'units'=>$units]);
     }
 
     public function getCities($province_id){
@@ -62,7 +61,7 @@ class WaybillPriceModelsController extends Controller
         if(!Gate::allows('计费模型-录入')){ return redirect(url('/'));  }
         $this->validateWaybillPriceModel($request)->validate();
         $waybillPriceModel=$request->input('WaybillPriceModel');
-        $waybillPriceModelIs=WaybillPriceModel::where('carrier_id',$waybillPriceModel['carrier_id'])->where('province_id',$waybillPriceModel['province_id'])->where('unit_id',$waybillPriceModel['unit_id']);
+        $waybillPriceModelIs=WaybillPriceModel::where('logistic_id',$waybillPriceModel['logistic_id'])->where('province_id',$waybillPriceModel['province_id'])->where('unit_id',$waybillPriceModel['unit_id']);
         if (isset($waybillPriceModel['city_id'])){
             $waybillPriceModelIs=$waybillPriceModelIs->where('city_id',$waybillPriceModel['city_id']);
         }
@@ -75,12 +74,12 @@ class WaybillPriceModelsController extends Controller
         $waybillPriceModelIs=$waybillPriceModelIs->first();
         if (!$waybillPriceModelIs){
             if (isset($waybillPriceModel['city_id'])){
-                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('carrier_id = ? AND province_id = ? AND city_id IS NULL',[$waybillPriceModel['carrier_id'],$waybillPriceModel['province_id']])->first();
+                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('logistic_id = ? AND province_id = ? AND city_id IS NULL',[$waybillPriceModel['logistic_id'],$waybillPriceModel['province_id']])->first();
                 if ($waybillPriceModelProvince){
                     return redirect()->back()->with('successTip','已存在省份模型,无需录入城市模型');
                 }
             }else{
-                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('carrier_id = ? AND province_id = ? AND city_id IS NOT NULL',[$waybillPriceModel['carrier_id'],$waybillPriceModel['province_id']])->first();
+                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('logistic_id = ? AND province_id = ? AND city_id IS NOT NULL',[$waybillPriceModel['logistic_id'],$waybillPriceModel['province_id']])->first();
                 if ($waybillPriceModelProvince){
                     return redirect()->back()->with('successTip','已存在城市模型,无法录入省份模型');
                 }
@@ -102,11 +101,11 @@ class WaybillPriceModelsController extends Controller
     {
         if(!Gate::allows('计费模型-编辑')){ return redirect(url('/'));  }
         $waybillPriceModel=WaybillPriceModel::find($id);
-        $carriers=Carrier::get();
+        $logistics=app('LogisticService')->getSelection(["id","name"],"logistic");
         $provinces=Province::get();
         $cities=City::where('province_id',$waybillPriceModel->province_id)->get();
         $units=Unit::get();
-        return view('maintenance.priceModel.waybillPriceModel.edit',['waybillPriceModel'=>$waybillPriceModel,'carriers'=>$carriers,'provinces'=>$provinces,'units'=>$units,'cities'=>$cities]);
+        return view('maintenance.priceModel.waybillPriceModel.edit',['waybillPriceModel'=>$waybillPriceModel,'logistics'=>$logistics,'provinces'=>$provinces,'units'=>$units,'cities'=>$cities]);
     }
 
 
@@ -129,7 +128,7 @@ class WaybillPriceModelsController extends Controller
     public function destroy($id)
     {
         if(!Gate::allows('计费模型-删除')){ return redirect(url('/'));  }
-        $waybillPriceModel=WaybillPriceModel::find($id);
+        $waybillPriceModel=WaybillPriceModel::query()->find($id);
         app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($waybillPriceModel),Auth::user()['id']);
         $result=$waybillPriceModel->delete();
         return ['success'=>$result];
@@ -165,7 +164,7 @@ class WaybillPriceModelsController extends Controller
         $min = $request->input('WaybillPriceModel.range_min');
         $validator= Validator::make($request->input(),[
             'WaybillPriceModel.province_id'=>'required|integer',
-            'WaybillPriceModel.carrier_id'=>'required|integer',
+            'WaybillPriceModel.logistic_id'=>'required|integer',
             'WaybillPriceModel.unit_id'=>'required|integer',
             'WaybillPriceModel.city_id'=>'nullable|Integer',
             'WaybillPriceModel.range_min'=> 'nullable|min:0|numeric|max:999999',
@@ -181,7 +180,7 @@ class WaybillPriceModelsController extends Controller
             'integer'=> ':attribute 选择错误',
         ],[
             'WaybillPriceModel.province_id'=>'省份',
-            'WaybillPriceModel.carrier_id'=>'承运商',
+            'WaybillPriceModel.logistic_id'=>'承运商',
             'WaybillPriceModel.unit_id'=>'计重单位',
             'WaybillPriceModel.city_id'=>'城市',
             'WaybillPriceModel.range_min'=>'价格区间最小值',

+ 0 - 115
app/Http/Controllers/api/thirdPart/flux/PackageController.php

@@ -17,121 +17,6 @@ class PackageController extends Controller
 
     public function new_(Request $request)
     {
-//        $requestInputs=$request->all();
-//        app('LogService')->log(__METHOD__,'request_'.__FUNCTION__,json_encode($requestInputs),null);
-//        $errors=$this->validatorForNew($requestInputs)->errors();
-//        if(count($errors)>0){
-//            app('LogService')->log(__METHOD__,'error2_'.__FUNCTION__,json_encode($requestInputs).'||'.json_encode($errors),null);
-//            return ['response'=>['flag'=>'W','message'=>'fields wrong, see Errors report please.',
-//                'errors'=>$errors]];
-//        }
-//        $receiveInputs=$requestInputs['request'];
-//        $package=Package::where('logistic_number',$receiveInputs['SOReference5'])->first();
-//        if (!$receiveInputs['Customer']) {
-//            app('LogService')->log(__METHOD__, __FUNCTION__, '富勒没有下发货主!快递单号:'.$receiveInputs['SOReference5'] , null);
-//        }
-//        $owner=Owner::select('id')->where('code',$receiveInputs['Customer'])->first();
-//        if (!$owner&&$receiveInputs['SOReference5']) {
-//            Owner::create(['code'=>$receiveInputs['Customer'],'name'=>$receiveInputs['Customer']]);
-//            app('LogService')->log(__METHOD__, __FUNCTION__, '富勒下发找不到货主,添加. 快递单号:'.$receiveInputs['SOReference5'] , null);
-//        }
-//        if (!$receiveInputs['CarrierID']) {
-//            app('LogService')->log(__METHOD__, __FUNCTION__, '富勒没有下发快递公司!快递单号:'.$receiveInputs['SOReference5'] , null);
-//        }
-//        $logistic=Logistic::select('id')->where('code',$receiveInputs['CarrierID'])->first();
-//        if (!$logistic&&$receiveInputs['CarrierID']) {
-//            Logistic::create(['code'=>$receiveInputs['CarrierID'],'name'=>$receiveInputs['CarrierID']]);
-//            app('LogService')->log(__METHOD__, __FUNCTION__, '富勒下发找不到承运商,添加. 快递单号:' .$receiveInputs['SOReference5'] , null);
-//        }
-//        if ($package) {
-//            $package->delivery_number = $receiveInputs['palletid'];
-//            if ($owner) {
-//                $package->owner_id = $owner->id;
-//                $packagePaperBox = new Package();
-//                $packagePaperBox->fetchPaperBox($package->length, $package->width, $package->height);
-//            } else {
-//                $package->status = '记录异常';
-//            }
-//            $package->recipient = $receiveInputs['Consigneename'];
-//            if ($logistic) $package->logistic_id = $logistic->id;
-//            $package->batch_number = $receiveInputs['USERDEFINE1'];
-//            $package->batch_rule = $receiveInputs['USERDEFINE2'];
-//            $package->save();
-//            $result = $this->accomplishToWMS($package);
-//            if ($result['result'] == 'success') {
-//                if ($package->status == "记录异常") $package->status = "已上传异常";
-//                else $package->status = "已上传";
-//            } else {
-//                $package->status = "上传异常";
-//            }
-//            $package->save();
-//            app('LogService')->log(__METHOD__, 'fluxPackageApi' . __FUNCTION__, json_encode($request->all()), null);
-//            return response()->json(['response' => ['flag' => 'Y', 'code' => '0000', 'message' => '正确接收']])
-//                ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
-//        }
-//        //package不存在
-//        $receive = new WMSReflectPackage($receiveInputs);
-//        try{
-//            $receive->save();
-//        }catch (\Exception $exception){
-//            Controller::logS(__METHOD__,'Exception_'.__FUNCTION__,'WMS下发请求保存异常:'.$exception->getMessage(),null);
-//            return ['response'=>['flag'=>'W','message'=>'already send, order number unique violation.',
-//                'errors'=>$exception->getMessage()]];
-//        }
-//        if (isset($owner->id)&&isset($logistic->id)){
-//            $createPackage = new Package([
-//                'logistic_number'=>$receiveInputs['SOReference5'],
-//                'delivery_number'=>$receiveInputs['palletid'],
-//                'recipient'=>$receiveInputs['Consigneename'],
-//                'owner_id'=>$owner->id,
-//                'logistic_id'=>$logistic->id,
-//                'batch_number'=>$receiveInputs['USERDEFINE1'],
-//                'batch_rule'=>$receiveInputs['USERDEFINE2'],
-//                'status'=>'未测量'
-//            ]);
-//        }else{
-//            app('LogService')->log(__METHOD__,'fluxPackageApi(no owner or carrier)'.__FUNCTION__,json_encode($request->all()),null);
-//            $createPackage = new Package([
-//                'logistic_number'=>$receiveInputs['SOReference5'],
-//                'delivery_number'=>$receiveInputs['palletid'],
-//                'recipient'=>$receiveInputs['Consigneename'],
-//                'batch_number'=>$receiveInputs['USERDEFINE1'],
-//                'batch_rule'=>$receiveInputs['USERDEFINE2'],
-//                'status'=>'记录异常'
-//            ]);
-//        }
-//        $createPackage->order_code=$receiveInputs['Orderno'];
-//        $createPackage->save();
-//        //活动波次同步  组合提总
-//        if ($receiveInputs['USERDEFINE2']&&strstr($receiveInputs['USERDEFINE2'],'组合')) {
-//            $packageBatch = Package::whereRaw('batch_number = ? AND weight IS NOT NULL', [$receiveInputs['USERDEFINE1']])->first();
-//            if ($receiveInputs['USERDEFINE1'] && $packageBatch) {
-//                $createPackage->measuring_machine_id = $packageBatch->measuring_machine_id;
-//                $createPackage->weight = $packageBatch->weight;
-//                $createPackage->length = $packageBatch->length;
-//                $createPackage->width = $packageBatch->width;
-//                $createPackage->height = $packageBatch->height;
-//                $createPackage->bulk = $packageBatch->bulk;
-//                $createPackage->paper_box_id = $packageBatch->paper_box_id;
-//                $createPackage->save();
-//                $result = $this->accomplishToWMS($createPackage);
-//                if ($result['result'] == 'success') {
-//                    if ($createPackage->status == "记录异常") $createPackage->status = "已上传异常";
-//                    else $createPackage->status = "已上传";
-//                } else {
-//                    $createPackage->status = "上传异常";
-//                }
-//            }
-//            if (!$receiveInputs['USERDEFINE1'] || !$packageBatch) {
-//                MarkPackageExcepted::dispatch($createPackage)->delay(Carbon::now()->addMinutes(1440));
-//            }
-//            $createPackage->save();
-//            app('LogService')->log(__METHOD__, 'success_' . __FUNCTION__, json_encode($request->all()), null);
-//            return response()->json(['response' => ['flag' => 'Y', 'code' => '0000', 'message' => '正确接收']])
-//                ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
-//        }
-//        MarkPackageExcepted::dispatch($createPackage)->delay(Carbon::now()->addMinutes(1440));
-//        app('LogService')->log(__METHOD__,'success_'.__FUNCTION__,json_encode($request->all()),null);
         return response()->json(['response'=>['flag'=>'Y','code'=>'0000','message'=>'正确接收']])
             ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
     }

+ 5 - 5
app/Http/Controllers/api/thirdPart/weixin/WxController.php

@@ -22,13 +22,13 @@ class WxController extends Controller
         $api_token=$request->input('api_token');
         $user=UserToken::getUser($api_token);
         if ($user){
-            foreach ($user->carriers as $carrier){
-                array_push($carrierArr, $carrier->id);
-                array_push($carriersName, $carrier->name);
+            foreach ($user->logistics as $logistic){
+                array_push($carrierArr, $logistic->id);
+                array_push($carriersName, $logistic->name);
             }
-            $count=Waybill::select('id')->whereIn('carrier_id',$carrierArr)->whereDate('created_at',date("Y-m-d "))->count();
+            $count=Waybill::select('id')->whereIn('logistic_id',$carrierArr)->whereDate('created_at',date("Y-m-d "))->count();
             $waybill=Waybill::orderBy('created_at','DESC')->select('created_at','waybill_number','wms_bill_number','carrier_bill')
-                ->whereIn('carrier_id',$carrierArr)->where('status','!=','已完结')->where('status','!=','无模型')->get();
+                ->whereIn('logistic_id',$carrierArr)->where('status','!=','已完结')->where('status','!=','无模型')->get();
             return ['waybill'=>$waybill,'carriersName'=>$carriersName,'count'=>$count];
         }
         return ['error'=>'请检查您的登录账号!'];

+ 0 - 6
app/Imports/PaperBoxesImport.php

@@ -4,12 +4,6 @@ namespace App\Imports;
 
 use App\Owner;
 use App\PaperBox;
-use App\WaybillPriceModel;
-use App\Carrier;
-use App\City;
-use App\Events\WaybillPriceModelEvent;
-use App\Province;
-use App\Unit;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Maatwebsite\Excel\Concerns\ToCollection;

+ 0 - 2
app/Imports/StoreCheckingReceiveImport.php

@@ -5,9 +5,7 @@ namespace App\Imports;
 use App\Http\Controllers\CommodityController;
 use App\Services\CommodityBarcodeService;
 use App\Services\CommodityService;
-use App\Services\LogService;
 use Carbon\Carbon;
-use Illuminate\Support\Arr;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Maatwebsite\Excel\Concerns\ToCollection;

+ 14 - 12
app/Imports/WaybillPriceModelsImport.php

@@ -2,8 +2,8 @@
 
 namespace App\Imports;
 
+use App\Logistic;
 use App\WaybillPriceModel;
-use App\Carrier;
 use App\City;
 use App\Events\WaybillPriceModelEvent;
 use App\Province;
@@ -43,12 +43,12 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
             foreach ($collection as $row) {
                 if ($row['承运商'] && $row['计数单位'] && $row['省份'] && $row['单价']) {
                     if (strstr($row['省份'], '省')){$row['省份']=str_replace('省','',$row['省份']);};
-                    $carrier = Carrier::where('name', $row['承运商'])->first();
-                    $unit = Unit::where('name', $row['计数单位'])->first();
-                    $province = Province::where('name', $row['省份'])->first();
-                    $city = City::where('name', $row['市'])->first();
-                    if ($carrier && $unit && $province) {
-                        $billing = WaybillPriceModel::where('carrier_id', $carrier->id);
+                    $logistic = Logistic::query()->where('name', $row['承运商'])->first();
+                    $unit = Unit::query()->where('name', $row['计数单位'])->first();
+                    $province = Province::query()->where('name', $row['省份'])->first();
+                    $city = City::query()->where('name', $row['市'])->first();
+                    if ($logistic && $unit && $province) {
+                        $billing = WaybillPriceModel::query()->where('logistic_id', $logistic->id);
                         $billing = $billing->where('unit_id', $unit->id);
                         $billing = $billing->where('province_id', $province->id);
                         if ($row['市']) {
@@ -64,20 +64,20 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                         $billing = $billing->first();
                         if (!$billing) {
                             if (isset($waybillPriceModel['city_id'])){
-                                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('carrier_id = ? AND province_id = ? AND city_id IS NULL',[$carrier->id,$province->id])->first();
+                                $waybillPriceModelProvince=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND city_id IS NULL',[$logistic->id,$province->id])->first();
                                 if ($waybillPriceModelProvince){
                                     $cityIs=false;
                                     array_push($exception, ['第' . $sum . '行数据已存在省份模型,无需录入城市模型']);
                                 }
                             }else{
-                                $waybillPriceModelProvince=WaybillPriceModel::whereRaw('carrier_id = ? AND province_id = ? AND city_id IS NOT NULL',[$carrier->id,$province->id])->first();
+                                $waybillPriceModelProvince=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND city_id IS NOT NULL',[$logistic->id,$province->id])->first();
                                 if ($waybillPriceModelProvince){
                                     $cityIs=false;
                                     array_push($exception, ['第' . $sum . '行数据已存在城市模型,无法录入省份模型']);
                                 }
                             }
                             if ($cityIs){
-                                $waybillPriceModel = ['carrier_id' => $carrier->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
+                                $waybillPriceModel = ['logistic_id' => $logistic->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
                                 if ($row['计数区间']) {
                                     $str = explode('-', $row['计数区间']);
                                     if (preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[0]) >= 0
@@ -106,12 +106,13 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['initial_weight' => 0]);
                                     array_push($exception, ['第' . $sum . '行数据最低计数为空,或为负,已默认设为0']);
                                 }
-                                $waybillPriceModel=WaybillPriceModel::create($waybillPriceModel);
+                                $waybillPriceModel=WaybillPriceModel::query()->create($waybillPriceModel);
+                                /** @var WaybillPriceModel $waybillPriceModel */
                                 event(new WaybillPriceModelEvent($waybillPriceModel));
                             }
                         } else {
                             if ($this->isOverride) {
-                                $waybillPriceModel = ['carrier_id' => $carrier->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
+                                $waybillPriceModel = ['logistic_id' => $logistic->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
                                 if ($row['计数区间']&& !strstr($row['计数区间'], '∞')) {
                                     $str = explode('-', $row['计数区间']);
                                     if (preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[0]) > 0
@@ -142,6 +143,7 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                 }
                                 $billing->fill($waybillPriceModel);
                                 if ($billing->save()) {
+                                    /** @var WaybillPriceModel $billing */
                                     event(new WaybillPriceModelEvent($billing));
                                     array_push($exception, ['第' . $sum . '行数据已覆盖原计费模型']);
                                 }

+ 6 - 8
app/Listeners/WaybillPriceModelListener.php

@@ -2,7 +2,7 @@
 
 namespace App\Listeners;
 
-use App\Carrier;
+use App\Logistic;
 use App\City;
 use App\Events\WaybillPriceModelEvent;
 use App\Waybill;
@@ -10,8 +10,6 @@ use App\WaybillFinancialSnapshot;
 use App\WaybillPayoff;
 use App\WaybillFinancialExcepted;
 use App\WaybillPriceModel;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Contracts\Queue\ShouldQueue;
 
 class WaybillPriceModelListener
 {
@@ -35,13 +33,13 @@ class WaybillPriceModelListener
             });
             //市不存在,价格区间不存在
             if (!$waybillPriceModel->range_max){
-                $waybills=Waybill::where('carrier_id',$waybillPriceModel->carrier_id)->whereIn('destination_city_id',$cityIds)
+                $waybills=Waybill::query()->where('logistic_id',$waybillPriceModel->logistic_id)->whereIn('destination_city_id',$cityIds)
                     ->where('type','专线')->where('status','!=','已完结')->where('carrier_weight_unit_id',$waybillPriceModel->unit_id)
                     ->orWhere('carrier_weight_unit_id_other',$waybillPriceModel->unit_id)->get();
             }
             //市不存在,价格区间存在
             if ($waybillPriceModel->range_max){
-                $waybills=Waybill::where('carrier_id',$waybillPriceModel->carrier_id)->whereIn('destination_city_id',$cityIds)
+                $waybills=Waybill::where('logistic_id',$waybillPriceModel->logistic_id)->whereIn('destination_city_id',$cityIds)
                     ->whereRaw('carrier_weight <= ? AND carrier_weight > ? AND carrier_weight_unit_id = ?',[$waybillPriceModel->range_max,$waybillPriceModel->range_min,$waybillPriceModel->unit_id])
                     ->orWhereRaw('carrier_weight_other <= ? AND carrier_weight_other > ? AND carrier_weight_unit_id_other = ?',[$waybillPriceModel->range_max,$waybillPriceModel->range_min,$waybillPriceModel->unit_id])
                     ->where('type','专线')->where('status','!=','已完结')->get();
@@ -50,7 +48,7 @@ class WaybillPriceModelListener
 
         //市存在,价格区间存在
         if ($waybillPriceModel->city_id&&$waybillPriceModel->range_max){
-            $waybills=Waybill::where('carrier_id',$waybillPriceModel->carrier_id)->where('destination_city_id',$waybillPriceModel->city_id)
+            $waybills=Waybill::where('logistic_id',$waybillPriceModel->logistic_id)->where('destination_city_id',$waybillPriceModel->city_id)
                 ->whereRaw('carrier_weight <= ? AND carrier_weight > ? AND carrier_weight_unit_id = ?',[$waybillPriceModel->range_max,$waybillPriceModel->range_min,$waybillPriceModel->unit_id])
                 ->orWhereRaw('carrier_weight_other <= ? AND carrier_weight_other > ? AND carrier_weight_unit_id_other = ?',[$waybillPriceModel->range_max,$waybillPriceModel->range_min,$waybillPriceModel->unit_id])
                 ->where('type','专线')->where('status','!=','完结')->get();
@@ -58,7 +56,7 @@ class WaybillPriceModelListener
 
         //市存在,价格区间不存在
         if ($waybillPriceModel->city_id&&!$waybillPriceModel->range_max){
-            $waybills=Waybill::where('carrier_id',$waybillPriceModel->carrier_id)->where('destination_city_id',$waybillPriceModel->city_id)
+            $waybills=Waybill::where('logistic_id',$waybillPriceModel->logistic_id)->where('destination_city_id',$waybillPriceModel->city_id)
                 ->where('type','专线')->where('status','!=','完结')->where('carrier_weight_unit_id',$waybillPriceModel->unit_id)
                 ->orWhere('carrier_weight_unit_id_other',$waybillPriceModel->unit_id)->get();
         }
@@ -78,7 +76,7 @@ class WaybillPriceModelListener
         if ($waybills){
             foreach ($waybills as $waybill){
                 //修改运单表运费
-                $carrier=Carrier::find($waybill->carrier_id);
+                $carrier=Carrier::find($waybill->logistic_id);
                 if ($waybill->carrier_weight<$waybillPriceModel->initial_weight){
                     $fee=(($waybillPriceModel->unit_price)*($waybillPriceModel->initial_weight))+$carrier->delivery_fee;
                 }else{

+ 1 - 1
app/Logistic.php

@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Model;
 class Logistic extends Model
 {
     use ModelTimeFormat;
-    protected $fillable = ['name','code'];
+    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee"];
 
 
     static function nameById($id){

+ 11 - 3
app/Services/LogisticService.php

@@ -6,6 +6,7 @@ use App\Logistic;
 use App\OracleBasCustomer;
 use Carbon\Carbon;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Str;
 
 Class LogisticService
 {
@@ -14,9 +15,11 @@ Class LogisticService
     function __construct(){
         $this->cacheService=app('CacheService');
     }
-    public function getSelection($column = ['id','name']){
-        return $this->cacheService->getOrExecute('LogisticAll_idName',function()use($column){
-            return Logistic::query()->select($column)->get();
+    public function getSelection($column = ['id','name'], $type = 'express'){
+        return $this->cacheService->getOrExecute('LogisticAll_idName'.Str::studly($type),function()use($column,$type){
+            $query = Logistic::query()->select($column);
+            if ($type)$query->where("type",$type);
+            return $query->get();
         },config('cache.expirations.persistent'));
     }
 
@@ -76,5 +79,10 @@ Class LogisticService
         return Logistic::query()->insert($params);
     }
 
+    public function find($id)
+    {
+        return Logistic::query()->find($id);
+    }
+
 
 }

+ 3 - 2
app/Services/RejectedService.php

@@ -27,8 +27,9 @@ class RejectedService
     private function conditionQuery(array $param)
     {
         $user = Auth::user();
-        $rejectedBills = RejectedBill::query()->with('user','owner', 'logistic', 'items.quality','orderIssue:logistic_number_return')->orderBy('rejected_bills.id', 'desc')->whereIn('rejected_bills.id_owner',
-            $user ? app('UserService')->getPermittingOwnerIds($user) : []);
+        $rejectedBills = RejectedBill::query()->with('user','owner', 'logistic', 'items.quality','orderIssue:logistic_number_return')
+            ->orderBy('rejected_bills.id', 'desc')->whereIn('rejected_bills.id_owner',
+            $user ? (app('UserService')->getPermittingOwnerIds($user) ?? []) : []);
         $columnQueryRules = [
             'created_at_start' => ['alias' => 'created_at', 'startDate' => ' 00:00:00'],
             'created_at_end' => ['alias' => 'created_at', 'endDate' => ' 23:59:59'],

+ 8 - 8
app/Services/WaybillService.php

@@ -17,7 +17,7 @@ Class WaybillService
      * @return Builder
      */
     private function conditionQuery(array $param){
-        $waybills = Waybill::filterAuthorities()->with(['owner','carrier','originationCity','destinationCity'=>function($query){
+        $waybills = Waybill::filterAuthorities()->with(['owner','logistic','originationCity','destinationCity'=>function($query){
             $query->with('province');
         },'uploadFile','amountUnit','priceModel','warehouseWeightUnit','carrierWeightUnit',
             'warehouseWeightUnitOther','carrierWeightUnitOther','carType','uploadFile','waybillAuditLogs' => function ($query) {
@@ -69,8 +69,8 @@ Class WaybillService
                 ->selectRaw('car_types.name car_type_name')
             ->leftJoin('units as amount_unit','amount_unit.id','=','waybills.amount_unit_id')
                 ->selectRaw('amount_unit.name amount_unit_name')
-            ->leftJoin('carriers','carriers.id','=','waybills.carrier_id')
-                ->selectRaw('carriers.name carrier_name')
+            ->leftJoin('logistics','logistics.id','=','waybills.logistic_id')
+                ->selectRaw('logistics.name carrier_name')
             ->sql();
     }
 
@@ -134,13 +134,13 @@ Class WaybillService
     public function getDeliveringSql(array $param){
         $waybills = $this->conditionQuery($param);
         if (!Auth::user()->isSuperAdmin()){
-            $carriersUsers=DB::table('carrier_user')->where('user_id',Auth::id())->get();
-            $carrierIds=array_column($carriersUsers->toArray(),'carrier_id');
-            $waybills=$waybills->whereIn("waybills.carrier_id",$carrierIds);
+            $users=DB::table('logistic_user')->where('user_id',Auth::id())->get();
+            $userIds=array_column($users->toArray(),'logistic_id');
+            $waybills=$waybills->whereIn("waybills.logistic_id",$userIds);
         }
         return $waybills->leftJoin('owners','owners.id','=','waybills.owner_id')->selectRaw('owners.name owner_name')
-            ->leftJoin('carriers','carriers.id','=','waybills.carrier_id')
-            ->selectRaw('carriers.name carrier_name')
+            ->leftJoin('logistics','logistics.id','=','waybills.logistic_id')
+            ->selectRaw('logistics.name carrier_name')
             ->sql();
     }
 }

+ 2 - 2
app/User.php

@@ -79,8 +79,8 @@ class User extends Authenticatable
         return $this->belongsToMany('App\Role','user_role','id_user','id_role');
     }
 
-    function carriers(){
-        return $this->belongsToMany('App\Carrier','carrier_user','user_id','carrier_id');
+    function logistics(){
+        return $this->belongsToMany('App\Logistic','logistic_user','user_id','logistic_id');
     }
     function userWorkgroups(){
         return $this->belongsToMany('App\UserWorkgroup','user_workgroup_user','user_id','user_workgroup_id');

+ 3 - 3
app/Waybill.php

@@ -15,7 +15,7 @@ class Waybill extends Model
     use SoftDeletes;
     protected $fillable=[
         'status','type','waybill_number','owner_id','wms_bill_number','origination','destination','recipient','recipient_mobile','charge','ordering_remark',
-        'carrier_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id',
+        'logistic_id','carrier_bill','origination_city_id','destination_city_id','warehouse_weight','warehouse_weight_unit_id','carrier_weight','carrier_weight_unit_id','carType_id',
         'car_owner_info','fee','pick_up_fee','other_fee','collect_fee','dispatch_remark','waybill_price_model_id','warehouse_weight_other','warehouse_weight_unit_id_other'
         ,'carrier_weight_other','carrier_weight_unit_id_other','source_bill','mileage','amount','inquire_tel','amount_unit_id','other_charge','other_charge_remark','deliver_at'
     ];
@@ -23,8 +23,8 @@ class Waybill extends Model
     public function owner(){
         return $this->hasOne('App\Owner','id','owner_id');
     }
-    public function carrier(){
-        return $this->hasOne('App\Carrier','id','carrier_id');
+    public function logistic(){
+        return $this->hasOne('App\Logistic','id','logistic_id');
     }
     public function originationCity(){
         return $this->hasOne('App\City','id','origination_city_id');

+ 3 - 3
app/WaybillPriceModel.php

@@ -10,7 +10,7 @@ class WaybillPriceModel extends Model
     use ModelTimeFormat;
 
     protected $fillable=[
-        'carrier_id','province_id','city_id','unit_id','range_min','range_max','unit_price','base_fee','initial_weight'
+        'logistic_id','province_id','city_id','unit_id','range_min','range_max','unit_price','base_fee','initial_weight'
     ];
 
     protected $appends=[
@@ -20,8 +20,8 @@ class WaybillPriceModel extends Model
         'unit_name',
     ];
 
-    public function carrier(){
-        return $this->belongsTo('App\Carrier','carrier_id','id');
+    public function logistic(){
+        return $this->belongsTo('App\Logistic','logistic_id','id');
     }
 
     public  function province(){

+ 0 - 10
database/migrations/2019_11_22_094024_create_waybills_table.php

@@ -42,16 +42,6 @@ class CreateWaybillsTable extends Migration
             $table->decimal('other_fee')->nullable()->comment('其他费用');
             $table->text('dispatch_remark')->nullable()->comment('调度备注');
             $table->bigInteger('waybill_price_model_id')->nullable()->index()->comment('外联计费模型');
-
-            //外键
-            /* $table->foreign('owner_id')->references('id')->on('owners');            //货主
-             $table->foreign('carrier_id')->references('id')->on('carrier');        //承运商
-             $table->foreign('origination_city_id')->references('id')->on('citys');  //城市
-             $table->foreign('destination_city_id')->references('id')->on('citys');  //城市
-             $table->foreign('warehouse_weight_unit_id')->references('id')->on('units');  //单位
-             $table->foreign('carrier_weight_unit_id')->references('id')->on('units');  //单位
-             $table->foreign('carType_id')->references('id')->on('carTypes');        //车型*/
-
         });
     }
 

+ 0 - 6
database/migrations/2019_11_22_094311_create_waybill_price_models_table.php

@@ -25,12 +25,6 @@ class CreateWaybillPriceModelsTable extends Migration
             $table->decimal('unit_price')->comment('单价(元)');
             $table->decimal('base_fee')->default(0)->comment('起步费');
             $table->decimal('initial_weight')->default(0)->comment('始重');
-
-/*            //外键
-            $table->foreign('carrier_id')->references('id')->on('carrier');    //承运商
-            $table->foreign('province_id')->references('id')->on('provinces');  //省份
-            $table->foreign('city_id')->references('id')->on('citys');         //城市
-            $table->foreign('unit_id')->references('id')->on('units');          //单位*/
         });
     }
 

+ 0 - 5
database/migrations/2020_09_20_142656_change_order_issue.php

@@ -27,11 +27,6 @@ class ChangeOrderIssue extends Migration
                 }
             }
         }
-
-//        Schema::table('order_issues',function (Blueprint $table) {
-//            $table->dropColumn('rejected_bill_id');
-//        });
-
     }
 
     /**

+ 62 - 0
database/migrations/2020_11_26_092308_add_column_carrier_table_logistic.php

@@ -0,0 +1,62 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnCarrierTableLogistic extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->enum("type",["logistic","express"])->default("express")->comment("类型");
+            $table->string("mobile")->nullable()->comment("手机号");
+            $table->string("remark")->nullable()->comment("备注");
+            $table->decimal("delivery_fee")->nullable()->comment("送货费");
+        });
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->renameColumn("carrier_id","logistic_id");
+        });
+        Schema::table('waybill_price_models', function (Blueprint $table) {
+            $table->renameColumn("carrier_id","logistic_id");
+        });
+        Schema::table('carrier_user', function (Blueprint $table) {
+            $table->rename("logistic_user");
+        });
+        Schema::table('logistic_user', function (Blueprint $table) {
+            $table->renameColumn("carrier_id","logistic_id");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->dropColumn("type");
+            $table->dropColumn("mobile");
+            $table->dropColumn("remark");
+            $table->dropColumn("delivery_fee");
+        });
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->renameColumn("logistic_id","carrier_id");
+        });
+        Schema::table('waybill_price_models', function (Blueprint $table) {
+            $table->renameColumn("logistic_id","carrier_id");
+        });
+        Schema::table('logistic_user', function (Blueprint $table) {
+            $table->rename("carrier_user");
+        });
+        Schema::table('carrier_user', function (Blueprint $table) {
+            $table->renameColumn("logistic_id","carrier_id");
+        });
+    }
+}

+ 16 - 0
database/seeds/LogisticSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class LogisticSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        factory(\App\Logistic::class,3)->create();
+    }
+}

+ 16 - 0
database/seeds/OwnerSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OwnerSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        factory(\App\Owner::class,3)->create();
+    }
+}

+ 0 - 78
database/seeds/faker_data.php

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

+ 48 - 3
resources/views/maintenance/logistic/create.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')创建物流公司@endsection
+@section('title')创建承运商@endsection
 
 @section('content')
     <div id="nav2">
@@ -15,7 +15,21 @@
                 <form method="POST" action="{{ url('maintenance/logistic') }}">
                     @csrf
                     <div class="form-group row">
-                        <label for="name" class="col-2 col-form-label text-right">物流公司名称</label>
+                        <label for="type" class="col-2 col-form-label text-right">承运商类型 <b class="text-danger">*</b></label>
+                        <div class="col-5">
+                            <select id="type" name="type" class="form-control @error('type') is-invalid @enderror" value="{{ old('type') }}" required>
+                                <option value="快递">快递</option>
+                                <option value="物流">物流</option>
+                            </select>
+                            @error('type')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">承运商名称 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('name') is-invalid @enderror"
                                    name="name" autocomplete="off" value="{{ old('name') }}" required>
@@ -27,7 +41,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="code" class="col-2 col-form-label text-right">物流公司代码</label>
+                        <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('code') is-invalid @enderror"
                                    name="code" autocomplete="off" value="{{ old('code') }}" required>
@@ -38,6 +52,37 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="mobile" class="col-2 col-form-label text-right">承运商电话</label>
+                        <div class="col-8">
+                            <input id="mobile" type="text" class="form-control @error('mobile') is-invalid @enderror"
+                                   name="mobile" autocomplete="off" value="{{ old('mobile') }}" >
+                            @error('mobile')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $errors->first('mobile') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="delivery_fee" class="col-2 col-form-label text-right">送货费</label>
+                        <div class="col-8">
+                            <input id="delivery_fee" type="text" class="form-control @error('delivery_fee') is-invalid @enderror"
+                                   name="delivery_fee" autocomplete="off" value="{{ old('delivery_fee') }}" >
+                            @error('delivery_fee')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $errors->first('delivery_fee') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="remark" class="col-2 col-form-label text-right">备注</label>
+                        <div class="col-8">
+                            <textarea id="remark" type="text" class="form-control "
+                                      name="remark" autocomplete="off" >{{ old('remark') }}</textarea>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-success form-control">

+ 48 - 3
resources/views/maintenance/logistic/edit.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')编辑物流公司@endsection
+@section('title')编辑承运商@endsection
 
 @section('content')
     <div id="nav2">
@@ -21,7 +21,21 @@
                     @csrf
                     @method('PUT')
                     <div class="form-group row">
-                        <label for="name" class="col-2 col-form-label text-right">物流公司名称</label>
+                        <label for="type" class="col-2 col-form-label text-right">承运商类型 <b class="text-danger">*</b></label>
+                        <div class="col-5">
+                            <select id="type" name="type" class="form-control @error('type') is-invalid @enderror" value="@if(old('type')){{old('type')}}@else{{$logistic->type}}@endif" required>
+                                <option value="快递">快递</option>
+                                <option value="物流">物流</option>
+                            </select>
+                            @error('type')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">物流公司名称 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('name') is-invalid @enderror"
                                    name="name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" required>
@@ -33,7 +47,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="code" class="col-2 col-form-label text-right">物流公司代码</label>
+                        <label for="code" class="col-2 col-form-label text-right">物流公司代码 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('code') is-invalid @enderror"
                                    name="code" autocomplete="off" value="@if(old('code')){{old('code')}}@else{{$logistic->code}}@endif" required>
@@ -44,6 +58,37 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="mobile" class="col-2 col-form-label text-right">承运商电话</label>
+                        <div class="col-8">
+                            <input id="mobile" type="text" class="form-control @error('mobile') is-invalid @enderror"
+                                   name="mobile" autocomplete="off" value="@if(old('mobile')){{old('mobile')}}@else{{$logistic->mobile}}@endif" >
+                            @error('mobile')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $errors->first('mobile') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="delivery_fee" class="col-2 col-form-label text-right">送货费</label>
+                        <div class="col-8">
+                            <input id="delivery_fee" type="text" class="form-control @error('delivery_fee') is-invalid @enderror"
+                                   name="delivery_fee" autocomplete="off" value="@if(old('delivery_fee')){{old('delivery_fee')}}@else{{$logistic->delivery_fee}}@endif" >
+                            @error('delivery_fee')
+                            <span class="invalid-feedback" role="alert">
+                                <strong>{{ $errors->first('delivery_fee') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="remark" class="col-2 col-form-label text-right">备注</label>
+                        <div class="col-8">
+                            <textarea id="remark" type="text" class="form-control "
+                                      name="remark" autocomplete="off" >@if(old('remark')){{old('remark')}}@else{{$logistic->remark}}@endif</textarea>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-outline-dark form-control">

+ 14 - 4
resources/views/maintenance/logistic/index.blade.php

@@ -1,5 +1,5 @@
 @extends('layouts.app')
-@section('title')物流公司@endsection
+@section('title')承运商@endsection
 
 @section('content')
     <span id="nav2">
@@ -15,8 +15,12 @@
                 <table class="table table-striped table-sm" id="list">
                     <tr>
                         <th>ID</th>
-                        <th>物流公司名</th>
-                        <th>物流公司代码</th>
+                        <th>承运商名称</th>
+                        <th>承运商代码</th>
+                        <th>承运商联系方式</th>
+                        <th>承运商类型</th>
+                        <th>承运商送货费</th>
+                        <th>备注</th>
                         <th>创建时间</th>
                         <th>操作</th>
                     </tr>
@@ -24,6 +28,10 @@
                         <td class="text-muted">@{{logistic.id}}</td>
                         <td>@{{logistic.name}}</td>
                         <td>@{{logistic.code}}</td>
+                        <td>@{{logistic.mobile}}</td>
+                        <td>@{{logistic.type}}</td>
+                        <td>@{{logistic.delivery_fee}}</td>
+                        <td>@{{logistic.remark}}</td>
                         <td class="text-muted">@{{logistic.created_at}}</td>
                         <td>
                             @can('物流公司-编辑')
@@ -46,7 +54,9 @@
             data:{
                 logistics:[
                     @foreach( $logistics as $logistic )
-                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}',code:'{{$logistic->code}}',created_at:'{{$logistic->created_at}}'},
+                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}',code:'{{$logistic->code}}',
+                        mobile:"{{$logistic->mobile}}",type:"{{$logistic->type}}",delivery_fee:"{{$logistic->delivery_fee}}",
+                        remark:"{{$logistic->remark}}",created_at:'{{$logistic->created_at}}'},
                     @endforeach
                 ],
             },

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

@@ -58,14 +58,14 @@
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/city')}}" :class="{active:isActive('city',2)}">城市</a>
                 </li> @endcan
-            @can('物流公司')
+            @can('承运商')
                 <li class="nav-item">
-                    <a class="nav-link text-dark" href="{{url('maintenance/logistic')}}" :class="{active:isActive('logistic',2)}">物流公司</a>
+                    <a class="nav-link text-dark" href="{{url('maintenance/logistic')}}" :class="{active:isActive('logistic',2)}">承运商</a>
                 </li> @endcan
-            @can('承运商')
+            {{--@can('承运商')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/carrier')}}" :class="{active:isActive('carrier',2)}">承运商</a>
-                </li> @endcan
+                </li> @endcan--}}
             @can('车型')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('maintenance/carType')}}" :class="{active:isActive('carType',2)}">车型</a>

+ 9 - 9
resources/views/maintenance/priceModel/waybillPriceModel/create.blade.php

@@ -15,13 +15,13 @@
                     @endif
                     @csrf
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <label for="logistic_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 class="form-control" name="WaybillPriceModel[logistic_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.logistic_id">
+                                    <option v-for="logistic in logistics" :value="logistic.id">@{{logistic.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>
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.logistic_id') }}</p>
                             </div>
                         </div>
                     </div>
@@ -138,8 +138,8 @@
                         @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']}}',
+                        @if(isset(old('WaybillPriceModel')['logistic_id']))
+                        logistic_id:'{{old('WaybillPriceModel')['logistic_id']}}',
                         @endif
                         @if(isset(old('WaybillPriceModel')['unit_id']))
                         unit_id:'{{old('WaybillPriceModel')['unit_id']}}',
@@ -153,9 +153,9 @@
                 ],
                 cities:[
                 ],
-                carriers:[
-                    @foreach($carriers as $carrier)
-                        {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                logistics:[
+                    @foreach($logistics as $logistic)
+                        {id:'{{$logistic->id}}',name:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 units:[

+ 10 - 10
resources/views/maintenance/priceModel/waybillPriceModel/edit.blade.php

@@ -5,7 +5,7 @@
     <div id="nav2">
         @component('maintenance.priceModel.waybillPriceModel.menu')
                 <li class="nav-item">
-                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">修改</a>
+                    <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',5)}">修改</a>
                 </li>
         @endcomponent
     </div>
@@ -16,14 +16,14 @@
                     @csrf
                     @method('PUT')
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <label for="logistic_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 name="WaybillPriceModel[logistic_id]" v-model="inputting.WaybillPriceModel.logistic_id" style="width: 30%;" class="form-control">
+                                <option v-for="logistic in logistics" :value="logistic.id">@{{logistic.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>
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.logistic_id') }}</p>
                             </div>
                         </div>
                     </div>
@@ -137,7 +137,7 @@
             data:{
                 inputting:{
                     WaybillPriceModel:{
-                        carrier_id:'{{old('WaybillPriceModel')['carrier_id']?old('WaybillPriceModel')['carrier_id']:$waybillPriceModel->carrier_id}}',
+                        logistic_id:'{{old('WaybillPriceModel')['logistic_id']?old('WaybillPriceModel')['logistic_id']:$waybillPriceModel->logistic_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}}',
@@ -153,9 +153,9 @@
                     {id:'{{$city->id}}',name:'{{$city->name}}'},
                     @endforeach
                 ],
-                carriers:[
-                     @foreach($carriers as $carrier)
-                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                logistics:[
+                     @foreach($logistics as $logistic)
+                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 units:[
@@ -165,7 +165,7 @@
                 ],
                 waybillPriceModel:[
                         {id:'{{$waybillPriceModel->id}}',created_at:'{{$waybillPriceModel->created_at}}',
-                        carrier_id:'{{$waybillPriceModel->carrier_id}}',province_id:'{{$waybillPriceModel->province_id}}',
+                            logistic_id:'{{$waybillPriceModel->logistic_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}}'},
                 ]

+ 7 - 7
resources/views/maintenance/priceModel/waybillPriceModel/index.blade.php

@@ -22,10 +22,10 @@
                                     <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">
+                                <select name="logistic_id" v-model="filterData.logistic_id" class="form-control"  @change="setCarrier">
                                     <option >    </option>
-                                    @foreach($carriers as $carrier)
-                                        <option value="{{$carrier->id}}">{{$carrier->name}}</option>
+                                    @foreach($logistics as $logistic)
+                                        <option value="{{$logistic->id}}">{{$logistic->name}}</option>
                                     @endforeach
                                 </select></label></td>
                             <td><label class="form-inline" style="margin-left: 2%">省份:
@@ -59,7 +59,7 @@
                     </tr>
                     <tr v-for="waybillPriceModel in waybillPriceModels">
                         <td class="text-muted">@{{waybillPriceModel.id}}</td>
-                        <td>@{{waybillPriceModel.carrier}}</td>
+                        <td>@{{waybillPriceModel.logistic}}</td>
                         <td>@{{waybillPriceModel.province}}</td>
                         <td>@{{waybillPriceModel.city}}</td>
                         <td>@{{waybillPriceModel.unit}}</td>
@@ -90,7 +90,7 @@
             data:{
                 waybillPriceModels:[
                     @foreach( $waybillPriceModels as $waybillPriceModel )
-                        {id:'{{$waybillPriceModel->id}}',carrier:'{{$waybillPriceModel->carrier_name}}',
+                        {id:'{{$waybillPriceModel->id}}',logistic:'{{$waybillPriceModel->logistic ? $waybillPriceModel->logistic->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}}',
@@ -98,7 +98,7 @@
                     @endforeach
                 ],
                 filterData:
-                    {paginate:'50',carrier_id:'',province_id: ''},
+                    {paginate:'50',logistic_id:'',province_id: ''},
             },
             mounted:function(){
                 this.initInputs();
@@ -152,7 +152,7 @@
                     form.submit();
                 },
                 setCarrier:function (e){
-                    this.filterData.carrier_id=e.target.value;
+                    this.filterData.logistic_id=e.target.value;
                     var form = document.getElementById("optionSubmit");
                     form.submit();
                 },

+ 58 - 58
resources/views/maintenance/user/create.blade.php

@@ -121,10 +121,10 @@
                                 </div>
                             </div>
                             <div class="form-group row">
-                                <label for="carrier" class="col-md-3 col-form-label text-md-right">可见承运商</label>
+                                <label for="logistic" class="col-md-3 col-form-label text-md-right">可见承运商</label>
                                 <div class="col-md-7">
                                     <input type="text" class="form-control tooltipTarget" placeholder="定位承运商"
-                                           @input="seekCarrier($event)" title="输入关键词快速定位"></div>
+                                           @input="seekLogistic($event)" title="输入关键词快速定位"></div>
                             </div>
                             <div class="form-group row">
                                 <label class="col-md-3"></label>
@@ -133,23 +133,23 @@
                                          style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
                                         <ul class="list-group tooltipTarget" style="width: 100%"
                                             onselectstart="return false;">
-                                            <li :data-original-title="carrier.style ? '双击删除承运商' : '双击添加承运商'"
-                                                v-for="carrier in carriersFilter" :id="carrier.name"
+                                            <li :data-original-title="logistic.style ? '双击删除承运商' : '双击添加承运商'"
+                                                v-for="logistic in logisticsFilter" :id="logistic.name"
                                                 class="tooltipTarget list-group-item list-group-item-action pt-0 pb-0"
-                                                @dblclick="selectedCarrier(carrier)"
-                                                :class="carrier.style ? 'active' :''"><span style="cursor: default;"> @{{ carrier.name }}  </span>
+                                                @dblclick="selectedLogistic(logistic)"
+                                                :class="logistic.style ? 'active' :''"><span style="cursor: default;"> @{{ logistic.name }}  </span>
                                             </li>
                                         </ul>
                                     </div>
                                 </div>
                                 <div class="col-md-3">
-                                    <input name="carrier" hidden v-model="carriers">
+                                    <input name="logistic" hidden v-model="logistics">
                                     <div class="input-group"
                                          style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
                                         <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                                            <li title="双击删除承运商" v-for="carrier in carriersList"
+                                            <li title="双击删除承运商" v-for="logistic in logisticsList"
                                                 class="list-group-item list-group-item-action pt-0 pb-0"
-                                                @dblclick="selectedCarrier(carrier)"><span style="cursor: default;"> @{{ carrier.name }}  </span>
+                                                @dblclick="selectedLogistic(logistic)"><span style="cursor: default;"> @{{ logistic.name }}  </span>
                                             </li>
                                         </ul>
                                     </div>
@@ -198,22 +198,22 @@
                 ],
                 roles: [{{old('role')}}],
                 rolesList: [],
-                carriersAll: [
-                        @foreach($carriers as $carrier)
+                logisticsAll: [
+                        @foreach($logistics as $logistic)
                     {
-                        id: '{{$carrier->id}}', name: '{{$carrier->name}}', style: false
+                        id: '{{$logistic->id}}', name: '{{$logistic->name}}', style: false
                     },
                     @endforeach
                 ],
-                carriersFilter: [
-                        @foreach($carriers as $carrier)
+                logisticsFilter: [
+                        @foreach($logistics as $logistic)
                     {
-                        id: '{{$carrier->id}}', name: '{{$carrier->name}}', style: false
+                        id: '{{$logistic->id}}', name: '{{$logistic->name}}', style: false
                     },
                     @endforeach
                 ],
-                carriers: [{{old('carrier')}}],
-                carriersList: [],
+                logistics: [{{old('logistic')}}],
+                logisticsList: [],
             },
             mounted: function () {
                 $(".tooltipTarget").tooltip({'trigger': 'hover'});
@@ -232,15 +232,15 @@
                         });
                     }
                 }
-                if (this.carriers.length > 0) {
-                    let carriersAll = this.carriersAll;
-                    let carriers = this.carriers;
-                    let carriersList = this.carriersList;
-                    for (let i = 0; i < carriers.length; i++) {
-                        carriersAll.every(function (carrierAll) {
-                            if (carrierAll.id == carriers[i]) {
-                                carrierAll.style = true;
-                                carriersList.push({'id': carrierAll.id, 'name': carrierAll.name});
+                if (this.logistics.length > 0) {
+                    let logisticsAll = this.logisticsAll;
+                    let logistics = this.logistics;
+                    let logisticsList = this.logisticsList;
+                    for (let i = 0; i < logistics.length; i++) {
+                        logisticsAll.every(function (logisticAll) {
+                            if (logisticAll.id == logistics[i]) {
+                                logisticAll.style = true;
+                                logisticsList.push({'id': logisticAll.id, 'name': logisticAll.name});
                                 return false;
                             }
                             return true;
@@ -249,41 +249,41 @@
                 }
             },
             methods: {
-                selectedCarrier: function (e) {
-                    let carriers = this.carriers;
-                    let carriersAll = this.carriersAll;
-                    let carriersList = this.carriersList;
-                    let isCarrier = true;
-                    if (carriers && carriersAll) {
-                        for (let i = 0; i < carriers.length; i++) {
-                            if (carriers[i] == e.id) {
-                                carriers.splice(i, 1);
-                                carriersAll.every(function (carrierAll) {
-                                    if (carrierAll.id == e.id) {
-                                        carrierAll.style = false;
+                selectedLogistic: function (e) {
+                    let logistics = this.logistics;
+                    let logisticsAll = this.logisticsAll;
+                    let logisticsList = this.logisticsList;
+                    let isLogistic = true;
+                    if (logistics && logisticsAll) {
+                        for (let i = 0; i < logistics.length; i++) {
+                            if (logistics[i] == e.id) {
+                                logistics.splice(i, 1);
+                                logisticsAll.every(function (logisticAll) {
+                                    if (logisticAll.id == e.id) {
+                                        logisticAll.style = false;
                                         return false;
                                     }
                                     return true;
                                 });
-                                carriersList.every(function (carrier, i) {
-                                    if (carrier.id == e.id) {
-                                        carriersList.splice(i, 1);
+                                logisticsList.every(function (logistic, i) {
+                                    if (logistic.id == e.id) {
+                                        logisticsList.splice(i, 1);
                                         return false;
                                     }
                                     return true;
                                 });
-                                isCarrier = false;
+                                isLogistic = false;
                                 break;
                             }
-                            isCarrier = true;
+                            isLogistic = true;
                         }
                     }
-                    if (isCarrier || !carriers) {
-                        carriers.push(e.id);
-                        carriersAll.every(function (carrierAll) {
-                            if (carrierAll.id == e.id) {
-                                carrierAll.style = true;
-                                carriersList.push({'id': carrierAll.id, 'name': carrierAll.name});
+                    if (isLogistic || !logistics) {
+                        logistics.push(e.id);
+                        logisticsAll.every(function (logisticAll) {
+                            if (logisticAll.id == e.id) {
+                                logisticAll.style = true;
+                                logisticsList.push({'id': logisticAll.id, 'name': logisticAll.name});
                                 return false;
                             }
                             return true;
@@ -293,12 +293,12 @@
                         $(".tooltipTarget").tooltip({'trigger': 'hover'});
                     }, 10)
                 },
-                seekCarrier: function (e) {
+                seekLogistic: function (e) {
                     let $val = e.target.value;
-                    let carriersAll = this.carriersAll;
+                    let logisticsAll = this.logisticsAll;
                     let bool = false;
-                    carriersAll.every(function (carrierAll) {
-                        let name = carrierAll.name;
+                    logisticsAll.every(function (logisticAll) {
+                        let name = logisticAll.name;
                         if (name.includes($val)) {
                             bool = true;
                             return false;
@@ -306,14 +306,14 @@
                         return true;
                     });
                     if($val==='' && !bool){
-                        this.carriersFilter = this.carriersAll;
+                        this.logisticsFilter = this.logisticsAll;
                     }else if(bool){
-                        this.carriersFilter= [];
-                        for (let i = 0; i < carriersAll.length; i++) {
-                            let carries = carriersAll[i];
+                        this.logisticsFilter= [];
+                        for (let i = 0; i < logisticsAll.length; i++) {
+                            let carries = logisticsAll[i];
                             let name = carries.name;
                             if(name.includes($val)){
-                                this.carriersFilter.push(carries);
+                                this.logisticsFilter.push(carries);
                             }
                         }
                     }

+ 61 - 61
resources/views/maintenance/user/edit.blade.php

@@ -81,28 +81,28 @@
                     <hr class="col-8 offset-2 border-info">
                     {{--承运商--}}
                     <div class="form-group row">
-                        <label for="carrier" class="col-md-3 col-form-label text-md-right">可见承运商</label>
+                        <label for="logistic" class="col-md-3 col-form-label text-md-right">可见承运商</label>
                         <div class="col-md-7">
                             <input type="text"  class="form-control tooltipTarget" placeholder="定位承运商"
-                                   @input="seekCarrier($event)" title="输入关键词快速定位"></div>
+                                   @input="seekLogistic($event)" title="输入关键词快速定位"></div>
                     </div>
                     <div class="form-group row">
                         <label class="col-md-3"></label>
                         <div class="col-md-4">
-                            <input name="carrier" hidden   v-model="carriers" >
+                            <input name="logistic" hidden   v-model="logistics" >
                             <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;opacity:0.5;text-align: center;">
                                 <ul class="list-group tooltipTarget" style="width: 100%" onselectstart="return false;">
-                                    <li  :data-original-title="carrier.style ? '双击删除承运商' :'双击添加承运商'"    v-for="carrier in carriersFilter" :id="carrier.name" class="list-group-item list-group-item-action pt-0 pb-0"
-                                         @dblclick="selectedCarrier(carrier)" :class="carrier.style ? 'active' :''"><span style="cursor: default;" > @{{ carrier.name }}  </span></li>
+                                    <li  :data-original-title="logistic.style ? '双击删除承运商' :'双击添加承运商'"    v-for="logistic in logisticsFilter" :id="logistic.name" class="list-group-item list-group-item-action pt-0 pb-0"
+                                         @dblclick="selectedLogistic(logistic)" :class="logistic.style ? 'active' :''"><span style="cursor: default;" > @{{ logistic.name }}  </span></li>
                                 </ul>
                             </div>
                         </div>
                         <div class="col-md-3">
-                            <input name="carrier" hidden   v-model="carriers" >
+                            <input name="logistic" hidden   v-model="logistics" >
                             <div class="input-group" style="max-height: 150px; overflow-y: scroll;border-radius:5px;text-align: center;">
                                 <ul class="list-group" style="width: 100%" onselectstart="return false;">
-                                    <li  title="双击删除承运商"    v-for="carrier in carriersList"  class="list-group-item list-group-item-action pt-0 pb-0"
-                                         @dblclick="selectedCarrier(carrier)" ><span style="cursor: default;" > @{{ carrier.name }}  </span></li>
+                                    <li  title="双击删除承运商"    v-for="logistic in logisticsList"  class="list-group-item list-group-item-action pt-0 pb-0"
+                                         @dblclick="selectedLogistic(logistic)" ><span style="cursor: default;" > @{{ logistic.name }}  </span></li>
                                 </ul>
                             </div>
                         </div>
@@ -151,26 +151,26 @@
                     @endif
                 ],
                 rolesList:[],
-                carriersAll:[
-                    @foreach($carriers as $carrier)
-                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}',style:false},
+                logisticsAll:[
+                    @foreach($logistics as $logistic)
+                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}',style:false},
                     @endforeach
                 ],
-                carriers:[
-                    @if(old('carrier'))
-                        {{ old('carrier') }}
+                logistics:[
+                    @if(old('logistic'))
+                        {{ old('logistic') }}
                     @else
-                        @foreach( $carrierUser as $carrier )
-                        {{$carrier->id}},
+                        @foreach( $logisticUser as $logistic )
+                        {{$logistic->id}},
                         @endforeach
                     @endif
                 ],
-                carriersFilter:[
-                    @foreach($carriers as $carrier)
-                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}',style:false},
+                logisticsFilter:[
+                    @foreach($logistics as $logistic)
+                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}',style:false},
                     @endforeach
                 ],
-                carriersList:[],
+                logisticsList:[],
             },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -189,15 +189,15 @@
                         });
                     }
                 }
-                if (this.carriers.length>0){
-                    let carriersAll=this.carriersAll;
-                    let carriers=this.carriers;
-                    let carriersList=this.carriersList;
-                    for (let i = 0; i < carriers.length; i++) {
-                        carriersAll.every(function (carrierAll) {
-                            if (carrierAll.id == carriers[i]) {
-                                carrierAll.style = true;
-                                carriersList.push({'id':carrierAll.id,'name':carrierAll.name});
+                if (this.logistics.length>0){
+                    let logisticsAll=this.logisticsAll;
+                    let logistics=this.logistics;
+                    let logisticsList=this.logisticsList;
+                    for (let i = 0; i < logistics.length; i++) {
+                        logisticsAll.every(function (logisticAll) {
+                            if (logisticAll.id == logistics[i]) {
+                                logisticAll.style = true;
+                                logisticsList.push({'id':logisticAll.id,'name':logisticAll.name});
                                 return false;
                             }
                             return true;
@@ -206,41 +206,41 @@
                 }
             },
             methods:{
-                selectedCarrier:function (e) {
-                    let carriers=this.carriers;
-                    let carriersAll=this.carriersAll;
-                    let carriersList=this.carriersList;
-                    let isCarrier=true;
-                    if (carriers&&carriersAll) {
-                        for (let i = 0; i < carriers.length; i++) {
-                            if (carriers[i] == e.id) {
-                                carriers.splice(i,1);
-                                carriersAll.every(function (carrierAll) {
-                                    if (carrierAll.id == e.id) {
-                                        carrierAll.style = false;
+                selectedLogistic:function (e) {
+                    let logistics=this.logistics;
+                    let logisticsAll=this.logisticsAll;
+                    let logisticsList=this.logisticsList;
+                    let isLogistic=true;
+                    if (logistics&&logisticsAll) {
+                        for (let i = 0; i < logistics.length; i++) {
+                            if (logistics[i] == e.id) {
+                                logistics.splice(i,1);
+                                logisticsAll.every(function (logisticAll) {
+                                    if (logisticAll.id == e.id) {
+                                        logisticAll.style = false;
                                         return false;
                                     }
                                     return true;
                                 });
-                                carriersList.every(function (carrier,i) {
-                                    if (carrier.id==e.id){
-                                        carriersList.splice(i,1);
+                                logisticsList.every(function (logistic,i) {
+                                    if (logistic.id==e.id){
+                                        logisticsList.splice(i,1);
                                         return false;
                                     }
                                     return true;
                                 });
-                                isCarrier= false;
+                                isLogistic= false;
                                 break;
                             }
-                            isCarrier= true;
+                            isLogistic= true;
                         }
                     }
-                    if (isCarrier || !carriers){
-                        carriers.push(e.id);
-                        carriersAll.every(function (carrierAll) {
-                            if (carrierAll.id==e.id){
-                                carrierAll.style=true;
-                                carriersList.push({'id':carrierAll.id,'name':carrierAll.name});
+                    if (isLogistic || !logistics){
+                        logistics.push(e.id);
+                        logisticsAll.every(function (logisticAll) {
+                            if (logisticAll.id==e.id){
+                                logisticAll.style=true;
+                                logisticsList.push({'id':logisticAll.id,'name':logisticAll.name});
                                 return false;
                             }
                             return  true;
@@ -250,12 +250,12 @@
                         $(".tooltipTarget").tooltip({'trigger':'hover'});
                     },10)
                 },
-                seekCarrier:function (e) {
+                seekLogistic:function (e) {
                     let $val=e.target.value;
-                    let carriersAll=this.carriersAll;
+                    let logisticsAll=this.logisticsAll;
                     let bool = false;
-                    carriersAll.every(function (carriersAll) {
-                        let name=carriersAll.name;
+                    logisticsAll.every(function (logisticsAll) {
+                        let name=logisticsAll.name;
                         if (name.includes($val)){
                             bool = true;
                             return false;
@@ -265,11 +265,11 @@
                     if($val === '' ){
                         this.rolesFilter = this.rolesAll;
                     }else if(bool){
-                        this.carriersFilter = [];
-                        for (let i = 0; i <carriersAll.length ; i++) {
-                            let carrier = carriersAll[i];
-                            if(carrier.name.includes($val)){
-                                this.carriersFilter.push(carrier);
+                        this.logisticsFilter = [];
+                        for (let i = 0; i <logisticsAll.length ; i++) {
+                            let logistic = logisticsAll[i];
+                            if(logistic.name.includes($val)){
+                                this.logisticsFilter.push(logistic);
                             }
                         }
                     }

+ 3 - 3
resources/views/maintenance/user/index.blade.php

@@ -28,8 +28,8 @@
                             </td>
                             <td><span v-if="user.workgroup&&user.workgroup.length>0">@{{ user.workgroup[0].name }}</span></td>
                             <td>
-                                <ul v-if="user.carriers.length>0" class="list-group">
-                                    <li v-for="carrier in user.carriers" style="list-style: none">@{{ carrier.name }}</li>
+                                <ul v-if="user.logistics.length>0" class="list-group">
+                                    <li v-for="logistic in user.logistics" style="list-style: none">@{{ logistic.name }}</li>
                                 </ul>
                             </td>
                             <td>@{{user.email}}</td>
@@ -63,7 +63,7 @@
                     @foreach( $users as $user )
                     {id:'{{$user->id}}',name:'{{$user->name}}',email:'{{$user->email}}',
                         isSuperAdmin:'{{$user->isSuperAdmin}}',
-                        roles:{!! $user->roles !!},carriers:{!! $user->carriers !!},workgroup:{!! $user->userWorkgroups !!},created_at:'{{$user->created_at}}'},
+                        roles:{!! $user->roles !!},logistics:{!! $user->logistics !!},workgroup:{!! $user->userWorkgroups !!},created_at:'{{$user->created_at}}'},
                     @endforeach
                 ],
                 form:'',

+ 7 - 7
resources/views/waybill/create.blade.php

@@ -33,7 +33,7 @@
                     <div class="form-group row">
                         <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_id"  style="width: 30%">
+                            <select id="owner_id" name="owner_id" class="form-control @error('owner_id') is-invalid @enderror" v-model="owner_id"  style="width: 30%" required>
                                 <option v-for="owner in owners" :value="owner.id">@{{owner.name}}</option>
                             </select>
                             <input class="form-control-sm ml-2" placeholder="输入关键字定位" @input="owner_seek">
@@ -112,8 +112,8 @@
                         <div class="form-group row">
                             <label for="charge" class="col-2 col-form-label text-right ">运输收费(元)</label>
                             <div class="col-8">
-                                <input type="text" class="form-control @error('charge') is-invalid @enderror"
-                                       name="charge" autocomplete="off" value="{{ old('charge') }}" >
+                                <input id="charge" type="number" step="0.001" class="form-control @error('charge') is-invalid @enderror"
+                                       name="charge" autocomplete="off" value="{{ old('charge') }}">
                                 @error('charge')
                                 <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
@@ -126,7 +126,7 @@
                     <div class="form-group row">
                         <label for="other_charge" class="col-2 col-form-label text-right text-muted">其他收费(元)</label>
                         <div class="col-8">
-                            <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
+                            <input id="other_charge" type="number" step="0.001" class="form-control @error('other_charge') is-invalid @enderror"
                                    name="other_charge" autocomplete="off" value="@if(old('other_charge')){{ old('other_charge') }}@endif"  >
                             @error('other_charge')
                             <span class="invalid-feedback" role="alert">
@@ -138,7 +138,7 @@
                     <div class="form-group row">
                         <label for="other_charge_remark" class="col-2 col-form-label text-right text-muted">其他收费备注</label>
                         <div class="col-8">
-                            <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
+                            <input id="other_charge_remark" type="text" class="form-control @error('other_charge') is-invalid @enderror"
                                    name="other_charge_remark" autocomplete="off" value="@if(old('other_charge_remark')){{ old('other_charge_remark') }}@endif"  >
                             @error('other_charge_remark')
                             <span class="invalid-feedback" role="alert">
@@ -152,7 +152,7 @@
                     <div class="form-group row">
                         <label for="collect_fee" class="col-2 col-form-label text-right text-muted">到付金额(元)</label>
                         <div class="col-8">
-                            <input type="text" class="form-control @error('collect_fee') is-invalid @enderror"
+                            <input id="collect_fee" type="number" step="0.001" class="form-control @error('collect_fee') is-invalid @enderror"
                                    name="collect_fee" autocomplete="off" value="{{ old('collect_fee') }}"  >
                             @error('collect_fee')
                             <span class="invalid-feedback" role="alert">
@@ -164,7 +164,7 @@
                     <div class="form-group row">
                         <label for="ordering_remark" class="col-2 col-form-label text-right text-muted">下单备注</label>
                         <div class="col-8">
-                            <textarea class="form-control @error('ordering_remark') is-invalid @enderror"
+                            <textarea id="ordering_remark" class="form-control @error('ordering_remark') is-invalid @enderror"
                                       name="ordering_remark" autocomplete="off"  >{{ old('ordering_remark') }}</textarea>
                             @error('ordering_remark')
                             <span class="invalid-feedback" role="alert">

+ 36 - 49
resources/views/waybill/delivering.blade.php

@@ -3,7 +3,7 @@
 
 @section('content')
     @component('waybill.menu')@endcomponent
-    <div id="list" class="d-none container-fluid">
+    <div id="list" class=" container-fluid">
         <form method="GET" action="{{url('waybill/delivering')}}" id="form">
             <div class="text-nowrap mb-0" style="background: #fff;">
                 <div v-if="isBeingFilterConditions">
@@ -84,15 +84,6 @@
                                    :title="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?errors['_'+waybill.id].amount[0]:''" type="text" class="form-control form-control-sm w-100" :value="waybill.amount">
                         </span><span v-else><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
                     </td>
-{{--                    <td>--}}
-{{--                        <span v-if="waybill.isBtn || !waybill.carrier_bill">--}}
-{{--                            <select :id="'amount_unit_id'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount_unit_id?'is-invalid tooltipTargetError':''"--}}
-{{--                                   :title="errors['_'+waybill.id]&&errors['_'+waybill.id].amount_unit_id?errors['_'+waybill.id].amount_unit_id[0]:''" type="text" class="form-control form-control-sm w-100" v-model="waybill.amount_unit_id">--}}
-{{--                            <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>--}}
-{{--                            </select>--}}
-{{--                        </span>--}}
-{{--                        <span v-else>@{{ waybill.amount_unit_name }}</span>--}}
-{{--                    </td>--}}
                     <td>
                         <span v-if="waybill.isBtn || !waybill.carrier_bill">
                             <input :id="'carrier_weight_other'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid tooltipTargetError':''"
@@ -150,13 +141,6 @@
                                            @click="enlarge($event)" style="width:50px">
                                     <span v-else class="text-muted"><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
                                 </span>
-{{--                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">件数单位:</span>--}}
-{{--                                    <select :id="'amount_unit_id'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount_unit_id?'is-invalid tooltipTargetError':''"--}}
-{{--                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].amount_unit_id?errors['_'+waybill.id].amount_unit_id[0]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" v-model="waybill.amount_unit_id" class="form-control form-control-sm"--}}
-{{--                                           @click="enlarge($event)" style="width:50px">--}}
-{{--                                        <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>--}}
-{{--                                    </select><span v-else class="text-muted">@{{ waybill.amount_unit_name }}</span>--}}
-{{--                                </span>--}}
                                 <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">重量:</span>
                                     <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid tooltipTargetError':''"
                                            :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?errors['_'+waybill.id].carrier_weight_other[0]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" :value="waybill.carrier_weight_other"
@@ -194,7 +178,7 @@
         el:"#list",
         data:{
             waybills:[
-                @foreach($waybills as $waybill)
+                    @foreach($waybills as $waybill)
                 {id:'{{$waybill->id}}',
                     created_at:'{{$waybill->created_at}}',
                     waybill_number:'{{$waybill->waybill_number}}',
@@ -209,7 +193,7 @@
                     amount_unit_id:'{{$waybill->amount_unit_id}}',
                     amount_unit_name:'{{$waybill->amount_unit ? $waybill->amount_unit->name : ''}}',
                     inquire_tel:'{{$waybill->inquire_tel}}',
-                    carrier_name:'{{$waybill->carrier ? $waybill->carrier->name : ''}}',
+                    carrier_name:'{{$waybill->logistic ? $waybill->logistic->name : ''}}',
                     owner_name:'{{$waybill->owner ? $waybill->owner->name : ''}}',
                     warehouse_weight_unit_name:'{{$waybill->warehouse_weight_unit ? $waybill->warehouse_weight_unit->name : ''}}',
                     carrier_weight_unit_name:'{{$waybill->carrier_weight_unit ? $waybill->carrier_weight_unit->name : ''}}',
@@ -240,35 +224,37 @@
         },
         mounted:function(){
             let _this=this;
-          $(".tooltipTarget").tooltip({'trigger':'hover'});
+            $(".tooltipTarget").tooltip({'trigger':'hover'});
             _this.initInputs();
-          $("#list").removeClass('d-none');
-          let column = [
-              {name:'index',value: '序号', neglect: true},
-              {name:'created_at',value: '日期', class:"color1"},
-              {name:'carrier_name',value: '承运商', class:"color1"},
-              {name:'waybill_number',value: '宝时运单号', class:"color1"},
-              {name:'origination',value: '提货仓', class:"color1"},
-              {name:'owner_name',value: '货主', class:"color1"},
-              {name:'warehouse_weight_other',value: '预估重量', neglect: true, class:"color1"},
-              {name:'warehouse_weight',value: '预估体积', neglect: true, class:"color1"},
-              {name:'status',value: '状态', class:"color2"},
-              {name:'carrier_bill',value: '专线运单号', class:"color2"},
-              {name:'inquire_tel',value: '查件电话', class:"color2"},
-              {name:'amount',value: '件数', neglect: true, class:"color2"},
-              {name:'carrier_weight_other',value: '重量', neglect: true, class:"color2"},
-              {name:'carrier_weight',value: '体积', neglect: true, class:"color2"},
-              {name:'operation',value: '操作', neglect: true},
-          ];
-            let header = new Header({
-                el: "#header",
-                column: column,
-                data: this.waybills,
-                restorationColumn: 'id',
-                fixedTop:($('#form_div').height())+2,
-                offset:0.5,
-            });
-            header.init();
+            $("#list").removeClass('d-none');
+            let column = [
+                {name:'index',value: '序号', neglect: true},
+                {name:'created_at',value: '日期', class:"color1"},
+                {name:'carrier_name',value: '承运商', class:"color1"},
+                {name:'waybill_number',value: '宝时运单号', class:"color1"},
+                {name:'origination',value: '提货仓', class:"color1"},
+                {name:'owner_name',value: '货主', class:"color1"},
+                {name:'warehouse_weight_other',value: '预估重量', neglect: true, class:"color1"},
+                {name:'warehouse_weight',value: '预估体积', neglect: true, class:"color1"},
+                {name:'status',value: '状态', class:"color2"},
+                {name:'carrier_bill',value: '专线运单号', class:"color2"},
+                {name:'inquire_tel',value: '查件电话', class:"color2"},
+                {name:'amount',value: '件数', neglect: true, class:"color2"},
+                {name:'carrier_weight_other',value: '重量', neglect: true, class:"color2"},
+                {name:'carrier_weight',value: '体积', neglect: true, class:"color2"},
+                {name:'operation',value: '操作', neglect: true},
+            ];
+            if (window.innerWidth > 500){
+                let header = new Header({
+                    el: "#header",
+                    column: column,
+                    data: this.waybills,
+                    restorationColumn: 'id',
+                    fixedTop:($('#form_div').height())+2,
+                    offset:0.5,
+                });
+                header.init();
+            }
         },
         computed:{
             isBeingFilterConditions:function(){
@@ -323,7 +309,7 @@
                 if (!confirm('确定要提交吗?')){return;}
                 let _this=this;
                 let data={};
-                data['id'] = id??waybill_id;
+                data['id'] = id ? waybill_id : '';
                 data['carrier_bill'] = $("#carrier_bill"+waybill_id).val();
                 data['inquire_tel'] = $("#inquire_tel"+waybill_id).val();
                 data['amount'] = $("#amount"+waybill_id).val();
@@ -361,8 +347,9 @@
                     }).catch(function (err) {
                     tempTip.setDuration(3000);
                     tempTip.show('网络异常:'+err);
-                    });
+                });
             }}
     });
+
 </script>
 @endsection

+ 22 - 21
resources/views/waybill/edit.blade.php

@@ -125,17 +125,17 @@
                     </div>
 
                     <div class="form-group row" style="margin-bottom: 20px">
-                        <label for="carrier_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
+                        <label for="logistic_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
                         <div class="col-8" style="position: relative">
-                            <select name="carrier_id" class="form-control @error('carrier_id') is-invalid @enderror"
-                                    :class="errors['carrier_id'] ? 'is-invalid' :''" id="carrier_id" v-model="waybill.carrier_id" style="width: 30%; ">
-                                <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
+                            <select name="logistic_id" class="form-control @error('logistic_id') is-invalid @enderror"
+                                    :class="errors['logistic_id'] ? 'is-invalid' :''" id="logistic_id" v-model="waybill.logistic_id" style="width: 30%; ">
+                                <option v-for="logistic in logistics" :value="logistic.id">@{{logistic.name}}</option>
                             </select>
-                            <div v-if="errors['carrier_id'] && errors['carrier_id'].length>0" class="invalid-feedback" role="alert" style="position: relative">
-                            <strong class="">@{{ errors['carrier_id'][0] }}</strong>
+                            <div v-if="errors['logistic_id'] && errors['logistic_id'].length>0" class="invalid-feedback" role="alert" style="position: relative">
+                            <strong class="">@{{ errors['logistic_id'][0] }}</strong>
                             </div>
                             <span class="col-sm-5" style="position: absolute;height: 15px;padding: 0">
-                                <p class="form-control-static text-danger small font-weight-bold" style="">{{ $errors->first('carrier_id') }}</p>
+                                <p class="form-control-static text-danger small font-weight-bold" style="">{{ $errors->first('logistic_id') }}</p>
                             </span>
                         </div>
 
@@ -257,7 +257,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right text-primary">计数</label>
+                        <label for="amount" class="col-2 col-form-label text-right text-primary">计数</label>
                         <div class="col-5">
                             <input type="number" class="form-control @error('amount') is-invalid @enderror"
                                    name="amount" autocomplete="off" v-model="waybill.amount" id="amount">
@@ -284,7 +284,7 @@
 
                     </div>
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right text-dark">里程数</label>
+                        <label for="mileage" class="col-2 col-form-label text-right text-dark">里程数</label>
                         <div class="col-8">
                             <input type="number" class="form-control @error('mileage') is-invalid @enderror"
                                    name="mileage" autocomplete="off" v-model="waybill.mileage" id="mileage" >
@@ -405,9 +405,9 @@
                     },
                     @endforeach
                 ],
-                carriers:[
-                    @foreach($carriers as $carrier)
-                        {id:'{{$carrier->id}}',name:'{{$carrier->name}}',},
+                logistics:[
+                    @foreach($logistics as $logistic)
+                        {id:'{{$logistic->id}}',name:'{{$logistic->name}}',},
                     @endforeach
                 ],
                 carTypes:[
@@ -420,7 +420,7 @@
                     id:'{{$waybill->id}}',type:'{{$waybill->type}}',waybill_number:'{{$waybill->waybill_number}}',owner_name:'{{$waybill->owner_name}}',
                     wms_bill_number:'{{$waybill->wms_bill_number}}',origination:'{{$waybill->origination}}',destination:'{{$waybill->destination}}',
                     recipient:'{{$waybill->recipient}}',recipient_mobile:'{{$waybill->recipient_mobile}}',ordering_remark:'{{$waybill->ordering_remark}}',
-                    charge:'{{$waybill->charge}}',carrier_id:'{{$waybill->carrier_id}}',carrier_bill:'{{$waybill->carrier_bill}}',
+                    charge:'{{$waybill->charge}}',logistic_id:'{{$waybill->logistic_id}}',carrier_bill:'{{$waybill->carrier_bill}}',
                     warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',warehouse_weight_unit_id_other:'{{$waybill->warehouse_weight_unit_id_other}}',amount:'{{$waybill->amount}}',
                     amount_unit_id:'{{$waybill->amount_unit_id}}',mileage:'{{$waybill->mileage}}',carType_id:'{{$waybill->carType_id}}',
                     car_owner_info:'{{$waybill->car_owner_info}}',fee:'{{$waybill->fee}}',other_fee:'{{$waybill->other_fee}}',
@@ -529,12 +529,12 @@
             },
             methods:{
                 {{--计费模型阶段保留--}}
-                is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
+                is_waybillPriceModel(logistic_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
                     this.errors=[];
                     let url='{{url('waybill/is/waybillPriceModel')}}';
 
                     let _this=this;
-                    axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
+                    axios.post(url,{logistic_id:logistic_id,carrier_weight:[carrier_weight,carrier_weight_other],
                         carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
                         .then(
                             function (response) {
@@ -559,7 +559,8 @@
                         );
                 },
                 executeSubmit(){
-                    let data=['origination','charge','carrier_bill', 'warehouse_weight','warehouse_weight_unit_id',
+                    document.getElementById('waybillForm').submit();
+         /*           let data=['origination','charge','carrier_bill', 'warehouse_weight','warehouse_weight_unit_id',
                         'warehouse_weight_other','warehouse_weight_unit_id_other','carrier_weight','carrier_weight_unit_id'
                         ,'carrier_weight_other','carrier_weight_unit_id_other','mileage','carType_id'
                         ,'car_owner_info','pick_up_fee','fee','other_fee','other_charge','other_charge_remark','dispatch_remark'];
@@ -569,10 +570,10 @@
                         if (waybill[name] === waybillTemp[name]){
                             if (document.getElementById(name))document.getElementById(name).removeAttribute('name');
                         }
-                    });
-                    setTimeout(function () {
+                    });*/
+                    /*setTimeout(function () {
                         document.getElementById('waybillForm').submit();
-                    },1);
+                    },1);*/
                 },
                 spliceDeliverAt:function () {
                         document.getElementById('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
@@ -580,13 +581,13 @@
                 submitForm(){
                     let type=this.waybill.type;
                     if (type==='专线'){
-                        let  carrier_id=document.getElementById('carrier_id').value;
+                        let  logistic_id=document.getElementById('logistic_id').value;
                         let carrier_weight=document.getElementById('carrier_weight').value;
                         let carrier_weight_unit_id=document.getElementById('carrier_weight_unit_id').value;
                         let destination_city_id=document.getElementById('destination_city_id').value;
                         let carrier_weight_other=document.getElementById('carrier_weight_other').value;
                         let carrier_weight_unit_id_other=document.getElementById('carrier_weight_unit_id_other').value;
-                        this.is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other);
+                        this.is_waybillPriceModel(logistic_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other);
                     }else {
                         document.getElementById('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
                         // document.getElementById('waybillForm').submit();

+ 5 - 6
resources/views/waybill/index.blade.php

@@ -306,6 +306,7 @@
                         waybillAuditLogs:{!! $waybill->waybillAuditLogs !!},
                         btn_refresh_weight:'zoomIn',
                         remark:'{{$waybill->remark ?? ''}}',
+                        test:{!! $waybill !!}
                     },
                     @endforeach
                 ],
@@ -316,9 +317,9 @@
                     {name:'{{$owner->id}}',value:'{{$owner->name}}'},
                     @endforeach
                 ],
-                carriers:[
-                        @foreach($carriers as $carrier)
-                    {name:"{{$carrier->id}}",value:'{{$carrier->name}}'},
+                logistics:[
+                        @foreach($logistics as $logistic)
+                    {name:"{{$logistic->id}}",value:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 status:[
@@ -368,7 +369,6 @@
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                             placeholder:['货主','定位或多选货主'],data:this.owners},
                         {name:'created_at_start',type:'time',tip:['选择显示指定日期的起始时间','选择显示指定日期的起始时间']},
-                        //{name:'created_at_start',type:'dateTimeLocal',tip:'选择显示指定日期的起始时间'},
                         {name:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
                         {name:'carrier_bill',type:'input',tip:'承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
                         {name:'status',type:'select',placeholder: '运单状态',data:this.status},
@@ -377,10 +377,9 @@
                     [
                         {name:'wms_bill_number',type:'input',tip:'WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
                         {name:'created_at_end',type:'time',tip:['选择显示指定日期的结束时间','选择显示指定日期的结束时间']},
-                        //{name:'created_at_end',type:'dateTimeLocal',tip:'选择显示指定日期的结束时间'},
                         {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
                         {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
-                        {name:'carrier_id',type:'select',placeholder: '承运商',data:this.carriers},
+                        {name:'logistic_id',type:'select',placeholder: '承运商',data:this.logistics},
                     ],
                 ];
                 let param=[];

+ 1 - 1
resources/views/waybill/menuWaybill.blade.php

@@ -10,7 +10,7 @@
                 <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>
+                            <a class="nav-link text-dark" href="{{url('maintenance/priceModel/waybillPriceModel')}}" :class="{active:isActive('waybillPriceModel',3)}">计费模型</a>
                         </li> @endcan
                 </ul>
             </div>

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

@@ -175,7 +175,7 @@
                 {name:'recipient_mobile',value: '收件人电话', neglect: true},
                 {name:'charge',value: '收费(元)', neglect: true},
                 {name:'ordering_remark',value: '下单备注', neglect: true},
-                {name:'carrier',value: '承运商', neglect: true},
+                {name:'logistic',value: '承运商', neglect: true},
                 {name:'carrier_bill',value: '承运商单号', neglect: true},
                 {name:'origination_city',value: '始发市', neglect: true},
                 {name:'destination_city',value: '目的市', neglect: true},

+ 9 - 9
resources/views/waybill/waybillPriceModel/create.blade.php

@@ -14,13 +14,13 @@
                     @endif
                     @csrf
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <label for="logistic_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 class="form-control" name="WaybillPriceModel[logistic_id]" style="width: 30%;" v-model="inputting.WaybillPriceModel.logistic_id">
+                                    <option v-for="logistic in logistics" :value="logistic.id">@{{logistic.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>
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.logistic_id') }}</p>
                             </div>
                         </div>
                     </div>
@@ -137,8 +137,8 @@
                         @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']}}',
+                        @if(isset(old('WaybillPriceModel')['logistic_id']))
+                        logistic_id:'{{old('WaybillPriceModel')['logistic_id']}}',
                         @endif
                         @if(isset(old('WaybillPriceModel')['unit_id']))
                         unit_id:'{{old('WaybillPriceModel')['unit_id']}}',
@@ -152,9 +152,9 @@
                 ],
                 cities:[
                 ],
-                carriers:[
-                    @foreach($carriers as $carrier)
-                        {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                logistics:[
+                    @foreach($logistics as $logistic)
+                        {id:'{{$logistic->id}}',name:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 units:[

+ 9 - 9
resources/views/waybill/waybillPriceModel/edit.blade.php

@@ -15,14 +15,14 @@
                     @csrf
                     @method('PUT')
                     <div class="form-group row">
-                        <label for="carrier_id" class="col-2 col-form-label text-right">承运商</label>
+                        <label for="logistic_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 name="WaybillPriceModel[logistic_id]" v-model="inputting.WaybillPriceModel.logistic_id" style="width: 30%;" class="form-control">
+                                <option v-for="logistic in logistics" :value="logistic.id">@{{logistic.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>
+                                <p class="form-control-static text-danger small font-weight-bold">{{ $errors->first('WaybillPriceModel.logistic_id') }}</p>
                             </div>
                         </div>
                     </div>
@@ -136,7 +136,7 @@
             data:{
                 inputting:{
                     WaybillPriceModel:{
-                        carrier_id:'{{old('WaybillPriceModel')['carrier_id']?old('WaybillPriceModel')['carrier_id']:$waybillPriceModel->carrier_id}}',
+                        logistic_id:'{{old('WaybillPriceModel')['logistic_id']?old('WaybillPriceModel')['logistic_id']:$waybillPriceModel->logistic_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}}',
@@ -152,9 +152,9 @@
                     {id:'{{$city->id}}',name:'{{$city->name}}'},
                     @endforeach
                 ],
-                carriers:[
-                     @foreach($carriers as $carrier)
-                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                logistics:[
+                     @foreach($logistics as $logistic)
+                    {id:'{{$logistic->id}}',name:'{{$logistic->name}}'},
                     @endforeach
                 ],
                 units:[
@@ -164,7 +164,7 @@
                 ],
                 waybillPriceModel:[
                         {id:'{{$waybillPriceModel->id}}',created_at:'{{$waybillPriceModel->created_at}}',
-                        carrier_id:'{{$waybillPriceModel->carrier_id}}',province_id:'{{$waybillPriceModel->province_id}}',
+                            logistic_id:'{{$waybillPriceModel->logistic_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}}'},
                 ]

+ 5 - 5
resources/views/waybill/waybillPriceModel/index.blade.php

@@ -22,10 +22,10 @@
                                     <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">
+                                <select name="logistic_id" v-model="filterData.logistic_id" class="form-control"  @change="setCarrier">
                                     <option >    </option>
-                                    @foreach($carriers as $carrier)
-                                        <option value="{{$carrier->id}}">{{$carrier->name}}</option>
+                                    @foreach($logistics as $logistic)
+                                        <option value="{{$logistic->id}}">{{$logistic->name}}</option>
                                     @endforeach
                                 </select></label></td>
                             <td><label class="form-inline" style="margin-left: 2%">省份:
@@ -97,7 +97,7 @@
                     @endforeach
                 ],
                 filterData:
-                    {paginate:'50',carrier_id:'',province_id: ''},
+                    {paginate:'50',logistic_id:'',province_id: ''},
             },
             mounted:function(){
                 this.initInputs();
@@ -151,7 +151,7 @@
                     form.submit();
                 },
                 setCarrier:function (e){
-                    this.filterData.carrier_id=e.target.value;
+                    this.filterData.logistic_id=e.target.value;
                     var form = document.getElementById("optionSubmit");
                     form.submit();
                 },

+ 3 - 0
serves/excelExportGo/logs/2020-11-26.log

@@ -0,0 +1,3 @@
+
+[ERROR]   15:27:05
+   /orm/query.go:11   SQL执行错误!(select waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update, owners.name owner_name, warehouse_weight_unit.name warehouse_weight_unit_name, warehouse_weight_unit_other.name warehouse_weight_unit_other_name, carrier_weight_unit.name carrier_weight_unit_name, carrier_weight_unit_other.name carrier_weight_unit_other_name, car_types.name car_type_name, amount_unit.name amount_unit_name, logistics.name carrier_name from `waybills` left join `waybill_on_tops` on `waybill_on_tops`.`waybill_id` = `waybills`.`id` left join `owners` on `owners`.`id` = `waybills`.`owner_id` left join `units` as `warehouse_weight_unit` on `warehouse_weight_unit`.`id` = `waybills`.`warehouse_weight_unit_id` left join `units` as `warehouse_weight_unit_other` on `warehouse_weight_unit_other`.`id` = `waybills`.`warehouse_weight_unit_id_other` left join `units` as `carrier_weight_unit` on `carrier_weight_unit`.`id` = `waybills`.`carrier_weight_unit_id` left join `units` as `carrier_weight_unit_other` on `carrier_weight_unit_other`.`id` = `waybills`.`carrier_weight_unit_id_other` left join `car_types` on `car_types`.`id` = `waybills`.`carType_id` left join `units` as `amount_unit` on `amount_unit`.`id` = `waybills`.`amount_unit_id` left join `logistics` on `logistics`.`id` = `waybills`.`logistic_id` where `owner_id` in ('1', '2', '3') and `waybill_on_tops`.`deleted_at` is null and `waybills`.`deleted_at` is null order by `waybill_on_tops`.`updated_at` desc, `waybills`.`id` desc)

+ 6 - 6
tests/old/WaybillPriceModelTest.php

@@ -44,7 +44,7 @@ class WaybillPriceModelTest extends TestCase
 
     public function testAddWaybillPriceModel(){
         $waybillPriceModel=new WaybillPriceModel([
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'province_id'=>1,
             'city_id'=>1,
             'unit_id'=>1,
@@ -91,7 +91,7 @@ class WaybillPriceModelTest extends TestCase
      */
     public function testStore(User $user,User $userMark){
         $response=$this->actingAs($user)->post('maintenance/waybillPriceModel',['WaybillPriceModel'=>[
-            'carrier_id'=>12,
+            'logistic_id'=>12,
             'province_id'=>4,
             'city_id'=>1,
             'unit_id'=>1,
@@ -103,7 +103,7 @@ class WaybillPriceModelTest extends TestCase
         ]]);
         $response->assertStatus(302)->assertRedirect('maintenance/waybillPriceModel')->assertSessionHas('successTip');
         $responseMark=$this->actingAs($userMark)->post('maintenance/waybillPriceModel',['WaybillPriceModel'=>[
-            'carrier_id'=>12,
+            'logistic_id'=>12,
             'province_id'=>4,
             'city_id'=>3,
             'unit_id'=>3,
@@ -114,7 +114,7 @@ class WaybillPriceModelTest extends TestCase
             'initial_weight'=>10
         ]]);
         $responseMark->assertStatus(302)->assertRedirect('/');
-        $waybillPriceModel=WaybillPriceModel::whereRaw('carrier_id = ? and province_id = ? and city_id=? and unit_id=? and range_min=? and range_max=? and unit_price=? and initial_weight=?',[
+        $waybillPriceModel=WaybillPriceModel::whereRaw('logistic_id = ? and province_id = ? and city_id=? and unit_id=? and range_min=? and range_max=? and unit_price=? and initial_weight=?',[
             12,4,1,1,0.00,1000.00,0.01,10.00
         ])->first();
         $result=$waybillPriceModel->delete();
@@ -141,7 +141,7 @@ class WaybillPriceModelTest extends TestCase
      */
     public function testUpdate(WaybillPriceModel $waybillPriceModel,User $user,User $userMark){
         $response=$this->actingAs($user)->put('maintenance/waybillPriceModel/'.$waybillPriceModel->id,['WaybillPriceModel'=>[
-            'carrier_id'=>2,
+            'logistic_id'=>2,
             'province_id'=>2,
             'city_id'=>11,
             'unit_id'=>1,
@@ -153,7 +153,7 @@ class WaybillPriceModelTest extends TestCase
         ]]);
         $response->assertStatus(302)->assertRedirect('maintenance/waybillPriceModel')->assertSessionHas('successTip');
         $responseMark=$this->actingAs($userMark)->put('maintenance/waybillPriceModel/'.$waybillPriceModel->id,['WaybillPriceModel'=>[
-            'carrier_id'=>2,
+            'logistic_id'=>2,
             'province_id'=>2,
             'city_id'=>11,
             'unit_id'=>2,

+ 13 - 13
tests/old/WaybillTest.php

@@ -89,7 +89,7 @@ class WaybillTest extends TestCase
 
     public function testAddWaybillPriceModel(){
         $waybillPriceModel=WaybillPriceModel::create([
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'province_id'=>1,
             'city_id'=>1,
             'unit_id'=>1,
@@ -105,7 +105,7 @@ class WaybillTest extends TestCase
 
     public function testAddWaybillPriceModelTwo(){
         $waybillPriceModelTwo=WaybillPriceModel::create([
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'province_id'=>1,
             'unit_id'=>3,
             'unit_price'=>5,
@@ -212,21 +212,21 @@ class WaybillTest extends TestCase
      */
     public function testIsWaybillPriceModel(User $user,WaybillPriceModel $waybillPriceModel,WaybillPriceModel $waybillPriceModelTwo){
         $response=$this->actingAs($user)->post('waybill/is/waybillPriceModel',[
-            'carrier_id'=>'1',
+            'logistic_id'=>'1',
             'destination_city_id'=>'1',
             'carrier_weight'=>['50','20'],
             'carrier_weight_unit_id'=>['1','1'],
         ]);
         $response->assertOk()->assertJson(['success'=>$waybillPriceModel->id]);
         $response=$this->actingAs($user)->post('waybill/is/waybillPriceModel',[
-            'carrier_id'=>'2',
+            'logistic_id'=>'2',
             'destination_city_id'=>'2',
             'carrier_weight'=>['50','20'],
             'carrier_weight_unit_id'=>['1','1'],
         ]);
         $response->assertOk()->assertJson(['success'=>false]);
         $response=$this->actingAs($user)->post('waybill/is/waybillPriceModel',[
-            'carrier_id'=>'1',
+            'logistic_id'=>'1',
             'destination_city_id'=>'2',
             'carrier_weight'=>['50','20'],
             'carrier_weight_unit_id'=>['1','1'],
@@ -247,7 +247,7 @@ class WaybillTest extends TestCase
 //直发车数据校验通过
         $responseZFTrue=$this->actingAs($user)->put('waybill/'.$waybill->id,[
             'type'=>'直发车',
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'carrier_bill'=>'0154786548',
             'carType_id'=>1,
             'fee'=>500,
@@ -258,7 +258,7 @@ class WaybillTest extends TestCase
         $responseZFTrue->assertStatus(302)->assertRedirect('waybill')->assertSessionHas('successTip');
         $responseZFMark=$this->actingAs($userMark)->put('waybill/'.$waybill->id,[
             'type'=>'直发车',
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'carrier_bill'=>'0154786548',
             'carType_id'=>1,
             'fee'=>500,
@@ -275,7 +275,7 @@ class WaybillTest extends TestCase
 //直发车数据校验失败
         $responseZFFalse=$this->actingAs($user)->put('waybill/'.$waybill->id,[
             'type'=>'直发车',
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'carrier_bill'=>'20',
             'other_fee'=>'a456d',
             'collect_fee'=>30,
@@ -285,7 +285,7 @@ class WaybillTest extends TestCase
 //无模型
         $responseZXFalse=$this->actingAs($user)->put('waybill/'.$waybillZX->id,[
             'type'=>'专线',
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'carrier_bill'=>'01547860548',
             'origination_city_id'=>1,
             'destination_city_id'=>2,
@@ -300,7 +300,7 @@ class WaybillTest extends TestCase
         $responseZXFalse->assertStatus(302)->assertRedirect('waybill');
         $responseZXMark=$this->actingAs($userMark)->put('waybill/'.$waybillZX->id,[
             'type'=>'专线',
-            'carrier_id'=>1,
+            'logistic_id'=>1,
             'carrier_bill'=>'01547860548',
             'origination_city_id'=>1,
             'destination_city_id'=>2,
@@ -318,7 +318,7 @@ class WaybillTest extends TestCase
 //有模型
         $responseZX=$this->actingAs($user)->put('waybill/'.$waybillZX->id,[
             'type'=>'专线',
-            'carrier_id'=>$carrier->id,
+            'logistic_id'=>$carrier->id,
             'carrier_bill'=>'test01547860548',
             'origination_city_id'=>1,
             'destination_city_id'=>1,
@@ -348,7 +348,7 @@ class WaybillTest extends TestCase
     public function testWaybillUpdate(User $user,Waybill $waybill,User $userMark){
         $response=$this->actingAs($user)->put('waybill/'.$waybill->id,[
             'type'=>'直发车',
-            'carrier_id'=>2,
+            'logistic_id'=>2,
             'carrier_bill'=>'5a4d664585',
             'carType_id'=>2,
             'fee'=>600,
@@ -359,7 +359,7 @@ class WaybillTest extends TestCase
         $response->assertStatus(302)->assertRedirect('waybill')->assertSessionHas('successTip');
         $responseMark=$this->actingAs($userMark)->put('waybill/'.$waybill->id,[
             'type'=>'直发车',
-            'carrier_id'=>2,
+            'logistic_id'=>2,
             'carrier_bill'=>'5a4d664585',
             'carType_id'=>2,
             'fee'=>600,