charge_del.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <title>撤单删除管理</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>车辆检测管理</cite></a>
  6. <a><cite>撤单删除管理</cite></a>
  7. </div>
  8. </div>
  9. <div class="layui-fluid">
  10. <div class="layui-row layui-col-space15">
  11. <div class="layui-col-md12">
  12. <div class="layui-card">
  13. <!--<div class="layui-card-header">开启头部工具栏</div>-->
  14. <div class="layui-card-body">
  15. <div class="test-table-reload-btn" style="margin-bottom: 10px;">
  16. 搜索车牌:
  17. <div class="layui-inline">
  18. <input class="layui-input" name="车牌号" id="test-table-demoReload" style="text-transform:uppercase;">
  19. <!--autocomplete="off"-->
  20. </div>
  21. 检测日期:
  22. <div class="layui-input-inline">
  23. <input type="text" class="layui-input" id="test-laydate-range-date">
  24. </div>
  25. <button class="layui-btn" data-type="reload">搜索</button>
  26. </div>
  27. <table class="layui-hide" id="test-table-radio" lay-filter="test-table-radio"></table>
  28. <script type="text/html" id="test-table-radio-toolbarDemo">
  29. <div class="layui-btn-container">
  30. <button class="layui-btn layui-btn-sm" lay-event="edit">撤单选择</button>
  31. </div>
  32. </script>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </body>
  39. <script>
  40. layui.use(['admin', 'table','layer','form','view','laydate'], function(){
  41. var admin = layui.admin
  42. ,$ = layui.$
  43. ,layer = layui.layer
  44. ,view = layui.view
  45. ,form = layui.form
  46. ,laydate = layui.laydate
  47. ,table = layui.table;
  48. table.render({
  49. elem: '#test-table-radio'
  50. ,url:'/charge/selectCharge'
  51. ,method:'post'
  52. // ,where:{"date":new Date()}
  53. ,toolbar: '#test-table-radio-toolbarDemo'
  54. ,title: '收费记录数据表'
  55. ,even: true//隔行背景
  56. ,cols: [[
  57. {type: 'radio', fixed: 'left'}
  58. ,{field:'license', title:'车牌', width:120}
  59. ,{field:'VIN', title:'车架号', width:120}
  60. ,{field:'owner', title:'所有人', width:120}
  61. ,{field:'EP_type', title:'环保类型', width:120}
  62. ,{field:'car_type', title:'安检类型', width:120}
  63. ,{field:'customer', title:'挂账客户', width:120}
  64. ,{field:'contracted_customer', title:'签约客户', width:120}
  65. ,{field:'EP_receivable', title:'环检应收', width:120}
  66. ,{field:'Safe_receivable', title:'安检应收', width:120}
  67. ,{field:'receivable', title:'应收总和', width:120}
  68. ,{field:'cost', title:'实收总和', width:120}
  69. ,{field:'telephone', title:'联系电话', width:120}
  70. ,{field:'date', title:'检测日期', width:120}
  71. ,{field:'remarks', title:'备注', width:120}
  72. // ,{fixed: 'right', title:'操作', toolbar: '#test-table-toolbar-barDemo', width:150}
  73. ]]
  74. ,page: true
  75. });
  76. laydate.render({
  77. elem: '#test-laydate-range-date'
  78. });
  79. var active = {
  80. reload: function(){
  81. var demoReload = $('#test-table-demoReload');
  82. var date = $('#test-laydate-range-date');
  83. //执行重载
  84. table.reload('test-table-radio', {
  85. where: {
  86. 'license': demoReload.val(),
  87. 'date': date.val()
  88. }
  89. ,page: {
  90. curr: 1 //重新从第 1 页开始
  91. }
  92. });
  93. }
  94. };
  95. $('.test-table-reload-btn .layui-btn').on('click', function(){
  96. var type = $(this).data('type');
  97. active[type] ? active[type].call(this) : '';
  98. });
  99. //头工具栏事件
  100. table.on('toolbar(test-table-radio)', function(obj){
  101. var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
  102. var data = checkStatus.data; //获取选中行数据
  103. switch(obj.event){
  104. case 'edit':
  105. if (data.length !== 0) {//选中
  106. admin.popup({
  107. title: '撤单删除管理'
  108. ,area: ['500px', '480px']
  109. ,id: 'LAY-popup-charge-del'
  110. ,success:function (layero, index) {
  111. view(this.id).render('detection/layer/popupChargeDel').done(function(){
  112. form.val('charge-form-del',{
  113. 'license':data[0].license,
  114. 'Safe_receivable':data[0].Safe_receivable,
  115. 'EP_receivable':data[0].EP_receivable,
  116. 'remarks':data[0].remarks,
  117. 'cost':data[0].cost,
  118. });
  119. //监听提交
  120. form.on('submit(LAY-charge-del-submit)', function(editData){
  121. var field = editData.field;
  122. field['id'] = data[0].id;
  123. admin.req({
  124. type:"POST",
  125. url:"/charge/chargeDel",
  126. data:field,
  127. done:function (res) {
  128. if (res && res.code === 0){
  129. layer.msg(res.msg)
  130. }else {//撤单失败
  131. layer.msg(res.msg)
  132. }
  133. layer.close(index);
  134. layui.table.reload('test-table-radio'); //重载表格
  135. }
  136. });
  137. })
  138. })
  139. }
  140. })
  141. }else {//未选中
  142. layer.msg("请选择!");
  143. }
  144. // layer.alert(JSON.stringify(data));
  145. break;
  146. };
  147. });
  148. });
  149. </script>