Kaynağa Gözat

Merge branch 'master' into zengjun

ajun 4 yıl önce
ebeveyn
işleme
567f38976c
30 değiştirilmiş dosya ile 305 ekleme ve 253 silme
  1. 1 1
      app/Events/OrderIssueProcessLogCreateEvent.php
  2. 10 6
      app/Filters/OrderPackageFilters.php
  3. 17 3
      app/Http/ApiControllers/LoginController.php
  4. 2 0
      app/Http/Controllers/PackageLogisticController.php
  5. 1 45
      app/Http/Controllers/TestController.php
  6. 23 7
      app/Http/Controllers/WaybillController.php
  7. 2 0
      app/Http/Kernel.php
  8. 36 3
      app/Http/Middleware/AuthorizingApi.php
  9. 1 1
      app/Http/Middleware/DecodingRequest.php
  10. 1 1
      app/Listeners/UpdateOrderPackageExceptionListener.php
  11. 5 1
      app/OrderPackage.php
  12. 2 2
      app/Services/HandInStorageService.php
  13. 3 3
      app/Services/LogisticAliJiSuApiService.php
  14. 1 1
      app/Services/LogisticSFService.php
  15. 4 8
      app/Services/LogisticYDService.php
  16. 3 3
      app/Services/LogisticYTOService.php
  17. 3 3
      app/Services/LogisticZopService.php
  18. 7 3
      app/Services/OrderPackageReceivedSyncService.php
  19. 25 22
      app/Services/UserService.php
  20. 3 0
      config/api.php
  21. 1 1
      database/factories/OrderPackageFactory.php
  22. 32 0
      database/migrations/2021_08_25_132757_add_column_is_manual_update_status_to_order_packages_table.php
  23. 28 2
      resources/views/package/logistic/index.blade.php
  24. 12 2
      resources/views/store/handInStorage/putaway.blade.php
  25. 3 6
      resources/views/store/handInStorage/receive.blade.php
  26. 4 0
      resources/views/store/handInStorage/receiveDetailPage.blade.php
  27. 2 1
      resources/views/store/inStorage/androidIndex.blade.php
  28. 60 128
      resources/views/transport/waybill/delivering.blade.php
  29. 12 0
      routes/api.php
  30. 1 0
      routes/web.php

+ 1 - 1
app/Events/OrderIssueProcessLogCreateEvent.php

@@ -18,7 +18,7 @@ class OrderIssueProcessLogCreateEvent
     /**
      * @var int
      * 1 返回派件
-     * 2 已收
+     * 2 已
      */
     public $status;
 

+ 10 - 6
app/Filters/OrderPackageFilters.php

@@ -32,6 +32,7 @@ class OrderPackageFilters
         'sent_at_end',
         'default_date',
         'has_transfer_status',
+        'is_new_rejecting',
     ];
 
     protected $orderIssueQuery;
@@ -149,15 +150,11 @@ class OrderPackageFilters
     {
         if ($is_issue === '是') {
             $this->queryBuilder->whereIn('order_id', function ($query) {
-                $query->from('orders')->select('id')->whereIn('id', function ($query) {
-                    $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
-                });
+                $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
             });
         } else {
             $this->queryBuilder->whereIn('order_id', function ($query) {
-                $query->from('orders')->select('id')->whereNotIn('id', function ($query) {
-                    $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
-                });
+                $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
             });
         }
     }
@@ -173,4 +170,11 @@ class OrderPackageFilters
             $query->from('order_package_remarks')->select('order_package_id')->where('content', 'like', $remark);
         });
     }
+
+    public function is_new_rejecting($is_new_rejecting)
+    {
+        $this->queryBuilder->whereIn('order_id', function ($query) use ($is_new_rejecting) {
+            $query->from('order_issues')->select('order_id')->where('is_new_rejecting', $is_new_rejecting);
+        });
+    }
 }

+ 17 - 3
app/Http/ApiControllers/LoginController.php

@@ -4,10 +4,10 @@
 namespace App\Http\ApiControllers;
 
 
-use Firebase\JWT\JWT;
 use Illuminate\Foundation\Auth\User;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Hash;
 
 class LoginController
@@ -15,6 +15,8 @@ class LoginController
     /**
      * JWT登录
      *
+     * {message:'',status_code:200,code:null,data:'',errors:{}}
+     *
      * @param Request $request
      * @return JsonResponse
      */
@@ -28,7 +30,7 @@ class LoginController
             'status_code' => 200,
         ];
         //验证用户登录
