instantBill.blade.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. @extends('layouts.app')
  2. @section('title')即时账单-客户管理@endsection
  3. @section('content')
  4. @component('finance.menu')@endcomponent
  5. <div class="container-fluid d-none" id="container">
  6. <div class="container-fluid nav3">
  7. <div class="card menu-third">
  8. <ul class="nav nav-pills">
  9. <li class="nav-item">
  10. <a target="customer/finance/instantBill" class="nav-link" href="{{url('finance/instantBill')}}" :class="!thisType ? 'active' : ''">全部</a>
  11. </li>
  12. <li class="nav-item">
  13. <a target="customer/finance/instantBill" class="nav-link" href="{{url('finance/instantBill?type=发货')}}" :class="thisType=='发货' ? 'active' : ''">发货</a>
  14. </li>
  15. <li class="nav-item">
  16. <a target="customer/finance/instantBill" class="nav-link" href="{{url('finance/instantBill?type=收货')}}" :class="thisType=='收货' ? 'active' : ''">收货</a>
  17. </li>
  18. <li class="nav-item">
  19. <a target="customer/finance/instantBill" class="nav-link" href="{{url('finance/instantBill?type=增值服务')}}" :class="thisType=='增值服务' ? 'active' : ''">增值服务</a>
  20. </li>
  21. </ul>
  22. </div>
  23. </div>
  24. <div id="form_div"></div>
  25. <div class="mt-1">
  26. <button type="button" class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
  27. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  28. 导出Excel
  29. </button>
  30. <div class="dropdown-menu">
  31. <a class="dropdown-item" @click="billExport(false)" href="javascript:">导出勾选内容</a>
  32. <a class="dropdown-item" @click="billExport(true)" href="javascript:">导出所有页</a>
  33. </div>
  34. @include("finance._resetInstantBill")
  35. @can("结算管理-即时账单-重置即时账单")<button data-toggle="modal" data-target="#resetInstantBill" class="btn btn-sm btn-outline-primary">重置即时账单</button>@endcan
  36. </div>
  37. <div>
  38. <label for="all" id="cloneCheckAll" class="d-none">
  39. <input id="all" type="checkbox" @click="checkAll($event)">全选
  40. </label>
  41. <table class="d-none" id="headerRoll"></table>
  42. <table class="table table-sm text-nowrap" id="headerParent">
  43. <tr class="text-center">
  44. <td colspan="2"></td>
  45. <td colspan="9" class="bg-light-info">单据信息</td>
  46. <td colspan="4" class="bg-light-khaki">物流作业信息</td>
  47. <td colspan="4" class="bg-light-cyanogen">费用信息</td>
  48. </tr>
  49. <tr id="header"></tr>
  50. <tbody v-for="(bill,i) in bills" :class="i%2==0 ? 'bg-light-gray' : 'bg-white'">
  51. <tr>
  52. <td :rowspan="bill.rowspan">
  53. <label><input type="checkbox" :value="bill.id" v-model="checkData"></label>
  54. </td>
  55. <td :rowspan="bill.rowspan">@{{ i+1 }}</td>
  56. <td :rowspan="bill.rowspan">@{{ bill.customerName }}</td>
  57. <td :rowspan="bill.rowspan">@{{ bill.ownerName }}</td>
  58. <td :rowspan="bill.rowspan">@{{ bill.workedAt }}</td>
  59. <td :rowspan="bill.rowspan">
  60. <label v-if="bill.type == '增值服务'">服务<span class="badge badge-primary">@{{ bill.methodName }}</span></label>
  61. <label v-else>@{{ bill.type }}</label>
  62. </td>
  63. <td :rowspan="bill.rowspan">@{{ bill.shopName }}</td>
  64. <td :rowspan="bill.rowspan">@{{ bill.operationBill }}</td>
  65. <td :rowspan="bill.rowspan">@{{ bill.consigneeName }}</td>
  66. <td :rowspan="bill.rowspan">@{{ bill.consigneePhone }}</td>
  67. <td>@{{ bill.commodityAmount }}</td>
  68. <td>
  69. <span v-if="bill.rowspan <= 1">@{{ bill.logisticBill }}</span>
  70. <span v-else class="font-weight-bold text-secondary">分箱:</span>
  71. </td>
  72. <td>@{{ bill.volume }}</td>
  73. <td>@{{ bill.weight }}</td>
  74. <td :rowspan="bill.rowspan">@{{ bill.logisticName }}</td>
  75. <td :rowspan="bill.rowspan">@{{ bill.workFee }}</td>
  76. <td>@{{ bill.logisticFee }}</td>
  77. <td :rowspan="bill.rowspan">@{{ bill.total }}</td>
  78. </tr>
  79. <tr v-for="item in bill.items">
  80. <td>@{{ item.amount }}</td>
  81. <td>@{{ item.logistic_bill }}</td>
  82. <td>@{{ item.volume }}</td>
  83. <td>@{{ item.weight }}</td>
  84. <td>@{{ item.logistic_fee }}</td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. {{$details->appends($params)->links()}}
  89. </div>
  90. </div>
  91. @stop
  92. @section("lastScript")
  93. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  94. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  95. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  96. <script>
  97. let vue = new Vue({
  98. el:"#container",
  99. data:{
  100. checkData:[],
  101. bills : [
  102. @foreach($details as $detail)
  103. { id : "{{$detail->id}}",
  104. ownerName : "{{$detail->owner ? $detail->owner->name : ''}}",
  105. customerName : "{{$detail->owner ? ($detail->owner->customer ? $detail->owner->customer->name : '') : ''}}",
  106. workedAt : "{{$detail->worked_at}}",
  107. type : "{{$detail->type}}",
  108. shopName : "{{$detail->shop ? $detail->shop->name : ''}}",
  109. operationBill : "{{$detail->operation_bill}}",
  110. consigneeName : "{{$detail->consignee_name}}",
  111. consigneePhone : "{{$detail->consignee_phone}}",
  112. commodityAmount : "{{$detail->commodity_amount}}",
  113. logisticBill : "{{$detail->logistic_bill}}",
  114. volume : "{{$detail->volume ? floor($detail->volume/10)/100 : ''}}",
  115. weight : "{{$detail->weight}}",
  116. logisticName : "{{$detail->logistic ? $detail->logistic->name : ''}}",
  117. methodName : "{{$detail->processMethod ? $detail->processMethod->name : ''}}",
  118. workFee : "{{$detail->work_fee}}",
  119. logisticFee : "{{$detail->logistic_fee}}",
  120. createdAt : "{{$detail->created_at}}",
  121. total : "{{$detail->work_fee + $detail->logistic_fee}}",
  122. items:{!! $detail->items !!},
  123. rowspan:Number("{{count($detail->items)}}")+1
  124. },
  125. @endforeach
  126. ],
  127. owners : [
  128. @foreach($owners as $owner)
  129. {name:"{{$owner->id}}",value:"{{$owner->name}}"},
  130. @endforeach
  131. ],
  132. customers : [
  133. @foreach($customers as $customer)
  134. {name:"{{$customer->id}}",value:"{{$customer->name}}"},
  135. @endforeach
  136. ],
  137. shops : [
  138. @foreach($shops as $shop)
  139. {name:"{{$shop->id}}",value:"{{$shop->name}}"},
  140. @endforeach
  141. ],
  142. types : [
  143. {name:"发货",value:"发货"},{name:"收货",value:"收货"},{name:"增值服务",value:"增值服务"},
  144. ],
  145. sum : Number("{{ $details->total() }}"),
  146. thisType : "",
  147. reset:{
  148. owner:[],
  149. },
  150. },
  151. mounted(){
  152. $('#container').removeClass('d-none');
  153. let data=[
  154. [
  155. {name:'shop_id',type:'select',tip:'店铺',placeholder: '店铺',data:this.shops},
  156. {name:'worked_at_start',type:'dateTime',tip:'起始作业日期'},
  157. {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的项目'],
  158. placeholder:['项目','定位或多选项目'],data:this.owners},
  159. {name: 'operation_bill', type: 'input', tip: '发/收/退/提货单号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '单据号'},
  160. ],[
  161. {name:'customer_id',type:'select',tip:'客户',placeholder: '客户',data:this.customers},
  162. {name:'worked_at_end',type:'dateTime',tip:'结束作业日期'},
  163. {name:'logistic_bill', type: 'input', tip: '物流/快递单号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '快递单号'},
  164. {name:'type',type:'select',tip:'类型',placeholder: '类型',data:this.types},
  165. ],
  166. ];
  167. this.form = new query({
  168. el:"#form_div",
  169. condition:data,
  170. });
  171. this.form.init();
  172. let column = [
  173. {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
  174. dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
  175. {name:'index',value: '序号', neglect: true},
  176. {name:'customerName',value: '客户', class: "bg-info"},
  177. {name:'ownerName',value: '项目', class: "bg-info"},
  178. {name:'workedAt',value: '作业时间', class: "bg-info"},
  179. {name:'type',value: '类型', class: "bg-info"},
  180. {name:'shopName',value: '店铺', class: "bg-info"},
  181. {name:'operationBill',value: '单号(发/收/退/提)', class: "bg-info"},
  182. {name:'consigneeName',value: '收件人', class: "bg-info"},
  183. {name:'consigneePhone',value: '收件人电话', class: "bg-info"},
  184. {name:'commodityAmount',value: '商品数量', class: "bg-info", neglect: true},
  185. {name:'logisticBill',value: '物流/快递单号', class: "bg-khaki"},
  186. {name:'volume',value: '体积(cm³)', class: "bg-khaki", neglect: true},
  187. {name:'weight',value: '重量(kg)', class: "bg-khaki", neglect: true},
  188. {name:'logisticName',value: '承运商', class: "bg-khaki"},
  189. {name:'workFee',value: '操作费', class: "bg-cyanogen", neglect: true},
  190. {name:'logisticFee',value: '物流费', class: "bg-cyanogen", neglect: true},
  191. {name:'total',value: '合计', class: "bg-cyanogen", neglect: true},
  192. ];
  193. let _this=this;
  194. setTimeout(function () {
  195. let header = new Header({
  196. el: "#header",
  197. column: column,
  198. data: _this.bills,
  199. restorationColumn: 'id',
  200. fixedTop:($('#form_div').height())+2,
  201. offset:7.5,
  202. vue:vue
  203. });
  204. header.init();
  205. },0);
  206. this.thisType = document.getElementsByName("type")[0].value;
  207. },
  208. watch:{
  209. checkData:{
  210. handler(){
  211. if (this.checkData.length === this.bills.length){
  212. document.querySelector('#all').checked = true;
  213. document.querySelector('#all_temp').checked = true;
  214. }else {
  215. document.querySelector('#all').checked = false;
  216. document.querySelector('#all_temp').checked = false;
  217. }
  218. },
  219. deep:true
  220. }
  221. },
  222. methods:{
  223. billExport(isAll){
  224. let url = '{{url('finance/instantBill/export')}}';
  225. let token='{{ csrf_token() }}';
  226. //excelExport 定义在 js/queryForm/export.js
  227. excelExport(isAll,this.checkData,url,this.sum,token);
  228. },
  229. //全选事件
  230. checkAll(e){
  231. if (e.target.checked){
  232. this.checkData = [];
  233. this.bills.forEach((el)=>{
  234. this.checkData.push(el.id);
  235. });
  236. }else {
  237. this.checkData = [];
  238. }
  239. },
  240. resetInstantBill(){
  241. window.tempTip.setDuration(3000);
  242. window.tempTip.setIndex(1099);
  243. if (!this.reset.startDate){
  244. window.tempTip.show("未选择起始日期");
  245. return;
  246. }
  247. window.tempTip.setDuration(999999);
  248. window.tempTip.waitingTip("加载中......");
  249. window.tempTip.postBasicRequest("{{url('customer/project/resetInstantBill')}}",this.reset,res=>{
  250. window.tempTip.setDuration(2000);
  251. window.tempTip.cancelWaitingTip();
  252. return "重置成功";
  253. },true)
  254. },
  255. },
  256. });
  257. </script>
  258. @stop