index.blade.php 62 KB

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