-        if (!$user || !Hash::check(base64_encode($password),$user->password)){
+        if (!$user || !Hash::check(base64_decode($password),$user->password)){
             $response["message"] = "用户名或密码错误";
             $response["status_code"] = 401;
             return response()->json($response);
@@ -37,7 +39,6 @@ class LoginController
         //获取公私钥
         try {
             $privateKey = file_get_contents(base_path().'/private.pem');
-            //$publicKey = file_get_contents(base_path().'/public.pem');
         }catch (\Exception $e){
             $response["status_code"] = 410;
             if (strpos($e->getMessage(),"No such file or directory")!==false)$response["message"] = "服务器异常,资源丢失";
@@ -47,6 +48,7 @@ class LoginController
 
         try {
             $response["data"] = ["token"=>app("UserService")->getJWTToken($user,$privateKey)];
+            app("UserService")->setOrRefreshCache($user);
             return response()->json($response);
         }catch (\Exception $e){
             $response["status_code"] = 409;
@@ -55,5 +57,17 @@ class LoginController
         }
     }
 
+    public function test()
+    {
+        return response()->json([
+            "message" => "登陆成功",
+            "status_code"=>200,
+            "data"=>[
+                "param" => \request("test"),
+                "user" => Auth::id(),
+            ],
+        ]);
+    }
+
 
 }

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

@@ -66,6 +66,8 @@ class PackageLogisticController extends Controller
     {
         $data['status'] = OrderPackage::switchStatus($request->input('status'));
         $logistic_numbers = $request->input('logistic_numbers');
+        //标记为手动更新
+        $data['is_manual_update']= true;
         OrderPackage::query()->whereIn('logistic_number', $logistic_numbers)->update($data);
     }
 

+ 1 - 45
app/Http/Controllers/TestController.php

@@ -86,52 +86,8 @@ class TestController extends Controller
 
     public function test4()
     {
-        $user = User::query()->first();
-        $b = file_get_contents(base_path() . '/public.pem');
-        $decoded = JWT::decode("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJkYXRhIjp7ImZpZWxkMSI6MSwiZmllbGQyIjoic3RyaW5nIGRhdGEifSwiaXNzIjoiaHR0cDpcL1wvZXhhbXBsZS5vcmciLCJhdWQiOiJodHRwOlwvXC9leGFtcGxlLmNvbSIsImlhdCI6MTYyOTc3NDUxMywiZWF0IjoxNjI5NzgxNzEzfQ.Twl3_KPMLP4Pi4zaGZig8SKhE9M6nZlCI8bVifWjuYIWuqZtlujp35Zvv1oY0GnPIkUmq-PGJZLU96mmT-RTRDL-83sPF2l7PPTeriYMoiKP1r2rsI421BtrgLs0qP7QCPxH5BmHWXAVbwTtnwv8JagKzcZxkZJRH3Lj8blRapumnCk-tMfHz4xiXHIATfMS1I23vhJJLomC-KW4Ou3pjTu6X3HiiUGe9ZBGTu5mHfiKm25dxXO5Fm3JMg2-anLf_Gy6D6D7IQJ5pM5HFEN-HdD7FibeEMraMxbk5B_82L15OjhaoCV7b7ioXNSs2QAdlRfuRgx0XIE_toFwb_152a", $b, ['RS256']);
-        $payload = [
-            'data' => ['field1' => 1, 'field2' => 'string data'],
-            "iss" => "http://example.org",
-            "aud" => "http://example.com",
-            "iat" => time(),
-            "eat" => time() + 7200,
-        ];
-        try {
-            $token = JWT::encode($payload, $a, 'RS256');
-        } catch (\Exception $e) {
-            $this->error("HTTP:409,资源异常,无法反馈");
-        }
-        try {
-            $a = file_get_contents("test");
-        } catch (\Exception $e) {
-            if (strpos($e->getMessage(), "No such file or directory") !== false) $this->error("HTTP:410,服务器异常,资源丢失");
-            else $this->error("HTTP:403,访问某些资源失败");
-        }
 
-
-        $payload = [
-
-            'data' => ['field1' => 1, 'field2' => 'string data'],
-
-            "iss" => "http://example.org",
-
-            "aud" => "http://example.com",
-
-            "iat" => time(),
-
-            "eat" => time() + 7200,
-
-        ];
-
-        $token = JWT::encode($payload, $a, 'RS256');
-
-        echo "Token:\n" . print_r($token, true) . "\n";
-
-        $decoded = JWT::decode($token, $b, ['RS256']);
-
-        $decoded_array = (array)$decoded;
-
-        echo "Decoded:\n" . print_r($decoded_array, true) . "\n";
+        dd(base64_encode("123456"),base64_decode("MTIzNDU2"));
     }
 
     public function OwnerStoreFeeReportService_recordReport()

+ 23 - 7
app/Http/Controllers/WaybillController.php

@@ -769,12 +769,11 @@ SQL;
         ])->direct();
     }
 
