Quellcode durchsuchen

运输页面改进

Zhouzhendong vor 4 Jahren
Ursprung
Commit
86c9c3211f

+ 1 - 1
app/Http/ApiControllers/LoginController.php

@@ -46,7 +46,7 @@ class LoginController
         }
 
         try {
-            $response["data"] = ["token"=>$this->getJWTToken($user,$privateKey)];
+            $response["data"] = ["token"=>app("UserService")->getJWTToken($user,$privateKey)];
             return response()->json($response);
         }catch (\Exception $e){
             $response["status_code"] = 409;

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

@@ -83,29 +83,7 @@ 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,访问某些资源失败");
-        }
-
-
+        dd(Waybill::query()->where("waybill_number","BSZX2108243260")->first()->toArray());
         $payload = [
 
             'data' => ['field1' => 1, 'field2' => 'string data'],

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

@@ -9,6 +9,7 @@ use App\Owner;
 use App\Region;
 use App\Services\CarTypeService;
 use App\Services\LogisticService;
+use App\Services\LogService;
 use App\Services\OwnerService;
 use App\Services\UnitService;
 use App\Services\WaybillPayoffService;
@@ -769,22 +770,26 @@ SQL;
     }
 
     //发运
-    public function delivering(){
+    public function delivering(Request $request){
         if (!Auth::user())return view('exception.login');
-        $waybills= Waybill::query()->where("type","专线")->whereNotNull("deliver_at")
-            ->whereNotNull("logistic_id")->whereIn("status",["已审核","待终审"])
-            ->whereNull("carrier_bill")->orderByDesc("id");
+        $waybills= Waybill::query()->where("type","专线")
+            ->whereNotNull("logistic_id")->whereNotIn("status",["未审核","待重审"])
+            ->orderByDesc("id");
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('logistic_user')->where('user_id',Auth::id())->get();
             $carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
             if ($carrierIds)$waybills->whereIn("logistic_id",$carrierIds);
         }
+        $searchText = $request->get("searchText","");
+        if ($searchText)$waybills->where(function ($query)use($searchText){
+            $query->where("waybill_number",'like','%'.$searchText.'%')->orWhere("carrier_bill",'like','%'.$searchText.'%');
+        });
         $waybills = $waybills->get();
-        return view('transport.waybill.delivering',compact('waybills'));
+        return view('transport.waybill.delivering',compact('waybills',"searchText"));
     }
     //承运商提交
     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',
@@ -1265,6 +1270,7 @@ SQL;
             $owner = array_unique($owner);
             if (count($owner)>1)$waybill->merge_owner = implode(',',$owner);
             $waybill->deliver_at = date("Y-m-d H:i:s");
+            if ($waybill->status=='未审核')$waybill->status = '已审核';
             $waybill->update();
             Waybill::destroy($destroys);
             WaybillAuditLog::query()->create([
@@ -1283,7 +1289,9 @@ SQL;
                 'audit_stage'=>'单独发货',
                 'user_id'=>Auth::id(),
             ]);
-            $waybill->update(["deliver_at"=>date("Y-m-d H:i:s"),"logistic"=>\request("logistic")]);
+            $update = ["deliver_at"=>date("Y-m-d H:i:s"),"logistic_id"=>\request("logistic")];
+            if ($waybill->status=='未审核')$update["status"] = '已审核';
+            $waybill->update($update);
         }
         $this->success();
     }
@@ -1344,4 +1352,15 @@ SQL;
         ]);
         $this->success();
     }
+
+    public function appendSubjoinFee()
+    {
+        $this->gate("运输管理-编辑");
+        $id = \request("id");
+        $subjoinFee = \request("subjoinFee");
+        if (!$id || !$subjoinFee)$this->error("非法参数");
+        if (Waybill::query()->where("id",$id)->update(["subjoin_fee"=>$subjoinFee]) == 0)$this->error("修改失败,运单信息发送变更");
+        LogService::log("运输附加费","调度商添加","录入人:".Auth::id()." | 修改费用{$id}为:".$subjoinFee);
+        $this->success();
+    }
 }

+ 20 - 0
app/Http/Middleware/AuthorizingApi.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class AuthorizingApi
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        return $next($request);
+    }
+}

+ 2 - 1
app/Waybill.php

@@ -73,7 +73,8 @@ class Waybill extends Model
         'express_face_list',
         'arrived_org_simple_name',
         'much_higher_delivery',
