edit.blade.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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 mt-3" 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. <input name="type" id="type" type="text" class="form-control" readonly="true" value="{{$waybill->type}}" >
  20. </div>
  21. </div>
  22. <div class="form-group row">
  23. <label class="col-2 col-form-label text-right text-secondary">运单号</label>
  24. <div class="col-8">
  25. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->waybill_number}}" >
  26. </div>
  27. </div>
  28. <div class="form-group row">
  29. <label class="col-2 col-form-label text-right text-secondary">货主</label>
  30. <div class="col-8">
  31. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->owner_name}}" >
  32. </div>
  33. </div>
  34. <div class="form-group row">
  35. <label class="col-2 col-form-label text-right text-secondary">WMS单号</label>
  36. <div class="col-8">
  37. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->wms_bill_number}}" >
  38. </div>
  39. </div>
  40. <div class="form-group row">
  41. <label class="col-2 col-form-label text-right text-secondary">始发地</label>
  42. <div class="col-8">
  43. <input id="origination_seek" type="text" class="form-control" disabled="disabled" value="{{$waybill->origination}}" >
  44. </div>
  45. </div>
  46. <div class="form-group row">
  47. <label class="col-2 col-form-label text-right text-secondary">目的地</label>
  48. <div class="col-8">
  49. <input id="destination_seek" type="text" class="form-control" disabled="disabled" value="{{$waybill->destination}}" >
  50. </div>
  51. </div>
  52. <div class="form-group row">
  53. <label class="col-2 col-form-label text-right text-secondary">收件人</label>
  54. <div class="col-8">
  55. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient}}" >
  56. </div>
  57. </div>
  58. <div class="form-group row">
  59. <label class="col-2 col-form-label text-right text-secondary">收件人电话</label>
  60. <div class="col-8">
  61. <input type="text" class="form-control" disabled="disabled" value="{{$waybill->recipient_mobile}}" >
  62. </div>
  63. </div>
  64. <div class="form-group row">
  65. <label for="charge" class="col-2 col-form-label text-right text-secondary">收费(元)</label>
  66. <div class="col-8">
  67. <input type="text" class="form-control @error('charge') is-invalid @enderror"
  68. id="charge" name="charge" value="@if(old('charge')){{ old('charge') }}@else{{$waybill->charge}}@endif " >
  69. </div>
  70. @error('charge')
  71. <span class="invalid-feedback" role="alert">
  72. <strong>{{ $message }}</strong>
  73. </span>
  74. @enderror
  75. </div>
  76. <div class="form-group row">
  77. <label class="col-2 col-form-label text-right text-secondary">下单备注</label>
  78. <div class="col-8">
  79. <textarea class="form-control" disabled="disabled" >{{$waybill->ordering_remark}}</textarea>
  80. </div>
  81. </div>
  82. {{--编辑区--}}
  83. <div class="form-group row">
  84. <label for="carrier_id" class="col-2 col-form-label text-right text-primary">承运商 *</label>
  85. <div class="col-8">
  86. <select name="carrier_id" class="form-control @error('carrier_id') is-invalid @enderror" id="carrier_id" v-model="waybillPriceModel.carrier_id" style="width: 30%; ">
  87. @foreach($carriers as $carrier)
  88. <option value="{{$carrier->id}}">{{$carrier->name}}</option>
  89. @endforeach
  90. </select>
  91. </div>
  92. <div class="col-sm-5">
  93. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('carrier_id') }}</p>
  94. </div>
  95. </div>
  96. <div class="form-group row">
  97. <label for="carrier_bill" class="col-2 col-form-label text-right">承运商单号</label>
  98. <div class="col-8">
  99. <input type="text" class="form-control @error('carrier_bill') is-invalid @enderror"
  100. name="carrier_bill" autocomplete="off" value="@if(old('carrier_bill')){{ old('carrier_bill') }}@else{{$waybill->carrier_bill}}@endif" >
  101. @error('carrier_bill')
  102. <span class="invalid-feedback" role="alert">
  103. <strong>{{ $message }}</strong>
  104. </span>
  105. @enderror
  106. </div>
  107. </div>
  108. @if($waybill->type=="专线")
  109. <div class="form-group row">
  110. <label for="origination_city_id" class="col-2 col-form-label text-right text-primary">始发市 *</label>
  111. <div class="col-8 form-inline">
  112. <select class="form-control" name="origination_city_id" style="width: 30%; " v-model="waybillPriceModel.origination_city_id">
  113. <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
  114. </select>
  115. <input class="form-control-sm" placeholder="输入关键字定位" @input="origination_city_name">
  116. </div>
  117. </div>
  118. <div class="form-group row">
  119. <label for="destination_city_id" class="col-2 col-form-label text-right text-primary">目的市 *</label>
  120. <div class="col-8 form-inline">
  121. <select class="form-control" name="destination_city_id" id="destination_city_id" v-model="waybillPriceModel.destination_city_id" style="width: 30%; " >
  122. <option v-for="city in cities" :value="city.id">@{{city.name}}</option>
  123. </select>
  124. <input class="form-control-sm" placeholder="输入关键字定位" @input="destination_city_id">
  125. @error('destination_city_id')
  126. <span class="invalid-feedback" role="alert">
  127. <strong>{{ $message }}</strong>
  128. </span>
  129. @enderror
  130. </div>
  131. </div>
  132. <div class="form-group row">
  133. <label for="warehouse_weight" class="col-2 col-form-label text-right ">仓库计数(抛)</label>
  134. <div class="col-2">
  135. <input type="text" class="form-control @error('warehouse_weight') is-invalid @enderror"
  136. name="warehouse_weight" autocomplete="off" value="@if(old('warehouse_weight')){{ old('warehouse_weight') }}@else{{$waybill->warehouse_weight}}@endif" >
  137. @error('warehouse_weight')
  138. <span class="invalid-feedback" role="alert">
  139. <strong>{{ $message }}</strong>
  140. </span>
  141. @enderror
  142. </div>
  143. <label for="warehouse_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  144. <div class="col-1.5">
  145. <select class="form-control @error('warehouse_weight_unit_id') is-invalid @enderror" name="warehouse_weight_unit_id" v-model="waybillPriceModel.warehouse_weight_unit_id">
  146. @foreach($units as $unit)
  147. <option value="{{$unit->id}}">{{$unit->name}}</option>
  148. @endforeach
  149. </select>
  150. </div>
  151. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  152. <label for="warehouse_weight_other" class="col-form-label text-right ">&nbsp;&nbsp;&nbsp;仓库计数二</label>
  153. <div class="col-2">
  154. <input type="text" class="form-control @error('warehouse_weight_other') is-invalid @enderror"
  155. name="warehouse_weight_other" autocomplete="off" value="@if(old('warehouse_weight_other')){{ old('warehouse_weight_other') }}@else{{$waybill->warehouse_weight_other}}@endif" >
  156. @error('warehouse_weight_other')
  157. <span class="invalid-feedback" role="alert">
  158. <strong>{{ $message }}</strong>
  159. </span>
  160. @enderror
  161. </div>
  162. <label for="warehouse_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  163. <div class="col-1.5">
  164. <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" >
  165. @foreach($units as $unit)
  166. <option value="{{$unit->id}}">{{$unit->name}}</option>
  167. @endforeach
  168. </select>
  169. </div>
  170. </div>
  171. {{-- <div class="form-group row">
  172. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('warehouse_weight_unit_id') }}</p>
  173. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('warehouse_weight_unit_id_other') }}</p>
  174. </div>--}}
  175. @endif
  176. {{--计费模型阶段保留--}}
  177. <div class="form-group row">
  178. <label for="carrier_weight" class="col-2 col-form-label text-right ">承运商计数(抛)</label>
  179. <div class="col-2">
  180. <input type="text" id="carrier_weight" class="form-control @error('carrier_weight') is-invalid @enderror"
  181. name="carrier_weight" autocomplete="off" value="@if(old('carrier_weight')){{ old('carrier_weight') }}@else{{$waybill->carrier_weight}}@endif" >
  182. @error('carrier_weight')
  183. <span class="invalid-feedback" role="alert">
  184. <strong>{{ $message }}</strong>
  185. </span>
  186. @enderror
  187. </div>
  188. <label for="carrier_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  189. <div class="col-1.5">
  190. <select id="carrier_weight_unit_id" class="form-control @error('carrier_weight_unit_id') is-invalid @enderror" name="carrier_weight_unit_id" v-model="waybillPriceModel.carrier_weight_unit_id">
  191. @foreach($units as $unit)
  192. <option value="{{$unit->id}}">{{$unit->name}}</option>
  193. @endforeach
  194. </select>
  195. </div>
  196. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  197. <label for="carrier_weight_other" class="col-form-label text-right ">承运商计数二</label>
  198. <div class="col-2">
  199. <input type="text" id="carrier_weight_other" class="form-control @error('carrier_weight_other') is-invalid @enderror"
  200. name="carrier_weight_other" autocomplete="off" value="@if(old('carrier_weight_other')){{ old('carrier_weight_other') }}@else{{$waybill->carrier_weight_other}}@endif" >
  201. @error('carrier_weight_other')
  202. <span class="invalid-feedback" role="alert">
  203. <strong>{{ $message }}</strong>
  204. </span>
  205. @enderror
  206. </div>
  207. <label for="carrier_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  208. <div class="col-1.5">
  209. <select id="carrier_weight_unit_id_other" 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" >
  210. @foreach($units as $unit)
  211. <option value="{{$unit->id}}">{{$unit->name}}</option>
  212. @endforeach
  213. </select>
  214. </div>
  215. </div>
  216. {{-- <div class="form-group row">
  217. <div class="col-sm-5">
  218. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('carrier_weight_unit_id') }}</p>
  219. </div>
  220. <div class="col-sm-5">
  221. <p class="form-control-static text-danger small font-weight-bold" style="margin-left: 50%">{{ $errors->first('carrier_weight_unit_id_other') }}</p>
  222. </div>
  223. </div>--}}
  224. @if($waybill->type=="直发车")
  225. <div class="form-group row">
  226. <label for="carType_id" class="col-2 col-form-label text-right text-primary">车型 *</label>
  227. <div class="col-8">
  228. <select class="form-control" name="carType_id" style="width: 30%;">
  229. @foreach($carTypes as $carType)
  230. @if($carType->id==$waybill->carType_id)
  231. <option value="{{$carType->id}}" selected>{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  232. @else
  233. <option value="{{$carType->id}}">{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  234. @endif
  235. @endforeach
  236. </select>
  237. </div>
  238. </div>
  239. <div class="form-group row">
  240. <label for="car_owner_info" class="col-2 col-form-label text-right">车辆信息</label>
  241. <div class="col-8">
  242. <input type="text" class="form-control"
  243. name="car_owner_info" autocomplete="off" value="@if(old('car_owner_info')){{ old('car_owner_info') }}@else{{$waybill->car_owner_info}}@endif" >
  244. </div>
  245. </div>
  246. @endif
  247. @if($waybill->type=="直发车")
  248. <div class="form-group row">
  249. <label for="fee" class="col-2 col-form-label text-right text-primary">运费(元) *</label>
  250. <div class="col-8">
  251. <input type="text" class="form-control @error('fee') is-invalid @enderror"
  252. name="fee" autocomplete="off" value="@if(old('fee')){{ old('fee') }}@else{{$waybill->fee}}@endif" >
  253. @error('fee')
  254. <span class="invalid-feedback" role="alert">
  255. <strong>{{ $message }}</strong>
  256. </span>
  257. @enderror
  258. </div>
  259. </div>
  260. @endif
  261. @if($waybill->type=="专线")
  262. <div class="form-group row">
  263. <label for="pick_up_fee" class="col-2 col-form-label text-right">提货费(元)</label>
  264. <div class="col-8">
  265. <input type="text" class="form-control @error('pick_up_fee') is-invalid @enderror"
  266. name="pick_up_fee" autocomplete="off" value="@if(old('pick_up_fee')){{ old('pick_up_fee') }}@else{{$waybill->pick_up_fee}}@endif" >
  267. @error('pick_up_fee')
  268. <span class="invalid-feedback" role="alert">
  269. <strong>{{ $message }}</strong>
  270. </span>
  271. @enderror
  272. </div>
  273. </div>
  274. @endif
  275. <div class="form-group row">
  276. <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
  277. <div class="col-8">
  278. <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
  279. name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif" >
  280. @error('other_fee')
  281. <span class="invalid-feedback" role="alert">
  282. <strong>{{ $message }}</strong>
  283. </span>
  284. @enderror
  285. </div>
  286. </div>
  287. <div class="form-group row">
  288. <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
  289. <div class="col-8">
  290. <textarea class="form-control @error('dispatch_remark') is-invalid @enderror"
  291. name="dispatch_remark" autocomplete="off" >@if(old('dispatch_remark')){{ old('dispatch_remark') }}@else{{$waybill->dispatch_remark}}@endif</textarea>
  292. @error('dispatch_remark')
  293. <span class="invalid-feedback" role="alert">
  294. <strong>{{ $message }}</strong>
  295. </span>
  296. @enderror
  297. </div>
  298. </div>
  299. <input type="hidden" name="state" value="待终审">
  300. <input type="hidden" name="waybillPriceModel" id="waybillPriceModel">
  301. <div class="form-group row">
  302. <div class="col-8 offset-2">
  303. <input type="button" @click="submitForm" class="btn btn-outline-dark form-control" value="提交">
  304. </div>
  305. </div>
  306. </form>
  307. </div>
  308. </div>
  309. </div>
  310. @endsection
  311. @section('lastScript')
  312. <script>
  313. let vueList=new Vue({
  314. el:'#list',
  315. data:{
  316. waybillPriceModel: {
  317. 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}}',
  318. destination_city_id:'{{old('destination_city_id')?old('destination_city_id'):$waybill->destination_city_id}}',
  319. 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}}',
  320. warehouse_weight_unit_id:'{{old('warehouse_weight_unit_id')?old('warehouse_weight_unit_id'):$waybill->warehouse_weight_unit_id}}',
  321. carrier_weight_other:'{{old('carrier_weight_other')?old('carrier_weight_other'):$waybill->carrier_weight_other}}',
  322. carrier_weight_unit_id_other:'{{old('carrier_weight_unit_id_other')?old('carrier_weight_unit_id_other'):$waybill->carrier_weight_unit_id_other}}',
  323. warehouse_weight_unit_id_other:'{{old('warehouse_weight_unit_id_other')?old('warehouse_weight_unit_id_other'):$waybill->warehouse_weight_unit_id_other}}',
  324. },
  325. cities:[
  326. @foreach($cities as $city)
  327. {
  328. id:'{{$city->id}}',name:'{{$city->name}}'
  329. },
  330. @endforeach
  331. ],
  332. },
  333. mounted:function(){
  334. /*将地址转换为市区,赋给data*/
  335. if (!this.waybillPriceModel.origination_city_id){
  336. let origination=document.getElementById('origination_seek').value;
  337. let str;
  338. let origination_id;
  339. if (origination){
  340. let arr=origination.split("");
  341. for (i=0;i<arr.length;i++){
  342. this.cities.some(function (city) {
  343. if (city.name.includes(str)){ origination_id=city.id; return true;}
  344. str=arr[i]+arr[i+1];
  345. });
  346. if (origination_id) {break;}
  347. }
  348. }
  349. this.waybillPriceModel.origination_city_id=origination_id;
  350. }
  351. if (!this.waybillPriceModel.destination_city_id) {
  352. let destination=document.getElementById('destination_seek').value;
  353. let strDestination;
  354. let destination_id;
  355. if (destination){
  356. let arr=destination.split("");
  357. for (i=0;i<arr.length;i++){
  358. this.cities.some(function (city) {
  359. if (city.name.includes(strDestination)){ destination_id=city.id; return true;}
  360. strDestination=arr[i]+arr[i+1];
  361. });
  362. if (destination_id) {break;}
  363. }
  364. }
  365. this.waybillPriceModel.destination_city_id=destination_id;
  366. }
  367. },
  368. methods:{
  369. {{--计费模型阶段保留--}}
  370. is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
  371. let url='{{url('waybill/is/waybillPriceModel')}}';
  372. let one=false;
  373. let two=false;
  374. if (carrier_id&&carrier_weight&&carrier_weight_unit_id&&destination_city_id){one=true;}
  375. if (carrier_id&&carrier_weight_other&&carrier_weight_unit_id_other&&destination_city_id){two=true;}
  376. if (one||two) {
  377. axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
  378. carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
  379. .then(
  380. function (response) {
  381. if (!response.data.success) {
  382. document.getElementById('waybillPriceModel').value='';
  383. tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
  384. function () {
  385. document.getElementById('waybillForm').submit();
  386. });
  387. }else{
  388. document.getElementById('waybillPriceModel').value=response.data.success;
  389. document.getElementById('waybillForm').submit();
  390. }
  391. }
  392. );
  393. }
  394. },
  395. submitForm(){
  396. let type=document.getElementById('type').value;
  397. if (type==='专线'){
  398. let carrier_id=document.getElementById('carrier_id').value;
  399. let carrier_weight=document.getElementById('carrier_weight').value;
  400. let carrier_weight_unit_id=document.getElementById('carrier_weight_unit_id').value;
  401. let destination_city_id=document.getElementById('destination_city_id').value;
  402. let carrier_weight_other=document.getElementById('carrier_weight_other').value;
  403. let carrier_weight_unit_id_other=document.getElementById('carrier_weight_unit_id_other').value;
  404. this.is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other);
  405. }else {
  406. document.getElementById('waybillForm').submit();
  407. }
  408. },
  409. origination_city_name:function (e) {
  410. let _this=this;
  411. let $val=e.target.value;
  412. if($val==='')_this.waybillPriceModel.origination_city_id='';
  413. else
  414. _this.cities.forEach(function (city) {
  415. if (city.name.includes($val)){
  416. _this.waybillPriceModel.origination_city_id=city.id;
  417. }
  418. });
  419. },
  420. destination_city_id:function (e) {
  421. let _this=this;
  422. let $val=e.target.value;
  423. if($val==='')_this.waybillPriceModel.destination_city_id='';
  424. else
  425. _this.cities.forEach(function (city) {
  426. if (city.name.includes($val)){
  427. _this.waybillPriceModel.destination_city_id=city.id;
  428. }
  429. });
  430. },
  431. },
  432. });
  433. </script>
  434. @endsection