-    //发运
-    public function delivering(Request $request){
-        if (!Auth::user())return view('exception.login');
-        $waybills= Waybill::query()->where("type","专线")
+    private function deliveringQuery(Request $request): Builder
+    {
+        $waybills= Waybill::query()->where("type","专线")->with(["order","logistic"])
             ->whereNotNull("logistic_id")->whereNotIn("status",["未审核","待重审"])
-            ->orderByDesc("id");
+            ->orderByDesc("id")->limit(10);
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('logistic_user')->where('user_id',Auth::id())->get();
             $carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
@@ -784,12 +783,29 @@ SQL;
         if ($searchText)$waybills->where(function ($query)use($searchText){
             $query->where("waybill_number",'like','%'.$searchText.'%')->orWhere("carrier_bill",'like','%'.$searchText.'%');
         });
-        $waybills = $waybills->get();
+        $lastId = $request->get("lastId","");
+        if ($lastId)$waybills->where("id","<",$lastId);
+        return $waybills;
+    }
+    //发运
+    public function delivering(Request $request){
+        if (!Auth::user())return view('exception.login');
+        $waybills = $this->deliveringQuery($request)->get();
+        $searchText = $request->get("searchText","");
         return view('transport.waybill.delivering',compact('waybills',"searchText"));
     }
+
+    /**
+     * 懒加载发运数据
+     */
+    public function loadData(Request $request)
+    {
+        if (!Auth::user())$this->error("登录信息失效");
+        $this->success($this->deliveringQuery($request)->get());
+    }
     //承运商提交
     public function storeCarrierBill(Request $request){
-        //if(!Gate::allows("运输管理-承运商调度"))return ["error"=>"无权操作!"];
+        if(!Gate::allows("运输管理-承运商调度"))return ["error"=>"无权操作!"];
         $errors=Validator::make($request->input(),[
             'id'=>'required|integer',
             'carrier_bill'=>'required',

+ 2 - 0
app/Http/Kernel.php

@@ -2,6 +2,7 @@
 
 namespace App\Http;
 
+use App\Http\Middleware\AuthorizingApi;
 use App\Http\Middleware\CheckCsrfToken;
 use App\Http\Middleware\LogPostRequest;
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
@@ -75,6 +76,7 @@ class Kernel extends HttpKernel
         'auth.api' => \App\Http\Middleware\ApiAuth::class,
         'procurement.auth.api' => \App\Http\Middleware\ProcurementApiAuth::class,
         'check.token' => CheckCsrfToken::class,
+        'authorizing' => AuthorizingApi::class,
     ];
 
     /**

+ 36 - 3
app/Http/Middleware/AuthorizingApi.php

@@ -3,18 +3,51 @@
 namespace App\Http\Middleware;
 
 use Closure;
+use Firebase\JWT\ExpiredException;
+use Firebase\JWT\JWT;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
 
 class AuthorizingApi
 {
     /**
      * Handle an incoming request.
      *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Closure  $next
+     * @param  Request  $request
+     * @param  Closure  $next
      * @return mixed
      */
-    public function handle($request, Closure $next)
+    public function handle(Request $request, Closure $next)
     {
+        $token = $request->header("token");
+        if (!$token) return response()->json([
+                        'message' => '没有认证,请前去认证',
+                        'status_code' => 401,
+                    ]);
+        try {
+            $publicKey = Cache::remember("TOKEN_PUBLIC_KEY",7200,function (){
+                return file_get_contents(base_path().'/public.pem');
+            });
+        }catch (\Exception $e){
+            $response["status_code"] = 410;
+            if (strpos($e->getMessage(),"No such file or directory")!==false)$response["message"] = "服务器异常,资源丢失";
+            else $response["message"] = "访问某些资源失败";
+            return response()->json($response);
+        }
+        try {
+            $payload = JWT::decode($token, $publicKey, ['RS256']);
+            $user = app("UserService")->getOrRefreshCache($payload->data->id,$payload->exp);
+        }catch (ExpiredException $e){
+            $response["status_code"] = 401;
+            $response["message"] = "token失效";
+            return response()->json($response);
+        } catch (\Exception $e){
+            $response["status_code"] = 401;
+            $response["message"] = "token非法";
+            return response()->json($response);
+        }
+        Auth::setUser($user);
         return $next($request);
     }
 }

+ 1 - 1
app/Http/Middleware/DecodingRequest.php

@@ -18,7 +18,7 @@ class DecodingRequest
     {
         if ($request->method() == "GET"){
             foreach ($request->input() as $key => $value){
-                if ($value != null)$request->offsetSet($key, urldecode($value));
+                if ($value != null && is_string($value))$request->offsetSet($key, urldecode($value));
             }
         }
         return $next($request);

+ 1 - 1
app/Listeners/UpdateOrderPackageExceptionListener.php

@@ -33,7 +33,7 @@ class UpdateOrderPackageExceptionListener implements ShouldQueue
                 $status = '返回派件';
                 break;
             case 2:
-                $status = '已收';
+                $status = '已收';
                 break;
             default:
                 $status = '无';

+ 5 - 1
app/OrderPackage.php

@@ -44,11 +44,13 @@ class OrderPackage extends Model
         'owner_id',
         'uploaded_to_wms',
         'sync_routes_flag',
+        'is_manual_update',
     ];
 
     protected $casts = [
         'transfer_status' => 'array',
         'sync_routes_flag' => 'boolean',
+        'is_manual_update' => 'boolean',
     ];
 
     static public $enums = [
@@ -67,7 +69,8 @@ class OrderPackage extends Model
             '返回异常'=>11,
             '返回派件'=>12,
             '其他异常'=>13,
-            '已收件'=>14,
+            '已签收'=>14,
+            '其他'=>14,
         ],
     ];
 
@@ -87,6 +90,7 @@ class OrderPackage extends Model
     public function setStatusAttribute($value)
     {
         if(!$value)return 0;
+        if (!(self::$enums['status'][$value] ?? false))return 0;
         $this->attributes['status']=self::$enums['status'][$value];
     }
 

+ 2 - 2
app/Services/HandInStorageService.php

@@ -128,7 +128,7 @@ class HandInStorageService
 
             $skuInvs = [];    // 库位没有该商品
             foreach ($invs as $inv) {
-                if ($inv['customerid'] != $param['customerid'] || $inv['sku'] != $param['sku']) {  // 库位没有该商品
+                if ($inv['customerid'] != $param['customerid'] && $inv['sku'] != $param['sku']) {  // 库位没有该商品
                     $skuInvs[] = $inv;
                     continue;
                 }
@@ -141,7 +141,7 @@ class HandInStorageService
             $inv = OracleInvLotLocId::query()->where('locationid', $info['location'])->first();
             if (!$inv) return true; //当前库位无库存余量 可直接入库
 
-            if ($inv['customerid'] == $param['customerid'] || $inv['sku'] == $param['sku']) return true;
+            if ($inv['customerid'] == $param['customerid'] && $inv['sku'] == $param['sku']) return true;
             else return 4; //库位:产品不能混放
         }
         // 库位

+ 3 - 3
app/Services/LogisticAliJiSuApiService.php

@@ -58,7 +58,7 @@ class LogisticAliJiSuApiService
             if (!empty($list) && is_array($list)) {
                 $lastNativeRoute = $list[0];
                 $result['status'] = $this->getStatus($response);
-                if ($result['status'] == '已收') $result['received_at'] = $lastNativeRoute->time;
+                if ($result['status'] == '已收') $result['received_at'] = $lastNativeRoute->time;
                 $result['transfer_status'] = $this->getTransferStatus($list);
                 $result['routes_length'] = array_key_exists('transfer_status', $result) ? count($result['transfer_status']) : 0;
                 $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
@@ -90,13 +90,13 @@ class LogisticAliJiSuApiService
                 $status = '派送中';
                 break;
             case '3':
-                $status = '已收';
+                $status = '已收';
                 break;
             case '4':
                 $status = '派送异常';
                 break;
             default:
-                $status = '';
+                $status = '其他';
         }
         return $status;
     }

+ 1 - 1
app/Services/LogisticSFService.php

@@ -165,7 +165,7 @@ xml;
                 case 607:
                 case 8000:
                 case 80:
-                    $data['status'] = '已收';
+                    $data['status'] = '已收';
                     $data['received_at'] = $lastRoute[$this->protected_switch['received_at']];
                     break;
                 case 648:

+ 4 - 8
app/Services/LogisticYDService.php

@@ -114,19 +114,15 @@ class LogisticYDService
             if (!empty($nativeRoutes)) {
                 $lastNativeRoute = $nativeRoutes[count($nativeRoutes) - 1];
                 $result['status'] = $this->getStatus($nativeData);
-                if ($result['status'] == '已收') {
+                if ($result['status'] == '已收') {
                     $result['received_at'] = $lastNativeRoute->time;
                 }
                 $result['transfer_status'] = $this->getTransferStatus($nativeRoutes);
                 $result['routes_length'] = array_key_exists('transfer_status', $result) ? count($result['transfer_status']) : 0;
-                $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
-                $exceptionData = $orderPackageReceivedSyncService->setExceptionType($result, $lastNativeRoute ? $lastNativeRoute->time : null);
-
             } else {
                 $result['status'] = null;
                 $result['transfer_status'] = [];
             }
-
             if (!array_key_exists('status', $result)) {
                 $result['status'] = null;
                 $result['transfer_status'] = [];
@@ -150,16 +146,16 @@ class LogisticYDService
                 $status = '在途';
                 break;
             case 'SIGNED':
-                $status = '已收';
+                $status = '已收';
                 break;
             case 'RETURN':
                 $status = '返回中';
                 break;
             case 'SIGNFAIL':
-                $status = '';
+                $status = '其他';
                 break;
             default:
-                $status = '';
+                $status = '其他';
         }
         return $status;
     }

+ 3 - 3
app/Services/LogisticYTOService.php

@@ -61,7 +61,7 @@ class LogisticYTOService
             if (!empty($response) && is_array($response)) {
                 $lastNativeRoute = $response[count($response) - 1];
                 $result['status'] = $this->getStatus($lastNativeRoute);
-                if ($result['status'] == '已收') $result['received_at'] = $lastNativeRoute->upload_Time;
+                if ($result['status'] == '已收') $result['received_at'] = $lastNativeRoute->upload_Time;
                 $result['transfer_status'] = $this->getTransferStatus($response);
                 $result['routes_length'] = array_key_exists('transfer_status', $result) ? count($result['transfer_status']) : 0;
                 $orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
@@ -95,13 +95,13 @@ class LogisticYTOService
                 $status = '派送中';
                 break;
             case 'SIGNED':
-                $status = '已收';
+                $status = '已收';
                 break;
             case 'TMS_RETURN':
                 $status = '返回中';
                 break;
             default:
-                $status = '';
+                $status = '其他';
         }
         return $status;
     }

