charge_month.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>收费记录查询</title>
  6. <!--<script src="../dist/controller/layui_exts/excel.js"></script>-->
  7. </head>
  8. <body>
  9. <div class="layui-card layadmin-header">
  10. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  11. <a lay-href="">主页</a>
  12. <a><cite>车辆检测管理</cite></a>
  13. <a><cite>收费记录查询</cite></a>
  14. </div>
  15. </div>
  16. <div class="layui-fluid">
  17. <div class="layui-row layui-col-space15">
  18. <div class="layui-col-md12">
  19. <div class="layui-card">
  20. <!--<div class="layui-card-header">开启头部工具栏</div>-->
  21. <div class="layui-card-body">
  22. <div class="test-table-reload-btn" style="margin-bottom: 10px;">
  23. 车牌地区:
  24. <div class="layui-inline layui-form" lay-filter="licenseSelect">
  25. <select name="license_region" lay-verify="required" lay-search="" lay-filter="licenseSelect" id="licenseSelect">
  26. <option value=0>全部</option>
  27. <option value=1>沪</option>
  28. <option value=2>非沪</option>
  29. </select>
  30. </div>
  31. 环保类型:
  32. <div class="layui-inline layui-form" lay-filter="detectionSelect">
  33. <select name="EP_type" lay-verify="required" lay-search="" lay-filter="detectionChangeType" id="detectionSelect">
  34. <option value="">全部</option>
  35. </select>
  36. </div>
  37. 挂账客户:
  38. <div class="layui-inline layui-form" lay-filter="customerSelect">
  39. <select name="customer" lay-verify="required" lay-search="" lay-filter="customerSelect" id="customerSelect">
  40. <!--<option value="">全部</option>-->
  41. </select>
  42. </div>
  43. 签约客户:
  44. <div class="layui-inline layui-form" lay-filter="contractedSelect">
  45. <select name="contracted_customer" lay-verify="required" lay-search="" lay-filter="contractedSelect" id="contractedSelect">
  46. <!--<option value="">全部</option>-->
  47. </select>
  48. </div>
  49. <!--换行-->
  50. <div class="layui-inline">
  51. 安检类型:
  52. <div class="layui-inline layui-form" lay-filter="carTypeSelect">
  53. <select name="car_type" lay-verify="required" lay-search="" lay-filter="carChangeType" id="carTypeSelect">
  54. <option value="">全部</option>
  55. </select>
  56. </div>
  57. 检测年月:
  58. <div class="layui-input-inline">
  59. <input type="text" class="layui-input" id="test-laydate-range-date">
  60. </div>
  61. </div>
  62. <button class="layui-btn" data-type="reload">搜索</button>
  63. <button type="button" lay-submit="" class="layui-btn layui-btn-warm" data-type="uploadImg" lay-filter="uploadImg">
  64. <i class="layui-icon"></i>导出Excel</button>
  65. </div>
  66. <table class="layui-hide" id="test-table-totalRow" lay-filter="test-table-totalRow"></table>
  67. </div>
  68. <div class="layui-card-body">
  69. 支付宝总计:
  70. <div class="layui-input-inline" style="width: 80px">
  71. <input type="text" class="layui-input" id="ali_pay_sum" style="border:none;font-weight:bold">
  72. </div>
  73. 挂账总计:
  74. <div class="layui-input-inline" style="width: 80px">
  75. <input type="text" class="layui-input" id="on_account_sum" style="border:none;font-weight:bold">
  76. </div>
  77. 环检应收总计:
  78. <div class="layui-input-inline" style="width: 80px">
  79. <input type="text" class="layui-input" id="EP_sum" style="border:none;font-weight:bold">
  80. </div>
  81. 安检应收总计:
  82. <div class="layui-input-inline" style="width: 80px">
  83. <input type="text" class="layui-input" id="Safe_sum" style="border:none;font-weight:bold">
  84. </div>
  85. 应收总计:
  86. <div class="layui-input-inline" style="width: 80px">
  87. <input type="text" class="layui-input" id="rece_sum" style="border:none;font-weight:bold">
  88. </div>
  89. 实收总计:
  90. <div class="layui-input-inline" style="width: 80px" >
  91. <input type="text" class="layui-input" id="cost_sum" style="border:none;font-weight:bold">
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </body>
  99. <script>
  100. // LAY_EXCEL.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')
  101. layui.use(['admin', 'table','laydate','form','excel'], function(){
  102. var admin = layui.admin
  103. ,$ = layui.$
  104. ,laydate = layui.laydate
  105. ,table = layui.table
  106. ,excel = layui.excel
  107. ,form = layui.form;
  108. // form.render(null, 'form-group');
  109. table.render({
  110. elem: '#test-table-totalRow'
  111. ,url:'/charge/chargeMonth'
  112. ,method:'post'
  113. ,toolbar: '#'
  114. ,even: true//隔行背景
  115. ,title: '收费记录数据表'
  116. // ,parseData:function (res) {
  117. // console.log(res)
  118. // }
  119. ,cols: [[
  120. // {type:'numbers',fixed: 'left', totalRowText: '合计:'}
  121. {field:'license', title:'车牌',align: 'center'},
  122. {field:'EP_type', title:'环保类型',align: 'center'},
  123. {field:'car_type', title:'安检类型',align: 'center'},
  124. {field:'customer', title:'挂账客户',align: 'center'},
  125. {field:'contracted_customer', title:'签约客户',align: 'center'},
  126. {field:'ali_pay', title:'支付宝',align: 'center'},
  127. {field:'on_account', title:'挂账金额',align: 'center'},
  128. {field:'EP_receivable', title:'环检应收',align: 'center'},
  129. {field:'Safe_receivable', title:'安检应收',align: 'center'},
  130. {field:'receivable', title:'应收总和',align: 'center'},
  131. {field:'cost', title:'实收总和',align: 'center'},
  132. {field:'remarks', title:'备注',align: 'center'}
  133. // ,{fixed: 'right', title:'操作', toolbar: '#test-table-toolbar-barDemo', width:150}
  134. ]]
  135. ,page: true
  136. ,done:function (data) {
  137. $('#ali_pay_sum').val(data.sum.ali_pay_sum);
  138. $('#on_account_sum').val(data.sum.on_account_sum);
  139. $('#EP_sum').val(data.sum.EP_sum);
  140. $('#Safe_sum').val(data.sum.Safe_sum);
  141. $('#rece_sum').val(data.sum.rece_sum);
  142. $('#cost_sum').val(data.sum.cost_sum);
  143. }
  144. });
  145. //环检下拉
  146. $.ajax({
  147. url:"/chargingStandard/getSelect",
  148. type:'POST',
  149. data:{"project":"环检"},
  150. success:function (res) {
  151. var data = res;
  152. $.each(data,function (index,item) {
  153. $('#detectionSelect').append('<option value="'+item.carType+'">'+item.carType+'</option>');
  154. });
  155. form.render('select', 'detectionSelect');
  156. }
  157. });
  158. //安检下拉
  159. $.ajax({
  160. url:"/chargingStandard/getSelect",
  161. type:'POST',
  162. data:{"project":"安检"},
  163. success:function (res) {
  164. var data = res;
  165. $.each(data,function (index,item) {
  166. $('#carTypeSelect').append('<option value="'+item.carType+'">'+item.carType+'</option>');
  167. });
  168. form.render('select', 'carTypeSelect');
  169. }
  170. });
  171. //挂账客户下拉
  172. $.ajax({
  173. url:"/customer/getCustomer",
  174. type:'GET',
  175. // data:{"project":"安检"},
  176. success:function (res) {
  177. var data = res;
  178. $.each(data,function (index,item) {
  179. if (index===0){
  180. $('#customerSelect').append('<option value="">'+item.name+'</option>');
  181. }else {
  182. $('#customerSelect').append('<option value="'+item.name+'">'+item.name+'</option>');
  183. }
  184. });
  185. form.render('select', 'customerSelect');
  186. }
  187. });
  188. //签约客户下拉
  189. $.ajax({
  190. url:"/contracted/getContracted",
  191. type:'GET',
  192. success:function (res) {
  193. var data = res;
  194. $.each(data,function (index,item) {
  195. if (index===0){
  196. $('#contractedSelect').append('<option value="">'+item.name+'</option>');
  197. }else {
  198. $('#contractedSelect').append('<option value="'+item.name+'">'+item.name+'</option>');
  199. }
  200. });
  201. form.render('select', 'contractedSelect');
  202. }
  203. });
  204. var active = {
  205. //搜索重载
  206. reload: function(){
  207. var date = $('#test-laydate-range-date');
  208. var ep = $('#detectionSelect');
  209. var car = $('#carTypeSelect');
  210. var customer = $('#customerSelect');
  211. var contracted = $('#contractedSelect');
  212. var license = $('#licenseSelect');
  213. //执行重载
  214. table.reload('test-table-totalRow', {
  215. where: {
  216. 'EP_type': ep.val(),
  217. 'car_type': car.val(),
  218. 'customer': customer.val(),
  219. 'contracted': contracted.val(),
  220. 'date': date.val(),
  221. 'license': license.val()
  222. },page: {
  223. curr: 1 //重新从第 1 页开始
  224. }
  225. });
  226. },
  227. //导出excel
  228. uploadImg:function () {
  229. var date = $('#test-laydate-range-date');
  230. var ep = $('#detectionSelect');//环保
  231. var car = $('#carTypeSelect');//安检
  232. var customer = $('#customerSelect');//挂账客户
  233. var contracted = $('#contractedSelect');//签约客户
  234. var license = $('#licenseSelect');//沪牌
  235. // loading = layer.load(1, {shade: [0.3, '#fff']});
  236. // var $ = layui.jquery;
  237. // var excel = layui.excel;
  238. $.ajax({
  239. url: '/charge/monthExcel',
  240. dataType: 'json',
  241. type:'POST',
  242. data: {
  243. 'EP_type': ep.val(),
  244. 'car_type': car.val(),
  245. 'customer': customer.val(),
  246. 'contracted': contracted.val(),
  247. 'date': date.val(),
  248. 'license': license.val()
  249. },
  250. success: function(res) {
  251. // layer.close(loading);
  252. layer.msg(res.msg);
  253. // 假如返回的 res.data 是需要导出的列表数据
  254. // 1. 数组头部新增表头
  255. res.data.unshift({
  256. // sdId: 'ID',sdMoney: '交易金额',sdTime:'交易时间',type:'交易类型',sdWater:'交易流水编号',order:'订单号'
  257. license:'车牌',
  258. EP_type:'环保类型',
  259. car_type:'安检类型',
  260. customer:'挂账客户',
  261. contracted_customer:'签约客户',
  262. ali_pay:'支付宝',
  263. on_account:'挂账金额',
  264. EP_receivable:'环检应收',
  265. Safe_receivable:'安检应收',
  266. receivable:'应收总和',
  267. cost:'实收总和',
  268. telephone:'电话',
  269. remarks:'备注'
  270. });
  271. // console.log(res.data)
  272. // 3. 执行导出函数,系统会弹出弹框
  273. excel.exportExcel({
  274. sheet1: res.data
  275. }, res.filename, 'xlsx');
  276. },
  277. error:function(res){
  278. // layer.close(loading);
  279. layer.msg(res.msg);
  280. }
  281. });
  282. }
  283. };
  284. $('.test-table-reload-btn .layui-btn').on('click', function(){
  285. var type = $(this).data('type');
  286. active[type] ? active[type].call(this) : '';
  287. });
  288. laydate.render({
  289. elem: '#test-laydate-range-date',
  290. type:'month'
  291. });
  292. //新接口打印
  293. // form.on('submit(uploadImg)', function(data){
  294. // // loading = layer.load(1, {shade: [0.3, '#fff']});
  295. // // var $ = layui.jquery;
  296. // // var excel = layui.excel;
  297. // console.log(111);
  298. // $.ajax({
  299. // url: '/charge/chargeMonth',
  300. // dataType: 'json',
  301. // type:'POST',
  302. // data: {
  303. // 'EP_type': "",
  304. // 'car_type': "",
  305. // 'customer': "",
  306. // 'date': ""
  307. // },
  308. // success: function(res) {
  309. // // layer.close(loading);
  310. // layer.msg(res.msg);
  311. // // 假如返回的 res.data 是需要导出的列表数据
  312. // console.log(res.data);//
  313. // // 1. 数组头部新增表头
  314. // res.data.unshift({sdId: 'ID',sdMoney: '交易金额',sdTime:'交易时间',type:'交易类型',sdWater:'交易流水编号',order:'订单号'});
  315. // // 3. 执行导出函数,系统会弹出弹框
  316. // excel.exportExcel({
  317. // sheet1: [1, 2, 3]
  318. // }, '平台流水.xlsx', 'xlsx');
  319. // },
  320. // error:function(res){
  321. // // layer.close(loading);
  322. // layer.msg(res.msg);
  323. // }
  324. // });
  325. // });
  326. });
  327. </script>
  328. </html>