edit.blade.php 43 KB

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