+ 3 - 3
app/Services/LogisticZopService.php

@@ -38,7 +38,7 @@ class LogisticZopService implements LogisticRouteInterface
             'transfer_status' => $order_package->transfer_status,
             'received_at' => $order_package->received_at,
         ];
-        if (empty($nativeResponse->result)|| !$nativeResponse->status || $nativeResponse->status=='P-OW005') {
+        if (empty($nativeResponse->result)|| !$nativeResponse->status || $nativeResponse->statusCode=='P-OW005') {
             return $result;
         }
         $nativeRoutes = $nativeResponse->result??[];
@@ -72,11 +72,11 @@ class LogisticZopService implements LogisticRouteInterface
                 break;
             case 'SIGNED':
             case '签收':
-                $status = '已收';
+                $status = '已收';
                 $received_at = Carbon::parse($lastRoute->scanDate / 1000)->addHours(8)->toDateTimeString();
                 break;
             default:
-                $status = '';
+                $status = '其他';
                 break;
         }
         return array($status, $received_at);

+ 7 - 3
app/Services/OrderPackageReceivedSyncService.php

@@ -180,9 +180,9 @@ class OrderPackageReceivedSyncService
         foreach ($logisticResponses as $logisticResponse) {
             if (empty($logisticResponse)) continue;
             $orderPackage = OrderPackage::query()->where('logistic_number', $logisticResponse['logistic_number'])->first();
-            //如果已经收货,状态改为已收
+            //如果已经收货,状态改为已
             if ($logisticResponse['received_at']??false) {
-                $logisticResponse['status'] = '已收';
+                $logisticResponse['status'] = '已收';
             }
             //未查询到路由信息改为  揽件异常
             if (empty($logisticResponse['transfer_status'])) {
@@ -192,6 +192,10 @@ class OrderPackageReceivedSyncService
                     $logisticResponse['status'] = '疑似库内丢件';
                 }
             }
+            //标记为手动更新的 status不更新
+            if ($orderPackage->is_manual_update) {
+                unset($logisticResponse['status']);
+            }
             if (isset($logisticResponse['status'])) $orderPackage->status = $logisticResponse['status'];
             if (isset($logisticResponse['received_at'])) $orderPackage->received_at = $logisticResponse['received_at'];
             if (isset($logisticResponse['transfer_status']) && !empty($logisticResponse['transfer_status'])) $orderPackage->transfer_status = $logisticResponse['transfer_status'];
@@ -343,7 +347,7 @@ class OrderPackageReceivedSyncService
             $conclusion |= !empty($data['transfer_status']) ? $IS_ROUTED : 0;
             $conclusion |= ($delivered_duration > $VALID_HOURS) ? $IS_IN_VALID_TIME : 0;
             $conclusion |= ($orderPackage->weighed_at) ? $IS_WEIGHED : 0;
-            $conclusion |= ($data['status'] == '已收') ? $IS_RECEIVED : 0;
+            $conclusion |= ($data['status'] == '已收') ? $IS_RECEIVED : 0;
             $conclusion |= ($data['status'] == '派送中') ? $IS_SENDING : 0;//
             $conclusion |= ($last_routed_duration > $SHORT_RESPONSE_HOURS && $last_routed_duration < $LONG_RESPONSE_HOURS) ? $IS_SHORT_NO_RESPONSE : 0;
             $conclusion |= ($last_routed_duration > $LONG_RESPONSE_HOURS) ? $IS_LONG_NO_RESPONSE : 0;

+ 25 - 22
app/Services/UserService.php

@@ -4,15 +4,13 @@
 namespace App\Services;
 
 
-use App\Authority;
 use App\Owner;
 use App\User;
 use App\UserWorkgroup;
 use Firebase\JWT\JWT;
+use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Gate;
 use App\Traits\ServiceAppAop;
 
 
@@ -118,6 +116,7 @@ class UserService
         Cache::forget("owners:user_".$user->id);
         Cache::forget("userWorkGroups:user_".$user->id);
         Cache::tags("AUTHORITY_MENU_MAPPING")->forget("am_mapping_".$user->id);
+        Cache::tags("USERS")->pull("user_info_".$user->id);
     }
 
     /**
@@ -134,7 +133,7 @@ class UserService
             'iss' => $_SERVER["HTTP_HOST"], //签发者
             'iat' => $time,
             'nbf' => $time,
-            'exp' => $time+7200,
+            'exp' => $time+config("api.timeliness_limits.token","7200"),
             'data' => [
                 'id' => $user->id,
                 'username' => $user->name
@@ -145,26 +144,30 @@ class UserService
     }
 
     /**
-     * 获取JWT token
+     * 设置或刷新缓存
      *
-     * @param User|\stdClass $user
-     * @param mixed $key
-     * @return string
+     * @param User|\stdClass|Model $user
+     * @param null $exp
      */
