index.blade.php 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990
  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->logistic ? $waybill->logistic->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. test:{!! $waybill !!}
  302. },
  303. @endforeach
  304. ],
  305. checkData:[],
  306. selectedStyle:[],
  307. owners:[
  308. @foreach($owners as $owner)
  309. {name:'{{$owner->id}}',value:'{{$owner->name}}'},
  310. @endforeach
  311. ],
  312. logistics:[
  313. @foreach($logistics as $logistic)
  314. {name:"{{$logistic->id}}",value:'{{$logistic->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:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
  364. {name:'carrier_bill',type:'input',tip:'承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
  365. {name:'status',type:'select',placeholder: '运单状态',data:this.status},
  366. {name:'source_bill',type:'input',tip: '上游单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '上游单号'},
  367. ],
  368. [
  369. {name:'wms_bill_number',type:'input',tip:'WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
  370. {name:'created_at_end',type:'time',tip:['选择显示指定日期的结束时间','选择显示指定日期的结束时间']},
  371. {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
  372. {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
  373. {name:'logistic_id',type:'select',placeholder: '承运商',data:this.logistics},
  374. ],
  375. ];
  376. let param=[];
  377. this.$set(param,"uriType",'{{$uriType}}');
  378. this.form = new query({
  379. el:"#form_div",
  380. condition:data,
  381. param:param,
  382. });
  383. this.form.init();
  384. let column = [
  385. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  386. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  387. @can('运输管理-编辑','运输管理-运单审核','运输管理-调度','运输管理-编辑')
  388. {name:'operation',value: '操作', neglect: true, class:"td-operation"},@endcan
  389. {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
  390. {name:'status',value: '状态', class:"td-operation"},
  391. {name:'index',value: '序号', neglect: true, class:"td-warm"},
  392. {name:'created_at',value: '创建时间', class:"td-warm"},
  393. {name:'type',value: '运单类型', class:"td-warm"},
  394. {name:'owner',value: '货主', class:"td-warm"},
  395. {name:'source_bill',value: '上游单号', class:"td-warm"},
  396. {name:'wms_bill_number',value: 'WMS订单号', class:"td-warm"},
  397. {name:'waybill_number',value: '运单号', class:"td-warm"},
  398. {name:'charge',value: '运输收费', neglect: true, class:"td-warm"},
  399. {name:'other_charge',value: '其他收费', neglect: true, class:"td-warm"},
  400. {name:'other_charge_remark',value: '其他收费备注', class:"td-warm"},
  401. @can('运输管理-图片上传'){name:'img',value: '照片', neglect: true, class:"td-warm"},@endcan
  402. {name:'recipient',value: '收件人', class:"td-cool"},
  403. {name:'recipient_mobile',value: '收件人电话', class:"td-cool"},
  404. {name:'origination',value: '始发地', class:"td-cool"},
  405. {name:'destination',value: '目的地', class:"td-cool"},
  406. {name:'carrier',value: '承运商', class:"td-cool"},
  407. {name:'carrier_bill',value: '单号/车型', neglect: true, class:"td-cool"},
  408. {name:'warehouse_weight',value: '仓库计抛', neglect: true, class:"td-cool"},
  409. {name:'carrier_weight',value: '承运商计抛', neglect: true, class:"td-cool"},
  410. {name:'warehouse_weight_other',value: '仓库计重', neglect: true, class:"td-cool"},
  411. {name:'carrier_weight_other',value: '承运商计重', neglect: true, class:"td-cool"},
  412. {name:'amount',value: '计件', neglect: true, class:"td-cool"},
  413. {name:'mileage',value: '里程', neglect: true, class:"td-cool"},
  414. @can('运输管理-运费'){name:'fee',value: '运费', neglect: true, class:"td-helpful"},@endcan
  415. {name:'pick_up_fee',value: '提货费', neglect: true, class:"td-helpful"},
  416. {name:'other_fee',value: '其他支出', neglect: true, class:"td-helpful"},
  417. {name:'deliver_at',value: '发货时间', class:"td-helpful"},
  418. {name:'dispatch_remark',value: '调度备注', class:"td-helpful"},
  419. @can('运输管理-删除'){name:'remove',value: '操作', neglect: true, class:"td-delete"},@endcan
  420. ];
  421. let _this = this;
  422. setTimeout(function () {
  423. let header = new Header({
  424. el: "#header",
  425. column: column,
  426. data: _this.waybills,
  427. restorationColumn: 'id',
  428. fixedTop:($('#form_div').height())+2,
  429. offset:0.5,
  430. vue : vue,
  431. });
  432. header.init();
  433. },0);
  434. this.paginate = $("#paginate").val();
  435. },
  436. methods:{
  437. btnRefreshWeightZoomIn(waybill){
  438. waybill.btn_refresh_weight='zoomIn'
  439. },
  440. btnRefreshWeightZoomOut(waybill){
  441. waybill.btn_refresh_weight='zoomOut'
  442. },
  443. lazy(){
  444. //可视区域高度
  445. let height=window.innerHeight;
  446. //滚动区域高度
  447. let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop;
  448. let _this=this;
  449. this.imgs.forEach(function (img,i) {
  450. if ((height+scrollHeight)>$('#'+img.getAttribute('id')).offset().top && img.getAttribute('data-src')){
  451. let temp=new Image();
  452. temp.src=img.getAttribute('data-src');
  453. temp.onload=function () {
  454. img.src=img.getAttribute('data-src');
  455. _this.$delete(_this.imgs,i);
  456. }
  457. }
  458. });
  459. },
  460. waybillAudit(id,waybill_number){
  461. if(!confirm('确定要通过“'+waybill_number+'”的审核吗?')){return};
  462. let _this=this;
  463. let w;
  464. let url = '{{url('waybill/waybillAudit')}}';
  465. axios.post(url, {id:id})
  466. .then(
  467. function (response) {
  468. if (response.data.success){
  469. _this.waybills.forEach(function (waybill) {
  470. if (waybill.id===id){
  471. waybill.status=response.data.status;
  472. waybill.waybillAuditLogs.push(response.data.waybillAuditLog);
  473. w=waybill.waybill_number;
  474. }
  475. });
  476. tempTip.setDuration(3000);
  477. tempTip.showSuccess('审核'+w+'成功!');
  478. }else if (response.data.exception!=null){
  479. tempTip.setDuration(3000);
  480. tempTip.show(response.data.exception);
  481. }else {
  482. tempTip.setDuration(3000);
  483. tempTip.show('审核失败!');
  484. }
  485. }
  486. ).catch(function (err) {
  487. tempTip.setDuration(3000);
  488. tempTip.show('审核失败,网络连接错误!'+err);
  489. });
  490. },
  491. {{--waybillUpdate(id){--}}
  492. {{-- location.href="{{url('waybill/waybillEdit')}}/"+id;--}}
  493. {{--},--}}
  494. // 软删除
  495. waybillDestroy(id,waybill_number,index){
  496. if(!confirm('确定要删除运单号为:“'+waybill_number+'”的运单吗?')){return};
  497. let url = '{{url('waybill')}}/'+id;
  498. let _this = this;
  499. axios.delete(url).then(
  500. function (response) {
  501. if(!response.data.success){
  502. tempTip.setDuration(3000);
  503. tempTip.show('运单:'+waybill_number+'删除失败!');
  504. }else {
  505. tempTip.setDuration(2000);
  506. tempTip.showSuccess('运单:'+waybill_number+'删除成功!');
  507. _this.$delete(_this.waybills,index);
  508. }
  509. }
  510. ).catch(function (err) {
  511. tempTip.setDuration(3000);
  512. tempTip.show('删除失败,网络链接错误!'+err);
  513. });
  514. },
  515. waybillRetreatAudit(id,waybill_number){
  516. if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
  517. let _this=this;
  518. let w;
  519. let url='{{url('files')}}';
  520. axios.post(url,{id:id})
  521. .then(
  522. function (response) {
  523. if (response.data.success){
  524. _this.waybills.forEach(function (waybill){
  525. if (waybill.id===id){
  526. waybill.status=response.data.status;
  527. waybill.waybillAuditLogs=[];
  528. w=waybill.waybill_number;
  529. }
  530. });
  531. tempTip.setDuration(3000);
  532. tempTip.showSuccess(w+'审核驳回成功!');
  533. }else {
  534. tempTip.setDuration(3000);
  535. tempTip.show('审核驳回失败!');
  536. }
  537. }
  538. ).catch(function (err) {
  539. tempTip.setDuration(3000);
  540. tempTip.show('审核驳回失败,网络连接错误!'+err);
  541. });
  542. },
  543. {{--job(id){--}}
  544. {{-- location.href="{{url('waybill')}}/"+id+"/edit";--}}
  545. {{--},--}}
  546. waybillEndAudit(id,waybill_number){
  547. if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
  548. let _this=this;
  549. let w;
  550. let url='{{url('waybill/waybillEndAudit')}}';
  551. axios.post(url, {id:id})
  552. .then(
  553. function (response) {
  554. if (response.data.success){
  555. _this.waybills.forEach(function (s) {
  556. if (s.id===id){
  557. s.status=response.data.status;
  558. s.waybillAuditLogs.push(response.data.waybillAuditLog);
  559. w=s.waybill_number;
  560. }
  561. });
  562. tempTip.setDuration(3000);
  563. tempTip.showSuccess(w+'终审完毕!');
  564. }else if (response.data.exception!=null){
  565. tempTip.setDuration(3000);
  566. tempTip.show(response.data.exception);
  567. }else {
  568. tempTip.setDuration(3000);
  569. tempTip.show('终审失败!');
  570. }
  571. }
  572. ).catch(function (err) {
  573. tempTip.setDuration(3000);
  574. tempTip.show('终审失败,网络连接错误!'+err);
  575. });
  576. },
  577. checkAll(e){
  578. if (e.target.checked){
  579. this.waybills.forEach((el,i)=>{
  580. if (this.checkData.indexOf(el.id) == '-1'){
  581. this.checkData.push(el.id);
  582. }
  583. });
  584. }else {
  585. this.checkData = [];
  586. }
  587. },
  588. waybillExport(checkAllSign){
  589. let url = '{{url('waybill/export')}}';
  590. let token='{{ csrf_token() }}';
  591. excelExport(checkAllSign,this.checkData,url,this.sum,token);
  592. },
  593. selectedColor(id){
  594. if (id==this.selectedStyle){
  595. this.selectedStyle='';
  596. return;
  597. }
  598. this.selectedStyle=id;
  599. },
  600. mouseleaveOwner:function () {
  601. if(!this.isOut&&!this.isBlur){
  602. this.isOwnersBtn=false;
  603. }
  604. },
  605. blurOwner:function () {
  606. if (!this.isOut&&!this.isBlur){
  607. this.isOwnersBtn=false;
  608. }
  609. },
  610. certiimg(waybill_number){
  611. $('#'+waybill_number).click();
  612. },
  613. submitFile(e,waybill_number){
  614. let file=e.target.files[0];
  615. if (file.size >=5242880){
  616. tempTip.setDuration(3000);
  617. tempTip.show("图片大小不能超过5MB!");
  618. return;
  619. }
  620. let _this=this;
  621. let formData=new FormData();
  622. formData.append("file",file);
  623. formData.append("waybill_number",waybill_number);
  624. axios.post('{{url('waybill/upload')}}',formData)
  625. .then(function (response) {
  626. if (!response.data.success){
  627. tempTip.setDuration(4000);
  628. tempTip.show(response.data.error);
  629. return;
  630. }
  631. _this.waybills.some(function (waybill) {
  632. if (waybill.waybill_number===waybill_number){
  633. waybill.url=response.data.data.url;
  634. waybill.suffix=response.data.data.type;
  635. setTimeout(function () {
  636. _this.imgs.push(document.getElementById('img_'+waybill.id));
  637. _this.lazy();
  638. },1);
  639. tempTip.setDuration(3000);
  640. tempTip.showSuccess("上传成功!");
  641. return true;
  642. }
  643. });
  644. }).catch(function (err) {
  645. tempTip.setDuration(4000);
  646. tempTip.show("网络错误:"+err);
  647. })
  648. },
  649. commonImg(id,url,suffix){
  650. $('#'+id).after(
  651. "<div id=\"common_"+id+"\" style='position: absolute;padding-top: 2px;z-index: 99'>" +
  652. "<div style='position:absolute'>"+
  653. "<div >"+
  654. "<a target='_blank' href='"+url+'-bulky.'+suffix+"'>" +
  655. "<img src=\""+url+'-common.'+suffix+"\" style='position: relative;left:-50px;' >" +
  656. "</a>" +
  657. "</div>"+
  658. @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
  659. "</div>"+
  660. "</div>");
  661. },
  662. removeCommonImg(id){
  663. $('#'+id).remove();
  664. },
  665. btnDeleteImg(e){
  666. let idstr = $(e).val();
  667. let id = idstr.substr( idstr.indexOf('_')+1);
  668. if (!confirm('确定要删除所选图片吗?'))return;
  669. this.destroyImg([id]);
  670. },
  671. deleteImg(){
  672. if (this.checkData.length <= 0) {
  673. tempTip.setDuration(2000);
  674. tempTip.showSuccess('没有勾选任何记录');
  675. return;
  676. }
  677. if (!confirm('确定要删除所选图片吗?'))return;
  678. this.destroyImg(this.checkData);
  679. },
  680. destroyImg(id){
  681. let _this = this;
  682. axios.post('{{url('waybill/deleteImg')}}',{'ids':id})
  683. .then(function (response) {
  684. if (!response.data.success){
  685. tempTip.setDuration(4000);
  686. tempTip.show("删除失败");
  687. return;
  688. }
  689. id.forEach(function (id) {
  690. _this.waybills.some(function (waybill) {
  691. if (waybill.id===id){
  692. waybill.url='';
  693. return true;
  694. }
  695. });
  696. });
  697. tempTip.setDuration(3000);
  698. tempTip.showSuccess("删除成功!");
  699. }).catch(function (err) {
  700. tempTip.setDuration(4000);
  701. tempTip.show("网络错误:"+err);
  702. });
  703. },
  704. // 运输收费修改
  705. waybillChargeCheck:function (e) {
  706. let target = $(e.target);
  707. target.hide();
  708. let input = target.next();
  709. input.show();
  710. input.focus();
  711. },
  712. // 运输收费失焦事件
  713. updateWaybillCharge:function (e) {
  714. let target = $(e.target);
  715. let _this = this;
  716. let span = target.prev();
  717. let id = target.attr('data_id');
  718. let oldCharge = span.text();
  719. let charge = target.val();
  720. if(charge !== span.text()){
  721. let ajaxUrl= '{{url("apiLocal/waybill/changeCharge")}}';
  722. axios.post(ajaxUrl,{'id':id,'charge':charge}).then(function (response) {
  723. if(response.data.success){
  724. _this.updateWaybill(id,charge);
  725. tempTip.setDuration(2000);
  726. tempTip.showSuccess('运输收费修改成功');
  727. }else{
  728. tempTip.setDuration(3000);
  729. tempTip.show('运输收费修改失败!'+response.data.fail_info);
  730. _this.updateWaybill(id,oldCharge);
  731. }
  732. }).catch(function (err) {
  733. tempTip.setDuration(3000);
  734. tempTip.show('运输收费修改失败!网络异常:'+err);
  735. _this.updateWaybill(id,oldCharge);
  736. });
  737. }
  738. span.show();
  739. target.hide();
  740. },
  741. // 为运单添加运输收费
  742. addWaybillCharge(e){
  743. let target = $(e.target);
  744. target.css('width','85px');
  745. let _this = this;
  746. let id = target.attr('data_id');
  747. let charge = target.val();
  748. console.log(charge);
  749. let ajaxUrl= '{{url("apiLocal/waybill/changeCharge")}}';
  750. if(charge === ''|| charge === null){
  751. target.css('width','75px');
  752. return;
  753. }else{
  754. axios.post(ajaxUrl,{'id':id,'charge':charge}).then(function (response) {
  755. if(response.data.success){
  756. tempTip.setDuration(2000);
  757. tempTip.showSuccess('运输收费添加成功');
  758. _this.updateWaybill(id,charge);
  759. }else{
  760. tempTip.setDuration(3000);
  761. tempTip.show('运输收费添加失败!'+response.data.fail_info);
  762. }
  763. }).catch(function (err) {
  764. tempTip.setDuration(3000);
  765. tempTip.show('运输收费添加失败!网络异常:'+err);
  766. });
  767. target.css('width','75px');
  768. }
  769. },
  770. // 修改运输收费更新表格数据
  771. updateWaybill(id,newCharge){
  772. this.waybills.some(function(waybill){
  773. if(waybill.id === id){
  774. waybill.charge = newCharge;
  775. return true;
  776. }
  777. })
  778. },
  779. // 运费修改
  780. waybillFeeCheck:function (e) {
  781. let target = $(e.target);
  782. target.hide();
  783. let input = target.next();
  784. input.show();
  785. input.focus();
  786. },
  787. // 失焦事件
  788. updateWaybillFee:function (e) {
  789. let target = $(e.target);
  790. let _this = this;
  791. let span = target.prev();
  792. let id = target.attr('data_id');
  793. let oldFee = span.text();
  794. let fee = target.val();
  795. if(fee !== span.text()){
  796. let ajaxUrl= '{{url("apiLocal/waybill/changeFee")}}';
  797. axios.post(ajaxUrl,{'id':id,'fee':fee}).then(function (response) {
  798. if(response.data.success){
  799. _this.updateWaybills(id,fee);
  800. tempTip.setDuration(2000);
  801. tempTip.showSuccess('运单运费修改成功');
  802. }else{
  803. tempTip.setDuration(3000);
  804. tempTip.show('运单运费修改失败!'+response.data.fail_info);
  805. _this.updateWaybills(id,oldFee);
  806. }
  807. }).catch(function (err) {
  808. tempTip.setDuration(3000);
  809. tempTip.show('运单运费修改失败!网络异常:'+err);
  810. _this.updateWaybills(id,oldFee);
  811. });
  812. }
  813. span.show();
  814. target.hide();
  815. },
  816. // 为直发车运单添加运费
  817. addWaybillFee(e){
  818. let target = $(e.target);
  819. target.css('width','85px');
  820. let _this = this;
  821. let id = target.attr('data_id');
  822. let fee = target.val();
  823. let ajaxUrl= '{{url("apiLocal/waybill/changeFee")}}';
  824. if(fee === ''|| fee === null){
  825. target.css('width','75px');
  826. return;
  827. }else{
  828. axios.post(ajaxUrl,{'id':id,'fee':fee}).then(function (response) {
  829. if(response.data.success){
  830. tempTip.setDuration(2000);
  831. tempTip.showSuccess('运单运费添加成功');
  832. _this.updateWaybills(id,fee);
  833. }else{
  834. tempTip.setDuration(3000);
  835. tempTip.show('运单运费添加失败!'+response.data.fail_info);
  836. }
  837. }).catch(function (err) {
  838. tempTip.setDuration(3000);
  839. tempTip.show('运单运费添加失败!网络异常:'+response.data.fail_info);
  840. });
  841. target.css('width','75px');
  842. }
  843. },
  844. // 更新表格数据
  845. updateWaybills(id,newFee){
  846. this.waybills.some(function(waybill){
  847. if(waybill.id === id){
  848. waybill.fee = newFee;
  849. return true;
  850. }
  851. })
  852. },
  853. // 置顶操作
  854. waybillOnTop:function(e){
  855. let target = $(e.target);
  856. let id = target.attr('data_id');
  857. $("#onTopId").val(id);
  858. $('#exampleModal').modal('show');
  859. },
  860. submitOnTop:function(){
  861. let ajaxUrl = '{{url('waybill/ontop/top')}}';
  862. let remark = $("#remark").val();
  863. let id = $("#onTopId").val();
  864. if(remark === ''){
  865. $("#remark").focus();
  866. $('#remark').addClass('is-invalid');
  867. }else{
  868. axios.post(ajaxUrl,{'id':id,'detail':remark}).then(function (response) {
  869. if(response.data.success){
  870. tempTip.setDuration(3000);
  871. tempTip.showSuccess('置顶成功');
  872. $('#exampleModal').modal('hide');
  873. setTimeout(function(){
  874. window.location.reload();
  875. }
  876. ,1000);
  877. }else{
  878. tempTip.setDuration(3000);
  879. tempTip.show('置顶失败!'+response.fail_info);
  880. }
  881. }).catch(function (err) {
  882. tempTip.setDuration(3000);
  883. tempTip.show('置顶失败,网络连接错误!'+err);
  884. });
  885. }
  886. },
  887. changeRemark:function(){
  888. $('#remark').removeClass('is-invalid');
  889. },
  890. cancelOnTop:function (e) {
  891. let target = $(e.target);
  892. let id = target.attr('data_id');
  893. let ajaxUrl='{{url('waybill/ontop/cancel')}}';
  894. if(id !== null){
  895. axios.post(ajaxUrl,{'id':id}).then(function (response) {
  896. if(response.data.success){
  897. tempTip.setDuration(30000);
  898. tempTip.showSuccess('取消置顶成功');
  899. setTimeout(function(){
  900. window.location.reload();
  901. }
  902. ,1000);
  903. }else{
  904. tempTip.setDuration(3000);
  905. tempTip.show('取消置顶失败!'+response.fail_info);
  906. }
  907. }).catch(function (err) {
  908. tempTip.setDuration(3000);
  909. tempTip.show('取消置顶失败,网络连接错误!'+err);
  910. });
  911. }
  912. },
  913. hidetop:function(e) {
  914. let target = $(e.target);
  915. let top = target.parent().find('.top');
  916. let tip = target.parent().find('.toptd');
  917. top.hide();
  918. tip.tooltip('show');
  919. },
  920. showtop:function(e){
  921. let target = $(e.target);
  922. let top = target.parent().find('.top');
  923. let tip = target.parent().find('.toptd');
  924. top.show();
  925. tip.tooltip('hide');
  926. },
  927. refreshWaveHouseWeight(wms_bill_number) {
  928. let _this=this;
  929. let url='{{url('waybill/refreshWaveHouseWeight')}}';
  930. axios.post(url,{'wms_bill_number':wms_bill_number}).then(function (response) {
  931. if(response.data.success){
  932. _this.waybills.every(function (waybill) {
  933. if (waybill.wms_bill_number==wms_bill_number){
  934. waybill.warehouse_weight_other=response.data.warehouseWeight;
  935. return false;
  936. }
  937. return true;
  938. });
  939. tempTip.setDuration(3000);
  940. tempTip.showSuccess('刷新计重成功');
  941. }else{
  942. tempTip.setDuration(3000);
  943. tempTip.show('刷新计重失败!'+response.data.fail_info);
  944. }
  945. }).catch(function (err) {
  946. tempTip.setDuration(3000);
  947. tempTip.show('刷新计重失败,网络连接错误!'+err);
  948. });
  949. }
  950. },
  951. filters:{
  952. km:function(value){
  953. if(!value)return '';
  954. return value + ' km';
  955. },
  956. money:function(value){
  957. if(value.indexOf('.')>0){
  958. return value
  959. }
  960. return value += '.00';
  961. },
  962. filterZero:function(value){
  963. value=value.replace(/\.00$/,'');
  964. value=value.replace(/(\.[1-9])0$/,'$1');
  965. return value;
  966. },
  967. }
  968. });
  969. // modal 隐藏时修改 input 为空
  970. $("#exampleModal").on('hide.bs.modal',function(e){
  971. $('#remark').val('');
  972. });
  973. </script>
  974. @endsection