edit.blade.php 56 KB

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