index.blade.php 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. @extends('layouts.app')
  2. @section('title')运输管理@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('waybill.menu')
  6. @endcomponent
  7. <div class="container-fluid nav3">
  8. <div class="card menu-third" >
  9. <ul class="nav nav-pills">
  10. @can('运输管理-查询')
  11. <li class="nav-item">
  12. <a class="nav-link" href="{{url('waybill/index')}}" :class="{active:isActive('',3)}">全部</a>
  13. </li> @endcan
  14. @can('运输管理-查询')
  15. <li class="nav-item">
  16. <a class="nav-link" href="{{url('waybill/index/ZX')}}" :class="{active:isActive('ZX',3)}">专线</a>
  17. </li> @endcan
  18. @can('运输管理-查询')
  19. <li class="nav-item">
  20. <a class="nav-link" href="{{url('waybill/index/ZF')}}" :class="{active:isActive('ZF',3)}">直发车</a>
  21. </li> @endcan
  22. </ul>
  23. </div>
  24. </div>
  25. </div>
  26. <div class="container-fluid" style="min-width: 1500px;">
  27. <div class="d-none" id="list">
  28. <form method="GET" action="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif" id="optionSubmit">
  29. <table class="table table-sm table-bordered text-nowrap mb-0" style="background: #fff;">
  30. <tr v-if="isBeingFilterConditions">
  31. <td colspan="4"><div class="col" style="padding:0">
  32. <a href="@if($uriType=='ZF'){{url('waybill/index/ZF')}}@elseif($uriType=='ZX'){{url('waybill/index/ZX')}}@else{{url('waybill/index')}}@endif"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
  33. </div>
  34. </td>
  35. </tr>
  36. <tr>
  37. <td colspan="6">
  38. <select name="paginate" v-model="filterData.paginate" @change="setPaginate" class="form-control-sm" style="vertical-align: middle">
  39. <option value="50">每页显示50行</option>
  40. <option value="100">每页显示100行</option>
  41. <option value="200">每页显示200行</option>
  42. <option value="500">每页显示500行</option>
  43. <option value="1000">每页显示1000行</option>
  44. </select>
  45. </td>
  46. </tr>
  47. <tr >
  48. <td >
  49. <select name="owner_id" v-model="filterData.owner_id" class="form-control-sm " @change="setOwner" style="vertical-align: middle" :class="filterData.owner_id?'bg-warning':''">
  50. <option value="" selected>货主</option>
  51. @foreach($owners as $owner)
  52. <option value="{{$owner->id}}">{{$owner->name}}</option>
  53. @endforeach
  54. </select></td>
  55. <td >
  56. <select name="carrier_id" v-model="filterData.carrier_id" class="form-control-sm " @change="setCarrier" style="vertical-align: middle" :class="filterData.carrier_id?'bg-warning':''">
  57. <option value="" selected>承运商</option>
  58. @foreach($carriers as $carrier)
  59. <option value="{{$carrier->id}}">{{$carrier->name}}</option>
  60. @endforeach
  61. </select></td>
  62. <td >
  63. <input type="text" title="运单号:支持15内模糊搜索与15天外精确搜索" name="waybill_number" placeholder="运单号"
  64. class="form-control-sm tooltipTarget" v-model="filterData.waybill_number" style="vertical-align: middle" :class="filterData.waybill_number?'bg-warning':''"></td>
  65. <td >
  66. <input type="text" title="承运商单号:支持15内模糊搜索与15天外精确搜索" name="carrier_bill" placeholder="承运商单号"
  67. class="form-control-sm tooltipTarget" v-model="filterData.carrier_bill" style="vertical-align: middle" :class="filterData.carrier_bill?'bg-warning':''"></td>
  68. <td width="50%"></td>
  69. </tr>
  70. <tr>
  71. <td >
  72. <input type="text" title="WMS单号:支持15内模糊搜索与15天外精确搜索" name="wms_bill_number" placeholder="WMS单号"
  73. class="form-control-sm tooltipTarget" v-model="filterData.wms_bill_number" style="vertical-align: middle" :class="filterData.wms_bill_number?'bg-warning':''"></td>
  74. <td style="width: 500px"><div>
  75. <input type="text" title="始发地:支持15内模糊搜索与15天外精确搜索" name="origination" placeholder="始发地"
  76. class="form-control-sm tooltipTarget" v-model="filterData.origination" style="vertical-align: middle" :class="filterData.origination?'bg-warning':''">
  77. <input type="text" title="目的地:支持15内模糊搜索与15天外精确搜索" style="vertical-align: middle" placeholder="目的地"
  78. name="destination" class="form-control-sm tooltipTarget" v-model="filterData.destination" :class="filterData.destination?'bg-warning':''"></div></td>
  79. <td style="width: 500px"><div>
  80. <input type="date" name="created_at_start" class="form-control-sm tooltipTarget" title="选择显示指定日期的起始时间"
  81. v-model="filterData.created_at_start" :class="filterData.created_at_start?'bg-warning':''">
  82. <input type="date" class="form-control-sm tooltipTarget" name="created_at_end" title="选择显示指定日期的结束时间"
  83. v-model="filterData.created_at_end" :class="filterData.created_at_end?'bg-warning':''"></div></td>
  84. <td>
  85. <select name="status" v-model="filterData.status" @change="setState" class="form-control-sm" style="vertical-align: middle" :class="filterData.status?'bg-warning':''">
  86. <option value="" selected>运单状态</option>
  87. <option value="未审核">未审核</option>
  88. <option value="已审核">待调度</option>
  89. <option value="待终审">待终审</option>
  90. <option value="已完结">已完结</option>
  91. </select>
  92. <input hidden type="submit">
  93. </td>
  94. <td></td>
  95. </tr>
  96. <tr>
  97. <td colspan="6">
  98. <span class="dropdown">
  99. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData>0?'btn-dark text-light':'']"
  100. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
  101. 导出Excel
  102. </button>
  103. <div class="dropdown-menu">
  104. <a class="dropdown-item" @click="waybillExport(1)" href="javascript:">导出勾选内容</a>
  105. <a class="dropdown-item" @click="waybillExport(2)" href="javascript:">导出所有页</a>
  106. </div>
  107. </span>
  108. </td>
  109. </tr>
  110. </table>
  111. </form>
  112. <div>
  113. @if(Session::has('successTip'))
  114. <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
  115. @endif
  116. </div>
  117. <table class="table table-striped table-sm table-bordered table-hover text-nowrap waybill-table" style="background: #fff;">
  118. <tr>
  119. <th class="table-header-layer-1" :colspan="elementCount('th.td-operation')"></th>
  120. <th class="table-header-layer-1" :colspan="elementCount('th.td-bill')"><span class="fa fa-file-text-o"></span> 运单信息</th>
  121. <th class="table-header-layer-1" :colspan="elementCount('th.td-transit')"><span class="fa fa-truck"></span> 运输信息</th>
  122. <th class="table-header-layer-1" :colspan="elementCount('th.td-fee')"><span class="fa fa-rmb"></span> 费用信息</th>
  123. </tr>
  124. <tr>
  125. <th class="td-operation">
  126. <label for="all">
  127. <input id="all" type="checkbox" @click="checkAll($event)">全选
  128. </label>
  129. </th>
  130. @can('运输管理-编辑','运输管理-运单审核','运输管理-调度','运输管理-编辑','运输管理-删除')
  131. <th class="td-operation">操作</th>
  132. @endcan
  133. <th class="td-operation">状态</th>
  134. <th class="td-bill">ID</th>
  135. <th class="td-bill">创建时间</th>
  136. <th class="td-bill">运单类型</th>
  137. <th class="td-bill">货主</th>
  138. <th class="td-bill">上游单号</th>
  139. <th class="td-bill">WMS订单号</th>
  140. <th class="td-bill">运单号</th>
  141. <th class="td-transit">收件人</th>
  142. <th class="td-transit">收件人电话</th>
  143. <th class="td-transit">始发地</th>
  144. <th class="td-transit">目的地</th>
  145. <th class="td-transit">承运商</th>
  146. <th class="td-transit">单号/车型</th>
  147. <th class="td-transit">仓库计抛</th>
  148. <th class="td-transit">承运商计抛</th>
  149. <th class="td-transit">仓库计重</th>
  150. <th class="td-transit">承运商计重</th>
  151. <th class="td-fee">运费</th>
  152. <th class="td-fee">提货费</th>
  153. <th class="td-fee">其他费用</th>
  154. <th class="td-fee">调度备注</th>
  155. {{-- <th>WMS单号</th>--}}
  156. {{-- <th>收件人</th>--}}
  157. {{-- <th>收件人电话</th>--}}
  158. {{-- <th>收费(元)</th>--}}
  159. {{-- <th>到付金额(元)</th>--}}
  160. {{-- <th>下单备注</th>--}}
  161. {{-- <th>运单审核人</th>--}}
  162. {{-- <th>商品列表</th>--}}
  163. {{-- <th>始发市</th>--}}
  164. {{-- <th>目的市</th>--}}
  165. {{-- <th>车辆信息</th>--}}
  166. {{-- <th>调度审核人</th>--}}
  167. </tr>
  168. <tr v-for="waybill in waybills" :style="{color:waybill.status=='待重审'?'red':''||waybill.status=='已完结'?'green':''}" :id="'waybill'+waybill.id">
  169. <td>
  170. <input class="checkItem" type="checkbox" :value="waybill.id" v-model="checkData">
  171. </td>
  172. <td>
  173. <span v-if=waybill.status==="未审核"||waybill.status==="待重审">
  174. @can('运输管理-运单审核')
  175. <button class="btn btn-outline-primary btn-sm" @click="waybillAudit(waybill.id,waybill.waybill_number)">审核</button>
  176. @endcan
  177. @can('运输管理-运单编辑')
  178. <button class="btn btn-outline-secondary btn-sm" @click="waybillUpdate(waybill.id)">修改</button>
  179. @endcan
  180. </span>
  181. <span v-if=waybill.status==="已审核">
  182. @can('运输管理-调度')
  183. <button class="btn btn-outline-secondary btn-sm" @click="waybillRetreatAudit(waybill.id,waybill.waybill_number)">取消审核</button>
  184. <button class="btn btn-outline-secondary btn-sm" @click="job(waybill.id)">调度</button>
  185. @endcan
  186. </span>
  187. <span v-if=waybill.status==="待终审">
  188. @can('运输管理-调度审核')
  189. <button class="btn btn-outline-success btn-sm" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">完结</button>
  190. @endcan
  191. @can('运输管理-调度')
  192. <button class="btn btn-outline-secondary btn-sm" @click="job(waybill.id)">改调度</button>
  193. @endcan
  194. </span>
  195. </td>
  196. <td :class="[waybill.status=='已审核'?'text-success':'']">@{{waybill.status}}</td>
  197. <td class="td-bill text-muted">@{{waybill.id}}</td>
  198. <td class="td-bill text-muted">@{{waybill.created_at}}</td>
  199. <td class="td-bill">@{{waybill.type}}</td>
  200. <td class="td-bill">@{{waybill.owner}}</td>
  201. <td class="td-bill">@{{waybill.source_bill}}</td>
  202. <td class="td-bill">@{{waybill.wms_bill_number}}</td>
  203. <td class="td-bill">@{{waybill.waybill_number}}</td>
  204. <td class="td-transit">@{{waybill.recipient}}</td>
  205. <td class="td-transit">@{{waybill.recipient_mobile}}</td>
  206. <td class="td-transit text-muted">@{{waybill.origination}}</td>
  207. <td class="td-transit text-muted">@{{waybill.destination}}</td>
  208. <td class="td-transit">@{{waybill.carrier}}</td>
  209. <td class="td-transit"><span v-if="waybill.type=='专线'">@{{waybill.carrier_bill}}</span>
  210. <span v-if="waybill.type=='直发车'">
  211. <span v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span></span></td>
  212. <td class="td-transit">@{{waybill.warehouse_weight}} @{{waybill.warehouse_weight_unit}}</td>
  213. <td class="td-transit">@{{waybill.carrier_weight}} @{{waybill.carrier_weight_unit}}</td>
  214. <td class="td-transit">@{{waybill.warehouse_weight_other}} @{{waybill.warehouse_weight_unit_other}}</td>
  215. <td class="td-transit">@{{waybill.carrier_weight_other}} @{{waybill.carrier_weight_unit_other}}</td>
  216. @can('运输管理-可见费用项')
  217. <td class="td-fee"><span v-if="waybill.type=='专线'"></span><span v-else>@{{waybill.fee}}</span></td>
  218. <td class="td-fee">@{{waybill.pick_up_fee}}</td>
  219. <td class="td-fee">@{{waybill.other_fee}}</td>
  220. @endcan
  221. <td class="td-fee">@{{waybill.dispatch_remark}}</td>
  222. {{-- <td>@{{waybill.wms_bill_number}}</td>--}}
  223. {{-- <td>@{{waybill.recipient}}</td>--}}
  224. {{-- <td>@{{waybill.recipient_mobile}}</td>--}}
  225. {{-- <td>@{{waybill.charge}}</td>--}}
  226. {{-- <td>@{{waybill.collect_fee}}</td>--}}
  227. {{-- <td>@{{waybill.ordering_remark}}</td>--}}
  228. {{-- <td><span v-for="waybillAuditLog in waybill.waybillAuditLogs" v-if=waybillAuditLog.audit_stage==="运单阶段">@{{waybillAuditLog.user.name}}</span></td>--}}
  229. {{-- <td ><u style="user-select: none;cursor:pointer" class="text-primary" v-if="!waybill.isBtn && waybill.wmsCommodities && waybill.wmsCommodities.length>0" @click="showWMSCommodities(waybill.id,waybill.wmsCommodities,waybill.isBtn)">--}}
  230. {{-- 该单有 @{{waybill.wmsCommodities.length}} 件商品,点击展开</u>--}}
  231. {{-- <u style="user-select: none;cursor:pointer" class="text-secondary" v-if="waybill.isBtn" @click="showWMSCommodities(waybill.id,waybill.wmsCommodities,waybill.isBtn)">--}}
  232. {{-- 该单有 @{{waybill.wmsCommodities.length}} 件商品,点击收起</u>--}}
  233. {{-- </td>--}}
  234. {{-- <td>--}}
  235. {{-- <div v-if=waybill.status==="未审核"||waybill.status==="待重审">--}}
  236. {{-- @can('运输管理-运单审核')--}}
  237. {{-- <button class="btn btn-outline-success btn-sm" @click="waybillAudit(waybill.id,waybill.waybill_number)">审核</button>--}}
  238. {{-- @endcan--}}
  239. {{-- @can('运输管理-运单编辑')--}}
  240. {{-- <button class="btn btn-outline-secondary btn-sm" @click="waybillUpdate(waybill.id)">修改</button>--}}
  241. {{-- @endcan--}}
  242. {{-- </div>--}}
  243. {{-- <div v-if=waybill.status==="已审核">--}}
  244. {{-- @can('运输管理-调度')--}}
  245. {{-- <button class="btn btn-outline-secondary btn-sm" @click="waybillRetreatAudit(waybill.id,waybill.waybill_number)">取消审核</button>--}}
  246. {{-- <button class="btn btn-outline-secondary btn-sm" @click="job(waybill.id)">调度</button>--}}
  247. {{-- @endcan--}}
  248. {{-- </div>--}}
  249. {{-- <div v-if=waybill.status==="待终审">--}}
  250. {{-- @can('运输管理-调度审核')--}}
  251. {{-- <button class="btn btn-outline-success btn-sm" @click="waybillEndAudit(waybill.id,waybill.waybill_number)">完结</button>--}}
  252. {{-- @endcan--}}
  253. {{-- @can('运输管理-调度')--}}
  254. {{-- <button class="btn btn-outline-secondary btn-sm" @click="job(waybill.id)">改调度</button>--}}
  255. {{-- @endcan--}}
  256. {{-- </div>--}}
  257. {{-- </td>--}}
  258. {{-- <td>@{{waybill.origination_city}}</td>--}}
  259. {{-- <td>@{{waybill.destination_city}}</td>--}}
  260. {{-- <td>@{{waybill.car_owner_info}}</td>--}}
  261. {{-- <td><span v-for="waybillAuditLog in waybill.waybillAuditLogs" v-if=waybillAuditLog.audit_stage==="调度阶段">@{{waybillAuditLog.user.name}}</span></td>--}}
  262. </tr>
  263. {{-- <tr v-show="wmsCommodities&&wmsCommodities.length>0" id="wmsCommodities">--}}
  264. {{-- <td colspan="15"></td>--}}
  265. {{-- <td colspan="15">--}}
  266. {{-- <table>--}}
  267. {{-- <tr style="background: #9fcdff">--}}
  268. {{-- <th>商品名称</th>--}}
  269. {{-- <th>商品编码</th>--}}
  270. {{-- <th>条码</th>--}}
  271. {{-- <th>数量</th>--}}
  272. {{-- <th>体称</th>--}}
  273. {{-- <th>毛重</th>--}}
  274. {{-- <th>净重</th>--}}
  275. {{-- </tr>--}}
  276. {{-- <tr v-for="wmsCommodity in wmsCommodities">--}}
  277. {{-- <td>@{{ wmsCommodity.SKU_Descr_c }}</td>--}}
  278. {{-- <td>@{{ wmsCommodity.SKU }}</td>--}}
  279. {{-- <td>@{{ wmsCommodity.Alternate_sku1 }}</td>--}}
  280. {{-- <td>@{{ wmsCommodity.Qtyordered_each }}</td>--}}
  281. {{-- <td>@{{ wmsCommodity.Cubic }}</td>--}}
  282. {{-- <td>@{{ wmsCommodity.GrossWeight }}</td>--}}
  283. {{-- <td>@{{ wmsCommodity.NetWeight }}</td>--}}
  284. {{-- </tr>--}}
  285. {{-- </table>--}}
  286. {{-- </td>--}}
  287. {{-- </tr>--}}
  288. </table>
  289. <div class="text-info h5 btn btn">{{$waybills->count()}}/{{$waybills->total()}}</div>
  290. {{$waybills->appends($filterData)->links()}}
  291. </div>
  292. </div>
  293. @endsection
  294. @section('lastScript')
  295. <style>
  296. .waybill_1{background-color: #FFA07A}
  297. .waybill_2{background-color: cornflowerblue}
  298. .waybill_3{background-color: #00FFFF}
  299. </style>
  300. <script>
  301. let vueList=new Vue({
  302. el:'#list',
  303. data:{
  304. waybills:[
  305. @foreach($waybills as $waybill)
  306. {
  307. id:'{{$waybill->id}}',created_at:'{{$waybill->created_at}}',updated_at:'{{$waybill->updated_at}}',
  308. status:'{{$waybill->status}}',type:'{{$waybill->type}}',waybill_number:'{{$waybill->waybill_number}}',
  309. owner:'{{$waybill->owner_name}}',source_bill:'{{$waybill->source_bill}}',wms_bill_number:'{{$waybill->wms_bill_number}}',origination:'{{$waybill->origination}}',
  310. destination:'{{$waybill->destination}}',recipient:'{{$waybill->recipient}}',recipient_mobile:'{{$waybill->recipient_mobile}}',
  311. charge:'{{$waybill->charge}}',ordering_remark:'{{$waybill->ordering_remark}}',carrier:'{{$waybill->carrier_name}}',
  312. carrier_bill:'{{$waybill->carrier_bill}}',origination_city:'{{$waybill->origination_city_name}}',
  313. destination_city:'{{$waybill->destination_city_name}}',warehouse_weight:'{{$waybill->warehouse_weight}}',
  314. warehouse_weight_unit:'{{$waybill->warehouse_weight_unit_name}}',carrier_weight:'{{$waybill->carrier_weight}}',
  315. carrier_weight_unit:'{{$waybill->carrier_weight_unit_name}}',
  316. warehouse_weight_other:'{{$waybill->warehouse_weight_other}}',
  317. warehouse_weight_unit_other:'{{$waybill->warehouse_weight_unit_other_name}}',carrier_weight_other:'{{$waybill->carrier_weight_other}}',
  318. carrier_weight_unit_other:'{{$waybill->carrier_weight_unit_other_name}}',
  319. @if($waybill->carType)carType:{!! $waybill->carType !!},car_owner_info:'{{$waybill->car_owner_info}}',@endif @can('运输管理-可见费用项') fee:'{{$waybill->fee}}',
  320. pick_up_fee:'{{$waybill->pick_up_fee}}',other_fee:'{{$waybill->other_fee}}',
  321. collect_fee:'{{$waybill->collect_fee}}', @endcan dispatch_remark:'{{$waybill->dispatch_remark}}',isBtn:false,
  322. waybillAuditLogs:{!! $waybill->waybillAuditLogs !!}
  323. },
  324. @endforeach
  325. ],
  326. checkData:[],
  327. filterData:
  328. {paginate:'50',waybill_number:''
  329. ,carrier_bill:'',carrier_id:''
  330. ,owner_id:'',wms_bill_number:''
  331. ,created_at_start:'',created_at_end:''
  332. ,type:'',status:'',origination:'',destination:'',},
  333. wmsCommodities:[],
  334. },
  335. computed:{
  336. isBeingFilterConditions:function(){
  337. for(let key in this.filterData){
  338. if(this.filterData[key]){
  339. if(key==='paginate')continue;
  340. return true
  341. }
  342. }
  343. return false;
  344. },
  345. },
  346. watch:{
  347. checkData:{
  348. handler(){
  349. if (this.checkData.length === this.waybills.length){
  350. document.querySelector('#all').checked = true;
  351. }else {
  352. document.querySelector('#all').checked = false;
  353. }
  354. },
  355. deep:true
  356. }
  357. },
  358. mounted:function(){
  359. this.initInputs();
  360. $(".tooltipTarget").tooltip({'trigger':'hover'});
  361. $('#list').removeClass('d-none');
  362. },
  363. methods:{
  364. initInputs:function(){
  365. let data=this;
  366. let uriParts =decodeURI(location.href).split("?");
  367. if(uriParts.length>1){
  368. let params = uriParts[1].split('&');
  369. params.forEach(function(paramPair){
  370. let pair=paramPair.split('=');
  371. let key = pair[0], val = pair[1];
  372. $('input[name="'+key+'"]').val(val);
  373. $('select[name="'+key+'"]').val(val);
  374. decodeURI(data.filterData[key]=val);
  375. });
  376. }
  377. },
  378. waybillAudit(id,waybill_number){
  379. if(!confirm('确定要通过“'+waybill_number+'”的审核吗?')){return};
  380. let _this=this;
  381. let w;
  382. let url = '{{url('waybill/waybillAudit')}}';
  383. axios.post(url, {id:id})
  384. .then(
  385. function (response) {
  386. if (response.data.success){
  387. _this.waybills.forEach(function (waybill) {
  388. if (waybill.id===id){
  389. waybill.status=response.data.status;
  390. waybill.waybillAuditLogs.push(response.data.waybillAuditLog);
  391. w=waybill.waybill_number;
  392. }
  393. });
  394. tempTip.setDuration(3000);
  395. tempTip.showSuccess('审核'+w+'成功!');
  396. }else if (response.data.exception!=null){
  397. tempTip.setDuration(3000);
  398. tempTip.show(response.data.exception);
  399. }else {
  400. tempTip.setDuration(3000);
  401. tempTip.show('审核失败!');
  402. }
  403. }
  404. ).catch(function (err) {
  405. tempTip.setDuration(3000);
  406. tempTip.show('审核失败,网络连接错误!'+err);
  407. });
  408. },
  409. waybillUpdate(id){
  410. location.href="{{url('waybill/waybillEdit')}}/"+id;
  411. },
  412. waybillRetreatAudit(id,waybill_number){
  413. if(!confirm('确定要驳回“'+waybill_number+'”的审核吗?')){return};
  414. let _this=this;
  415. let w;
  416. let url='{{url('waybill/waybillRetreatAudit')}}';
  417. axios.post(url,{id:id})
  418. .then(
  419. function (response) {
  420. if (response.data.success){
  421. _this.waybills.forEach(function (waybill){
  422. if (waybill.id===id){
  423. waybill.status=response.data.status;
  424. waybill.waybillAuditLogs=[];
  425. w=waybill.waybill_number;
  426. }
  427. });
  428. tempTip.setDuration(3000);
  429. tempTip.showSuccess(w+'审核驳回成功!');
  430. }else {
  431. tempTip.setDuration(3000);
  432. tempTip.show('审核驳回失败!');
  433. }
  434. }
  435. ).catch(function (err) {
  436. tempTip.setDuration(3000);
  437. tempTip.show('审核驳回失败,网络连接错误!'+err);
  438. });
  439. },
  440. job(id){
  441. location.href="{{url('waybill')}}/"+id+"/edit";
  442. },
  443. waybillEndAudit(id,waybill_number){
  444. if(!confirm('确定要通过“'+waybill_number+'”的终审吗?')){return};
  445. let _this=this;
  446. let w;
  447. let url='{{url('waybill/waybillEndAudit')}}';
  448. axios.post(url, {id:id})
  449. .then(
  450. function (response) {
  451. if (response.data.success){
  452. _this.waybills.forEach(function (s) {
  453. if (s.id===id){
  454. s.status=response.data.status;
  455. s.waybillAuditLogs.push(response.data.waybillAuditLog);
  456. w=s.waybill_number;
  457. }
  458. });
  459. tempTip.setDuration(3000);
  460. tempTip.showSuccess(w+'终审完毕!');
  461. }else if (response.data.exception!=null){
  462. tempTip.setDuration(3000);
  463. tempTip.show(response.data.exception);
  464. }else {
  465. tempTip.setDuration(3000);
  466. tempTip.show('终审失败!');
  467. }
  468. }
  469. ).catch(function (err) {
  470. tempTip.setDuration(3000);
  471. tempTip.show('终审失败,网络连接错误!'+err);
  472. });
  473. },
  474. setPaginate:function(e){
  475. this.filterData.paginate=e.target.value;
  476. var form = document.getElementById("optionSubmit");
  477. form.submit();
  478. },
  479. setCarrier:function (e){
  480. this.filterData.carrier_id=e.target.value;
  481. var form = document.getElementById("optionSubmit");
  482. form.submit();
  483. },
  484. setOwner:function (e) {
  485. this.filterData.owner_id=e.target.value;
  486. var form = document.getElementById("optionSubmit");
  487. form.submit();
  488. },
  489. setType:function (e) {
  490. this.filterData.type=e.target.value;
  491. var form = document.getElementById("optionSubmit");
  492. form.submit();
  493. },
  494. setState:function (e) {
  495. this.filterData.status=e.target.value;
  496. var form = document.getElementById("optionSubmit");
  497. form.submit();
  498. },
  499. checkAll(e){
  500. if (e.target.checked){
  501. this.waybills.forEach((el,i)=>{
  502. if (this.checkData.indexOf(el.id) == '-1'){
  503. this.checkData.push(el.id);
  504. }
  505. });
  506. }else {
  507. this.checkData = [];
  508. }
  509. },
  510. waybillExport(e){
  511. let val=e;
  512. let data=this.filterData;
  513. if (val==1) {
  514. if (this.checkData.length <= 0) {
  515. tempTip.setDuration(4000);
  516. tempTip.showSuccess('没有勾选任何记录');
  517. } else {
  518. location.href = "{{url('waybillExport')}}/" + this.checkData;
  519. }
  520. }else {
  521. location.href = "{{url('waybillExport/-1?waybill_number=')}}"+
  522. data.waybill_number+"&carrier_bill="+data.carrier_bill+
  523. "&carrier_id="+data.carrier_id+"&owner_id="+data.owner_id+
  524. "&wms_bill_number="+data.wms_bill_number+"&created_at_start="+
  525. data.created_at_start+"&created_at_end="+data.created_at_end+
  526. "&type="+data.type+"&status="+data.status+"&origination="+data.origination+
  527. "&destination="+data.destination;
  528. }
  529. },
  530. //展开收起商品列表
  531. showWMSCommodities(id,wmsCommodities,isBtn){
  532. if (!isBtn){
  533. this.wmsCommodities=wmsCommodities;
  534. $("#waybill"+id).after($("#wmsCommodities"));
  535. this.waybills.forEach(function (waybill) {
  536. if (waybill.id!==id&&waybill.isBtn){
  537. waybill.isBtn=false;
  538. }
  539. if (waybill.id===id){
  540. waybill.isBtn=true;
  541. }
  542. });
  543. return;
  544. }
  545. if (isBtn){
  546. this.wmsCommodities=[];
  547. this.waybills.every(function (waybill) {
  548. if (waybill.id===id){
  549. waybill.isBtn=false;
  550. return false;
  551. }
  552. return true;
  553. });
  554. }
  555. },
  556. elementCount:function(elementName){
  557. return $(elementName).length;
  558. }
  559. },
  560. });
  561. </script>
  562. @endsection