| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432 |
- @extends('layouts.app')
- @section('content')
- <div id="nav2">
- @component('waybill.menu')
- <li class="nav-item">
- <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">调度</a>
- </li>
- @endcomponent
- </div>
- <div class="container-fluid mt-3" id="list">
- <div class="card">
- <div class="card-body">
- <form method="POST" id="waybillForm" action='{{url("waybill/{$waybill->id}")}}'>
- @csrf
- @method('PUT')
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">运单类型</label>
- <div class="col-8">
- <input name="type" id="type" type="text" class="form-control" readonly="true" value="{{$waybill->type}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">运单号</label>
- <div class="col-8">
- <input type="text" class="form-control" disabled="disabled" value="{{$waybill->waybill_number}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">货主</label>
- <div class="col-8">
- <input type="text" class="form-control" disabled="disabled" value="{{$waybill->owner_name}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">WMS单号</label>
- <div class="col-8">
- <input type="text" class="form-control" disabled="disabled" value="{{$waybill->wms_bill_number}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">始发地</label>
- <div class="col-8">
- <input id="origination_seek" type="text" class="form-control" disabled="disabled" value="{{$waybill->origination}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">目的地</label>
- <div class="col-8">
- <input id="destination_seek" type="text" class="form-control" disabled="disabled" value="{{$waybill->destination}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">收件人</label>
- <div class="col-8">
- <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient}}" >
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">收件人电话</label>
- <div class="col-8">
- <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient_mobile}}" >
- </div>
- </div>
- <div class="form-group row">
- <label for="charge" class="col-2 col-form-label text-right text-secondary">收费(元)</label>
- <div class="col-8">
- <input type="text" class="form-control @error('charge') is-invalid @enderror"
- id="charge" name="charge" value="@if(old('charge')){{ old('charge') }}@else{{$waybill->charge}}@endif " >
- </div>
- @error('charge')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary">下单备注</label>
- <div class="col-8">
- <textarea class="form-control" disabled="disabled" >{{$waybill->ordering_remark}}</textarea>
- </div>
- </div>
- {{--编辑区--}}
- <div class="form-group row">
- <label for="carrier_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
- <div class="col-8">
- <select name="carrier_id" class="form-control @error('carrier_id') is-invalid @enderror" :class="errors['carrier_id'] ? 'is-invalid' :''" id="carrier_id" v-model="waybillPriceModel.carrier_id" style="width: 30%; ">
- @foreach($carriers as $carrier)
- <option value="{{$carrier->id}}">{{$carrier->name}}</option>
- @endforeach
- </select>
- </div>
- <div class="col-sm-5">
- <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('carrier_id') }}</p>
- </div>
- </div>
- <div class="form-group row">
- <label for="carrier_bill" class="col-2 col-form-label text-right">承运商单号</label>
- <div class="col-8">
- <input type="text" class="form-control @error('carrier_bill') is-invalid @enderror"
- name="carrier_bill" autocomplete="off" value="@if(old('carrier_bill')){{ old('carrier_bill') }}@else{{$waybill->carrier_bill}}@endif" >
- @error('carrier_bill')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- @if($waybill->type=="专线")
- <div class="form-group row">
- <label for="origination_city_id" class="col-2 col-form-label text-right text-primary">始发市 *</label>
- <div class="col-8 form-inline">
- <select class="form-control @error('origination_city_id') is-invalid @enderror" name="origination_city_id" :class="errors['origination_city_id'] ? 'is-invalid' :''" style="width: 30%; " v-model="waybillPriceModel.origination_city_id">
- <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
- </select>
- <input class="form-control-sm" placeholder="输入关键字定位" @input="origination_city_name">
- </div>
- </div>
- <div class="form-group row">
- <label for="destination_city_id" class="col-2 col-form-label text-right text-primary">目的市 *</label>
- <div class="col-8 form-inline">
- <select class="form-control @error('destination_city_id') is-invalid @enderror" name="destination_city_id" :class="errors['destination_city_id'] ? 'is-invalid' :''" id="destination_city_id" v-model="waybillPriceModel.destination_city_id" style="width: 30%; " >
- <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
- </select>
- <input class="form-control-sm" placeholder="输入关键字定位" @input="destination_city_id">
- </div>
- </div>
- <div class="form-group row">
- <label for="warehouse_weight" class="col-2 col-form-label text-right ">仓库计数(抛)</label>
- <div class="col-2">
- <input type="text" class="form-control @error('warehouse_weight') is-invalid @enderror"
- name="warehouse_weight" autocomplete="off" value="@if(old('warehouse_weight')){{ old('warehouse_weight') }}@else{{$waybill->warehouse_weight}}@endif" >
- @error('warehouse_weight')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <label for="warehouse_weight_unit_id" class=" col-form-label text-right ">单位:</label>
- <div class="col-1.5">
- <select class="form-control @error('warehouse_weight_unit_id') is-invalid @enderror" name="warehouse_weight_unit_id" v-model="waybillPriceModel.warehouse_weight_unit_id">
- @foreach($units as $unit)
- <option value="{{$unit->id}}">{{$unit->name}}</option>
- @endforeach
- </select>
- </div>
-
- <label for="warehouse_weight_other" class="col-form-label text-right "> 仓库计数二</label>
- <div class="col-2">
- <input type="text" class="form-control @error('warehouse_weight_other') is-invalid @enderror"
- name="warehouse_weight_other" autocomplete="off" value="@if(old('warehouse_weight_other')){{ old('warehouse_weight_other') }}@else{{$waybill->warehouse_weight_other}}@endif" >
- @error('warehouse_weight_other')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <label for="warehouse_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
- <div class="col-1.5">
- <select class="form-control @error('warehouse_weight_unit_id_other') is-invalid @enderror" name="warehouse_weight_unit_id_other" v-model="waybillPriceModel.warehouse_weight_unit_id_other" >
- @foreach($units as $unit)
- <option value="{{$unit->id}}">{{$unit->name}}</option>
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label for="carrier_weight" class="col-2 col-form-label text-right ">承运商计数(抛)</label>
- <div class="col-2">
- <input type="text" id="carrier_weight" :class="errors['carrier_weight'] ? 'is-invalid' :''" class="form-control @error('carrier_weight') is-invalid @enderror"
- name="carrier_weight" autocomplete="off" value="@if(old('carrier_weight')){{ old('carrier_weight') }}@else{{$waybill->carrier_weight}}@endif" >
- @error('carrier_weight')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <label for="carrier_weight_unit_id" class=" col-form-label text-right ">单位:</label>
- <div class="col-1.5">
- <select id="carrier_weight_unit_id" :class="errors['carrier_weight_unit_id'] ? 'is-invalid' :''" class="form-control @error('carrier_weight_unit_id') is-invalid @enderror" name="carrier_weight_unit_id" v-model="waybillPriceModel.carrier_weight_unit_id">
- @foreach($units as $unit)
- <option value="{{$unit->id}}">{{$unit->name}}</option>
- @endforeach
- </select>
- </div>
-
- <label for="carrier_weight_other" class="col-form-label text-right ">承运商计数二</label>
- <div class="col-2">
- <input type="text" id="carrier_weight_other" :class="errors['carrier_weight_other'] ? 'is-invalid' :''" class="form-control @error('carrier_weight_other') is-invalid @enderror"
- name="carrier_weight_other" autocomplete="off" value="@if(old('carrier_weight_other')){{ old('carrier_weight_other') }}@else{{$waybill->carrier_weight_other}}@endif" >
- @error('carrier_weight_other')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <label for="carrier_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
- <div class="col-1.5">
- <select id="carrier_weight_unit_id_other" :class="errors['carrier_weight_unit_id_other'] ? 'is-invalid' :''" class="form-control @error('carrier_weight_unit_id_other') is-invalid @enderror" name="carrier_weight_unit_id_other" v-model="waybillPriceModel.carrier_weight_unit_id_other" >
- @foreach($units as $unit)
- <option value="{{$unit->id}}">{{$unit->name}}</option>
- @endforeach
- </select>
- </div>
- </div>
- @endif
- @if($waybill->type=="直发车")
- <div class="form-group row">
- <label for="carType_id" class="col-2 col-form-label text-right text-primary">车型 *</label>
- <div class="col-8">
- <select class="form-control" name="carType_id" style="width: 30%;">
- @foreach($carTypes as $carType)
- @if($carType->id==$waybill->carType_id)
- <option value="{{$carType->id}}" selected>{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
- @else
- <option value="{{$carType->id}}">{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
- @endif
- @endforeach
- </select>
- </div>
- </div>
- <div class="form-group row">
- <label for="car_owner_info" class="col-2 col-form-label text-right">车辆信息</label>
- <div class="col-8">
- <input type="text" class="form-control"
- name="car_owner_info" autocomplete="off" value="@if(old('car_owner_info')){{ old('car_owner_info') }}@else{{$waybill->car_owner_info}}@endif" >
- </div>
- </div>
- @endif
- @if($waybill->type=="直发车")
- <div class="form-group row">
- <label for="fee" class="col-2 col-form-label text-right text-primary">运费(元) *</label>
- <div class="col-8">
- <input type="text" class="form-control @error('fee') is-invalid @enderror"
- name="fee" autocomplete="off" value="@if(old('fee')){{ old('fee') }}@else{{$waybill->fee}}@endif" >
- @error('fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- @endif
- @if($waybill->type=="专线")
- <div class="form-group row">
- <label for="pick_up_fee" class="col-2 col-form-label text-right">提货费(元)</label>
- <div class="col-8">
- <input type="text" class="form-control @error('pick_up_fee') is-invalid @enderror"
- name="pick_up_fee" autocomplete="off" value="@if(old('pick_up_fee')){{ old('pick_up_fee') }}@else{{$waybill->pick_up_fee}}@endif" >
- @error('pick_up_fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- @endif
- <div class="form-group row">
- <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
- <div class="col-8">
- <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
- name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif" >
- @error('other_fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div class="form-group row">
- <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
- <div class="col-8">
- <textarea class="form-control @error('dispatch_remark') is-invalid @enderror"
- name="dispatch_remark" autocomplete="off" >@if(old('dispatch_remark')){{ old('dispatch_remark') }}@else{{$waybill->dispatch_remark}}@endif</textarea>
- @error('dispatch_remark')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <input type="hidden" name="status" value="待终审">
- <input type="hidden" name="waybillPriceModel" id="waybillPriceModel">
- <div class="form-group row">
- <div class="col-8 offset-2">
- <input type="button" @click="submitForm" class="btn btn-outline-dark form-control" value="提交">
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- @endsection
- @section('lastScript')
- <script>
- let vueList=new Vue({
- el:'#list',
- data:{
- waybillPriceModel: {
- carrier_id:'{{old('carrier_id')?old('carrier_id'):$waybill->carrier_id}}',origination_city_id:'{{old('origination_city_id')?old('origination_city_id'):$waybill->origination_city_id}}',
- destination_city_id:'{{old('destination_city_id')?old('destination_city_id'):$waybill->destination_city_id}}',
- carrier_weight:'{{old('carrier_weight')?old('carrier_weight'):$waybill->carrier_weight}}',carrier_weight_unit_id:'{{old('carrier_weight_unit_id')?old('carrier_weight_unit_id'):$waybill->carrier_weight_unit_id}}',
- warehouse_weight_unit_id:'{{old('warehouse_weight_unit_id')?old('warehouse_weight_unit_id'):$waybill->warehouse_weight_unit_id}}',
- carrier_weight_other:'{{old('carrier_weight_other')?old('carrier_weight_other'):$waybill->carrier_weight_other}}',
- carrier_weight_unit_id_other:'{{old('carrier_weight_unit_id_other')?old('carrier_weight_unit_id_other'):$waybill->carrier_weight_unit_id_other}}',
- warehouse_weight_unit_id_other:'{{old('warehouse_weight_unit_id_other')?old('warehouse_weight_unit_id_other'):$waybill->warehouse_weight_unit_id_other}}',
- },
- cities:[
- @foreach($cities as $city)
- {
- id:'{{$city->id}}',name:'{{$city->name}}'
- },
- @endforeach
- ],
- errors:[],
- },
- mounted:function(){
- if (!this.waybillPriceModel.origination_city_id){
- let _this=this;
- this.cities.every(function (city) {
- if (city.name=="上海"){
- _this.waybillPriceModel.origination_city_id=city.id;
- return false;
- }
- return true;
- });
- }
- /*将地址转换为市区,赋给data*/
- if (!this.waybillPriceModel.origination_city_id){
- let origination=document.getElementById('origination_seek').value;
- let str;
- let origination_id;
- if (origination){
- let arr=origination.split("");
- for (i=0;i<arr.length;i++){
- this.cities.some(function (city) {
- if (city.name.includes(str)){ origination_id=city.id; return true;}
- str=arr[i]+arr[i+1];
- });
- if (origination_id) {break;}
- }
- }
- this.waybillPriceModel.origination_city_id=origination_id;
- }
- if (!this.waybillPriceModel.destination_city_id) {
- let destination=document.getElementById('destination_seek').value;
- let strDestination;
- let destination_id;
- if (destination){
- let arr=destination.split("");
- for (i=0;i<arr.length;i++){
- this.cities.some(function (city) {
- if (city.name.includes(strDestination)){ destination_id=city.id; return true;}
- strDestination=arr[i]+arr[i+1];
- });
- if (destination_id) {break;}
- }
- }
- this.waybillPriceModel.destination_city_id=destination_id;
- }
- },
- methods:{
- {{--计费模型阶段保留--}}
- is_waybillPriceModel(carrier_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],
- carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
- .then(
- function (response) {
- if (response.data.error){_this.errors=response.data.error;return;}
- if (!response.data.success) {
- document.getElementById('waybillPriceModel').value='';
- tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
- function () {
- document.getElementById('waybillForm').submit();
- });
- }else{
- document.getElementById('waybillPriceModel').value=response.data.success;
- document.getElementById('waybillForm').submit();
- }
- }
- );
- },
- submitForm(){
- let type=document.getElementById('type').value;
- if (type==='专线'){
- let carrier_id=document.getElementById('carrier_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);
- }else {
- document.getElementById('waybillForm').submit();
- }
- },
- origination_city_name:function (e) {
- let _this=this;
- let $val=e.target.value;
- if($val==='')_this.waybillPriceModel.origination_city_id='';
- else
- _this.cities.forEach(function (city) {
- if (city.name.includes($val)){
- _this.waybillPriceModel.origination_city_id=city.id;
- }
- });
- },
- destination_city_id:function (e) {
- let _this=this;
- let $val=e.target.value;
- if($val==='')_this.waybillPriceModel.destination_city_id='';
- else
- _this.cities.forEach(function (city) {
- if (city.name.includes($val)){
- _this.waybillPriceModel.destination_city_id=city.id;
- }
- });
- },
- },
- });
- </script>
- @endsection
|