edit.blade.php 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  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',4)}">调度</a>
  7. </li>
  8. @endcomponent
  9. </div>
  10. <div class="container-fluid 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" :class="errors['carrier_id'] ? 'is-invalid' :''" 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 @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">
  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 @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%; " >
  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. </div>
  126. </div>
  127. <div class="form-group row">
  128. <label for="warehouse_weight" class="col-2 col-form-label text-right ">仓库计数(抛)</label>
  129. <div class="col-2">
  130. <input type="text" class="form-control @error('warehouse_weight') is-invalid @enderror"
  131. name="warehouse_weight" autocomplete="off" value="@if(old('warehouse_weight')){{ old('warehouse_weight') }}@else{{$waybill->warehouse_weight}}@endif" >
  132. @error('warehouse_weight')
  133. <span class="invalid-feedback" role="alert">
  134. <strong>{{ $message }}</strong>
  135. </span>
  136. @enderror
  137. </div>
  138. <label for="warehouse_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  139. <div class="col-1.5">
  140. <select class="form-control @error('warehouse_weight_unit_id') is-invalid @enderror" name="warehouse_weight_unit_id" v-model="waybillPriceModel.warehouse_weight_unit_id">
  141. @foreach($units as $unit)
  142. <option value="{{$unit->id}}">{{$unit->name}}</option>
  143. @endforeach
  144. </select>
  145. </div>
  146. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  147. <label for="warehouse_weight_other" class="col-form-label text-right ">&nbsp;&nbsp;&nbsp;仓库计数二</label>
  148. <div class="col-2">
  149. <input type="text" class="form-control @error('warehouse_weight_other') is-invalid @enderror"
  150. name="warehouse_weight_other" autocomplete="off" value="@if(old('warehouse_weight_other')){{ old('warehouse_weight_other') }}@else{{$waybill->warehouse_weight_other}}@endif" >
  151. @error('warehouse_weight_other')
  152. <span class="invalid-feedback" role="alert">
  153. <strong>{{ $message }}</strong>
  154. </span>
  155. @enderror
  156. </div>
  157. <label for="warehouse_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  158. <div class="col-1.5">
  159. <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" >
  160. @foreach($units as $unit)
  161. <option value="{{$unit->id}}">{{$unit->name}}</option>
  162. @endforeach
  163. </select>
  164. </div>
  165. </div>
  166. <div class="form-group row">
  167. <label for="carrier_weight" class="col-2 col-form-label text-right ">承运商计数(抛)</label>
  168. <div class="col-2">
  169. <input type="text" id="carrier_weight" :class="errors['carrier_weight'] ? 'is-invalid' :''" class="form-control @error('carrier_weight') is-invalid @enderror"
  170. name="carrier_weight" autocomplete="off" value="@if(old('carrier_weight')){{ old('carrier_weight') }}@else{{$waybill->carrier_weight}}@endif" >
  171. @error('carrier_weight')
  172. <span class="invalid-feedback" role="alert">
  173. <strong>{{ $message }}</strong>
  174. </span>
  175. @enderror
  176. </div>
  177. <label for="carrier_weight_unit_id" class=" col-form-label text-right ">单位:</label>
  178. <div class="col-1.5">
  179. <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">
  180. @foreach($units as $unit)
  181. <option value="{{$unit->id}}">{{$unit->name}}</option>
  182. @endforeach
  183. </select>
  184. </div>
  185. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  186. <label for="carrier_weight_other" class="col-form-label text-right ">承运商计数二</label>
  187. <div class="col-2">
  188. <input type="text" id="carrier_weight_other" :class="errors['carrier_weight_other'] ? 'is-invalid' :''" class="form-control @error('carrier_weight_other') is-invalid @enderror"
  189. name="carrier_weight_other" autocomplete="off" value="@if(old('carrier_weight_other')){{ old('carrier_weight_other') }}@else{{$waybill->carrier_weight_other}}@endif" >
  190. @error('carrier_weight_other')
  191. <span class="invalid-feedback" role="alert">
  192. <strong>{{ $message }}</strong>
  193. </span>
  194. @enderror
  195. </div>
  196. <label for="carrier_weight_unit_id_other" class=" col-form-label text-right ">单位:</label>
  197. <div class="col-1.5">
  198. <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" >
  199. @foreach($units as $unit)
  200. <option value="{{$unit->id}}">{{$unit->name}}</option>
  201. @endforeach
  202. </select>
  203. </div>
  204. </div>
  205. @endif
  206. @if($waybill->type=="直发车")
  207. <div class="form-group row">
  208. <label for="carType_id" class="col-2 col-form-label text-right text-primary">车型 *</label>
  209. <div class="col-8">
  210. <select class="form-control" name="carType_id" style="width: 30%;">
  211. @foreach($carTypes as $carType)
  212. @if($carType->id==$waybill->carType_id)
  213. <option value="{{$carType->id}}" selected>{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  214. @else
  215. <option value="{{$carType->id}}">{{$carType->name}}@if($carType->length)({{$carType->length}}米)@endif</option>
  216. @endif
  217. @endforeach
  218. </select>
  219. </div>
  220. </div>
  221. <div class="form-group row">
  222. <label for="car_owner_info" class="col-2 col-form-label text-right">车辆信息</label>
  223. <div class="col-8">
  224. <input type="text" class="form-control"
  225. name="car_owner_info" autocomplete="off" value="@if(old('car_owner_info')){{ old('car_owner_info') }}@else{{$waybill->car_owner_info}}@endif" >
  226. </div>
  227. </div>
  228. @endif
  229. @if($waybill->type=="直发车")
  230. <div class="form-group row">
  231. <label for="fee" class="col-2 col-form-label text-right text-primary">运费(元) *</label>
  232. <div class="col-8">
  233. <input type="text" class="form-control @error('fee') is-invalid @enderror"
  234. name="fee" autocomplete="off" value="@if(old('fee')){{ old('fee') }}@else{{$waybill->fee}}@endif" >
  235. @error('fee')
  236. <span class="invalid-feedback" role="alert">
  237. <strong>{{ $message }}</strong>
  238. </span>
  239. @enderror
  240. </div>
  241. </div>
  242. @endif
  243. @if($waybill->type=="专线")
  244. <div class="form-group row">
  245. <label for="pick_up_fee" class="col-2 col-form-label text-right">提货费(元)</label>
  246. <div class="col-8">
  247. <input type="text" class="form-control @error('pick_up_fee') is-invalid @enderror"
  248. name="pick_up_fee" autocomplete="off" value="@if(old('pick_up_fee')){{ old('pick_up_fee') }}@else{{$waybill->pick_up_fee}}@endif" >
  249. @error('pick_up_fee')
  250. <span class="invalid-feedback" role="alert">
  251. <strong>{{ $message }}</strong>
  252. </span>
  253. @enderror
  254. </div>
  255. </div>
  256. @endif
  257. <div class="form-group row">
  258. <label for="other_fee" class="col-2 col-form-label text-right text-muted">其他费用(元)</label>
  259. <div class="col-8">
  260. <input type="text" class="form-control @error('other_fee') is-invalid @enderror"
  261. name="other_fee" autocomplete="off" value="@if(old('other_fee')){{ old('other_fee') }}@else{{$waybill->other_fee}}@endif" >
  262. @error('other_fee')
  263. <span class="invalid-feedback" role="alert">
  264. <strong>{{ $message }}</strong>
  265. </span>
  266. @enderror
  267. </div>
  268. </div>
  269. <div class="form-group row">
  270. <label for="dispatch_remark" class="col-2 col-form-label text-right text-muted">调度备注</label>
  271. <div class="col-8">
  272. <textarea class="form-control @error('dispatch_remark') is-invalid @enderror"
  273. name="dispatch_remark" autocomplete="off" >@if(old('dispatch_remark')){{ old('dispatch_remark') }}@else{{$waybill->dispatch_remark}}@endif</textarea>
  274. @error('dispatch_remark')
  275. <span class="invalid-feedback" role="alert">
  276. <strong>{{ $message }}</strong>
  277. </span>
  278. @enderror
  279. </div>
  280. </div>
  281. <input type="hidden" name="status" value="待终审">
  282. <input type="hidden" name="waybillPriceModel" id="waybillPriceModel">
  283. <div class="form-group row">
  284. <div class="col-8 offset-2">
  285. <input type="button" @click="submitForm" class="btn btn-outline-dark form-control" value="提交">
  286. </div>
  287. </div>
  288. </form>
  289. </div>
  290. </div>
  291. </div>
  292. @endsection
  293. @section('lastScript')
  294. <script>
  295. let vueList=new Vue({
  296. el:'#list',
  297. data:{
  298. waybillPriceModel: {
  299. 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}}',
  300. destination_city_id:'{{old('destination_city_id')?old('destination_city_id'):$waybill->destination_city_id}}',
  301. 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}}',
  302. warehouse_weight_unit_id:'{{old('warehouse_weight_unit_id')?old('warehouse_weight_unit_id'):$waybill->warehouse_weight_unit_id}}',
  303. carrier_weight_other:'{{old('carrier_weight_other')?old('carrier_weight_other'):$waybill->carrier_weight_other}}',
  304. carrier_weight_unit_id_other:'{{old('carrier_weight_unit_id_other')?old('carrier_weight_unit_id_other'):$waybill->carrier_weight_unit_id_other}}',
  305. warehouse_weight_unit_id_other:'{{old('warehouse_weight_unit_id_other')?old('warehouse_weight_unit_id_other'):$waybill->warehouse_weight_unit_id_other}}',
  306. },
  307. cities:[
  308. @foreach($cities as $city)
  309. {
  310. id:'{{$city->id}}',name:'{{$city->name}}'
  311. },
  312. @endforeach
  313. ],
  314. errors:[],
  315. },
  316. mounted:function(){
  317. if (!this.waybillPriceModel.origination_city_id){
  318. let _this=this;
  319. this.cities.every(function (city) {
  320. if (city.name=="上海"){
  321. _this.waybillPriceModel.origination_city_id=city.id;
  322. return false;
  323. }
  324. return true;
  325. });
  326. }
  327. /*将地址转换为市区,赋给data*/
  328. if (!this.waybillPriceModel.origination_city_id){
  329. let origination=document.getElementById('origination_seek').value;
  330. let str;
  331. let origination_id;
  332. if (origination){
  333. let arr=origination.split("");
  334. for (i=0;i<arr.length;i++){
  335. this.cities.some(function (city) {
  336. if (city.name.includes(str)){ origination_id=city.id; return true;}
  337. str=arr[i]+arr[i+1];
  338. });
  339. if (origination_id) {break;}
  340. }
  341. }
  342. this.waybillPriceModel.origination_city_id=origination_id;
  343. }
  344. if (!this.waybillPriceModel.destination_city_id) {
  345. let destination=document.getElementById('destination_seek').value;
  346. let strDestination;
  347. let destination_id;
  348. if (destination){
  349. let arr=destination.split("");
  350. for (i=0;i<arr.length;i++){
  351. this.cities.some(function (city) {
  352. if (city.name.includes(strDestination)){ destination_id=city.id; return true;}
  353. strDestination=arr[i]+arr[i+1];
  354. });
  355. if (destination_id) {break;}
  356. }
  357. }
  358. this.waybillPriceModel.destination_city_id=destination_id;
  359. }
  360. },
  361. methods:{
  362. {{--计费模型阶段保留--}}
  363. is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other){
  364. this.errors=[];
  365. let url='{{url('waybill/is/waybillPriceModel')}}';
  366. let _this=this;
  367. axios.post(url,{carrier_id:carrier_id,carrier_weight:[carrier_weight,carrier_weight_other],
  368. carrier_weight_unit_id:[carrier_weight_unit_id,carrier_weight_unit_id_other],destination_city_id:destination_city_id})
  369. .then(
  370. function (response) {
  371. if (response.data.error){_this.errors=response.data.error;return;}
  372. if (!response.data.success) {
  373. document.getElementById('waybillPriceModel').value='';
  374. tempTip.confirm('该目的地与计量单位对应的计费模型不存在,如录入将会标为异常记录,请通知相关负责人添加计费模型,点击'+'<b class="text-primary">"确定"</b>'+'则确认提交 ',
  375. function () {
  376. document.getElementById('waybillForm').submit();
  377. });
  378. }else{
  379. document.getElementById('waybillPriceModel').value=response.data.success;
  380. document.getElementById('waybillForm').submit();
  381. }
  382. }
  383. );
  384. },
  385. submitForm(){
  386. let type=document.getElementById('type').value;
  387. if (type==='专线'){
  388. let carrier_id=document.getElementById('carrier_id').value;
  389. let carrier_weight=document.getElementById('carrier_weight').value;
  390. let carrier_weight_unit_id=document.getElementById('carrier_weight_unit_id').value;
  391. let destination_city_id=document.getElementById('destination_city_id').value;
  392. let carrier_weight_other=document.getElementById('carrier_weight_other').value;
  393. let carrier_weight_unit_id_other=document.getElementById('carrier_weight_unit_id_other').value;
  394. this.is_waybillPriceModel(carrier_id,carrier_weight,carrier_weight_unit_id,destination_city_id,carrier_weight_other,carrier_weight_unit_id_other);
  395. }else {
  396. document.getElementById('waybillForm').submit();
  397. }
  398. },
  399. origination_city_name:function (e) {
  400. let _this=this;
  401. let $val=e.target.value;
  402. if($val==='')_this.waybillPriceModel.origination_city_id='';
  403. else
  404. _this.cities.forEach(function (city) {
  405. if (city.name.includes($val)){
  406. _this.waybillPriceModel.origination_city_id=city.id;
  407. }
  408. });
  409. },
  410. destination_city_id:function (e) {
  411. let _this=this;
  412. let $val=e.target.value;
  413. if($val==='')_this.waybillPriceModel.destination_city_id='';
  414. else
  415. _this.cities.forEach(function (city) {
  416. if (city.name.includes($val)){
  417. _this.waybillPriceModel.destination_city_id=city.id;
  418. }
  419. });
  420. },
  421. },
  422. });
  423. </script>
  424. @endsection