edit.blade.php 33 KB

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