edit.blade.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. @extends('layouts.app')
  2. @section('content')
  3. <div id="nav2">
  4. @component('waybill.menu')
  5. <li class="nav-item">
  6. <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',3)}">调度</a>
  7. </li>
  8. @endcomponent
  9. </div>
  10. <div class="container-fluid" id="list">
  11. <div class="card">
  12. <div class="card-body">
  13. <form method="POST" id="waybillForm" action='{{url("waybill/{$waybill->id}")}}'>
  14. @csrf
  15. @method('PUT')
  16. <div class="form-group row">
  17. <label class="col-2 col-form-label text-right text-secondary">运单类型</label>
  18. <div class="col-8">
  19. <div class="h5 mb-3 col-8">
  20. <button type="button" @click="type='专线'" class="btn" :class="type=='专线'?'btn-primary':'btn-outline-primary'">专线</button>
  21. <button type="button" @click="type='直发车'" class="btn ml-2" :class="type!='专线'?'btn-primary':'btn-outline-primary'">直发车</button>
  22. </div>
  23. <input name="type" id="type" :value="type" hidden>
  24. </div>
  25. </div>
  26. <div class="form-group row">
  27. <label class="col-2 col-form-label text-right text-secondary">运单号</label>
  28. <div class="col-8">
  29. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->waybill_number}}" >
  30. </div>
  31. </div>
  32. <div class="form-group row">
  33. <label class="col-2 col-form-label text-right text-secondary">货主</label>
  34. <div class="col-8">
  35. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->owner_name}}" >
  36. </div>
  37. </div>
  38. <div class="form-group row">
  39. <label class="col-2 col-form-label text-right text-secondary">WMS单号</label>
  40. <div class="col-8">
  41. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->wms_bill_number}}" >
  42. </div>
  43. </div>
  44. <div id="origination">
  45. <div class="col-8" style="margin-left: 15%" id="btn" hidden>
  46. <button type="button" class="btn btn-outline-primary btn-sm" @click="origination='上海市松江区泗砖仓'" style="transform: scale(0.9)">松江泗砖仓</button>
  47. <button type="button" class="btn btn-outline-primary btn-sm" @click="origination='上海市松江区九干仓'" style="transform: scale(0.9)">松江九干仓</button>
  48. <button type="button" class="btn btn-outline-primary btn-sm" @click="origination='上海市嘉定区武乡仓'" style="transform: scale(0.9)">嘉定武乡仓</button>
  49. </div>
  50. <div class="form-group row">
  51. <label class="col-2 col-form-label text-right text-secondary">始发地</label>
  52. <div class="col-8">
  53. <input type="text" class="form-control @error('origination') is-invalid @enderror"
  54. id="origination_seek" name="origination" disabled="disabled" @if(old('origination'))value="{{old('origination')}}" @else :value="origination"@endif>
  55. </div>
  56. @error('origination')
  57. <span class="invalid-feedback" role="alert">
  58. <strong>{{ $message }}</strong>
  59. </span>
  60. @enderror
  61. </div>
  62. </div>
  63. <div class="form-group row">
  64. <label class="col-2 col-form-label text-right text-secondary">目的地</label>
  65. <div class="col-8">
  66. <input id="destination_seek" type="text" class="form-control" disabled="disabled" value="{{$waybill->destination}}" >
  67. </div>
  68. </div>
  69. <div class="form-group row">
  70. <label class="col-2 col-form-label text-right text-secondary">收件人</label>
  71. <div class="col-8">
  72. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient}}" >
  73. </div>
  74. </div>
  75. <div class="form-group row">
  76. <label class="col-2 col-form-label text-right text-secondary">收件人电话</label>
  77. <div class="col-8">
  78. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient_mobile}}" >
  79. </div>
  80. </div>
  81. <div class="form-group row" id="ordering_remark">
  82. <label class="col-2 col-form-label text-right text-secondary">下单备注</label>
  83. <div class="col-8">
  84. <textarea class="form-control" disabled="disabled" >{{$waybill->ordering_remark}}</textarea>
  85. </div>
  86. </div>
  87. {{--编辑区--}}
  88. <div class="form-group row">
  89. <label class="col-2 col-form-label text-right text-secondary">收费(元)</label>
  90. <div class="col-8">
  91. <input type="text" class="form-control @error('charge') is-invalid @enderror"
  92. id="charge" name="charge" value="@if(old('charge')){{ old('charge') }}@else{{$waybill->charge}}@endif " >
  93. </div>
  94. @error('charge')
  95. <span class="invalid-feedback" role="alert">
  96. <strong>{{ $message }}</strong>
  97. </span>
  98. @enderror
  99. </div>
  100. <div class="form-group row">
  101. <label for="carrier_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
  102. <div class="col-8">
  103. <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%; ">
  104. @foreach($carriers as $carrier)
  105. <option value="{{$carrier->id}}">{{$carrier->name}}</option>
  106. @endforeach
  107. </select>
  108. </div>
  109. <div class="col-sm-5">
  110. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('carrier_id') }}</p>
  111. </div>
  112. </div>
  113. <div class="form-group row">
  114. <label class="col-2 col-form-label text-right">承运商单号</label>
  115. <div class="col-8">
  116. <input type="text" class="form-control @error('carrier_bill') is-invalid @enderror"
  117. name="carrier_bill" autocomplete="off" value="@if(old('carrier_bill')){{ old('carrier_bill') }}@else{{$waybill->carrier_bill}}@endif" >
  118. @error('carrier_bill')
  119. <span class="invalid-feedback" role="alert">
  120. <strong>{{ $message }}</strong>
  121. </span>
  122. @enderror
  123. </div>
  124. </div>
  125. <div v-if="type=='专线'">
  126. <div class="form-group row">
  127. <label for="origination_city_id" class="col-2 col-form-label text-right text-primary">始发市 *</label>
  128. <div class="col-8 form-inline">
  129. <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">
  130. <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
  131. </select>
  132. <input class="form-control-sm" placeholder="输入关键字定位" @input="origination_city_name">
  133. </div>
  134. </div>
  135. <div class="form-group row">
  136. <label for="destination_city_id" class="col-2 col-form-label text-right text-primary">目的市 *</label>
  137. <div class="col-8 form-inline">
  138. <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%; " >
  139. <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
  140. </select>
  141. <input class="form-control-sm tooltipTarget" placeholder="输入关键字定位" @input="destination_city_id" v-model="destination_city" title="若无法显示县级市,可点击后方按钮手动添加" style="vertical-align: middle">
  142. <button type="button" class="btn btn-outline-info btn-sm" @click="addCounty" style="transform: scale(0.9)">添加市/县</button>
  143. </div>
  144. </div>
  145. <div class="form-group row">
  146. <label for="warehouse_weight" class="col-2 col-form-label text-right ">仓库计抛</label>
  147. <div class="col-2">
  148. <input type="text" class="form-control @error('warehouse_weight') is-invalid @enderror"
  149. name="warehouse_weight" autocomplete="off" value="@if(old('warehouse_weight')){{ old('warehouse_weight') }}@else{{$waybill->warehouse_weight}}@endif" >
  150. @error('warehouse_weight')
  151. <span class="invalid-feedback" role="alert">
  152. <strong>{{ $message }}</strong>
  153. </span>
  154. @enderror
  155. </div>
  156. <label for="warehouse_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  157. <div class="col-1.5">
  158. <select class="form-control @error('warehouse_weight_unit_id') is-invalid @enderror" name="warehouse_weight_unit_id" v-model="waybillPriceModel.warehouse_weight_unit_id">
  159. <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
  160. </select>
  161. </div>
  162. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  163. <label for="warehouse_weight_other" class="col-form-label text-right ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;仓库重</label>
  164. <div class="col-2">
  165. <input type="text" class="form-control @error('warehouse_weight_other') is-invalid @enderror"
  166. name="warehouse_weight_other" autocomplete="off" value="@if(old('warehouse_weight_other')){{ old('warehouse_weight_other') }}@else{{$waybill->warehouse_weight_other}}@endif" >
  167. @error('warehouse_weight_other')
  168. <span class="invalid-feedback" role="alert">
  169. <strong>{{ $message }}</strong>
  170. </span>
  171. @enderror
  172. </div>
  173. <label for="warehouse_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  174. <div class="col-1.5">
  175. <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" >
  176. <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
  177. </select>
  178. </div>
  179. </div>
  180. <div class="form-group row">
  181. <label for="carrier_weight" class="col-2 col-form-label text-right ">承运商计抛</label>
  182. <div class="col-2">
  183. <input type="text" id="carrier_weight" :class="errors['carrier_weight'] ? 'is-invalid' :''" class="form-control @error('carrier_weight') is-invalid @enderror"
  184. name="carrier_weight" autocomplete="off" value="@if(old('carrier_weight')){{ old('carrier_weight') }}@else{{$waybill->carrier_weight}}@endif" >
  185. @error('carrier_weight')
  186. <span class="invalid-feedback" role="alert">
  187. <strong>{{ $message }}</strong>
  188. </span>
  189. @enderror
  190. </div>
  191. <label for="carrier_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  192. <div class="col-1.5">
  193. <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">
  194. <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
  195. </select>
  196. </div>
  197. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  198. <label for="carrier_weight_other" class="col-form-label text-right ">承运商计重</label>
  199. <div class="col-2">
  200. <input type="text" id="carrier_weight_other" :class="errors['carrier_weight_other'] ? 'is-invalid' :''" class="form-control @error('carrier_weight_other') is-invalid @enderror"
  201. name="carrier_weight_other" autocomplete="off" value="@if(old('carrier_weight_other')){{ old('carrier_weight_other') }}@else{{$waybill->carrier_weight_other}}@endif" >
  202. @error('carrier_weight_other')
  203. <span class="invalid-feedback" role="alert">
  204. <strong>{{ $message }}</strong>
  205. </span>
  206. @enderror
  207. </div>
  208. <label for="carrier_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  209. <div class="col-1.5">
  210. <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" >
  211. <option :value="unit.id" v-for="unit in units" >@{{ unit.name }}</option>
  212. </select>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="form-group row">
  217. <label for="carrier_id" class="col-2 col-form-label text-right text-primary">计数</label>
  218. <div class="col-8">
  219. <input type="number" class="form-control @error('mileage') is-invalid @enderror"
  220. name="amount" autocomplete="off" value="@if(old('amount')){{ old('amount') }}@else{{$waybill->amount}}@endif" >
  221. @error('amount')
  222. <span class="invalid-feedback" role="alert">
  223. <strong>{{ amount }}</strong>
  224. </span>
  225. @enderror
  226. </div>
  227. </div>
  228. <div class="form-group row">
  229. <label for="carrier_id" class="col-2 col-form-label text-right text-primary">里程数</label>
  230. <div class="col-8">
  231. <input type="number" class="form-control @error('mileage') is-invalid @enderror"
  232. name="mileage" autocomplete="off" value="@if(old('mileage')){{ old('mileage') }}@else{{$waybill->mileage}}@endif" >
  233. @error('mileage')
  234. <span class="invalid-feedback" role="alert">
  235. <strong>{{ $message }}</strong>
  236. </span>
  237. @enderror
  238. </div>
  239. </div>
  240. <div v-if="type=='直发车'">
  241. <div class="form-group row">
  242. <label for="carType_id" class="col-2 col-form-label text-right text-primary">车型 *</label>
  243. <div class="col-8">
  244. <select class="form-control" name="carType_id" style="width: 30%;">
  245. @foreach($carTypes as $carType)
  246. @if($carType->id==$waybill->carType_id)
  247. <option value="{{$carType->id}}" selected>{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  248. @else
  249. <option value="{{$carType->id}}">{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  250. @endif
  251. @endforeach
  252. </select>
  253. </div>
  254. </div>
  255. <div class="form-group row">
  256. <label for="car_owner_info" class="col-2 col-form-label text-right">车辆信息</label>
  257. <div class="col-8">
  258. <input type="text" class="form-control"
  259. name="car_owner_info" autocomplete="off" value="@if(old('car_owner_info')){{ old('car_owner_info') }}@else{{$waybill->car_owner_info}}@endif" >
  260. </div>
  261. </div>
  262. <div class="form-group row">
  263. <label for="fee" class="col-2 col-form-label text-right text-primary">运费(元) *</label>
  264. <div class="col-8">
  265. <input type="text" class="form-control @error('fee') is-invalid @enderror"
  266. name="fee" autocomplete="off" value="@if(old('fee')){{ old('fee') }}@else{{$waybill->fee}}@endif" >
  267. @error('fee')
  268. <span class="invalid-feedback" role="alert">
  269. <strong>{{ $message }}</strong>
  270. </span>
  271. @enderror
  272. </div>
  273. </div>
  274. </div>
  275. <div v-if="type=='专线'">
  276. <div class="form-group row">
  277. <label for="pick_up_fee" class="col-2 col-form-label text-right">提货费(元)</label>
  278. <div class="col-8">
  279. <input type="text" class="form-control @error('pick_up_fee') is-invalid @enderror"
  280. name="pick_up_fee" autocomplete="off" value="@if(old('pick_up_fee')){{ old('pick_up_fee') }}@else{{$waybill->pick_up_fee}}@endif" >
  281. @error('pick_up_fee')
  282. <span class="invalid-feedback" role="alert">
  283. <strong>{{ $message }}</strong>
  284. </span>
  285. @enderror
  286. </div>
  287. </div>
  288. </div>
  289. <div class="form-group row">
  290. <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
  291. <div class="col-8">
  292. <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
  293. name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif" >
  294. @error('other_fee')
  295. <span class="invalid-feedback" role="alert">
  296. <strong>{{ $message }}</strong>
  297. </span>
  298. @enderror
  299. </div>
  300. </div>
  301. <div class="form-group row">
  302. <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
  303. <div class="col-8">
  304. <textarea class="form-control @error('dispatch_remark') is-invalid @enderror"
  305. name="dispatch_remark" autocomplete="off" >@if(old('dispatch_remark')){{ old('dispatch_remark') }}@else{{$waybill->dispatch_remark}}@endif</textarea>
  306. @error('dispatch_remark')
  307. <span class="invalid-feedback" role="alert">
  308. <strong>{{ $message }}</strong>
  309. </span>
  310. @enderror
  311. </div>
  312. </div>
  313. <input type="hidden" name="status" value="待终审">
  314. <input type="hidden" name="waybillPriceModel" id="waybillPriceModel">
  315. <div class="form-group row">
  316. <div class="col-8 offset-2">
  317. <input type="button" @click="submitForm" class="btn btn-outline-dark form-control" value="提交">
  318. </div>
  319. </div>
  320. </form>
  321. </div>
  322. </div>
  323. </div>
  324. @endsection
  325. @section('lastScript')
  326. <script>
  327. let vueList=new Vue({
  328. el:'#list',
  329. data:{
  330. waybillPriceModel: {
  331. 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}}',
  332. destination_city_id:'{{old('destination_city_id')?old('destination_city_id'):$waybill->destination_city_id}}',
  333. 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}}',
  334. warehouse_weight_unit_id:'{{old('warehouse_weight_unit_id')?old('warehouse_weight_unit_id'):$waybill->warehouse_weight_unit_id}}',
  335. carrier_weight_other:'{{old('carrier_weight_other')?old('carrier_weight_other'):$waybill->carrier_weight_other}}',
  336. carrier_weight_unit_id_other:'{{old('carrier_weight_unit_id_other')?old('carrier_weight_unit_id_other'):$waybill->carrier_weight_unit_id_other}}',
  337. warehouse_weight_unit_id_other:'{{old('warehouse_weight_unit_id_other')?old('warehouse_weight_unit_id_other'):$waybill->warehouse_weight_unit_id_other}}',
  338. },
  339. cities:[
  340. @foreach($cities as $city)
  341. {
  342. id:'{{$city->id}}',name:'{{$city->name}}',type:'{{$city->type}}',
  343. },
  344. @endforeach
  345. ],
  346. units:[
  347. @foreach($units as $unit){
  348. id:'{{$unit->id}}',name:'{{$unit->name}}',
  349. },
  350. @endforeach
  351. ],
  352. errors:[],
  353. type:'{{old('type')?old('type'):$waybill->type}}',
  354. origination:'{{$waybill->origination}}',
  355. destination_city:'',
  356. },
  357. mounted:function(){
  358. let _this=this;
  359. this.units.every(function (unit) {
  360. switch (unit.name) {
  361. case "kg":
  362. if (!_this.waybillPriceModel.warehouse_weight_unit_id_other)_this.waybillPriceModel.warehouse_weight_unit_id_other=unit.id;
  363. if (!_this.waybillPriceModel.carrier_weight_unit_id_other)_this.waybillPriceModel.carrier_weight_unit_id_other=unit.id;
  364. break;
  365. case "m³":
  366. if (!_this.waybillPriceModel.carrier_weight_unit_id)_this.waybillPriceModel.carrier_weight_unit_id=unit.id;
  367. if (!_this.waybillPriceModel.warehouse_weight_unit_id)_this.waybillPriceModel.warehouse_weight_unit_id=unit.id;
  368. break;
  369. }
  370. return true;
  371. });
  372. if (!this.origination){
  373. $("#btn").removeAttr("hidden");
  374. $("#ordering_remark").after($("#origination"));
  375. $("#origination_seek").attr("disabled",false);
  376. }
  377. if (!this.waybillPriceModel.origination_city_id){
  378. let _this=this;
  379. this.cities.every(function (city) {
  380. if (city.name=="上海"){
  381. _this.waybillPriceModel.origination_city_id=city.id;
  382. return false;
  383. }
  384. return true;
  385. });
  386. }
  387. /*将地址转换为市区,赋给data*/
  388. if (!this.waybillPriceModel.origination_city_id){
  389. let origination=document.getElementById('origination_seek').value;
  390. let str;
  391. let origination_id;
  392. if (origination){
  393. let arr=origination.split("");
  394. for (i=0;i<arr.length;i++){
  395. this.cities.some(function (city) {
  396. if (city.name.includes(str)){ origination_id=city.id; return true;}
  397. str=arr[i]+arr[i+1];
  398. });
  399. if (origination_id) {break;}
  400. }
  401. }
  402. this.waybillPriceModel.origination_city_id=origination_id;
  403. }
  404. if (!this.waybillPriceModel.destination_city_id) {
  405. let destination=document.getElementById('destination_seek').value;
  406. let strDestination; //两字城市关键字
  407. let destination_id; //寻找到的城市id
  408. let sign=false; //标记 用于for识别跳出
  409. if (destination){ //input有值
  410. let arr=destination.split("");//切分数组
  411. for (let i=0;i<arr.length;i++){
  412. if (!destination_id) { //城市不存在时找城市
  413. this.cities.some(function (city) {
  414. if (city.name.includes(strDestination)) {
  415. destination_id = city.id;
  416. return true;
  417. }
  418. strDestination = arr[i] + arr[i + 1];
  419. });
  420. }
  421. if (destination_id) { //城市存在时找县区
  422. this.cities.some(function (city) {
  423. if (city.type == 3 && city.name.includes(strDestination)) {
  424. destination_id = city.id;
  425. sign=true;
  426. return true; //标记
  427. }
  428. strDestination = arr[i] + arr[i + 1];
  429. });
  430. }
  431. if (sign)break; //跳出
  432. }
  433. if (!destination_id){ //城市与城市下县区都未找到,直接找县区,忽略城市
  434. for (let i=0;i<arr.length;i++) {
  435. this.cities.some(function (city) {
  436. if (city.type == 3 && city.name.includes(strDestination)) {
  437. destination_id = city.id;
  438. return true;
  439. }
  440. strDestination = arr[i] + arr[i + 1];
  441. });
  442. }
  443. }
  444. //找到赋值 未找到置空
  445. if (destination_id)this.waybillPriceModel.destination_city_id=destination_id;
  446. }
  447. }
  448. },
  449. methods:{
  450. {{--计费模型阶段保留--}}
  451. is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
  452. this.errors=[];
  453. let url='{{url('waybill/is/waybillPriceModel')}}';
  454. let _this=this;
  455. axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
  456. carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
  457. .then(
  458. function (response) {
  459. if (response.data.error){_this.errors=response.data.error;return;}
  460. if (!response.data.success) {
  461. document.getElementById('waybillPriceModel').value='';
  462. tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
  463. function () {
  464. document.getElementById('waybillForm').submit();
  465. });
  466. }else{
  467. document.getElementById('waybillPriceModel').value=response.data.success;
  468. document.getElementById('waybillForm').submit();
  469. }
  470. }
  471. );
  472. },
  473. submitForm(){
  474. let type=document.getElementById('type').value;
  475. if (type==='专线'){
  476. let carrier_id=document.getElementById('carrier_id').value;
  477. let carrier_weight=document.getElementById('carrier_weight').value;
  478. let carrier_weight_unit_id=document.getElementById('carrier_weight_unit_id').value;
  479. let destination_city_id=document.getElementById('destination_city_id').value;
  480. let carrier_weight_other=document.getElementById('carrier_weight_other').value;
  481. let carrier_weight_unit_id_other=document.getElementById('carrier_weight_unit_id_other').value;
  482. this.is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other);
  483. }else {
  484. document.getElementById('waybillForm').submit();
  485. }
  486. },
  487. origination_city_name:function (e) {
  488. let _this=this;
  489. let $val=e.target.value;
  490. if($val==='')_this.waybillPriceModel.origination_city_id='';
  491. else
  492. _this.cities.forEach(function (city) {
  493. if (city.name.includes($val)){
  494. _this.waybillPriceModel.origination_city_id=city.id;
  495. }
  496. });
  497. },
  498. destination_city_id:function (e) {
  499. let _this=this;
  500. let $val=e.target.value;
  501. if($val==='')_this.waybillPriceModel.destination_city_id='';
  502. else
  503. _this.cities.forEach(function (city) {
  504. if (city.name.includes($val)){
  505. _this.waybillPriceModel.destination_city_id=city.id;
  506. }
  507. });
  508. },
  509. addCounty:function () {
  510. var add=window.confirm("您确认添加该市/县?");
  511. let _this=this;
  512. let url='{{url('waybill/addCounty?destination_city=')}}'+_this.destination_city;
  513. if(add){
  514. axios.post(url)
  515. .then(function (response) {
  516. if(response.data && response.data.destination_city){
  517. tempTip.setDuration(3000);
  518. tempTip.show(response.data.destination_city[0]);
  519. return ;
  520. }
  521. _this.cities.push(response.data);
  522. _this.waybillPriceModel.destination_city_id=response.data.id;
  523. }).catch(function (err) {
  524. tempTip.setDuration(3000);
  525. tempTip.show("网络错误!"+err);
  526. });
  527. }
  528. }
  529. },
  530. });
  531. </script>
  532. @endsection