index.blade.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. @extends('admin/layout')
  2. @section('content')
  3. <body class="gray-bg">
  4. <div class="wrapper wrapper-content animated fadeInRight">
  5. <div class="row">
  6. <div class="col-sm-12">
  7. <div class="ibox float-e-margins">
  8. <div class="ibox-title"></div>
  9. <div class="ibox-content">
  10. <form class="form-inline" id="searchForm" onsubmit="units.search();return false;">
  11. <div class="form-group">
  12. <div class="input-group">
  13. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  14. <input type="text" title="开始时间" class="form-control lay-datetime" id="start_at"
  15. name="start_at">
  16. </div>
  17. </div>
  18. -
  19. <div class="form-group">
  20. <div class="input-group">
  21. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  22. <input type="text" title="结束时间" class="form-control lay-datetime" id="end_at"
  23. name="end_at">
  24. </div>
  25. </div>
  26. <div class="form-group" style="margin-top: 5px;">
  27. <div class="input-group">
  28. {{--<input type="text" placeholder="请输入关键词" class="input-md form-control" name="keyword"--}}
  29. {{--id="keyword">--}}
  30. <span class="input-group-btn">
  31. <button type="button" class="btn btn-md btn-primary"
  32. onclick="units.search()"> 搜索</button>
  33. <button type="reset" class="btn btn-md btn-primary" style="margin-left: 10px"
  34. name="resetBtn"> 重置</button>
  35. <button type="button" class="btn btn-md btn-warning" style="margin-left: 10px"
  36. onclick="units.settle()">结算</button>
  37. </span>
  38. </div>
  39. </div>
  40. </form>
  41. <hr>
  42. <div class="table-responsive">
  43. <table id="table" class="table table-condensed" data-mobile-responsive="true"></table>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </body>
  51. @endsection
  52. @section('footer')
  53. <script src="{{asset('js/plugins/layDate-v5.0.9/laydate/laydate.js')}}"></script>
  54. <script>
  55. var units = {
  56. search: function () {
  57. tips.selectPage();
  58. },
  59. getIdsBySelections: function () {
  60. var selections = $("#table").bootstrapTable('getSelections');
  61. var ids = [];
  62. $.each(selections, function (inx, val) {
  63. ids = ids.concat(val.ids);
  64. });
  65. return ids;
  66. },
  67. detail: function (idsStr) {
  68. var ids = idsStr.split(',');
  69. var ladingBillIds = '';
  70. $.each(ids, function (inx, val) {
  71. ladingBillIds += '&ladingBillIds[]=' + val;
  72. });
  73. layer.open({
  74. type: 2,
  75. content: ['/admin/finances/detail?isSettle=0' + ladingBillIds],
  76. area: ['80%', '80%'],
  77. title: '详情'
  78. });
  79. },
  80. settle: function () {
  81. var ids = units.getIdsBySelections();
  82. if (ids.length === 0) {
  83. layer.alert('请先选择您所要操作的对象', {icon: 0});
  84. return;
  85. }
  86. layer.confirm('您确定要进行结算吗?', {icon: 3, title: '删除信息'}, function () {
  87. tips.ajax({url: '/admin/finances/settle', type: 'put', data: {ids: ids}});
  88. tips.tableRefresh('#table');
  89. });
  90. },
  91. test: function (t) {
  92. console.log('test');
  93. console.log(t);
  94. }
  95. };
  96. units.test('["1", "2"]');
  97. var config = {};
  98. config.url = '/admin/finances';
  99. config.columns = [ //字段
  100. {checkbox: true},
  101. {
  102. title: '序号', align: 'center', formatter: function (value, item, index) {
  103. return index + 1;
  104. }
  105. },
  106. {title: '用户姓名', field: 'username', align: 'center'},
  107. {title: '结算金额', field: 'settle_amount', align: 'center'},
  108. {
  109. visible: false, field: 'ids'
  110. },
  111. {
  112. title: '操作', field: '_', align: 'center',
  113. formatter: function (value, row) {
  114. var idsStr = row.ids.join(',');
  115. return (
  116. '<button onclick="units.detail(\'' + idsStr + '\')" class="btn btn-xs"><span class="glyphicon glyphicon-edit"></span>查看</button>&nbsp;'
  117. );
  118. }
  119. }
  120. ];
  121. tips.bootstrapTable(config);
  122. laydate.render({
  123. elem: '#start_at', //指定元素
  124. type: 'datetime'
  125. });
  126. laydate.render({
  127. elem: '#end_at', //指定元素
  128. type: 'datetime'
  129. });
  130. </script>
  131. @endsection