-        'station_no'
+        'station_no',
+        'subjoin_fee',//附加费
     ];
 
     public function district()

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

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeWaybillsAddColumnSubjoinFee extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table("waybills",function (Blueprint $table){
+            $table->decimal("subjoin_fee",10,3)->default(0)->comment("附加费");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table("waybills",function (Blueprint $table){
+            $table->dropColumn("subjoin_fee");
+        });
+    }
+}

+ 118 - 99
resources/views/transport/waybill/delivering.blade.php

@@ -3,45 +3,6 @@
 
 @section('content')
     <div id="list" class="d-none container-fluid">
-<!--        <form method="GET" action="{{url('transport/waybill/delivering')}}" id="form">
-            计费模型  <div class="text-nowrap mb-0" style="background: #fff;">
-                <div v-if="isBeingFilterConditions">
-                    <div><div class="col" style="padding:0">
-                            <a  href="{{url('transport/waybill/delivering')}}"><span class="btn btn-warning text-dark">清除筛选</span></a>
-                        </div>
-                    </div>
-                </div>
-                <div class="row mt-2 ml-2">
-                    <div class="col-md-6 form-inline" style="max-width: 400px">
-                        <input type="date" name="created_at_start" class="form-control form-control-sm tooltipTarget" title="选择显示指定日期的起始时间"
-                               v-model="filterData.created_at_start" :class="filterData.created_at_start?'bg-warning':''">
-                        <input type="date" class="form-control form-control-sm tooltipTarget" name="created_at_end" title="选择显示指定日期的结束时间"
-                               v-model="filterData.created_at_end" :class="filterData.created_at_end?'bg-warning':''" >
-                    </div>
-                    <div class=" col-md-2 mr-0 " style="max-width: 160px">
-                        <input type="text" title="运单号:可在两侧增加百分号(%)进行模糊搜索" name="waybill_number" placeholder="运单号"
-                               class="form-control form-control-sm tooltipTarget" v-model="filterData.waybill_number" style="vertical-align: middle;width: 153px" :class="filterData.waybill_number?'bg-warning':''">
-                    </div>
-                    <div class=" col-md-2 ml-2 p-0" style="max-width: 160px">
-                        <input type="text" title="承运商单号:可在两侧增加百分号(%)进行模糊搜索"  name="carrier_bill" placeholder="承运商单号"
-                               class="form-control form-control-sm tooltipTarget" v-model="filterData.carrier_bill" style="vertical-align: middle;width: 153px" :class="filterData.carrier_bill?'bg-warning':''">
-                    </div>
-                    <input type="submit" hidden>
-                </div>
-                <div class="ml-4 mt-2">
-                    <span class="dropdown">
-                        <button type="button" class="btn  btn-sm  form-control-sm dropdown-toggle tooltipTarget"
-                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
-                            导出Excel
-                        </button>
-                        <div class="dropdown-menu">
-                            <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
-                            <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
-                        </div>
-                    </span>
-                </div>
-            </div>
-        </form>-->
         <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">
@@ -90,8 +51,8 @@
                     <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.id+'PC',waybill.id);" class="btn btn-sm btn-outline-info" >录入</button>
-                            <button v-if="waybill.isBtn" @click="submit(waybill.id+'PC',waybill.id);" class="btn btn-sm btn-outline-success">确定</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>
@@ -115,44 +76,76 @@
                             <div style="transform:scale(0.9)" class="pl-0 form-inline">
                                 <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">专线运单号:</span>
                                     <input :id="'carrier_bill'+waybill.id" :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]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" :value="waybill.carrier_bill"
+                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?errors['_'+waybill.id].carrier_bill[0]:''" v-if="waybill.isBtn" type="text" :value="waybill.carrier_bill"
                                            class="form-control form-control-sm " @click="enlarge($event)"  style="width: 50px">
                                     <span v-else  class="text-muted">@{{ waybill.carrier_bill }}</span>
                                 </span>
-                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">查&nbsp;件&nbsp;电&nbsp;话:</span>
+                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">查&nbsp;件&nbsp;电&nbsp;&nbsp;话:</span>
                                     <input :id="'inquire_tel'+waybill.id" :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]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" :value="waybill.inquire_tel"
+                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?errors['_'+waybill.id].inquire_tel[0]:''" v-if="waybill.isBtn" type="text" :value="waybill.inquire_tel"
                                            class="form-control form-control-sm" @click="enlarge($event)"  style="width:50px">
                                     <span v-else  class="text-muted">@{{ waybill.inquire_tel }}</span>
                                 </span>
