| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643 |
- @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',3)}">调度</a>
- </li>
- @endcomponent
- </div>
- <div class="container-fluid" 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">
- <div class="h5 mb-3 col-8">
- <button type="button" @click="waybill.type='专线'" class="btn" :class="waybill.type=='专线'?'btn-primary':'btn-outline-primary'">专线</button>
- <button type="button" @click="waybill.type='直发车'" class="btn ml-2" :class="waybill.type!='专线'?'btn-primary':'btn-outline-primary'">直发车</button>
- </div>
- <input name="type" id="type" :value="waybill.type" hidden>
- </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 id="origination">
- <div class="col-8" style="margin-left: 15%" id="btn" hidden>
- <button type="button" class="btn btn-outline-primary btn-sm" @click="waybill.origination='上海市松江区泗砖仓'" style="transform: scale(0.9)">松江泗砖仓</button>
- <button type="button" class="btn btn-outline-primary btn-sm" @click="waybill.origination='上海市松江区九干仓'" style="transform: scale(0.9)">松江九干仓</button>
- <button type="button" class="btn btn-outline-primary btn-sm" @click="waybill.origination='上海市嘉定区武乡仓'" style="transform: scale(0.9)">嘉定武乡仓</button>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary" for="origination_seek">始发地</label>
- <div class="col-8">
- <input type="text" class="form-control @error('origination') is-invalid @enderror"
- id="origination_seek" name="origination" disabled="disabled" v-model="waybill.origination">
- </div>
- @error('origination')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div class="form-group row">
- <label class="col-2 col-form-label text-right text-secondary" for="destination_seek">目的地</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" id="ordering_remark">
- <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 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" v-model="waybill.charge" >
- </div>
- @error('charge')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <div class="form-group row">
- <label for="other_charge" class="col-2 col-form-label text-right text-muted">其他收费(元)</label>
- <div class="col-8">
- <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
- name="other_charge" autocomplete="off" value="@if(old('other_charge')){{ old('other_charge') }}@else{{$waybill->other_charge}}@endif" >
- @error('other_charge')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div class="form-group row">
- <label for="other_charge_remark" class="col-2 col-form-label text-right text-muted">其他收费备注</label>
- <div class="col-8">
- <input type="text" class="form-control @error('other_charge') is-invalid @enderror"
- name="other_charge_remark" autocomplete="off" value="@if(old('other_charge_remark')){{ old('other_charge_remark') }}@else{{$waybill->other_charge_remark}}@endif" >
- @error('other_charge_remark')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>·
- @enderror
- </div>
- </div>
- <div class="form-group row" style="margin-bottom: 20px">
- <label for="carrier_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
- <div class="col-8" style="position: relative">
- <select name="carrier_id" class="form-control @error('carrier_id') is-invalid @enderror"
- :class="errors['carrier_id'] ? 'is-invalid' :''" id="carrier_id" v-model="waybill.carrier_id" style="width: 30%; ">
- <option v-for="carrier in carriers" :value="carrier.id">@{{carrier.name}}</option>
- </select>
- <div v-if="errors['carrier_id'] && errors['carrier_id'].length>0" class="invalid-feedback" role="alert" style="position: relative">
- <strong class="">@{{ errors['carrier_id'][0] }}</strong>
- </div>
- <span class="col-sm-5" style="position: absolute;height: 15px;padding: 0">
- <p class="form-control-static text-danger small font-weight-bold" style="">{{ $errors->first('carrier_id') }}</p>
- </span>
- </div>
- </div>
- <div class="form-group row">
- <label 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" v-model="waybill.carrier_bill" id="carrier_bill">
- @error('carrier_bill')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div v-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="waybill.origination_city_id" id="origination_city_id">
- <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
- </select>
- <input class="form-control-sm form-control" 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="waybill.destination_city_id" style="width: 30%; " >
- <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
- </select>
- <input type="text" class="form-control-sm form-control tooltipTarget" style="vertical-align: middle"
- placeholder="输入关键字定位" @input="destination_city_id" v-model="waybill.destination_city" id="destination_city" title="若无法显示区/县级市,可点击后方按钮手动添加" >
- <button type="button" class="btn btn-outline-info btn-sm" @click="addCounty" style="transform: scale(0.9)">添加市/县</button>
- </div>
- </div>
- </div>
- <div class="form-group row">
- <label for="warehouse_weight" class="col-2 col-form-label text-right " v-if="waybill.type=='专线'">仓库计抛</label>
- <div class="col-2" v-if="waybill.type=='专线'">
- <input type="text" class="form-control @error('warehouse_weight') is-invalid @enderror"
- name="warehouse_weight" autocomplete="off" v-model="waybill.warehouse_weight" id="warehouse_weight" >
- @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 " v-if="waybill.type=='专线'">单位:</label>
- <div class="col-1.5" v-if="waybill.type=='专线'">
- <select class="form-control @error('warehouse_weight_unit_id') is-invalid @enderror"
- name="warehouse_weight_unit_id" v-model="waybill.warehouse_weight_unit_id" id="warehouse_weight_unit_id">
- <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
- </select>
- </div>
- <span v-if="waybill.type=='专线'"> </span>
- <label for="warehouse_weight_other" class="col-form-label text-right " :class="waybill.type=='专线' ? '' : 'col-2'"> 仓库重</label>
- <div class="col-2">
- <input type="text" class="form-control @error('warehouse_weight_other') is-invalid @enderror"
- name="warehouse_weight_other" autocomplete="off" v-model="waybill.warehouse_weight_other" id="warehouse_weight_other">
- @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="waybill.warehouse_weight_unit_id_other" id="warehouse_weight_unit_id_other">
- <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
- </select>
- </div>
- </div>
- <div v-if="waybill.type=='专线'">
- <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" v-model="waybill.carrier_weight" >
- @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="waybill.carrier_weight_unit_id" >
- <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
- </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" v-model="waybill.carrier_weight_other" >
- @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="waybill.carrier_weight_unit_id_other" >
- <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
- </select>
- </div>
- </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-5">
- <input type="number" class="form-control @error('amount') is-invalid @enderror"
- name="amount" autocomplete="off" v-model="waybill.amount" id="amount" >
- @error('amount')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- <label for="amount_unit_id" class=" col-form-label text-right ">单位:</label>
- <div class="col-1.5 form-inline">
- <label for="amount_unit_id" class="ml-1 @error('amount_unit_id') text-danger @enderror" >件</label>
- <input id="amount_unit_id" type="radio" value="4" class="form-control form-control-sm ml-1"
- name="amount_unit_id" v-model="waybill.amount_unit_id">
- <label for="amount_unit_id1" class="ml-1 @error('amount_unit_id') text-danger @enderror" >托</label>
- <input id="amount_unit_id1" type="radio" value="5" class="form-control form-control-sm ml-1"
- :class="errors['amount_unit_id'] ? 'is-invalid' :''" name="amount_unit_id" v-model="waybill.amount_unit_id">
- </div>
- @error('amount_unit_id')
- <div class="col-2 form-inline">
- <label class="form-control-static text-danger small font-weight-bold">{{$message}}</label>
- </div>
- @enderror
- </div>
- <div class="form-group row">
- <label for="carrier_id" class="col-2 col-form-label text-right text-dark">里程数</label>
- <div class="col-8">
- <input type="number" class="form-control @error('mileage') is-invalid @enderror"
- name="mileage" autocomplete="off" v-model="waybill.mileage" id="mileage" >
- @error('mileage')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div v-if="waybill.type=='直发车'">
- <div class="form-group row">
- <label for="carType_id" class="col-2 col-form-label text-right">车型</label>
- <div class="col-8">
- <select class="form-control" name="carType_id" style="width: 30%;" v-model="waybill.carType_id" id="carType_id">
- <option v-for="carType in carTypes" :value="carType.id">@{{ carType.name }}</option>
- </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" v-model="waybill.car_owner_info" id="car_owner_info" >
- </div>
- </div>
- @can('运输管理-运费')
- <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" v-model="waybill.fee" id="fee" >
- @error('fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- @endcan
- </div>
- <div v-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" v-model="waybill.pick_up_fee" id="pick_up_fee">
- @error('pick_up_fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- </div>
- <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" v-model="waybill.other_fee" id="other_fee">
- @error('other_fee')
- <span class="invalid-feedback" role="alert">
- <strong>{{ $message }}</strong>
- </span>
- @enderror
- </div>
- </div>
- <div class="form-group row">
- <label for="deliver_at" class="col-2 col-form-label text-right text-muted">发货时间</label>
- <div class="col-8 form-inline">
- <input id="deliver_at_date" @input="spliceDeliverAt" name="deliver_at_date" type="date" class="form-control col-4"
- value="@if(old('deliver_at_date')){{ old('deliver_at_date') }}@else{{$waybill->deliver_at_date}}@endif">
- <input id="deliver_at_time" @input="spliceDeliverAt" name="deliver_at_time" type="time" class="form-control col-4"
- value="@if(old('deliver_at_time')){{ old('deliver_at_time') }}@else{{$waybill->deliver_at_time}}@endif">
- <input hidden id="deliver_at" name="deliver_at" type="text" class="form-control col-4">
- </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" v-model="waybill.dispatch_remark" id="dispatch_remark"></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:{
- cities:[
- @foreach($cities as $city)
- {
- id:'{{$city->id}}',name:'{{$city->name}}',type:'{{$city->type}}',
- },
- @endforeach
- ],
- units:[
- @foreach($units as $unit){
- id:'{{$unit->id}}',name:'{{$unit->name}}',
- },
- @endforeach
- ],
- carriers:[
- @foreach($carriers as $carrier)
- {id:'{{$carrier->id}}',name:'{{$carrier->name}}',},
- @endforeach
- ],
- carTypes:[
- @foreach($carTypes as $carType)
- {!! $carType !!},
- @endforeach
- ],
- errors:[],
- waybill:{
- id:'{{$waybill->id}}',type:'{{$waybill->type}}',waybill_number:'{{$waybill->waybill_number}}',owner_name:'{{$waybill->owner_name}}',
- wms_bill_number:'{{$waybill->wms_bill_number}}',origination:'{{$waybill->origination}}',destination:'{{$waybill->destination}}',
- recipient:'{{$waybill->recipient}}',recipient_mobile:'{{$waybill->recipient_mobile}}',ordering_remark:'{{$waybill->ordering_remark}}',
- charge:'{{$waybill->charge}}',carrier_id:'{{$waybill->carrier_id}}',carrier_bill:'{{$waybill->carrier_bill}}',
- warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',warehouse_weight_unit_id_other:'{{$waybill->warehouse_weight_unit_id_other}}',amount:'{{$waybill->amount}}',
- amount_unit_id:'{{$waybill->amount_unit_id}}',mileage:'{{$waybill->mileage}}',carType_id:'{{$waybill->carType_id}}',
- car_owner_info:'{{$waybill->car_owner_info}}',fee:'{{$waybill->fee}}',other_fee:'{{$waybill->other_fee}}',
- other_charge:'{{$waybill->other_charge}}',other_charge_remark:'{{$waybill->other_charge_remark}}',dispatch_remark:'{{$waybill->dispatch_remark}}',
- origination_city_id:'{{$waybill->origination_city_id}}',destination_city_id:'{{$waybill->destination_city_id}}',warehouse_weight:'{{$waybill->warehouse_weight}}',
- warehouse_weight_unit_id:'{{$waybill->warehouse_weight_unit_id}}',carrier_weight:'{{$waybill->carrier_weight}}',carrier_weight_unit_id:'{{$waybill->carrier_weight_unit_id}}',
- carrier_weight_other:'{{$waybill->carrier_weight_other}}',carrier_weight_unit_id_other:'{{$waybill->carrier_weight_unit_id_other}}',pick_up_fee:'{{$waybill->pick_up_fee}}',
- },
- waybillTemp:{!! $waybill !!}
- },
- mounted:function(){
- let _this=this;
- //console.log(_this.waybillPriceModel.amount_unit_id)
- $(".tooltipTarget").tooltip({'trigger':'hover'});
- this.units.every(function (unit) {
- switch (unit.name) {
- case "kg":
- if (!_this.waybill.warehouse_weight_unit_id_other)_this.waybill.warehouse_weight_unit_id_other=unit.id;
- if (!_this.waybill.carrier_weight_unit_id_other)_this.waybill.carrier_weight_unit_id_other=unit.id;
- break;
- case "m³":
- if (!_this.waybill.carrier_weight_unit_id)_this.waybill.carrier_weight_unit_id=unit.id;
- if (!_this.waybill.warehouse_weight_unit_id)_this.waybill.warehouse_weight_unit_id=unit.id;
- break;
- }
- return true;
- });
- if (!this.waybill.origination){
- $("#btn").removeAttr("hidden");
- $("#ordering_remark").after($("#origination"));
- $("#origination_seek").attr("disabled",false);
- }
- if (!this.waybill.origination_city_id){
- let _this=this;
- this.cities.every(function (city) {
- if (city.name==="上海"){
- _this.waybill.origination_city_id=city.id;
- return false;
- }
- return true;
- });
- }
- /*将地址转换为市区,赋给data*/
- if (!this.waybill.origination_city_id){
- let origination=document.getElementById('origination_seek').value;
- let str;
- let origination_id;
- if (origination){
- let arr=origination.split("");
- for (let 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.waybill.origination_city_id=origination_id;
- }
- if (!this.waybill.destination_city_id) {
- let destination=document.getElementById('destination_seek').value;
- let strDestination; //两字城市关键字
- let destination_id; //寻找到的城市id
- let sign=false; //标记 用于for识别跳出
- if (destination){ //input有值
- let arr=destination.split("");//切分数组
- for (let i=0;i<arr.length;i++){
- if (!destination_id) { //城市不存在时找城市
- 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) { //城市存在时找县区
- this.cities.some(function (city) {
- if (city.type == 3 && city.name.includes(strDestination)) {
- destination_id = city.id;
- sign=true;
- return true; //标记
- }
- strDestination = arr[i] + arr[i + 1];
- });
- }
- if (sign)break; //跳出
- }
- if (!destination_id){ //城市与城市下县区都未找到,直接找县区,忽略城市
- for (let i=0;i<arr.length;i++) {
- this.cities.some(function (city) {
- if (city.type == 3 && city.name.includes(strDestination)) {
- destination_id = city.id;
- return true;
- }
- strDestination = arr[i] + arr[i + 1];
- });
- }
- }
- //找到赋值 未找到置空
- if (destination_id)this.waybill.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('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
- // document.getElementById('waybillForm').submit();
- _this.executeSubmit();
- });
- }else{
- document.getElementById('waybillPriceModel').value=response.data.success;
- document.getElementById('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
- _this.executeSubmit();
- }
- }
- );
- },
- executeSubmit(){
- let data=['origination','charge','carrier_bill', 'warehouse_weight','warehouse_weight_unit_id',
- 'warehouse_weight_other','warehouse_weight_unit_id_other','carrier_weight','carrier_weight_unit_id'
- ,'carrier_weight_other','carrier_weight_unit_id_other','mileage','carType_id'
- ,'car_owner_info','pick_up_fee','fee','other_fee','other_charge','other_charge_remark','dispatch_remark'];
- let waybill=this.waybill;
- let waybillTemp=this.waybillTemp;
- data.forEach(function (name) {
- if (waybill[name] === waybillTemp[name]){
- if (document.getElementById(name))document.getElementById(name).removeAttribute('name');
- }
- });
- setTimeout(function () {
- document.getElementById('waybillForm').submit();
- },1);
- },
- spliceDeliverAt:function () {
- document.getElementById('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
- },
- submitForm(){
- let type=this.waybill.type;
- 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('deliver_at').value= document.getElementById('deliver_at_date').value+' '+ document.getElementById('deliver_at_time').value;
- // document.getElementById('waybillForm').submit();
- this.executeSubmit();
- }
- },
- origination_city_name:function (e) {
- let _this=this;
- let $val=e.target.value;
- if($val==='')_this.waybill.origination_city_id='';
- else
- _this.cities.forEach(function (city) {
- if (city.name.includes($val)){
- _this.waybill.origination_city_id=city.id;
- }
- });
- },
- destination_city_id:function (e) {
- let _this=this;
- let $val=e.target.value;
- if($val==='')_this.waybill.destination_city_id='';
- else
- _this.cities.forEach(function (city) {
- if (city.name.includes($val)){
- _this.waybill.destination_city_id=city.id;
- }
- });
- },
- addCounty:function () {
- var add=window.confirm("您确认添加该市/县?");
- let _this=this;
- let url='{{url('waybill/addCounty?destination_city=')}}'+_this.destination_city;
- if(add){
- axios.post(url)
- .then(function (response) {
- if(response.data && response.data.destination_city){
- tempTip.setDuration(3000);
- tempTip.show(response.data.destination_city[0]);
- return ;
- }
- _this.cities.push(response.data);
- _this.waybill.destination_city_id=response.data.id;
- }).catch(function (err) {
- tempTip.setDuration(3000);
- tempTip.show("网络错误!"+err);
- });
- }
- }
- },
- });
- </script>
- @endsection
|