-    public function checkJWTToken($user,$key):string
+    public function setOrRefreshCache($user, $exp = null)
     {
-        $time = time();
-        $payload = [
-            'iss' => $_SERVER["HTTP_HOST"], //签发者
-            'iat' => $time,
-            'nbf' => $time,
-            'exp' => $time+7200,
-            'data' => [
-                'id' => $user->id,
-                'username' => $user->name
-            ]
-        ];
-        $alg = 'RS256';
-        return JWT::encode($payload, $key, $alg);
+        if (!$exp)$exp = config("api.timeliness_limits.token","7200");
+        Cache::tags("USERS")->put("user_info_".$user->id,$user,$exp);
+    }
+
+    /**
+     * @param integer $id
+     * @param integer $exp
+     * @return User|\stdClass|null
+     */
+    public function getOrRefreshCache(int $id,int $exp):?Model
+    {
+        $user = Cache::tags("USERS")->get("user_info_".$id);
+        if ($user)return $user;
+        $user = User::query()->find($id);
+        if (!$user)return null;
+        $time = $exp-time();
+        $this->setOrRefreshCache($user,$time>0 ? $time : 7200);
+        return $user;
     }
 }

+ 3 - 0
config/api.php

@@ -75,4 +75,7 @@ return [
         // 登录相关,次数/分钟
         'sign' =>  env('SIGN_RATE_LIMITS', '10,1'),
     ],
+    "timeliness_limits" => [
+        'token' => 604800,
+    ],
 ];

+ 1 - 1
database/factories/OrderPackageFactory.php

@@ -7,7 +7,7 @@ use App\OrderPackage;
 use Faker\Generator as Faker;
 
 $factory->define(OrderPackage::class, function (Faker $faker) {
-    $statuses = ['无', '已称重', '已揽收', '在途', '在途异常', '派送中', '派送异常', '返回中', '返回异常', '返回派件', '其他异常', '已收',];
+    $statuses = ['无', '已称重', '已揽收', '在途', '在途异常', '派送中', '派送异常', '返回中', '返回异常', '返回派件', '其他异常', '已收',];
     $exceptions = ['是', '否'];
     $exception_types = ['疑似库内丢件','揽件异常','中转异常','疑似丢件','派件异常','其他','无'];
     return [

+ 32 - 0
database/migrations/2021_08_25_132757_add_column_is_manual_update_status_to_order_packages_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnIsManualUpdateStatusToOrderPackagesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->boolean('is_manual_update')->default(false)->comment('是否手动更新');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->dropColumn('is_manual_update');
+        });
+    }
+}

+ 28 - 2
resources/views/package/logistic/index.blade.php

@@ -121,6 +121,10 @@
                             <span
                                 style="display: inline-block;width: 15px;height: 15px;border-radius: 50%;position: absolute;top: 2px; margin-left: 3px;box-shadow: 0 0 3px #211f1f"
                                   :style="package.sync_routes_flag?'background-color:#4ed32d':'background-color:#e83939'"></span>
+                            <span v-if="package.is_manual_update">
+                                <i class="fa fa-hand-paper-o" aria-hidden="true"
+                                   style="color: red;position: absolute;left: 50px;top: 3px;"></i>
+                            </span>
                         </span>
                     </td>
                     <td>@{{ package.logistic_number }}</td>
@@ -132,6 +136,7 @@
                     <td>@{{ package.received_at }}</td>
                     <td>@{{ package.weighed_at }}</td>
                     <td>
+
                         <div v-if="package.transfer_status && package.transfer_status.length>0"
                              class="text-overflow-warp-200 up" :id="'route-'+i">
                             <p v-for="route in package.transfer_status">
@@ -150,6 +155,8 @@
                             </label>
                         </div>
                     </td>
+                    <!--退件状态-->
+                    <td>@{{ package.order.issue?package.order.issue.is_new_rejecting:'' }}</td>
                     <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
                         @can('包裹管理-快递-客服备注')
                         <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
@@ -258,9 +265,20 @@
                 showRemarkList: {},
                 selectTr: 0,
                 statuses: [
+                    '无',
+                    '已称重',
                     '已揽收',
+                    '揽件异常',
+                    '疑似库内丢件',
                     '在途',
-                    '无',
+                    '在途异常',
+                    '派送中',
+                    '派送异常',
+                    '返回中',
+                    '返回异常',
+                    '返回派件',
+                    '其他异常',
+                    '已签收',
                 ],
                 batchStatus: null,
                 remarkHover: null,
@@ -311,7 +329,7 @@
                                 {name: '11', value: '返回异常'},
                                 {name: '12', value: '返回派件'},
                                 {name: '13', value: '其他异常'},
-                                {name: '14', value: '已收'},
+                                {name: '14', value: '已收'},
                             ]
                         },
                         {name: 'sent_at_start', type: 'dateTime', tip: '选择显示发出时间的起始时间'},
@@ -363,6 +381,13 @@
                             placeholder: '是否为问题件',
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                         },
+                        {
+                            name: 'is_new_rejecting',
+                            type: 'select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
+                            placeholder: '退件状态',
+                            data: [{name: '无', value: '无'}, {name: '有', value: '有'},{name: '已处理', value: '已处理'}]
+                        },
                     ]
                 ];
                 _this.form = new query({
@@ -382,6 +407,7 @@
                     {name: 'received_at', value: '收货日期'},
                     {name: 'weighed_at', value: '称重日期'},
                     {name: 'transfer_status', value: '快递路由'},
+                    {name: 'is_new_rejecting', value: '退件状态'},
                     {name: 'remark', value: '客服备注'},
                     {name: 'result_explain', value: '情况说明'},
                     {name: 'issue_type', value: '问题类别'},

+ 12 - 2
resources/views/store/handInStorage/putaway.blade.php

@@ -316,21 +316,31 @@
                                 self.prop('checked', false);
                             });
                         },