-                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">件数:</span>
-                                    <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?'is-invalid tooltipTargetError':''"
-                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?errors['_'+waybill.id].amount[0]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" :value="waybill.amount" class="form-control form-control-sm"
-                                           @click="enlarge($event)" style="width:50px">
+                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">数量:</span>
+                                    <span class="input-group input-group-sm" v-if="waybill.isBtn">
+                                        <input :id="'amount'+waybill.id" :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" :value="waybill.amount"
+                                               class="form-control"
+                                               @click="enlarge($event)" style="width:50px">
+                                        <span class="input-group-append">
+                                          <span class="input-group-text">件</span>
+                                        </span>
+                                    </span>
                                     <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>
-                                    <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"
-                                           class="form-control form-control-sm" @click="enlarge($event)" style="width:50px">
+                                    <span class="input-group input-group-sm" v-if="waybill.isBtn">
+                                        <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]:''" type="text" :value="waybill.carrier_weight_other"
+                                               class="form-control" @click="enlarge($event)" style="width:50px">
+                                        <span class="input-group-append">
+                                          <span class="input-group-text">KG</span>
+                                        </span>
+                                    </span>
                                     <span v-else class="text-muted">@{{ waybill.carrier_weight_other }}</span>
                                 </span>
                                 <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">体积:</span>
-                                    <input :id="'carrier_weight'+waybill.id" :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]:''" v-if="waybill.isBtn || !waybill.carrier_bill" type="text" :value="waybill.carrier_weight"
-                                           class="form-control form-control-sm" @click="enlarge($event)" {{--@mouseleave="shrink($event)"--}} style="width:50px">
+                                    <span class="input-group input-group-sm" v-if="waybill.isBtn">
+                                        <input :id="'carrier_weight'+waybill.id" :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" :value="waybill.carrier_weight"
+                                               class="form-control" @click="enlarge($event)" style="width:50px">
+                                        <span class="input-group-append">
+                                          <span class="input-group-text">M³</span>
+                                        </span>
+                                    </span>
                                     <span v-else class="text-muted">@{{ waybill.carrier_weight }}</span>
                                 </span>
-                                <span class="mr-3 text-nowrap" v-if="waybill.status!='已完结'">
-                                    <button v-if="waybill.isBtn==true || !waybill.carrier_bill" class="btn btn-sm btn-outline-success" @click="submit(waybill.id)">提交</button>
-                                    <button v-if="waybill.isBtn==true" class="btn btn-sm btn-outline-danger" @click="waybill.isBtn=false">取消</button>
-                                    <button v-if="waybill.isBtn==false && waybill.carrier_bill" class="btn btn-sm " @click="waybill.isBtn=true" :class="waybill.carrier_bill?'btn-outline-dark':'btn-outline-primary'">修改</button></span></div>
+                                <span class="mr-3 text-nowrap form-inline" v-if="!waybill.isBtn && (waybill.status!=='已完结' && waybill.status!=='无模型')"><span style="color:#02346a">附加费:</span>
+                                    <span class="input-group input-group-sm">
+                                        <input :id="'subjoin_fee'+waybill.id" :value="waybill.subjoin_fee" type="number" step="0.01"
+                                               class="form-control" style="width:150px">
+                                        <span class="input-group-append">
+                                          <span class="input-group-text">元</span>
+                                        </span>
+                                    </span>
+                                </span>
+                                <span class="mr-3 text-nowrap" v-if="waybill.status!=='已完结' || waybill.status!=='无模型'">
+                                    <button class="btn btn-sm btn-outline-success" @click="submit(waybill.isBtn,waybill.id)">提交</button>
+                                </span>
+                            </div>
                         </div>
                     </td>
                 </tr>
             </tbody>
             </table>
         </div>
+        <div class="bg-white w-100 row" 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>
+                <a id="search" v-bind:href="'{{url('transport/waybill/delivering?searchText=')}}'+searchText"><button type="button" class="border btn btn-sm btn-primary text-white rounded-pill position-absolute" style="top: 0;right: 12px;">搜索</button></a>
+            </div>
+        </div>
     </div>
 @endsection
 
@@ -189,7 +182,8 @@
                     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:false
+                    isBtn:!!!'{{$waybill->carrier_bill}}',
+                    subjoin_fee:'{{$waybill->subjoin_fee}}',
                 },
                 @endforeach
             ],
@@ -198,6 +192,7 @@
             },
             errors:{},
             sum:{!! $waybills->count() !!},
