index.blade.php 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. @extends('layouts.app')
  2. @section('title')运输管理@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('waybill.menu')
  6. @endcomponent
  7. </div>
  8. <div class="container-fluid" style="min-width: 1500px;">
  9. <div class="d-none" id="list">
  10. <div class="container-fluid nav3">
  11. <div class="card menu-third" >
  12. <ul class="nav nav-pills">
  13. @can('运输管理-查询')
  14. <li class="nav-item">
  15. <a class="nav-link @if($uriType=='') active @endif" href="{{url('waybill/index')}}">全部</a>
  16. </li> @endcan
  17. @can('运输管理-查询')
  18. <li class="nav-item">
  19. <a class="nav-link @if($uriType=='专线') active @endif" href="{{url('waybill/index?uriType=专线')}}">专线</a>
  20. </li> @endcan
  21. @can('运输管理-查询')
  22. <li class="nav-item">
  23. <a class="nav-link @if($uriType=='直发车') active @endif" href="{{url('waybill/index?uriType=直发车')}}">直发车</a>
  24. </li> @endcan
  25. </ul>
  26. </div>
  27. </div>
  28. <div id="form_div"></div>
  29. <span class="dropdown">
  30. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  31. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  32. 导出Excel
  33. </button>
  34. <div class="dropdown-menu">
  35. <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
  36. <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
  37. </div>
  38. </span>
  39. <div>
  40. @if(Session::has('successTip'))
  41. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  42. @endif
  43. </div>
  44. <label for="all" class="d-none" id="cloneCheckAll">
  45. <input id="all" type="checkbox" @click="checkAll($event)">全选
  46. </label>
  47. <table class="table table-striped table-sm table-bordered table-hover text-nowrap d-none" id="headerRoll"></table>
  48. <table class="table table-striped table-sm table-bordered table-hover text-nowrap waybill-table" style="background: #fff;" id="headerParent">
  49. <tr>
  50. <th class="table-header-layer-1" colspan="4"></th>
  51. <th class="table-header-layer-1" colspan="11"><span class="fa fa-file-text-o"></span> 运单信息</th>
  52. <th class="table-header-layer-1" colspan="12"><span class="fa fa-truck"></span> 运输信息</th>
  53. <th class="table-header-layer-1" colspan="5"><span class="fa fa-rmb"></span> 费用信息
  54. @can('运输管理-删除')
  55. <th class="table-header-layer-1" colspan="1"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
  56. @endcan
  57. </tr>
  58. <tr id="header"></tr>
  59. <tr v-for="(waybill,i) in waybills" :style="[{color:waybill.status=='待重审'?'red':''||waybill.status=='已完结'?'green':''},{'font-weight': waybill.id==selectedStyle?'bold':''}]"
  60. :id="'waybill'+waybill.id" @click="selectedColor(waybill.id)" position="static" @mouseover="hidetop($event)" @mouseleave="showtop($event)">
  61. <td>
  62. <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
  63. </td>
  64. <td>
  65. <span v-if=waybill.status==="未审核"||waybill.status==="待重审">
  66. @can('运输管理-运单审核')
  67. <button class="btn btn-outline-primary btn-sm" @click="waybillAudit(waybill.id,waybill.waybill_number)">审核</button>
  68. @endcan
  69. @can('运输管理-编辑')
  70. <a target="_blank" class="btn btn-outline-secondary btn-sm" :href= "('{{url('waybill/waybillEdit')}}/'+waybill.id)">修改</a>
  71. @endcan
  72. </span>
  73. <span v-if=waybill.status==="已审核">
  74. @can('运输管理-调度')
  75. <button class="btn btn-outline-secondary btn-sm" @click="waybillRetreatAudit(waybill.id,waybill.waybill_number)">取消审核</button>
  76. <a target="_blank" class="btn btn-outline-secondary btn-sm" :href= "('{{url('waybill')}}/'+waybill.id+'/edit')">调度</a>
  77. @endcan
  78. </span>
  79. <span v-if=waybill.status==="待终审">
  80. @can('运输管理-调度审核')
  81. <button class="btn btn-outline-success btn-sm" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">完结</button>
  82. @endcan
  83. @can('运输管理-调度')
  84. <a target="_blank" class="btn btn-outline-secondary btn-sm" :href= "('{{url('waybill')}}/'+waybill.id+'/edit')">改调度</a>
  85. @endcan
  86. </span>
  87. </td>
  88. @can('运输管理-置顶')
  89. <td class="td-warm text-muted" v-if="waybill.remark" style="height: 55px">
  90. <button type="button" class="btn btn-sm btn-outline-danger " @click="cancelOnTop($event)" :data_id="waybill.id" style="opacity: 0.75">取消</button>
  91. </td>
  92. <td v-else>
  93. <button type="button" class="btn btn-sm btn-outline-secondary" @click="waybillOnTop($event)" :data_id="waybill.id" style="opacity: 0.75">置顶</button>
  94. </td>
  95. @endcan
  96. <td :class="[waybill.status=='已审核'?'text-success':'']">@{{waybill.status}}</td>
  97. <td class="td-warm text-muted toptd" >
  98. <div v-if="waybill.remark" class="bg-light-yellow text-danger top" data-toggle="tooltip" style="opacity: 0.1;position: absolute;z-index: 1"
  99. >置顶备注:@{{ waybill.remark }}</div>
  100. @{{ i+1 }}</td>
  101. <td class="td-warm text-muted">@{{waybill.created_at}}</td>
  102. <td class="td-warm">@{{waybill.type}} <span class="badge badge-sm bg-warning" v-if="waybill.collect_fee">到付</span></td>
  103. <td class="td-warm">@{{waybill.owner}}</td>
  104. <td class="td-warm toptd" :title="waybill.remark? '置顶备注:'+waybill.remark :''">@{{waybill.source_bill}}</td>
  105. <td class="td-warm" >@{{waybill.wms_bill_number}}</td>
  106. <td class="td-warm">@{{waybill.waybill_number}}</td>
  107. @can('运输管理-运单编辑')
  108. <td class="td-warm" >
  109. <span v-if="waybill.charge" class="btn-sm btn-outline-secondary btn" @click="waybillChargeCheck($event)" :data_id="waybill.id">@{{waybill.charge|money}}</span>
  110. <input v-else type="number" class="form-control form-control-sm" @blur="addWaybillCharge($event)" onfocus="$(this).css('width','85px')" :value="waybill.charge" :data_id="waybill.id" >
  111. <input type="number" class="form-control form-control-sm" @blur="updateWaybillCharge($event)" :value="waybill.charge" :data_id="waybill.id" style="min-width:85px;display: none">
  112. </td>
  113. @else
  114. <td class="td-warm" ><span v-if="waybill.charge">@{{waybill.charge|money}}</span></td>
  115. @endcan
  116. <td class="td-warm">@{{waybill.other_charge}}</td>
  117. <td class="td-warm">@{{waybill.other_charge_remark}}</td>
  118. <td class="td-warm">
  119. <div align="center" @mouseleave="removeCommonImg('common_img_'+waybill.id)" @mouseenter="commonImg('img_'+waybill.id,waybill.url,waybill.suffix)">
  120. <img v-if="waybill.url" :id="'img_'+waybill.id" :data-src="waybill.url+'-thumbnail.'+waybill.suffix" src="{{url('icon/img404-thumbnail.jpg')}}">
  121. @can('运输管理-图片上传')<div v-if="!waybill.url">
  122. <input class="btn btn-sm btn-outline-secondary" type="button" @click="certiimg(waybill.waybill_number)" value="上传照片 "/>
  123. <input type="file" @change="submitFile($event,waybill.waybill_number)" :id="waybill.waybill_number"
  124. style="display: none" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg"/>
  125. </div>@endcan
  126. </div>
  127. </td>
  128. <td class="td-cool">@{{waybill.recipient}}</td>
  129. <td class="td-cool">@{{waybill.recipient_mobile}}</td>
  130. <td class="td-cool text-muted">@{{waybill.origination}}</td>
  131. <td class="td-cool text-muted">@{{waybill.destination}}</td>
  132. <td class="td-cool">@{{waybill.carrier}}</td>
  133. <td class="td-cool"><span v-if="waybill.type==='专线'">@{{waybill.carrier_bill}}</span>
  134. <span v-if="waybill.type==='直发车'">
  135. <span v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span></span></td>
  136. <td class="td-cool"><span v-if="waybill.warehouse_weight">@{{waybill.warehouse_weight|filterZero}} @{{waybill.warehouse_weight_unit}}</span></td>
  137. <td class="td-cool"><span v-if="waybill.carrier_weight">@{{waybill.carrier_weight|filterZero}} @{{waybill.carrier_weight_unit}}</span></td>
  138. <td class="td-cool text-center" style="position: relative" @mouseenter="btnRefreshWeightZoomOut(waybill)" @mouseleave="btnRefreshWeightZoomIn(waybill)">
  139. <span v-if="waybill.warehouse_weight_other&&waybill.btn_refresh_weight=='zoomIn'"> @{{waybill.warehouse_weight_other}} @{{waybill.warehouse_weight_unit_other}}</span>
  140. <button type="button" class="btn btn-sm btn-outline-info" @click="refreshWaveHouseWeight(waybill.wms_bill_number)"
  141. :style="[
  142. {position:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'absolute':'static'},
  143. {transform:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'scale(0.55)':'scale(1)'},
  144. {right:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'-10px':'auto'},
  145. {bottom:waybill.btn_refresh_weight&&waybill.btn_refresh_weight=='zoomIn'?'-6px':'auto'},
  146. ]">刷新</button>
  147. </td>
  148. <td class="td-cool"><span v-if="waybill.carrier_weight_other">@{{waybill.carrier_weight_other|filterZero}} @{{waybill.carrier_weight_unit_other}}</span></td>
  149. <td class="td-cool"><span v-if="waybill.amount">@{{waybill.amount}} @{{waybill.amount_unit_name }}</span></td>
  150. <td class="td-cool">@{{waybill.mileage|km}} </td>
  151. @can('运输管理-可见费用项')
  152. @can('运输管理-运费')
  153. <td class="td-helpful" v-if="waybill.fee">
  154. <span v-if="waybill.type==='专线'"></span>
  155. <span v-else-if="waybill.fee" class="btn-sm btn-outline-secondary btn" @click="waybillFeeCheck($event)" :data_id="waybill.id">@{{waybill.fee|money}}</span>
  156. <input type="number" class="form-control form-control-sm" @blur="updateWaybillFee($event)" :value="waybill.fee" :data_id="waybill.id" style="min-width:85px;display: none">
  157. </td>
  158. <td class="td-helpful" v-else>
  159. <span v-if="waybill.type==='专线'"></span>
  160. <input v-else type="number" class="form-control form-control-sm" @blur="addWaybillFee($event)" onfocus="$(this).css('width','85px')" :value="waybill.fee" :data_id="waybill.id" >
  161. </td>
  162. @endcan
  163. <td class="td-helpful">@{{waybill.pick_up_fee}}</td>
  164. <td class="td-helpful">@{{waybill.other_fee}}</td>
  165. @endcan
  166. <td class="td-helpful">@{{waybill.deliver_at}}</td>
  167. <td class="td-helpful"><span v-html="waybill.dispatch_remark"></span></td>
  168. @can('运输管理-删除')
  169. <td class="td-operation">
  170. <button type="button" class="btn btn-outline-danger btn-sm" @click="waybillDestroy(waybill.id,waybill.waybill_number,i)">删</button>
  171. </td>
  172. @endcan
  173. </tr>
  174. </table>
  175. <div class="modal fade " id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  176. <div class="modal-dialog modal-dialog-centered">
  177. <div class="modal-content">
  178. <div class="modal-header">
  179. <h5 class="modal-title" id="exampleModalLabel">请输入置顶备注</h5>
  180. <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="changeRemark">
  181. <span aria-hidden="true">&times;</span>
  182. </button>
  183. </div>
  184. <div class="modal-body">
  185. <input type="hidden" class="form-control" id="onTopId">
  186. <textarea type="text" class="form-control" required id="remark" @change="changeRemark" ></textarea>
  187. <div class="invalid-feedback">
  188. 备注信息不能为空
  189. </div>
  190. </div>
  191. <div class="modal-footer">
  192. <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal" @click="changeRemark" >关闭</button>
  193. <button type="button" class="btn btn-sm btn-primary" @click="submitOnTop">提交</button>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <div class="text-info h5 btn btn">@{{ ((page-1)*paginate) + count }}/{{$waybills->total()}}</div>
  199. {{$waybills->appends($paginateParams)->links()}}
  200. </div>
  201. </div>
  202. @endsection
  203. @section('lastScript')
  204. <style type="text/css">
  205. @keyframes anima
  206. {
  207. from {
  208. opacity:0.1;
  209. }
  210. to{
  211. opacity:1;
  212. }
  213. }
  214. @-webkit-keyframes anima
  215. {
  216. from {
  217. opacity:0.75;
  218. }
  219. to{
  220. opacity:0.1;
  221. }
  222. }
  223. .bg-light-yellow{
  224. background: #fffff8;
  225. }
  226. .top{
  227. padding-top: 0px;
  228. padding-left: 10px;
  229. margin-top: -4px;
  230. margin-left: -5px;
  231. line-height: 55px;
  232. position: absolute;
  233. animation: anima;
  234. animation-duration: 3s;
  235. animation-timing-function: cubic-bezier(0,0,1,1);
  236. animation-direction: alternate;
  237. animation-play-state: running;
  238. -webkit-animation-name: anima;
  239. -webkit-animation-duration: 3s;
  240. -webkit-animation-timing-function: cubic-bezier(0,0,1,1);
  241. -webkit-animation-iteration-count: infinite;
  242. -webkit-animation-direction: alternate;
  243. -webkit-animation-play-state: running;
  244. }
  245. </style>
  246. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  247. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  248. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  249. <script>
  250. let vue = new Vue({
  251. el:'#list',
  252. data:{
  253. waybills:[
  254. @foreach($waybills as $waybill)
  255. {
  256. id:'{{$waybill->id}}',
  257. created_at:'{{$waybill->created_at}}',
  258. updated_at:'{{$waybill->updated_at}}',
  259. url:'{{$waybill->uploadFile ? asset('/storage'.$waybill->uploadFile->url) : ''}}',
  260. suffix:'{{$waybill->uploadFile ? $waybill->uploadFile->type : ''}}',
  261. status:'{{$waybill->status}}',
  262. type:'{{$waybill->type}}',
  263. waybill_number:'{{$waybill->waybill_number}}',
  264. owner:'{{$waybill->owner ? $waybill->owner->name : ''}}',
  265. source_bill:'{{$waybill->source_bill}}',
  266. wms_bill_number:'{{$waybill->wms_bill_number}}',
  267. origination:'{{$waybill->origination}}',
  268. destination:'{{$waybill->destination}}',
  269. recipient:'{{$waybill->recipient}}',
  270. recipient_mobile:'{{$waybill->recipient_mobile}}',
  271. charge:'{{$waybill->charge}}',
  272. ordering_remark:'{{$waybill->ordering_remark}}',
  273. carrier:'{{$waybill->carrier ? $waybill->carrier->name : ''}}',
  274. carrier_bill:'{{$waybill->carrier_bill}}',
  275. origination_city:'{{$waybill->origination_city ? $waybill->origination_city->name : ''}}',
  276. destination_city:'{{$waybill->destination_city ? $waybill->destination_city->name : ''}}',
  277. warehouse_weight:'{{$waybill->warehouse_weight}}',
  278. destination_province_name:'{{$waybill->destination_city ? ($waybill->destination_city->province ? $waybill->destination_city->province->name : '') : ''}}',
  279. warehouse_weight_unit:'{{$waybill->warehouse_weight_unit ? $waybill->warehouse_weight_unit->name : ''}}',
  280. carrier_weight:'{{$waybill->carrier_weight}}',
  281. carrier_weight_unit:'{{$waybill->carrier_weight_unit ? $waybill->carrier_weight_unit->name : ''}}',
  282. warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
  283. warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other ? $waybill->warehouse_weight_unit_other->name : ''}}',
  284. carrier_weight_other:'{{$waybill->carrier_weight_other}}',
  285. carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other ? $waybill->carrier_weight_unit_other->name : ''}}',
  286. amount_unit_name:'{{$waybill->amount_unit ? $waybill->amount_unit->name : ''}}',
  287. other_charge:'{{$waybill->other_charge}}',
  288. other_charge_remark:'{{$waybill->other_charge_remark}}',
  289. mileage:'{{$waybill->mileage}}',
  290. amount:'{{$waybill->amount}}',
  291. @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif
  292. @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
  293. pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
  294. collect_fee:'{{$waybill->collect_fee}}', @endcan
  295. deliver_at:'{{$waybill->deliver_at}}',
  296. dispatch_remark:'{{$waybill->dispatch_remark}}',
  297. isBtn:false,
  298. waybillAuditLogs:{!! $waybill->waybillAuditLogs !!},
  299. btn_refresh_weight:'zoomIn',
  300. remark:'{{$waybill->remark ?? ''}}',
  301. },
  302. @endforeach
  303. ],
  304. checkData:[],
  305. wmsCommodities:[],
  306. selectedStyle:[],
  307. owners:[
  308. @foreach($owners as $owner)
  309. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  310. @endforeach
  311. ],
  312. carriers:[
  313. @foreach($carriers as $carrier)
  314. {name:"{{$carrier->id}}",value:'{{$carrier->name}}'},
  315. @endforeach
  316. ],
  317. status:[
  318. {name:'未审核',value:'未审核'},
  319. {name:'已审核',value:'已审核'},
  320. {name:'待调度',value:'待调度'},
  321. {name:'待终审',value:'待终审'},
  322. {name:'已完结',value:'已完结'},
  323. ],
  324. isOut:false,
  325. isBlur:false,
  326. isOwnersBtn:false,
  327. imgs:'',
  328. is_ownerSelectShow:true,
  329. sum:{!! $waybills->total() !!},
  330. paginate : 50,
  331. page : Number('{{$waybills->currentPage()}}'),
  332. count : Number('{{$waybills->count()}}'),
  333. },
  334. watch:{
  335. checkData:{
  336. handler(){
  337. if (this.checkData.length === this.waybills.length){
  338. document.querySelector('#all').checked = true;
  339. document.querySelector('#all_temp').checked = true;
  340. }else {
  341. document.querySelector('#all').checked = false;
  342. document.querySelector('#all_temp').checked = false;
  343. }
  344. },
  345. deep:true
  346. },
  347. },
  348. mounted:function(){
  349. $(".tooltipTarget").tooltip({'trigger':'hover'});
  350. $('#list').removeClass('d-none');
  351. let waybill = $('.table-header-layer-1')[1];
  352. $('.top').css('min-width', waybill.scrollWidth);
  353. this.imgs=Array.from(document.getElementById('list').querySelectorAll('img'));
  354. this.lazy();
  355. if (this.imgs&&this.imgs.length>0){
  356. window.addEventListener('scroll',this.lazy)
  357. }
  358. let data=[
  359. [
  360. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
  361. placeholder:['货主','定位或多选货主'],data:this.owners},
  362. {name:'created_at_start',type:'time',tip:['选择显示指定日期的起始时间','选择显示指定日期的起始时间']},
  363. //{name:'created_at_start',type:'dateTimeLocal',tip:'选择显示指定日期的起始时间'},
  364. {name:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
  365. {name:'carrier_bill',type:'input',tip:'承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
  366. {name:'status',type:'select',placeholder: '运单状态',data:this.status},
  367. {name:'source_bill',type:'input',tip: '上游单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '上游单号'},
  368. ],
  369. [
  370. {name:'wms_bill_number',type:'input',tip:'WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
  371. {name:'created_at_end',type:'time',tip:['选择显示指定日期的结束时间','选择显示指定日期的结束时间']},
  372. //{name:'created_at_end',type:'dateTimeLocal',tip:'选择显示指定日期的结束时间'},
  373. {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
  374. {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
  375. {name:'carrier_id',type:'select',placeholder: '承运商',data:this.carriers},
  376. ],
  377. ];
  378. let param=[];
  379. this.$set(param,"uriType",'{{$uriType}}');
  380. this.form = new query({
  381. el:"#form_div",
  382. condition:data,
  383. param:param,
  384. });
  385. this.form.init();
  386. let column = [
  387. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  388. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  389. @can('运输管理-编辑','运输管理-运单审核','运输管理-调度','运输管理-编辑')
  390. {name:'operation',value: '操作', neglect: true, class:"td-operation"},@endcan
  391. {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
  392. {name:'status',value: '状态', class:"td-operation"},
  393. {name:'index',value: '序号', neglect: true, class:"td-warm"},
  394. {name:'created_at',value: '创建时间', class:"td-warm"},
  395. {name:'type',value: '运单类型', class:"td-warm"},
  396. {name:'owner',value: '货主', class:"td-warm"},
  397. {name:'source_bill',value: '上游单号', class:"td-warm"},
  398. {name:'wms_bill_number',value: 'WMS订单号', class:"td-warm"},
  399. {name:'waybill_number',value: '运单号', class:"td-warm"},
  400. {name:'charge',value: '运输收费', neglect: true, class:"td-warm"},
  401. {name:'other_charge',value: '其他收费', neglect: true, class:"td-warm"},
  402. {name:'other_charge_remark',value: '其他收费备注', class:"td-warm"},
  403. @can('运输管理-图片上传'){name:'img',value: '照片', neglect: true, class:"td-warm"},@endcan
  404. {name:'recipient',value: '收件人', class:"td-cool"},
  405. {name:'recipient_mobile',value: '收件人电话', class:"td-cool"},
  406. {name:'origination',value: '始发地', class:"td-cool"},
  407. {name:'destination',value: '目的地', class:"td-cool"},
  408. {name:'carrier',value: '承运商', class:"td-cool"},
  409. {name:'carrier_bill',value: '单号/车型', neglect: true, class:"td-cool"},
  410. {name:'warehouse_weight',value: '仓库计抛', neglect: true, class:"td-cool"},
  411. {name:'carrier_weight',value: '承运商计抛', neglect: true, class:"td-cool"},
  412. {name:'warehouse_weight_other',value: '仓库计重', neglect: true, class:"td-cool"},
  413. {name:'carrier_weight_other',value: '承运商计重', neglect: true, class:"td-cool"},
  414. {name:'amount',value: '计件', neglect: true, class:"td-cool"},
  415. {name:'mileage',value: '里程', neglect: true, class:"td-cool"},
  416. @can('运输管理-运费'){name:'fee',value: '运费', neglect: true, class:"td-helpful"},@endcan
  417. {name:'pick_up_fee',value: '提货费', neglect: true, class:"td-helpful"},
  418. {name:'other_fee',value: '其他支出', neglect: true, class:"td-helpful"},
  419. {name:'deliver_at',value: '发货时间', class:"td-helpful"},
  420. {name:'dispatch_remark',value: '调度备注', class:"td-helpful"},
  421. @can('运输管理-删除'){name:'remove',value: '操作', neglect: true, class:"td-delete"},@endcan
  422. ];
  423. let _this = this;
  424. setTimeout(function () {
  425. let header = new Header({
  426. el: "#header",
  427. column: column,
  428. data: _this.waybills,
  429. restorationColumn: 'id',
  430. fixedTop:($('#form_div').height())+2,
  431. offset:0.5,
  432. vue : vue,
  433. });
  434. header.init();
  435. },0);
  436. this.paginate = $("#paginate").val();
  437. },
  438. methods:{
  439. btnRefreshWeightZoomIn(waybill){
  440. waybill.btn_refresh_weight='zoomIn'
  441. },
  442. btnRefreshWeightZoomOut(waybill){
  443. waybill.btn_refresh_weight='zoomOut'
  444. },
  445. lazy(){
  446. //可视区域高度
  447. let height=window.innerHeight;
  448. //滚动区域高度
  449. let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop;
  450. let _this=this;
  451. this.imgs.forEach(function (img,i) {
  452. if ((height+scrollHeight)>$('#'+img.getAttribute('id')).offset().top && img.getAttribute('data-src')){
  453. let temp=new Image();
  454. temp.src=img.getAttribute('data-src');
  455. temp.onload=function () {
  456. img.src=img.getAttribute('data-src');
  457. _this.$delete(_this.imgs,i);
  458. }
  459. }
  460. });
  461. },
  462. waybillAudit(id,waybill_number){
  463. if(!confirm('确定要通过“'+waybill_number+'”的审核吗?')){return};
  464. let _this=this;
  465. let w;
  466. let url = '{{url('waybill/waybillAudit')}}';
  467. axios.post(url, {id:id})
  468. .then(
  469. function (response) {
  470. if (response.data.success){
  471. _this.waybills.forEach(function (waybill) {
  472. if (waybill.id===id){
  473. waybill.status=response.data.status;
  474. waybill.waybillAuditLogs.push(response.data.waybillAuditLog);
  475. w=waybill.waybill_number;
  476. }
  477. });
  478. tempTip.setDuration(3000);
  479. tempTip.showSuccess('审核'+w+'成功!');
  480. }else if (response.data.exception!=null){
  481. tempTip.setDuration(3000);
  482. tempTip.show(response.data.exception);
  483. }else {
  484. tempTip.setDuration(3000);
  485. tempTip.show('审核失败!');
  486. }
  487. }
  488. ).catch(function (err) {
  489. tempTip.setDuration(3000);
  490. tempTip.show('审核失败,网络连接错误!'+err);
  491. });
  492. },
  493. {{--waybillUpdate(id){--}}
  494. {{-- location.href="{{url('waybill/waybillEdit')}}/"+id;--}}
  495. {{--},--}}
  496. // 软删除
  497. waybillDestroy(id,waybill_number,index){
  498. if(!confirm('确定要删除运单号为:“'+waybill_number+'”的运单吗?')){return};
  499. let url = '{{url('waybill')}}/'+id;
  500. let _this = this;
  501. axios.delete(url).then(
  502. function (response) {
  503. if(!response.data.success){
  504. tempTip.setDuration(3000);
  505. tempTip.show('运单:'+waybill_number+'删除失败!');
  506. }else {
  507. tempTip.setDuration(2000);
  508. tempTip.showSuccess('运单:'+waybill_number+'删除成功!');
  509. _this.$delete(_this.waybills,index);
  510. }
  511. }
  512. ).catch(function (err) {
  513. tempTip.setDuration(3000);
  514. tempTip.show('删除失败,网络链接错误!'+err);
  515. });
  516. },
  517. waybillRetreatAudit(id,waybill_number){
  518. if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
  519. let _this=this;
  520. let w;
  521. let url='{{url('files')}}';
  522. axios.post(url,{id:id})
  523. .then(
  524. function (response) {
  525. if (response.data.success){
  526. _this.waybills.forEach(function (waybill){
  527. if (waybill.id===id){
  528. waybill.status=response.data.status;
  529. waybill.waybillAuditLogs=[];
  530. w=waybill.waybill_number;
  531. }
  532. });
  533. tempTip.setDuration(3000);
  534. tempTip.showSuccess(w+'审核驳回成功!');
  535. }else {
  536. tempTip.setDuration(3000);
  537. tempTip.show('审核驳回失败!');
  538. }
  539. }
  540. ).catch(function (err) {
  541. tempTip.setDuration(3000);
  542. tempTip.show('审核驳回失败,网络连接错误!'+err);
  543. });
  544. },
  545. {{--job(id){--}}
  546. {{-- location.href="{{url('waybill')}}/"+id+"/edit";--}}
  547. {{--},--}}
  548. waybillEndAudit(id,waybill_number){
  549. if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
  550. let _this=this;
  551. let w;
  552. let url='{{url('waybill/waybillEndAudit')}}';
  553. axios.post(url, {id:id})
  554. .then(
  555. function (response) {
  556. if (response.data.success){
  557. _this.waybills.forEach(function (s) {
  558. if (s.id===id){
  559. s.status=response.data.status;
  560. s.waybillAuditLogs.push(response.data.waybillAuditLog);
  561. w=s.waybill_number;
  562. }
  563. });
  564. tempTip.setDuration(3000);
  565. tempTip.showSuccess(w+'终审完毕!');
  566. }else if (response.data.exception!=null){
  567. tempTip.setDuration(3000);
  568. tempTip.show(response.data.exception);
  569. }else {
  570. tempTip.setDuration(3000);
  571. tempTip.show('终审失败!');
  572. }
  573. }
  574. ).catch(function (err) {
  575. tempTip.setDuration(3000);
  576. tempTip.show('终审失败,网络连接错误!'+err);
  577. });
  578. },
  579. checkAll(e){
  580. if (e.target.checked){
  581. this.waybills.forEach((el,i)=>{
  582. if (this.checkData.indexOf(el.id) == '-1'){
  583. this.checkData.push(el.id);
  584. }
  585. });
  586. }else {
  587. this.checkData = [];
  588. }
  589. },
  590. waybillExport(checkAllSign){
  591. let url = '{{url('waybill/export')}}';
  592. let token='{{ csrf_token() }}';
  593. excelExport(checkAllSign,this.checkData,url,this.sum,token);
  594. },
  595. //展开收起商品列表
  596. showWMSCommodities(id,wmsCommodities,isBtn){
  597. if (!isBtn){
  598. this.wmsCommodities=wmsCommodities;
  599. $("#waybill"+id).after($("#wmsCommodities"));
  600. this.waybills.forEach(function (waybill) {
  601. if (waybill.id!==id&&waybill.isBtn){
  602. waybill.isBtn=false;
  603. }
  604. if (waybill.id===id){
  605. waybill.isBtn=true;
  606. }
  607. });
  608. return;
  609. }
  610. if (isBtn){
  611. this.wmsCommodities=[];
  612. this.waybills.every(function (waybill) {
  613. if (waybill.id===id){
  614. waybill.isBtn=false;
  615. return false;
  616. }
  617. return true;
  618. });
  619. }
  620. },
  621. selectedColor(id){
  622. if (id==this.selectedStyle){
  623. this.selectedStyle='';
  624. return;
  625. }
  626. this.selectedStyle=id;
  627. },
  628. mouseleaveOwner:function () {
  629. if(!this.isOut&&!this.isBlur){
  630. this.isOwnersBtn=false;
  631. }
  632. },
  633. blurOwner:function () {
  634. if (!this.isOut&&!this.isBlur){
  635. this.isOwnersBtn=false;
  636. }
  637. },
  638. certiimg(waybill_number){
  639. $('#'+waybill_number).click();
  640. },
  641. submitFile(e,waybill_number){
  642. let file=e.target.files[0];
  643. if (file.size >=5242880){
  644. tempTip.setDuration(3000);
  645. tempTip.show("图片大小不能超过5MB!");
  646. return;
  647. }
  648. let _this=this;
  649. let formData=new FormData();
  650. formData.append("file",file);
  651. formData.append("waybill_number",waybill_number);
  652. axios.post('{{url('waybill/upload')}}',formData)
  653. .then(function (response) {
  654. if (!response.data.success){
  655. tempTip.setDuration(4000);
  656. tempTip.show(response.data.error);
  657. return;
  658. }
  659. _this.waybills.some(function (waybill) {
  660. if (waybill.waybill_number===waybill_number){
  661. waybill.url=response.data.data.url;
  662. waybill.suffix=response.data.data.type;
  663. setTimeout(function () {
  664. _this.imgs.push(document.getElementById('img_'+waybill.id));
  665. _this.lazy();
  666. },1);
  667. tempTip.setDuration(3000);
  668. tempTip.showSuccess("上传成功!");
  669. return true;
  670. }
  671. });
  672. }).catch(function (err) {
  673. tempTip.setDuration(4000);
  674. tempTip.show("网络错误:"+err);
  675. })
  676. },
  677. commonImg(id,url,suffix){
  678. $('#'+id).after(
  679. "<div id=\"common_"+id+"\" style='position: absolute;padding-top: 2px;z-index: 99'>" +
  680. "<div style='position:absolute'>"+
  681. "<div >"+
  682. "<a target='_blank' href='"+url+'-bulky.'+suffix+"'>" +
  683. "<img src=\""+url+'-common.'+suffix+"\" style='position: relative;left:-50px;' >" +
  684. "</a>" +
  685. "</div>"+
  686. @can('运输管理-图片删除')"<button type='button' class='btn btn-sm btn-danger' onclick='vueList.btnDeleteImg(this)' value='"+id+"' style='position: relative;float: right;margin-right: 51px;margin-top: -30px;' >删除</button>" +@endcan
  687. "</div>"+
  688. "</div>");
  689. },
  690. removeCommonImg(id){
  691. $('#'+id).remove();
  692. },
  693. btnDeleteImg(e){
  694. let idstr = $(e).val();
  695. let id = idstr.substr( idstr.indexOf('_')+1);
  696. if (!confirm('确定要删除所选图片吗?'))return;
  697. this.destroyImg([id]);
  698. },
  699. deleteImg(){
  700. if (this.checkData.length <= 0) {
  701. tempTip.setDuration(2000);
  702. tempTip.showSuccess('没有勾选任何记录');
  703. return;
  704. }
  705. if (!confirm('确定要删除所选图片吗?'))return;
  706. this.destroyImg(this.checkData);
  707. },
  708. destroyImg(id){
  709. let _this = this;
  710. axios.post('{{url('waybill/deleteImg')}}',{'ids':id})
  711. .then(function (response) {
  712. if (!response.data.success){
  713. tempTip.setDuration(4000);
  714. tempTip.show("删除失败");
  715. return;
  716. }
  717. id.forEach(function (id) {
  718. _this.waybills.some(function (waybill) {
  719. if (waybill.id===id){
  720. waybill.url='';
  721. return true;
  722. }
  723. });
  724. });
  725. tempTip.setDuration(3000);
  726. tempTip.showSuccess("删除成功!");
  727. }).catch(function (err) {
  728. tempTip.setDuration(4000);
  729. tempTip.show("网络错误:"+err);
  730. });
  731. },
  732. // 运输收费修改
  733. waybillChargeCheck:function (e) {
  734. let target = $(e.target);
  735. target.hide();
  736. let input = target.next();
  737. input.show();
  738. input.focus();
  739. },
  740. // 运输收费失焦事件
  741. updateWaybillCharge:function (e) {
  742. let target = $(e.target);
  743. let _this = this;
  744. let span = target.prev();
  745. let id = target.attr('data_id');
  746. let oldCharge = span.text();
  747. let charge = target.val();
  748. if(charge !== span.text()){
  749. let ajaxUrl= '{{url("apiLocal/waybill/changeCharge")}}';
  750. axios.post(ajaxUrl,{'id':id,'charge':charge}).then(function (response) {
  751. if(response.data.success){
  752. _this.updateWaybill(id,charge);
  753. tempTip.setDuration(2000);
  754. tempTip.showSuccess('运输收费修改成功');
  755. }else{
  756. tempTip.setDuration(3000);
  757. tempTip.show('运输收费修改失败!'+response.data.fail_info);
  758. _this.updateWaybill(id,oldCharge);
  759. }
  760. }).catch(function (err) {
  761. tempTip.setDuration(3000);
  762. tempTip.show('运输收费修改失败!网络异常:'+err);
  763. _this.updateWaybill(id,oldCharge);
  764. });
  765. }
  766. span.show();
  767. target.hide();
  768. },
  769. // 为运单添加运输收费
  770. addWaybillCharge(e){
  771. let target = $(e.target);
  772. target.css('width','85px');
  773. let _this = this;
  774. let id = target.attr('data_id');
  775. let charge = target.val();
  776. console.log(charge);
  777. let ajaxUrl= '{{url("apiLocal/waybill/changeCharge")}}';
  778. if(charge === ''|| charge === null){
  779. target.css('width','75px');
  780. return;
  781. }else{
  782. axios.post(ajaxUrl,{'id':id,'charge':charge}).then(function (response) {
  783. if(response.data.success){
  784. tempTip.setDuration(2000);
  785. tempTip.showSuccess('运输收费添加成功');
  786. _this.updateWaybill(id,charge);
  787. }else{
  788. tempTip.setDuration(3000);
  789. tempTip.show('运输收费添加失败!'+response.data.fail_info);
  790. }
  791. }).catch(function (err) {
  792. tempTip.setDuration(3000);
  793. tempTip.show('运输收费添加失败!网络异常:'+err);
  794. });
  795. target.css('width','75px');
  796. }
  797. },
  798. // 修改运输收费更新表格数据
  799. updateWaybill(id,newCharge){
  800. this.waybills.some(function(waybill){
  801. if(waybill.id === id){
  802. waybill.charge = newCharge;
  803. return true;
  804. }
  805. })
  806. },
  807. // 运费修改
  808. waybillFeeCheck:function (e) {
  809. let target = $(e.target);
  810. target.hide();
  811. let input = target.next();
  812. input.show();
  813. input.focus();
  814. },
  815. // 失焦事件
  816. updateWaybillFee:function (e) {
  817. let target = $(e.target);
  818. let _this = this;
  819. let span = target.prev();
  820. let id = target.attr('data_id');
  821. let oldFee = span.text();
  822. let fee = target.val();
  823. if(fee !== span.text()){
  824. let ajaxUrl= '{{url("apiLocal/waybill/changeFee")}}';
  825. axios.post(ajaxUrl,{'id':id,'fee':fee}).then(function (response) {
  826. if(response.data.success){
  827. _this.updateWaybills(id,fee);
  828. tempTip.setDuration(2000);
  829. tempTip.showSuccess('运单运费修改成功');
  830. }else{
  831. tempTip.setDuration(3000);
  832. tempTip.show('运单运费修改失败!'+response.data.fail_info);
  833. _this.updateWaybills(id,oldFee);
  834. }
  835. }).catch(function (err) {
  836. tempTip.setDuration(3000);
  837. tempTip.show('运单运费修改失败!网络异常:'+err);
  838. _this.updateWaybills(id,oldFee);
  839. });
  840. }
  841. span.show();
  842. target.hide();
  843. },
  844. // 为直发车运单添加运费
  845. addWaybillFee(e){
  846. let target = $(e.target);
  847. target.css('width','85px');
  848. let _this = this;
  849. let id = target.attr('data_id');
  850. let fee = target.val();
  851. let ajaxUrl= '{{url("apiLocal/waybill/changeFee")}}';
  852. if(fee === ''|| fee === null){
  853. target.css('width','75px');
  854. return;
  855. }else{
  856. axios.post(ajaxUrl,{'id':id,'fee':fee}).then(function (response) {
  857. if(response.data.success){
  858. tempTip.setDuration(2000);
  859. tempTip.showSuccess('运单运费添加成功');
  860. _this.updateWaybills(id,fee);
  861. }else{
  862. tempTip.setDuration(3000);
  863. tempTip.show('运单运费添加失败!'+response.data.fail_info);
  864. }
  865. }).catch(function (err) {
  866. tempTip.setDuration(3000);
  867. tempTip.show('运单运费添加失败!网络异常:'+response.data.fail_info);
  868. });
  869. target.css('width','75px');
  870. }
  871. },
  872. // 更新表格数据
  873. updateWaybills(id,newFee){
  874. this.waybills.some(function(waybill){
  875. if(waybill.id === id){
  876. waybill.fee = newFee;
  877. return true;
  878. }
  879. })
  880. },
  881. // 置顶操作
  882. waybillOnTop:function(e){
  883. let target = $(e.target);
  884. let id = target.attr('data_id');
  885. $("#onTopId").val(id);
  886. $('#exampleModal').modal('show');
  887. },
  888. submitOnTop:function(){
  889. let ajaxUrl = '{{url('waybill/ontop/top')}}';
  890. let remark = $("#remark").val();
  891. let id = $("#onTopId").val();
  892. if(remark === ''){
  893. $("#remark").focus();
  894. $('#remark').addClass('is-invalid');
  895. }else{
  896. axios.post(ajaxUrl,{'id':id,'detail':remark}).then(function (response) {
  897. if(response.data.success){
  898. tempTip.setDuration(3000);
  899. tempTip.showSuccess('置顶成功');
  900. $('#exampleModal').modal('hide');
  901. setTimeout(function(){
  902. window.location.reload();
  903. }
  904. ,1000);
  905. }else{
  906. tempTip.setDuration(3000);
  907. tempTip.show('置顶失败!'+response.fail_info);
  908. }
  909. }).catch(function (err) {
  910. tempTip.setDuration(3000);
  911. tempTip.show('置顶失败,网络连接错误!'+err);
  912. });
  913. }
  914. },
  915. changeRemark:function(){
  916. $('#remark').removeClass('is-invalid');
  917. },
  918. cancelOnTop:function (e) {
  919. let target = $(e.target);
  920. let id = target.attr('data_id');
  921. let ajaxUrl='{{url('waybill/ontop/cancel')}}';
  922. if(id !== null){
  923. axios.post(ajaxUrl,{'id':id}).then(function (response) {
  924. if(response.data.success){
  925. tempTip.setDuration(30000);
  926. tempTip.showSuccess('取消置顶成功');
  927. setTimeout(function(){
  928. window.location.reload();
  929. }
  930. ,1000);
  931. }else{
  932. tempTip.setDuration(3000);
  933. tempTip.show('取消置顶失败!'+response.fail_info);
  934. }
  935. }).catch(function (err) {
  936. tempTip.setDuration(3000);
  937. tempTip.show('取消置顶失败,网络连接错误!'+err);
  938. });
  939. }
  940. },
  941. hidetop:function(e) {
  942. let target = $(e.target);
  943. let top = target.parent().find('.top');
  944. let tip = target.parent().find('.toptd');
  945. top.hide();
  946. tip.tooltip('show');
  947. },
  948. showtop:function(e){
  949. let target = $(e.target);
  950. let top = target.parent().find('.top');
  951. let tip = target.parent().find('.toptd');
  952. top.show();
  953. tip.tooltip('hide');
  954. },
  955. refreshWaveHouseWeight(wms_bill_number) {
  956. let _this=this;
  957. let url='{{url('waybill/refreshWaveHouseWeight')}}';
  958. axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
  959. if(response.data.success){
  960. _this.waybills.every(function (waybill) {
  961. if (waybill.wms_bill_number==wms_bill_number){
  962. waybill.warehouse_weight_other=response.data.warehouseWeight;
  963. return false;
  964. }
  965. return true;
  966. });
  967. tempTip.setDuration(3000);
  968. tempTip.showSuccess('刷新计重成功');
  969. }else{
  970. tempTip.setDuration(3000);
  971. tempTip.show('刷新计重失败!'+response.data.fail_info);
  972. }
  973. }).catch(function (err) {
  974. tempTip.setDuration(3000);
  975. tempTip.show('刷新计重失败,网络连接错误!'+err);
  976. });
  977. }
  978. },
  979. filters:{
  980. km:function(value){
  981. if(!value)return '';
  982. return value + ' km';
  983. },
  984. money:function(value){
  985. if(value.indexOf('.')>0){
  986. return value
  987. }
  988. return value += '.00';
  989. },
  990. filterZero:function(value){
  991. value=value.replace(/\.00$/,'');
  992. value=value.replace(/(\.[1-9])0$/,'$1');
  993. return value;
  994. },
  995. }
  996. });
  997. // modal 隐藏时修改 input 为空
  998. $("#exampleModal").on('hide.bs.modal',function(e){
  999. $('#remark').val('');
  1000. });
  1001. </script>
  1002. @endsection