instantBill.blade.php 11 KB

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