index.blade.php 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. @extends('layouts.app')
  2. @section('content')
  3. <div id="nav2">
  4. @component('waybill.menu')
  5. @endcomponent
  6. <div class="container-fluid">
  7. <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
  8. <ul class="nav nav-pills">
  9. @can('运输管理-查询')
  10. <li class="nav-item">
  11. <a class="nav-link" href="{{url('waybill/index')}}" :class="{active:isActive('',3)}">全部</a>
  12. </li> @endcan
  13. @can('运输管理-查询')
  14. <li class="nav-item">
  15. <a class="nav-link" href="{{url('waybill/index/ZX')}}" :class="{active:isActive('ZX',3)}">专线</a>
  16. </li> @endcan
  17. @can('运输管理-查询')
  18. <li class="nav-item">
  19. <a class="nav-link" href="{{url('waybill/index/ZF')}}" :class="{active:isActive('ZF',3)}">直发车</a>
  20. </li> @endcan
  21. </ul>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="container-fluid" style="min-width: 3500px;">
  26. <div id="list">
  27. <form method="GET" action="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif" style="margin-top: 1%" id="optionSubmit">
  28. <table class="table table-sm table-bordered table-hover text-nowrap " style="background: #fff;">
  29. <tr v-if="isBeingFilterConditions">
  30. <td colspan="4"><div class="col" style="padding:0">
  31. <a href="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  32. </div>
  33. </td>
  34. </tr>
  35. <tr >
  36. <td> <label style="margin-left: 2%">页显示条数:</label>
  37. <select name="paginate" v-model="filterData.paginate" @change="setPaginate" class="form-control-sm" style="vertical-align: middle">
  38. <option value="50">50行</option>
  39. <option value="100">100行</option>
  40. <option value="200">200行</option>
  41. <option value="500">500行</option>
  42. <option value="1000">1000行</option>
  43. </select></td>
  44. <td ><label style="margin-left: 2%">货主:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  45. <select name="owner_id" v-model="filterData.owner_id" class="form-control-sm " @change="setOwner" style="vertical-align: middle">
  46. <option> </option>
  47. @foreach($owners as $owner)
  48. <option value="{{$owner->id}}">{{$owner->name}}</option>
  49. @endforeach
  50. </select></td>
  51. <td ><label style="margin-left: 2%">承运商:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  52. <select name="carrier_id" v-model="filterData.carrier_id" class="form-control-sm " @change="setCarrier" style="vertical-align: middle">
  53. <option > </option>
  54. @foreach($carriers as $carrier)
  55. <option value="{{$carrier->id}}">{{$carrier->name}}</option>
  56. @endforeach
  57. </select></td>
  58. </tr>
  59. <tr>
  60. <td ><label style="margin-left: 2%">运单号:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  61. <input type="text" name="waybill_number" class="form-control-sm " v-model="filterData.waybill_number" style="vertical-align: middle"></td>
  62. <td ><label style="margin-left: 2%">承运商单号:</label>
  63. <input type="text" name="carrier_bill" class="form-control-sm " v-model="filterData.carrier_bill" style="vertical-align: middle"></td>
  64. <td ><label style="margin-left: 2%"> WMS单号:&nbsp;&nbsp;</label>
  65. <input type="text" name="wms_bill_number" class="form-control-sm " v-model="filterData.wms_bill_number" style="vertical-align: middle"></td>
  66. </tr>
  67. <tr>
  68. <td style="width: 500px"><div><label style="margin-left: 2%"> 始发地:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  69. <input type="text" name="origination" class="form-control-sm " v-model="filterData.origination" style="vertical-align: middle">
  70. <label style="margin-left: 2%"> 目的地:&nbsp;&nbsp;</label>
  71. <input type="text" style="vertical-align: middle" name="destination" class="form-control-sm " v-model="filterData.destination"></div></td>
  72. <td style="width: 500px"><div><label style="margin-left: 2%"> 开始日期:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="date" name="created_at_start" class="form-control-sm" v-model="filterData.created_at_start">
  73. <label style="margin-left: 1%"> 截至日期:&nbsp;&nbsp;</label><input type="date" class="form-control-sm" name="created_at_end" v-model="filterData.created_at_end"></div></td>
  74. <td>
  75. <label style="margin-left: 2%">运单状态:&nbsp;&nbsp;&nbsp;&nbsp;</label>
  76. <select name="state" v-model="filterData.state" @change="setState" class="form-control-sm" style="vertical-align: middle">
  77. <option value="待审核">待审核</option>
  78. <option value="已审核">待调度</option>
  79. <option value="待终审">待终审</option>
  80. <option value="已完结">已完结</option>
  81. </select></td>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td colspan="5">
  86. <label style="margin-left: 5px"> 操作选定记录:</label>
  87. <span class="btn btn-sm" @click="waybillExport" style="cursor: pointer"
  88. :class="[checkData>0?'btn-dark':'btn-outline-dark']">导出Excel</span>
  89. <input hidden type="submit" value="kk">
  90. </td>
  91. </tr>
  92. </table>
  93. </form>
  94. <div>
  95. @if(Session::has('successTip'))
  96. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  97. @endif
  98. </div>
  99. <table class="table table-striped table-sm table-bordered table-hover text-nowrap" style="background: #fff;">
  100. <tr>
  101. <th>
  102. <label for="all">
  103. <input id="all" type="checkbox" @click="checkAll($event)">全选
  104. </label>
  105. </th>
  106. <th>ID</th>
  107. <th>运单类型</th>
  108. <th>当前状态</th>
  109. <th>运单号</th>
  110. <th>货主</th>
  111. <th>WMS单号</th>
  112. <th>始发地</th>
  113. <th>目的地</th>
  114. <th>收件人</th>
  115. <th>收件人电话</th>
  116. <th>收费(元)</th>
  117. <th>到付金额(元)</th>
  118. <th>下单备注</th>
  119. <th>运单审核人</th>
  120. @can('运输管理-编辑','运输管理-运单审核','运输管理-调度')
  121. <th>运单操作</th>
  122. @endcan
  123. <th>承运商</th>
  124. <th>承运商单号</th>
  125. <th>始发市</th>
  126. <th>目的市</th>
  127. <th>仓库计数(抛)</th>
  128. <th>仓库计数二</th>
  129. <th>承运商计数(抛)</th>
  130. <th>承运商计数二</th>
  131. <th>车型</th>
  132. <th>车辆信息</th>
  133. <th>运费(元)</th>
  134. <th>提货费(元)</th>
  135. <th>其他费用(元)</th>
  136. <th>调度备注</th>
  137. <th>创建时间</th>
  138. <th>调度审核人</th>
  139. @can('运输管理-编辑','运输管理-删除')
  140. <th>调度操作</th>
  141. @endcan
  142. </tr>
  143. <tr v-for="waybill in waybills" :style="{color:waybill.state=='待重审'?'red':''||waybill.state=='已完结'?'green':''}">
  144. <td>
  145. <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
  146. </td>
  147. <td>@{{waybill.id}}</td>
  148. <td>@{{waybill.type}}</td>
  149. <td :style="{color:waybill.state=='已审核'?'blue':''}">@{{waybill.state}}</td>
  150. <td>@{{waybill.waybill_number}}</td>
  151. <td>@{{waybill.owner}}</td>
  152. <td>@{{waybill.wms_bill_number}}</td>
  153. <td>@{{waybill.origination}}</td>
  154. <td>@{{waybill.destination}}</td>
  155. <td>@{{waybill.recipient}}</td>
  156. <td>@{{waybill.recipient_mobile}}</td>
  157. <td>@{{waybill.charge}}</td>
  158. <td>@{{waybill.collect_fee}}</td>
  159. <td>@{{waybill.ordering_remark}}</td>
  160. <td><p v-for="waybillAuditLog in waybill.waybillAuditLogs" v-if=waybillAuditLog.audit_stage==="运单阶段">@{{waybillAuditLog.user.name}}</p></td>
  161. <td>
  162. <div v-if=waybill.state==="未审核"||waybill.state==="待重审">
  163. @can('运输管理-运单审核')
  164. <button class="btn btn-outline-success" @click="waybillAudit(waybill.id,waybill.waybill_number)">审核</button>
  165. @endcan
  166. @can('运输管理-运单编辑')
  167. <button class="btn btn-outline-secondary" @click="waybillUpdate(waybill.id)">修改</button>
  168. @endcan
  169. </div>
  170. <div v-if=waybill.state==="已审核">
  171. @can('运输管理-调度')
  172. <button class="btn btn-outline-secondary" @click="waybillRetreatAudit(waybill.id,waybill.waybill_number)">取消审核</button>
  173. <button class="btn btn-outline-secondary" @click="job(waybill.id)">调度</button>
  174. @endcan
  175. </div>
  176. </td>
  177. <td><p>@{{waybill.carrier}}</p></td>
  178. <td>@{{waybill.carrier_bill}}</td>
  179. <td>@{{waybill.origination_city}}</td>
  180. <td>@{{waybill.destination_city}}</td>
  181. <td>@{{waybill.warehouse_weight}} @{{waybill.warehouse_weight_unit}}</td>
  182. <td>@{{waybill.warehouse_weight_other}} @{{waybill.warehouse_weight_unit_other}}</td>
  183. <td>@{{waybill.carrier_weight}} @{{waybill.carrier_weight_unit}}</td>
  184. <td>@{{waybill.carrier_weight_other}} @{{waybill.carrier_weight_unit_other}}</td>
  185. <td><p v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></p></td>
  186. <td>@{{waybill.car_owner_info}}</td>
  187. @can('运输管理-可见费用项')
  188. <td><p v-if="waybill.type=='专线'"></p><p v-else>@{{waybill.fee}}</p></td>
  189. <td>@{{waybill.pick_up_fee}}</td>
  190. <td>@{{waybill.other_fee}}</td>
  191. @endcan
  192. <td>@{{waybill.dispatch_remark}}</td>
  193. <td>@{{waybill.created_at}}</td>
  194. <td><p v-for="waybillAuditLog in waybill.waybillAuditLogs" v-if=waybillAuditLog.audit_stage==="调度阶段">@{{waybillAuditLog.user.name}}</p></td>
  195. <td>
  196. <div v-if=waybill.state==="待终审">
  197. @can('运输管理-调度审核')
  198. <button class="btn btn-outline-success" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">完结</button>
  199. @endcan
  200. @can('运输管理-调度')
  201. <button class="btn btn-outline-secondary" @click="job(waybill.id)">改调度</button>
  202. @endcan
  203. </div>
  204. </td>
  205. </tr>
  206. </table>
  207. {{$waybills->appends($filterData)->links()}}
  208. </div>
  209. </div>
  210. @endsection
  211. @section('lastScript')
  212. <script>
  213. let vueList=new Vue({
  214. el:'#list',
  215. data:{
  216. waybills:[
  217. @foreach($waybills as $waybill)
  218. {
  219. id:'{{$waybill->id}}',created_at:'{{$waybill->created_at}}',updated_at:'{{$waybill->updated_at}}',
  220. status:'{{$waybill->status}}',type:'{{$waybill->type}}',waybill_number:'{{$waybill->waybill_number}}',
  221. owner:'{{$waybill->owner_name}}',wms_bill_number:'{{$waybill->wms_bill_number}}',origination:'{{$waybill->origination}}',
  222. destination:'{{$waybill->destination}}',recipient:'{{$waybill->recipient}}',recipient_mobile:'{{$waybill->recipient_mobile}}',
  223. charge:'{{$waybill->charge}}',ordering_remark:'{{$waybill->ordering_remark}}',carrier:'{{$waybill->carrier_name}}',
  224. carrier_bill:'{{$waybill->carrier_bill}}',origination_city:'{{$waybill->origination_city_name}}',
  225. destination_city:'{{$waybill->destination_city_name}}',warehouse_weight:'{{$waybill->warehouse_weight}}',
  226. warehouse_weight_unit:'{{$waybill->warehouse_weight_unit_name}}',carrier_weight:'{{$waybill->carrier_weight}}',
  227. carrier_weight_unit:'{{$waybill->carrier_weight_unit_name}}',
  228. warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
  229. warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other_name}}',carrier_weight_other:'{{$waybill->carrier_weight_other}}',
  230. carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other_name}}',
  231. @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
  232. pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
  233. collect_fee:'{{$waybill->collect_fee}}', @endcan dispatch_remark:'{{$waybill->dispatch_remark}}',
  234. waybillAuditLogs:{!! $waybill->waybillAuditLogs !!}
  235. },
  236. @endforeach
  237. ],
  238. checkData:[],
  239. filterData:
  240. {paginate:'50',waybill_number:''
  241. ,carrier_bill:'',carrier_id:''
  242. ,owner_id:'',wms_bill_number:''
  243. ,created_at_start:'',created_at_end:''
  244. ,type:'',status:'',origination:'',destination:'',},
  245. },
  246. computed:{
  247. isBeingFilterConditions:function(){
  248. for(let key in this.filterData){
  249. if(this.filterData[key]){
  250. if(key==='paginate')continue;
  251. return true
  252. }
  253. }
  254. return false;
  255. },
  256. },
  257. watch:{
  258. checkData:{
  259. handler(){
  260. if (this.checkData.length === this.waybills.length){
  261. document.querySelector('#all').checked = true;
  262. }else {
  263. document.querySelector('#all').checked = false;
  264. }
  265. },
  266. deep:true
  267. }
  268. },
  269. mounted:function(){
  270. this.initInputs();
  271. },
  272. methods:{
  273. initInputs:function(){
  274. let data=this;
  275. let uriParts =decodeURI(location.href).split("?");
  276. if(uriParts.length>1){
  277. let params = uriParts[1].split('&');
  278. params.forEach(function(paramPair){
  279. let pair=paramPair.split('=');
  280. let key = pair[0], val = pair[1];
  281. $('input[name="'+key+'"]').val(val);
  282. $('select[name="'+key+'"]').val(val);
  283. decodeURI(data.filterData[key]=val);
  284. });
  285. }
  286. },
  287. waybillAudit(id,waybill_number){
  288. if(!confirm('确定要通过“'+waybill_number+'”的审核吗?')){return};
  289. let _this=this;
  290. let w;
  291. let url = '{{url('waybill/waybillAudit')}}';
  292. axios.post(url, {id:id})
  293. .then(
  294. function (response) {
  295. if (response.data.success){
  296. _this.waybills.forEach(function (waybill) {
  297. if (waybill.id===id){
  298. waybill.status=response.data.status;
  299. waybill.waybillAuditLogs.push(response.data.waybillAuditLog);
  300. w=waybill.waybill_number;
  301. }
  302. });
  303. tempTip.setDuration(3000);
  304. tempTip.showSuccess('审核'+w+'成功!');
  305. }else if (response.data.exception!=null){
  306. tempTip.setDuration(3000);
  307. tempTip.showSuccess(response.data.exception);
  308. }else {
  309. tempTip.setDuration(3000);
  310. tempTip.showSuccess('审核失败!');
  311. }
  312. }
  313. ).catch(function (err) {
  314. tempTip.setDuration(3000);
  315. tempTip.showSuccess('审核失败,网络连接错误!'+err);
  316. });
  317. },
  318. waybillUpdate(id){
  319. location.href="{{url('waybill/waybillEdit')}}/"+id;
  320. },
  321. waybillRetreatAudit(id,waybill_number){
  322. if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
  323. let _this=this;
  324. let w;
  325. let url='{{url('waybill/waybillRetreatAudit')}}';
  326. axios.post(url,{id:id})
  327. .then(
  328. function (response) {
  329. if (response.data.success){
  330. _this.waybills.forEach(function (waybill){
  331. if (waybill.id===id){
  332. waybill.status=response.data.status;
  333. waybill.waybillAuditLogs=[];
  334. w=waybill.waybill_number;
  335. }
  336. });
  337. tempTip.setDuration(3000);
  338. tempTip.showSuccess(w+'审核驳回成功!');
  339. }else {
  340. tempTip.setDuration(3000);
  341. tempTip.showSuccess('审核驳回失败!');
  342. }
  343. }
  344. ).catch(function (err) {
  345. tempTip.setDuration(3000);
  346. tempTip.showSuccess('审核驳回失败,网络连接错误!'+err);
  347. });
  348. },
  349. job(id){
  350. location.href="{{url('waybill')}}/"+id+"/edit";
  351. },
  352. waybillEndAudit(id,waybill_number){
  353. if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
  354. let _this=this;
  355. let w;
  356. let url='{{url('waybill/waybillEndAudit')}}';
  357. axios.post(url, {id:id})
  358. .then(
  359. function (response) {
  360. if (response.data.success){
  361. _this.waybills.forEach(function (s) {
  362. if (s.id===id){
  363. s.status=response.data.status;
  364. s.waybillAuditLogs.push(response.data.waybillAuditLog);
  365. w=s.waybill_number;
  366. }
  367. });
  368. tempTip.setDuration(3000);
  369. tempTip.showSuccess(w+'终审完毕!');
  370. }else if (response.data.exception!=null){
  371. tempTip.setDuration(3000);
  372. tempTip.showSuccess(response.data.exception);
  373. }else {
  374. tempTip.setDuration(3000);
  375. tempTip.showSuccess('终审失败!');
  376. }
  377. }
  378. ).catch(function (err) {
  379. tempTip.setDuration(3000);
  380. tempTip.showSuccess('终审失败,网络连接错误!'+err);
  381. });
  382. },
  383. setPaginate:function(e){
  384. this.filterData.paginate=e.target.value;
  385. var form = document.getElementById("optionSubmit");
  386. form.submit();
  387. },
  388. setCarrier:function (e){
  389. this.filterData.carrier_id=e.target.value;
  390. var form = document.getElementById("optionSubmit");
  391. form.submit();
  392. },
  393. setOwner:function (e) {
  394. this.filterData.owner_id=e.target.value;
  395. var form = document.getElementById("optionSubmit");
  396. form.submit();
  397. },
  398. setType:function (e) {
  399. this.filterData.type=e.target.value;
  400. var form = document.getElementById("optionSubmit");
  401. form.submit();
  402. },
  403. setState:function (e) {
  404. this.filterData.status=e.target.value;
  405. var form = document.getElementById("optionSubmit");
  406. form.submit();
  407. },
  408. checkAll(e){
  409. if (e.target.checked){
  410. this.waybills.forEach((el,i)=>{
  411. if (this.checkData.indexOf(el.id) == '-1'){
  412. this.checkData.push(el.id);
  413. }
  414. });
  415. }else {
  416. this.checkData = [];
  417. }
  418. },
  419. waybillExport(){
  420. if (this.checkData.length<=0){
  421. tempTip.setDuration(4000);
  422. tempTip.showSuccess('没有勾选任何记录');
  423. }else{
  424. location.href="{{url('waybillExport')}}/"+this.checkData;
  425. }
  426. }
  427. },
  428. });
  429. </script>
  430. @endsection