+                        clearInfo(){
+                            this.info.name='';
+                            this.info.amount='';
+                            this.info.barCode='';
+                            this.info.location='';
+                            this.info.paTotal='';
+                        },
                         ensure() {
                             this.errors={};//初始errors状态
                             this.verifyInfoAndCheckData();
+                            tempTip.setDuration(1000);
+                            tempTip.waitingTip('提交中');
                             let url = '{{url('store/handInStorage/handFluxPa')}}';
                             if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info,checkData:this.checkData})
                                 .then(res=>{
                                     if (res.data.success){
                                         window.tempTip.setDuration(3000);
                                         window.tempTip.showSuccess(res.data.data);
-                                        this.info={};
+                                        // this.info={};
+                                        this.clearInfo();
                                         this.checkData=[];
                                         this.tasks=[];
                                         this.invLots=[];
                                         this.$forceUpdate()
-                                        document.getElementById("trackNumber").focus();
+                                        document.getElementById("trackNumber").select();
                                         return;
                                     }
                                     window.tempTip.setDuration(3000);

+ 3 - 6
resources/views/store/handInStorage/receive.blade.php

@@ -7,7 +7,7 @@
             <div class="card-header text-center bg-transparent" id="header_title">
                 <span class="font-weight-bold h3">收货</span>
             </div>
-            <div class="">
+            <div >
                 <div class="offset-1 mt-2">
                     <span class="font-weight-bold h5">ASN号:</span><br>
                     <p class="small font-weight-light">可输入条码,ASN号,货主编号(如:YOUWU)_搜索</p>
@@ -84,6 +84,7 @@
                 isAndroid:false,
                 asnno:'',
                 customerid:'',
+
             },
             mounted(){
                 if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
@@ -91,7 +92,7 @@
                 $("#container").removeClass("d-none");
                 this.height=window.screen.availHeight;
                 document.getElementById('cardTable').style.height=this.height*0.35+'px';
-                document.getElementById("asn").focus();
+                $('#asn').trigger("click").focus();
             },
             methods:{
                 //页面初始化
@@ -164,9 +165,6 @@
                         this.info.asntype=asn.asntype;
                     }
                 },
-                onfocus(){
-                    document.getElementById("asn").focus();
-                },
                 ensure(){
                     let error = {};
                     if (!this.info.asnno)error.asnno = ["ASN号必填"];
@@ -193,7 +191,6 @@
                 cancel(){
                     setTimeout(function () {
                         window.location.reload();
-                        this.onfocus();
                     },100);
                 },
             },

+ 4 - 0
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -313,6 +313,8 @@
                     if (Number(this.info.receivedqty)===Number(this.info.expectedqty)){
                         window.tempTip.setDuration(2000); window.tempTip.show("收货已完成");
                     }
+                    tempTip.setDuration(1000);
+                    tempTip.waitingTip('提交中');
                     let url = '{{url('store/handInStorage/fluxHandIn')}}';
                     if (JSON.stringify(this.errors)==='{}') window.axios.post(url,{info:this.info})
                         .then(res=>{
@@ -327,6 +329,8 @@
                                 this.$forceUpdate();
                                 document.getElementById("sku").focus();
                                 document.getElementById("sku").select();
+                                if (this.asn_expectedqty==this.asn_receivedqty)
+                                    window.location.href="{{url('store/handInStorage/receive')}}";
                                 return;
                             }
                             window.tempTip.setDuration(3000);

+ 2 - 1
resources/views/store/inStorage/androidIndex.blade.php

@@ -9,7 +9,7 @@
     <title>入库首页</title>
     <link href="{{ mix('css/app.css') }}" rel="stylesheet">
 </head>
-<body class="h-100">
+<body class="">
 <div class="container-fluid h-100 text-center">
     <div class="container-fluid h-25">
         <a class="navbar-brand" href="{{ url('/control/panel/menu') }}" title="宝时 Warehouse Assistance System" style="vertical-align: text-bottom">
@@ -22,6 +22,7 @@
 <!--                <a href="{{url('store/inStorage/cacheRackStorage')}}"><button class="btn btn-info w-75 text-white" style="height: 60px"><h4>整箱入库</h4></button></a>-->
                 @can("入库管理-手持入库-收货")<a href="{{url('store/handInStorage/receive')}}"><button class="btn btn-info w-75 h-25 text-white" style="height: 60px"><h4>收货</h4></button></a>@endcan
                 @can("入库管理-手持入库-上架")<a href="{{url('store/handInStorage/putaway')}}"><button class="btn btn-info w-75 h-25 mt-3 text-white" style="height: 60px"><h4>上架</h4></button></a>@endcan
+{{--                @can("入库管理-手持入库-库存查询")<a href="{{url('store/handInStorage/inventoryInfo')}}"><button class="btn btn-info w-75 h-25 mt-3 text-white" style="height: 60px"><h4>库存查询</h4></button></a>@endcan--}}
                 @can("入库管理-入库-半箱补货入库")<a href="{{url('store/inStorage/halfChestStorage')}}"><button class="btn btn-info w-75 h-25 mt-3 text-white" style="height: 60px"><h4>半箱入库</h4></button></a>
                 <a href="{{url('store/inStorage/boxBindShelf')}}"><button class="btn btn-info w-75 h-25 mt-3 text-white" style="height: 60px"><h4>新箱上架</h4></button></a>
                 <a href="{{url('store/inStorage/boxBindModel')}}"><button class="btn btn-info w-75 h-25 mt-3 text-white" style="height: 60px"><h4>料箱型号</h4></button></a>

+ 60 - 128
resources/views/transport/waybill/delivering.blade.php

@@ -4,69 +4,17 @@
 @section('content')
     <div id="list" class="d-none container-fluid">
         <div class="card">
-            <table class="card-body table table-sm table-hover table-striped table-bordered d-none d-sm-block p-0 text-nowrap td-min-width-80" style="width: 100%" id="table">
-                <tr v-for="(waybill,i) in waybills">
-                    <td>
-                        <input class="checkItem" type="checkbox" :value="waybill.id">
-                    </td>
-                    <td><span>@{{ i+1 }}</span></td>
-                    <td><span>@{{ waybill.deliver_at }}</span></td>
-                    <td><span>@{{ waybill.carrier_name }}</span></td>
-                    <td><span>@{{ waybill.waybill_number }}</span></td>
-                    <td><span>@{{ waybill.origination }}</span></td>
-                    <td><span>@{{ waybill.owner_name }}</span></td>
-                    <td><span>@{{ waybill.warehouse_weight_other }}</span></td>
-                    <td><span>@{{ waybill.warehouse_weight }}</span></td>
-                    <td><span v-if="waybill.status=='已完结'">已完成</span><span v-else><span v-if="waybill.carrier_bill">已提交</span><span v-if="!waybill.carrier_bill">待提交</span></span></td>
-                    <td>
-                        <span v-if="waybill.isBtn || !waybill.carrier_bill">
-                            <input :id="'carrier_bill'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid tooltipTargetError':''"
-                                   :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?errors['_'+waybill.id].carrier_bill[0]:''" type="text" class="form-control form-control-sm w-100" :value="waybill.carrier_bill">
-                        </span><span v-else>@{{ waybill.carrier_bill }}</span>
-                    </td>
-                    <td>
-                        <span v-if="waybill.isBtn || !waybill.carrier_bill">
-                            <input :id="'inquire_tel'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid tooltipTargetError':''"
-                                   :title="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?errors['_'+waybill.id].inquire_tel[0]:''" type="text" class="form-control form-control-sm w-100" :value="waybill.inquire_tel">
-                        </span><span v-else>@{{ waybill.inquire_tel }} </span>
-                    </td>
-                    <td>
-                        <span v-if="waybill.isBtn || !waybill.carrier_bill">
-                            <input :id="'amount'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?'is-invalid tooltipTargetError':''"
-                                   :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">
-                            <input :id="'carrier_weight_other'+waybill.id+'PC'" :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]:''" type="text" class="form-control form-control-sm w-100" :value="waybill.carrier_weight_other">
-                        </span><span v-else>@{{ waybill.carrier_weight_other }}</span>
-                    </td>
-                    <td>
-                        <span v-if="waybill.isBtn || !waybill.carrier_bill">
-                            <input :id="'carrier_weight'+waybill.id+'PC'" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid tooltipTargetError':''"
-                                   :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?errors['_'+waybill.id].carrier_weight[0]:''" type="text" class="form-control form-control-sm w-100" :value="waybill.carrier_weight">
-                        </span><span v-else>@{{ waybill.carrier_weight }}</span>
-                    </td>
-                    <td>
-                        <span v-if="waybill.status!='已完结'">
-                            <button v-if="!waybill.isBtn&&waybill.carrier_bill" @click="waybill.isBtn=true" class="btn btn-sm btn-outline-dark" >修改</button>
-                            <button v-if="!waybill.isBtn&& !waybill.carrier_bill" @click="submit(waybill.isBtn,waybill.id+'PC',waybill.id);" class="btn btn-sm btn-outline-info" >录入</button>
-                            <button v-if="waybill.isBtn" @click="submit(waybill.isBtn,waybill.id+'PC',waybill.id);" class="btn btn-sm btn-outline-success">确定</button>
-                            <button @click="waybill.isBtn=false" v-if="waybill.isBtn" class="btn btn-sm btn-outline-danger">取消</button>
-                        </span>
-                    </td>
-                </tr>
-            </table>
             <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-sm-none" style="background: rgb(255, 255, 255);">
                 <tbody>
                 <tr v-for="waybill in waybills">