+            searchText:"{{$searchText}}",
         },
         mounted:function(){
             let _this=this;
@@ -206,6 +201,7 @@
             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"},
@@ -245,6 +241,9 @@
 
         },
         methods:{
+            searchSubmit(){
+                document.getElementById("search").click();
+            },
             //页面初始化
             pageInit(){
                 if (!this.isAndroid)return;
@@ -285,49 +284,69 @@
             shrink(e){
                 e.target.style.width="50px";
             },
-            submit(waybill_id,id=null){
-                if (!confirm('确定要提交吗?')){return;}
-                let _this=this;
-                let data={};
-                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();
-                data['carrier_weight'] = $("#carrier_weight"+waybill_id).val();//体积
-                data['carrier_weight_other'] = $("#carrier_weight_other"+waybill_id).val();//重量
-                if (_this.errors["_"+data['id']])_this.errors["_"+data['id']]={};
-                axios.post("{{url('transport/waybill/storeCarrierBill')}}",data)
-                    .then(function (response) {
-                        if (response.data.error){
-                            tempTip.setDuration(3000);
-                            tempTip.show(response.data.error);
-                            return
-                        }
-                        if (response.data.errors){
-                            Vue.set(_this.errors,"_"+data['id'],response.data.errors);
-                            setTimeout(function(){
-                                $(".tooltipTargetError").tooltip('show');
-                            },1);
-                            return;
+            appendSubjoinFee(waybillId){
+                let subjoinFee =  $("#subjoin_fee"+waybillId).val();
+                if (!subjoinFee)return;
+                window.tempTip.postBasicRequest("{{url('transport/waybill/appendSubjoinFee')}}",{subjoinFee:subjoinFee,id:waybillId},()=>{
+                    this.waybills.some((waybill,index)=>{
+                        if (waybill.id===waybillId){
+                            this.$set(this.waybills[index],"subjoin_fee",subjoinFee);
+                            return true;
                         }
-                        _this.waybills.some(function (waybill) {
-                            if (waybill.id===data['id']){
-                                waybill.carrier_bill=response.data.carrier_bill;
-                                waybill.inquire_tel=response.data.inquire_tel;
-                                waybill.amount=response.data.amount;
-                                waybill.amount_unit_name=response.data.amount_unit_name;
-                                waybill.carrier_weight=response.data.carrier_weight;
-                                waybill.carrier_weight_other=response.data.carrier_weight_other;
-                                waybill.isBtn=false;
-                                tempTip.setDuration(2000);
-                                tempTip.showSuccess('录入成功!');
-                                return true;
+                    });
+                    return "附加费添加成功";
+                });
+            },
+            submit(isBtn,waybillId,id=null){
+                if(!isBtn){this.appendSubjoinFee(waybillId);return;}
+                window.tempTip.confirm("确定要提交调配信息吗?",()=>{
+                    let data={
+                        id           :  id ? id : waybillId,
+                        carrier_bill :  $("#carrier_bill"+waybillId).val(),
+                        inquire_tel  :  $("#inquire_tel"+waybillId).val(),
+                        amount  :  $("#amount"+waybillId).val(),
+                        carrier_weight  :  $("#carrier_weight"+waybillId).val(),
+                        carrier_weight_other  :  $("#carrier_weight_other"+waybillId).val(),
+                    };
+                    if (!data["id"]){
+                        window.tempTip.setDuration(3000);
+                        window.tempTip.show("参数异常");
+                        return;
+                    }
+                    this.errors["_"+data['id']]={};
+                    axios.post("{{url('transport/waybill/storeCarrierBill')}}",data)
+                        .then(response=>{
+                            if (response.data.error){
+                                tempTip.setDuration(3000);
+                                tempTip.show(response.data.error);
+                                return;
+                            }
+                            if (response.data.errors){
+                                this.$set(this.errors,"_"+data['id'],response.data.errors);
+                                setTimeout(function(){
+                                    $(".tooltipTargetError").tooltip('show');
+                                },1);
+                                return;
                             }
+                            this.waybills.some(function (waybill) {
+                                if (waybill.id===data['id']){
+                                    waybill.carrier_bill=response.data.carrier_bill;
+                                    waybill.inquire_tel=response.data.inquire_tel;
+                                    waybill.amount=response.data.amount;
+                                    waybill.amount_unit_name=response.data.amount_unit_name;
+                                    waybill.carrier_weight=response.data.carrier_weight;
+                                    waybill.carrier_weight_other=response.data.carrier_weight_other;
+                                    if (waybill.carrier_bill)waybill.isBtn=false;
+                                    tempTip.setDuration(2000);
+                                    tempTip.showSuccess('录入成功!');
+                                    return true;
+                                }
+                            });
+                        }).catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('网络异常:'+err);
                         });
-                    }).catch(function (err) {
-                    tempTip.setDuration(3000);
-                    tempTip.show('网络异常:'+err);
-                });
+                })
             }}
     });
 

+ 1 - 0
routes/web.php

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