delivering.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. @extends('layouts.app')
  2. @section('title')发运-运输管理@endsection
  3. @section("head")<link href="{{ mix('css/animation.css') }}" rel="stylesheet">@endsection
  4. @section('content')
  5. <div id="list" class="d-none container-fluid mt-2">
  6. @include("transport.waybill._dailyBillingApp")
  7. <div class="card" v-for="(item,date) in groups">
  8. <div class="card-header p-1 row" >
  9. <div class="text-center" :class="slideStatus[date] ? 'col-8' : 'col-12'" @click="selectedHeader(date)" @touchstart="startSlide()" @touchend="endSlide(date)">
  10. @{{ date }}<i class="fa mr-2 pull-right" style="top: 2em" :class="header[date] ? 'fa-angle-down' : 'fa-angle-right'"></i>
  11. </div>
  12. <div class="col-4 p-0" :class="slideStatus[date] ? '' : 'd-none'">
  13. <span class="btn btn-sm btn-success w-100" v-if="!item.pick_up_fee_total" @click="dailyBillingApp(date)">按日输入专线费</span>
  14. <span class="text-info w-100 small" v-else>专线费:
  15. <span class="font-weight-bold">@{{ item.pick_up_fee_total }}</span>
  16. <span class="btn btn-sm btn-info text-white" @click="dailyBillingApp(date)">修改</span>
  17. </span>
  18. </div>
  19. </div>
  20. <div class="card-body p-0" v-if="header[date]">
  21. <div class="w-100 h-100 d-inline-block text-center" v-if="loadAnimation[date]">
  22. <i class="fa fa-spinner fa-pulse"></i>
  23. </div>
  24. <div v-else v-for="waybill in item.waybills" class="w-100 border border-1" style="filter:grayscale(30%); " :id="'waybill-'+waybill.id">
  25. <div :style="waybill.status!=='已完结'?'background-color:#f6eee8':''" class="mt-3">
  26. <div style="transform:scale(0.9);color:#783000" class="pl-0">
  27. <span class="mr-3 text-nowrap">日期:@{{ waybill.deliver_at }}</span>
  28. <span class="mr-3 text-nowrap">承运商:@{{ waybill.carrier_name }}</span>
  29. <span class="mr-3 text-nowrap">宝时运单号:@{{ waybill.waybill_number }}<br></span>
  30. <span class="mr-3 text-nowrap">目的地:@{{ waybill.address }}<br></span>
  31. <span class="mr-3 text-nowrap">收货人:@{{ waybill.recipient }}</span>
  32. <span class="mr-3 text-nowrap">提货仓:@{{ waybill.origination }}</span>
  33. <span class="mr-3 text-nowrap">预估重量:<span v-if="waybill.warehouse_weight_other">@{{ waybill.warehouse_weight_other }} @{{ waybill.warehouse_weight_unit_other_name }}</span></span>
  34. <span class="mr-3 text-nowrap">预估体积:<span v-if="waybill.warehouse_weight">@{{ waybill.warehouse_weight }} @{{ waybill.warehouse_weight_unit_name }}</span></span>
  35. </div>
  36. </div>
  37. <div style="background-color:#e8eef6" class="mb-3">
  38. <div style="transform:scale(0.9);color:#02346a" class="pl-0 form-inline">
  39. <div class="mr-3 text-nowrap form-inline">
  40. <label :for="'carrier_bill'+waybill.id">专线运单号:</label>
  41. <input :id="'carrier_bill'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid':''"
  42. v-if="waybill.isBtn || updatePool[waybill.id]" type="text" v-model="waybill.carrier_bill"
  43. class="form-control form-control-sm " @click="enlarge($event)" style="width: 50px">
  44. <span v-else class="text-muted">@{{ waybill.carrier_bill }}</span>
  45. </div>
  46. <div class="mr-3 text-nowrap form-inline">
  47. <label :for="'inquire_tel'+waybill.id">查&nbsp;件&nbsp;电&nbsp;&nbsp;话:</label>
  48. <input :id="'inquire_tel'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid':''"
  49. v-if="waybill.isBtn || updatePool[waybill.id]" v-model="waybill.inquire_tel" @click="enlarge($event)"
  50. class="form-control form-control-sm" type="text" style="width:50px">
  51. <span v-else class="text-muted">@{{ waybill.inquire_tel }}</span>
  52. </div>
  53. <div class="mr-3 text-nowrap form-inline">
  54. <label :for="'amount'+waybill.id">数量:</label>
  55. <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
  56. <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&(errors['_'+waybill.id].amount || errors['_'+waybill.id].amount_unit_name)?'is-invalid':''"
  57. v-model="waybill.amount" @click="enlarge($event)"
  58. class="form-control" type="text" style="width:50px">
  59. <span class="input-group-append">
  60. <span class="input-group-text">
  61. <span class="custom-control custom-radio">
  62. <input :name="'radio-'+waybill.id" type="radio" class="custom-control-input" :id="'radio-one'+waybill.id" v-model="waybill.amount_unit_name" value="件"/>
  63. <label class="custom-control-label" :for="'radio-one'+waybill.id">件</label>
  64. </span>
  65. <span class="custom-control custom-radio">
  66. <input :name="'radio-'+waybill.id" type="radio" class="custom-control-input" :id="'radio-two'+waybill.id" v-model="waybill.amount_unit_name" value="托"/>
  67. <label class="custom-control-label" :for="'radio-two'+waybill.id">托</label>
  68. </span>
  69. </span>
  70. </span>
  71. </div>
  72. <span v-else class="text-muted"><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
  73. </div>
  74. <div class="mr-3 text-nowrap form-inline">
  75. <label :for="'carrier_weight_other'+waybill.id">重量:</label>
  76. <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
  77. <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid':''"
  78. v-model="waybill.carrier_weight_other" @click="enlarge($event)"
  79. type="number" step="0.01" min="0" class="form-control" style="width:50px">
  80. <span class="input-group-append">
  81. <span class="input-group-text">KG</span>
  82. </span>
  83. </div>
  84. <span v-else class="text-muted">@{{ waybill.carrier_weight_other }}</span>
  85. </div>
  86. <div class="mr-3 text-nowrap form-inline">
  87. <label :for="'carrier_weight'+waybill.id">体积:</label>
  88. <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
  89. <input :id="'carrier_weight'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid':''"
  90. v-model="waybill.carrier_weight" @click="enlarge($event)"
  91. type="number" step="0.01" min="0" class="form-control" style="width:50px">
  92. <span class="input-group-append">
  93. <span class="input-group-text">M³</span>
  94. </span>
  95. </div>
  96. <span v-else class="text-muted">@{{ waybill.carrier_weight }}</span>
  97. </div>
  98. <div class="mr-3 text-nowrap form-inline" v-if="!waybill.isBtn">
  99. <label :for="'subjoin_fee'+waybill.id">附加费:</label>
  100. <div class="input-group input-group-sm">
  101. <input :id="'subjoin_fee'+waybill.id" :value="waybill.subjoin_fee"
  102. class="form-control" style="width:150px">
  103. </div>
  104. </div>
  105. <span class="mr-3 text-nowrap">
  106. <button class="btn btn-sm btn-outline-success" type="button" @click="submit(date,waybill)">提交</button>
  107. <button v-if="!waybill.isBtn && !updatePool[waybill.id]" class="btn btn-sm btn-outline-info" @click="$set(updatePool,waybill.id,true);">修改</button>
  108. </span>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="bg-white w-100 row" id="searchBlock" style="position: fixed;top:0;left:0;
  115. width: 100%; text-align: center; border-radius: 3px;">
  116. <div class="position-relative offset-2 col-9 mt-3 mb-3">
  117. <input class="form-control form-control-sm w-100 rounded-pill" @keydown.enter="searchSubmit()" v-model="searchText" type="text" placeholder="运单号 物流单号"></input>
  118. <a id="search" v-bind:href="'{{url('transport/waybill/delivering?searchText=')}}'+searchText"><button type="button" class="border btn btn-sm btn-primary text-white rounded-pill position-absolute" style="top: 0;right: 12px;">搜索</button></a>
  119. </div>
  120. </div>
  121. </div>
  122. @endsection
  123. @section('lastScript')
  124. <style>
  125. .color1{background-color: #FFA07A}
  126. .color2{background-color: cornflowerblue}
  127. </style>
  128. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  129. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>{{--新版2--}}
  130. <script>
  131. new Vue({
  132. el:"#list",
  133. data:{
  134. groups:{
  135. @foreach($groups as $group)
  136. "{{$group->date}}": {waybills:[],pick_up_fee_total:'{{$group->pick_up_fee_total ? round($group->pick_up_fee_total) : ''}}'},
  137. @endforeach
  138. },
  139. header:{},
  140. errors:{},
  141. loadAnimation:{},
  142. searchText:"{{$searchText}}",
  143. lastHeight:"",
  144. updatePool:{},
  145. coordinate:{},
  146. slideStatus:{},
  147. dailyBilling:{screenDate:'', billing:''},
  148. error:{screenDate:'', billing:''},
  149. },
  150. mounted:function(){
  151. $(".tooltipTarget").tooltip({'trigger':'hover'});
  152. if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
  153. this.pageInit();
  154. $("#list").removeClass('d-none');
  155. },
  156. methods:{
  157. startSlide(){
  158. this.coordinate.x = event.touches[0].pageX;
  159. this.coordinate.y = event.touches[0].pageY;
  160. },
  161. endSlide(date){
  162. let x = event.changedTouches[0].pageX - this.coordinate.x;
  163. let y = event.changedTouches[0].pageY - this.coordinate.y;
  164. if (Math.abs(x) > Math.abs(y)) {
  165. if (x>0)this.lToR(date,event.target);
  166. else this.rToL(date,event.target);
  167. }
  168. },
  169. rToL(date,element){
  170. if (this.slideStatus[date])return;
  171. element.classList.add('translationRtoL');
  172. setTimeout(()=>{
  173. element.classList.remove('translationRtoL');
  174. this.$set(this.slideStatus,date,true);
  175. },300);
  176. },
  177. lToR(date,element){
  178. if (!this.slideStatus[date])return;
  179. element.classList.add('translationLtoR');
  180. setTimeout(()=>{
  181. element.classList.remove('translationLtoR');
  182. this.$set(this.slideStatus,date,false);
  183. },300);
  184. },
  185. selectedHeader(date){
  186. if (this.header[date]===undefined)this.loadData(date);
  187. if (this.header[date])this.$set(this.header,date,!this.header[date])
  188. else this.$set(this.header,date,true);
  189. },
  190. listener(){
  191. window.addEventListener('scroll', ()=>{
  192. let clientHeight = document.documentElement.clientHeight;
  193. let scrollTop = document.body.scrollTop;
  194. let scrollHeight = document.body.scrollHeight;
  195. if (clientHeight+scrollTop >= scrollHeight-500) {
  196. setTimeout(()=>{
  197. if (this.lastHeight===scrollHeight)return;
  198. this.loadData();
  199. this.lastHeight=scrollHeight;
  200. });
  201. }
  202. }, false);
  203. },
  204. loadData(date){
  205. this.$set(this.loadAnimation,date,true);
  206. window.tempTip.postBasicRequest("{{url('transport/waybill/loadData')}}",{searchText:this.searchText,lastId:this.lastId,date:date},res=>{
  207. this.$set(this.loadAnimation,date,false);
  208. if(!res || res.length<1)return;
  209. let waybills = [];
  210. res.forEach(waybill=>{
  211. waybills.push({
  212. id:waybill.id,
  213. deliver_at:waybill.deliver_at,
  214. waybill_number:waybill.waybill_number,
  215. origination:waybill.origination,
  216. carrier_bill:waybill.carrier_bill,
  217. warehouse_weight:waybill.warehouse_weight,
  218. carrier_weight:waybill.carrier_weight,
  219. warehouse_weight_other:waybill.warehouse_weight_other,
  220. carrier_weight_other:waybill.carrier_weight_other,
  221. status:waybill.status,
  222. amount:waybill.amount,
  223. amount_unit_name:waybill.amount_unit ? waybill.amount_unit.name : '',
  224. inquire_tel:waybill.inquire_tel,
  225. carrier_name:waybill.logistic ? waybill.logistic.name : '',
  226. isBtn:!!!waybill.carrier_bill,
  227. subjoin_fee:waybill.subjoin_fee,
  228. recipient:waybill.order ? waybill.order.consignee_name : waybill.recipient,
  229. address:waybill.order ? waybill.order.province+waybill.order.city+waybill.order.district : waybill.destination,
  230. });
  231. });
  232. this.groups[date].waybills = waybills;
  233. });
  234. },
  235. searchSubmit(){
  236. document.getElementById("search").click();
  237. },
  238. //页面初始化
  239. pageInit(){
  240. if (!this.isAndroid)return;
  241. let element = document.getElementById("navbarSupportedContent").parentElement;
  242. element.className = "row";
  243. element.children[0].className += " col-5";
  244. element.children[0].href = "#";
  245. element.innerHTML = element.children[0].outerHTML;
  246. let e1 = document.getElementById("menu");
  247. let e2 = document.getElementById("demand-div");
  248. //let e3 = document.getElementsByClassName("navbar");
  249. if (e1)e1.remove();
  250. if (e2)e2.remove();
  251. //if (e3.length>0)e3[0].remove();
  252. element = document.getElementById("container");
  253. if (element)element.style.height = (window.innerHeight-100)+"px";
  254. },
  255. enlarge(e){
  256. e.target.style.width="150px";
  257. },
  258. shrink(e){
  259. e.target.style.width="50px";
  260. },
  261. appendSubjoinFee(date,waybillId){
  262. let subjoinFee = $("#subjoin_fee"+waybillId).val();
  263. if (!subjoinFee)return;
  264. window.tempTip.postBasicRequest("{{url('transport/waybill/appendSubjoinFee')}}",{subjoinFee:subjoinFee,id:waybillId},()=>{
  265. this.groups[date].waybills.some((waybill,index)=>{
  266. if (waybill.id===waybillId){
  267. this.$set(this.groups[date].waybills[index],"subjoin_fee",subjoinFee);
  268. return true;
  269. }
  270. });
  271. return !this.updatePool[waybillId] ? "附加费添加成功" : '';
  272. });
  273. },
  274. submit(date,waybill){
  275. if(!waybill.isBtn){this.appendSubjoinFee(date,waybill.id);if (!this.updatePool[waybill.id])return;}
  276. window.tempTip.confirm("确定要提交调配信息吗?",()=>{
  277. let data={
  278. id : waybill.id,
  279. carrier_bill : waybill.carrier_bill,
  280. inquire_tel : waybill.inquire_tel,
  281. amount : waybill.amount,
  282. carrier_weight : waybill.carrier_weight,
  283. carrier_weight_other : waybill.carrier_weight_other,
  284. amount_unit_name : waybill.amount_unit_name
  285. };
  286. axios.post("{{url('transport/waybill/storeCarrierBill')}}",data)
  287. .then(response=>{
  288. if (response.data.error){
  289. tempTip.setDuration(3000);
  290. tempTip.show(response.data.error);
  291. return;
  292. }
  293. if (response.data.errors){
  294. let key = "_"+data['id']
  295. let errors = {};
  296. errors[key] = response.data.errors;
  297. this.errors = errors;
  298. return;
  299. }
  300. waybill.isBtn=false;
  301. tempTip.setDuration(2000);
  302. if (this.updatePool[waybill.id]){
  303. tempTip.showSuccess('修改成功!');this.$set(this.updatePool,waybill.id,false);
  304. }else tempTip.showSuccess('录入成功!');
  305. }).catch(function (err) {
  306. tempTip.setDuration(3000);
  307. tempTip.show('网络异常:'+err);
  308. });
  309. })
  310. },
  311. dailyBillingApp(date){
  312. $('#dailyBillingApp').modal('show');
  313. this.dailyBilling.screenDate=date;
  314. },
  315. dailyBillingCountApp(){
  316. if (this.dailyBilling.billing==='')this.error.billing='专线费必填';
  317. if (this.dailyBilling.billing && this.dailyBilling.screenDate)this.error={};
  318. if (this.error.billing || this.error.screenDate)return;
  319. let url = '{{url('transport/waybill/dailyBilling')}}';
  320. let param=this.dailyBilling;
  321. window.axios.post(url,{param:param})
  322. .then(response=> {
  323. if (!response.data.success){
  324. $('#dailyBillingApp').modal('hide');
  325. this.dailyBilling.billing='';
  326. this.error={};
  327. this.$forceUpdate();
  328. tempTip.setDuration(3000);
  329. tempTip.show(response.data.message);
  330. }else{
  331. this.groups[this.dailyBilling.screenDate].pick_up_fee_total=this.dailyBilling.billing;
  332. $('#dailyBillingApp').modal('hide');
  333. this.dailyBilling={};
  334. this.error={};
  335. this.$forceUpdate();
  336. tempTip.setDuration(3000);
  337. tempTip.showSuccess('按日输入专线费成功')
  338. }
  339. }
  340. ).catch(function (err){
  341. tempTip.setDuration(3000);
  342. tempTip.show('按日输入专线费失败,网络连接错误!'+err)
  343. })
  344. },
  345. }
  346. });
  347. </script>
  348. @endsection