-                    <td style="filter:grayscale(30%); ">
+                    <td style="filter:grayscale(30%); " :id="'waybill-'+waybill.id">
                         <div :style="waybill.status!='已完结'?'background-color:#f6eee8':''" class="mt-3">
                             <div style="transform:scale(0.9)" class="pl-0">
                                 <span class="mr-3 text-nowrap"><span style="color:#783000">日期:</span><span style="color:#af7651">@{{ waybill.deliver_at }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000">承运商:</span><span style="color:#af7651">@{{ waybill.carrier_name }}</span></span>
-                                <span class="mr-3 text-nowrap"><span style="color:#783000">宝时运单号:</span><span style="color:#af7651">@{{ waybill.waybill_number }}</span></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000">宝时运单号:</span><span style="color:#af7651">@{{ waybill.waybill_number }}</span><br></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000">目的地:</span><span style="color:#af7651">@{{ waybill.address }}</span><br></span>
+                                <span class="mr-3 text-nowrap"><span style="color:#783000">收货人:</span><span style="color:#af7651">@{{ waybill.recipient }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000">提货仓:</span><span style="color:#af7651">@{{ waybill.origination }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000">预估重量:</span><span style="color:#af7651" v-if="waybill.warehouse_weight_other">@{{ waybill.warehouse_weight_other }} @{{ waybill.warehouse_weight_unit_other_name }}</span></span>
                                 <span class="mr-3 text-nowrap"><span style="color:#783000">预估体积:</span><span style="color:#af7651" v-if="waybill.warehouse_weight">@{{ waybill.warehouse_weight }} @{{ waybill.warehouse_weight_unit_name }}</span></span>
@@ -139,7 +87,7 @@
             </tbody>
             </table>
         </div>
-        <div class="bg-white w-100 row" style="position: fixed;top:0;left:0;
+        <div class="bg-white w-100 row" id="searchBlock" style="position: fixed;top:0;left:0;
             width: 100%; text-align: center; border-radius: 3px;">
             <div class="position-relative offset-2 col-9 mt-3 mb-3">
                 <input class="form-control form-control-sm w-100 rounded-pill" @keydown.enter="searchSubmit()" v-model="searchText" type="text" placeholder="运单号 物流单号"></input>
@@ -173,74 +121,77 @@
                     carrier_weight_other:'{{$waybill->carrier_weight_other}}',
                     status:'{{$waybill->status}}',
                     amount:'{{$waybill->amount}}',
-                    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->logistic->name ?? ''}}',
-                    owner_name:'{{$waybill->owner_name ?? ($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 : ''}}',
-                    warehouse_weight_unit_other_name:'{{$waybill->warehouse_weight_unit_other ? $waybill->warehouse_weight_unit_other->name : ''}}',
-                    carrier_weight_unit_other_name:'{{$waybill->carrier_weight_unit_other ? $waybill->carrier_weight_unit_other->name : ''}}',
                     isBtn:!!!'{{$waybill->carrier_bill}}',
                     subjoin_fee:'{{$waybill->subjoin_fee}}',
