index.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php
  2. $this->title = '历史报表';
  3. ?>
  4. <?php $this->beginBlock('header_script'); ?>
  5. <link href="<?= STATIC_URL ?>/ui/css/plugins/dataTables/datatables.min.css" rel="stylesheet">
  6. <?php $this->endBlock(); ?>
  7. <style>
  8. table.table-bordered.dataTable th, table.table-bordered.dataTable td {
  9. white-space: nowrap;
  10. }
  11. @media (min-width: 1600px){
  12. .container {
  13. width: 1550px;
  14. }
  15. }
  16. @media (min-width: 1920px){
  17. .container {
  18. width: 1550px;
  19. }
  20. }
  21. </style>
  22. <div class="row">
  23. <div class="col-md-2">
  24. <?= $this->render('/common/_left_menu.php') ?>
  25. </div>
  26. <div class="col-md-10">
  27. <div class="ibox">
  28. <div class="ibox-title">
  29. <h2>历史报表</h2>
  30. </div>
  31. <form>
  32. <input type="hidden" name="type" value="<?= $type ?>">
  33. <div class="ibox-content m-b-sm border-bottom">
  34. <div class="row">
  35. <div class="col-sm-4">
  36. <div class="form-group">
  37. <label class="control-label" for="price">开始时间</label>
  38. <input readonly="readonly" type="text" id="sTime" name="sTime" value="<?= $sTime ?>" placeholder="开始时间" class="data form-control">
  39. </div>
  40. </div>
  41. <div class="col-sm-4">
  42. <div class="form-group">
  43. <label class="control-label" for="quantity">结束时间</label>
  44. <input readonly="readonly" type="text" id="eTime" name="eTime" value="<?= $eTime ?>" placeholder="结束时间" class="data form-control">
  45. </div>
  46. </div>
  47. <div class="col-sm-4">
  48. <div class="form-group">
  49. <label class="control-label" for="quantity">操作</label>
  50. <input type="submit" class="btn btn-primary form-control" value="搜索">
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </form>
  56. <div class="ibox-content">
  57. <div class="table-responsive">
  58. <table id="datatables" class="table table-striped table-bordered table-hover dataTables-example">
  59. <thead>
  60. <tr>
  61. <th>订单号</th>
  62. <th>类型</th>
  63. <th>品种</th>
  64. <th>SL</th>
  65. <th>TP</th>
  66. <th>手数</th>
  67. <th>开仓价格</th>
  68. <th>开仓时间</th>
  69. <th>平仓价格</th>
  70. <th>平仓时间</th>
  71. <th>利息</th>
  72. <th>佣金</th>
  73. <th>获利</th>
  74. </tr>
  75. </thead>
  76. </table>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. <?php $this->beginBlock('footer_script'); ?>
  83. <!-- Mainly scripts -->
  84. <script src="<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js"></script>
  85. <script>
  86. var table;
  87. $(document).ready(function() {
  88. table = $('#datatables').DataTable({
  89. "aLengthMenu": [[20,50,100,500], [20,50,100,500]],
  90. language: {
  91. "sProcessing": "处理中...",
  92. "sLengthMenu": "显示 _MENU_ 项结果",
  93. "sZeroRecords": "没有匹配结果",
  94. "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
  95. "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
  96. "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
  97. "sInfoPostFix": "",
  98. "sSearch": "搜索:",
  99. "sUrl": "",
  100. "sEmptyTable": "表中数据为空",
  101. "sLoadingRecords": "载入中...",
  102. "sInfoThousands": ",",
  103. "oPaginate": {
  104. "sFirst": "首页",
  105. "sPrevious": "上页",
  106. "sNext": "下页",
  107. "sLast": "末页"
  108. },
  109. "oAria": {
  110. "sSortAscending": ": 以升序排列此列",
  111. "sSortDescending": ": 以降序排列此列"
  112. }
  113. },
  114. "processing": true,
  115. "serverSide": true,
  116. "ajax": '/user/trades?type=<?= $type ?>&sTime=<?= $sTime ?>&eTime=<?= $eTime ?>',
  117. "order": [[0, "desc"]],
  118. "columns": [{
  119. "data": "TICKET"
  120. },
  121. {
  122. "data": "CMD"
  123. },
  124. {
  125. "data": "SYMBOL"
  126. },
  127. {
  128. "data": "SL"
  129. },
  130. {
  131. "data": "TP"
  132. },
  133. {
  134. "data": "VOLUME"
  135. },
  136. {
  137. "data": "OPEN_PRICE"
  138. },
  139. {
  140. "data": "OPEN_TIME"
  141. },
  142. {
  143. "data": "CLOSE_PRICE"
  144. },
  145. {
  146. "data": "CLOSE_TIME"
  147. },
  148. {
  149. "data": "SWAPS"
  150. },
  151. {
  152. "data": "COMMISSION"
  153. },
  154. {
  155. "data": "PROFIT"
  156. }],
  157. columnDefs: [{
  158. targets: 1,
  159. render: function(data, type, row, meta) {
  160. if(data==0){
  161. return 'BUY';
  162. }else if (data==1){
  163. return 'SELL';
  164. }else if (data==2){
  165. return 'BUY LIMIT';
  166. }else if (data==3){
  167. return 'SELL LIMIT';
  168. }else if (data==4){
  169. return 'BUY STOP';
  170. }else if (data==5){
  171. return 'SELL STOP';
  172. }else if (data==6){
  173. return 'BALANCE';
  174. }else if (data==7){
  175. return 'CREDIT';
  176. }else{
  177. return '';
  178. }
  179. },
  180. "orderable": true
  181. },{
  182. targets: 5,
  183. render: function(data, type, row, meta) {
  184. return data/100;
  185. },
  186. "orderable": true
  187. }],
  188. "sPaginationType": "full_numbers",
  189. dom: '<"html5buttons"B>lTfgitp',
  190. buttons: [{
  191. extend: 'copy'
  192. },
  193. {
  194. extend: 'csv'
  195. },
  196. {
  197. extend: 'excel'
  198. },
  199. {
  200. extend: 'pdf'
  201. },
  202. {
  203. extend: 'print',
  204. customize: function(win) {
  205. $(win.document.body).addClass('white-bg');
  206. $(win.document.body).css('font-size', '10px');
  207. $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
  208. }
  209. }]
  210. });
  211. $('#datatables tbody').on('click', 'tr',
  212. function() {
  213. if ($(this).hasClass('selected')) {
  214. $(this).removeClass('selected');
  215. } else {
  216. table.$('tr.selected').removeClass('selected');
  217. $(this).addClass('selected');
  218. }
  219. });
  220. });
  221. </script>
  222. <?php $this->endBlock(); ?>