+                    recipient:'{{$waybill->order->consignee_name ?? $waybill->recipient}}',
+                    address:'{{$waybill->order ? $waybill->order->province.$waybill->order->city.$waybill->order->district : $waybill->destination}}',
                 },
                 @endforeach
             ],
-            filterData:{
-                created_at_start:'',created_at_end:'',waybill_number:'',carrier_bill:''
-            },
             errors:{},
-            sum:{!! $waybills->count() !!},
             searchText:"{{$searchText}}",
+            lastId:"",
+            lastHeight:"",
         },
         mounted:function(){
-            let _this=this;
             $(".tooltipTarget").tooltip({'trigger':'hover'});
-            _this.initInputs();
+            if (this.waybills.length>0)this.lastId = this.waybills[this.waybills.length-1].id;
+            this.listener();
             if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
             this.pageInit();
             $("#list").removeClass('d-none');
-            if (this.isAndroid)return;
-            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},
-            ];
-            new Header({
-                el: "table",
-                name: "waybillDelivering",
-                column: column,
-                data: this.waybills,
-                restorationColumn: 'id',
-                fixedTop:($('#form_div').height())+2,
-            }).init();
         },
-        computed:{
-            isBeingFilterConditions:function(){
-
-                for(let key in this.filterData){
-                    if(this.filterData[key]){
-                        return true
+        methods:{
+            listener(){
+                window.addEventListener('scroll',  ()=>{
+                    let clientHeight = document.documentElement.clientHeight;
+                    let scrollTop = document.body.scrollTop;
+                    let scrollHeight = document.body.scrollHeight;
+                    if (clientHeight+scrollTop >= scrollHeight-500) {
+                        setTimeout(()=>{
+                            if (this.lastHeight===scrollHeight)return;
+                            this.loadData();
+                            this.lastHeight=scrollHeight;
+                        });
                     }
-                }
-                return false;
+                }, false);
+            },
+            loadData(){
+                window.tempTip.postBasicRequest("{{url('transport/waybill/loadData')}}",{searchText:this.searchText,lastId:this.lastId},res=>{
+                    if(!res || res.length<1){
+                        window.removeEventListener("scroll",function (){},false);
+                        return;
+                    }
+                    let waybills = [];
+                    let lastId = "";
+                    res.forEach(waybill=>{
+                        waybills.push({
+                            id:waybill.id,
+                            deliver_at:waybill.deliver_at,
+                            waybill_number:waybill.waybill_number,
+                            origination:waybill.origination,
+                            carrier_bill:waybill.carrier_bill,
+                            warehouse_weight:waybill.warehouse_weight,
+                            carrier_weight:waybill.carrier_weight,
+                            warehouse_weight_other:waybill.warehouse_weight_other,
+                            carrier_weight_other:waybill.carrier_weight_other,
+                            status:waybill.status,
+                            amount:waybill.amount,
+                            inquire_tel:waybill.inquire_tel,
+                            carrier_name:waybill.logistic ? waybill.logistic.name : '',
+                            isBtn:!!!waybill.carrier_bill,
+                            subjoin_fee:waybill.subjoin_fee,
+                            recipient:waybill.order ? waybill.order.consignee_name : waybill.recipient,
+                            address:waybill.order ? waybill.order.province+waybill.order.city+waybill.order.district : waybill.destination,
+                        });
+                        lastId = waybill.id;
+                    });
+                    this.waybills.push.apply(this.waybills, waybills);
+                    this.lastId = lastId;
+                });
             },
-
-        },
-        methods:{
             searchSubmit(){
                 document.getElementById("search").click();
             },
@@ -254,32 +205,13 @@
                 element.innerHTML = element.children[0].outerHTML;
                 let e1 = document.getElementById("menu");
                 let e2 = document.getElementById("demand-div");
-                let e3 = document.getElementsByClassName("navbar");
+                //let e3 = document.getElementsByClassName("navbar");
                 if (e1)e1.remove();
                 if (e2)e2.remove();
-                if (e3.length>0)e3[0].remove();
+                //if (e3.length>0)e3[0].remove();
                 element = document.getElementById("container");
                 if (element)element.style.height = (window.innerHeight-100)+"px";
             },
-            initInputs:function(){
-                let data=this;
-                let uriParts =decodeURI(location.href).split("?");
-                if(uriParts.length>1){
-                    let params = uriParts[1].split('&');
-                    params.forEach(function(paramPair){
-                        let pair=paramPair.split('=');
-                        let key = pair[0], val = pair[1];
-                        $('input[name="'+key+'"]').val(val);
-                        $('select[name="'+key+'"]').val(val);
-                        decodeURI(data.filterData[key]=val);
-                    });
-                }
-            },
-            waybillExport(checkAllSign){
-                let url = '{{url('transport/waybill/deliveringExport')}}';
-                let token='{{ csrf_token() }}';
-                excelExport(checkAllSign,checkData,url,this.sum,token);
-            },
             enlarge(e){
                 e.target.style.width="150px";
             },

+ 12 - 0
routes/api.php

@@ -14,3 +14,15 @@ use Illuminate\Support\Facades\Route;
 |
 */
 
+Route::prefix("v1")->group(function (){
+    Route::middleware('throttle:' . config('api.rate_limits.sign'))
+        ->group(function () {
+           //登录
+           Route::POST('login', 'LoginController@login');
+        });
+    Route::middleware(['throttle:' . config('api.rate_limits.access'),"authorizing"])
+        ->group(function () {
+            Route::POST('test', 'LoginController@test');
+        });
+});
+

+ 1 - 0
routes/web.php

@@ -392,6 +392,7 @@ Route::group(['middleware'=>'auth'],function ($route){
             Route::post('expressFaceList','WaybillController@expressFaceList');
             Route::post('changeExpressTag','WaybillController@changeExpressTag');
             Route::post('appendSubjoinFee','WaybillController@appendSubjoinFee');
+            Route::post('loadData','WaybillController@loadData');
         });
         Route::resource('waybill','WaybillController');
     });