open.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?php
  2. /* @var $this \yii\web\View */
  3. $this->title = '开设同名转账';
  4. ?>
  5. <?php $this->beginBlock('header_script'); ?>
  6. <link href="<?= STATIC_URL ?>/ui/css/plugins/dataTables/datatables.min.css" rel="stylesheet">
  7. <style>
  8. label.error {
  9. display: none !important;
  10. }
  11. #datatables {
  12. width: 100% !important;
  13. }
  14. </style>
  15. <?php $this->endBlock(); ?>
  16. <div class="row">
  17. <div class="col-md-3">
  18. <?= $this->render('/common/_left_menu.php') ?>
  19. </div>
  20. <div class="col-md-9">
  21. <div class="tabs-container">
  22. <ul class="nav nav-tabs">
  23. <li class="active" style="background:none;"><a data-toggle="tab" href="#tab-1"> <i class="fa fa-retweet"></i> 开设同名转账</a></li>
  24. </ul>
  25. <div class="tab-content">
  26. <div id="tab-1" class="tab-pane active">
  27. <div class="panel-body">
  28. <br><br><br><br>
  29. <form id="form">
  30. <div class="row">
  31. <div class="col-sm-1"></div>
  32. <div class="col-sm-4">
  33. <div class="input-group">
  34. <span class="input-group-btn">
  35. <button type="button" class="btn btn-primary btn-lg"><i class="fa fa-user"></i> 杠杆</button>
  36. </span>
  37. <select name="flever" id="flever" class="form-control input-lg">
  38. <option value="">请选择</option>
  39. <option value="100">1:100</option>
  40. <option value="200">1:200</option>
  41. </select>
  42. </div>
  43. </div>
  44. <div class="col-sm-4">
  45. <div class="input-group">
  46. <span class="input-group-btn">
  47. <div id="submit" class="btn btn-danger"><i class="fa fa-upload"></i> 提交申请</div>
  48. </span>
  49. </div>
  50. </div>
  51. <div class="col-sm-1"></div>
  52. </div>
  53. <br>
  54. </form>
  55. <br><br>
  56. </div>
  57. </div>
  58. <div id="tab-2" class="tab-pane">
  59. <div class="panel-body">
  60. <div class="table-responsive" style="margin:30px 10px 0px 10px;">
  61. <table id="datatables" class="table table-striped table-bordered table-hover">
  62. <thead>
  63. <tr>
  64. <th>ID</th>
  65. <th>状态</th>
  66. <th>转出账户</th>
  67. <th>转入账户</th>
  68. <th>金额</th>
  69. <th>申请时间</th>
  70. <th>备注</th>
  71. </tr>
  72. </thead>
  73. </table>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <?php $this->beginBlock('footer_script'); ?>
  82. <script src="<?= STATIC_URL ?>/ui/js/plugins/dataTables/datatables.min.js"></script>
  83. <script>
  84. $("#flogin").change(function(){
  85. var v=$(this).val();
  86. $("#floginTd").html(v);
  87. });
  88. $("#tlogin").change(function(){
  89. var v=$(this).val();
  90. var f=$("#flogin").val();
  91. $("#tloginTd").html(v);
  92. $.ajax({
  93. type: "GET",
  94. url: "<?= \yii\helpers\Url::to(['/user/transfer/is-ib-user']) ?>",
  95. data: {
  96. toLogin: v,
  97. fromLogin: f
  98. },
  99. beforeSend: function() {},
  100. success: function(data) {
  101. if(data.isSuccess) {
  102. $('#submit').removeAttr("disabled");
  103. // $('#submit').bind("click");
  104. } else {
  105. $('#submit').attr('disabled', true);
  106. toastr.error(data.msg, "提示");
  107. // $('#submit').unbind("click");
  108. }
  109. },
  110. complete: function(XMLHttpRequest, textStatus) {},
  111. error: function() {
  112. toastr.error(data.msg, "提示");
  113. }
  114. });
  115. });
  116. function amountChange(){
  117. var amount=$("#amount").val();
  118. $("#amountTd").html("$"+amount);
  119. }
  120. $("#submit").on("click", function() {
  121. if($("#form").valid()){
  122. $.ajax({
  123. type: "POST",
  124. url: "<?= \yii\helpers\Url::to(['/user/transfer/transfer-save']) ?>",
  125. data: $('#form').serialize(),
  126. dataType: "json",
  127. beforeSend: function() {},
  128. success: function(data) {
  129. if(data.code == 1) {
  130. table.ajax.reload();
  131. toastr.success(data.message, "提示");
  132. } else {
  133. toastr.error(data.message, "提示");
  134. }
  135. },
  136. complete: function(XMLHttpRequest, textStatus) {},
  137. error: function() {
  138. toastr.error(data.message, "提示");
  139. }
  140. });
  141. }
  142. });
  143. var table;
  144. $(document).ready(function() {
  145. $("#form").validate({
  146. rules: {
  147. "flogin": {
  148. required: true
  149. },
  150. "tlogin": {
  151. required: true
  152. },
  153. "amount": {
  154. required: true
  155. }
  156. }
  157. });
  158. table = $('#datatables').DataTable({
  159. "aLengthMenu": [[20,50,100,500,999999999], [20,50,100,500,"ALL"]],
  160. language: {
  161. "sProcessing": "处理中...",
  162. "sLengthMenu": "显示 _MENU_ 项结果",
  163. "sZeroRecords": "没有匹配结果",
  164. "sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
  165. "sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
  166. "sInfoFiltered": "(由 _MAX_ 项结果过滤)",
  167. "sInfoPostFix": "",
  168. "sSearch": "搜索:",
  169. "sUrl": "",
  170. "sEmptyTable": "表中数据为空",
  171. "sLoadingRecords": "载入中...",
  172. "sInfoThousands": ",",
  173. "oPaginate": {
  174. "sFirst": "首页",
  175. "sPrevious": "上页",
  176. "sNext": "下页",
  177. "sLast": "末页"
  178. },
  179. "oAria": {
  180. "sSortAscending": ": 以升序排列此列",
  181. "sSortDescending": ": 以降序排列此列"
  182. }
  183. },
  184. "processing": true,
  185. "serverSide": true,
  186. "ajax": '<?= \yii\helpers\Url::to(['/user/transfer/transfer-ajax']) ?>',
  187. "order": [[0, "desc"]],
  188. "columns": [{
  189. "data": "id"
  190. },{
  191. "data": "type"
  192. },{
  193. "data": "from_login"
  194. },{
  195. "data": "to_login"
  196. },{
  197. "data": "amount"
  198. },{
  199. "data": "in_time"
  200. },{
  201. "data": "memo"
  202. }],
  203. columnDefs: [{
  204. targets: 1,
  205. render: function(data, type, row, meta) {
  206. if(data==0){
  207. return '<span class="label label-danger">处理中</span>';
  208. }else if(data==1){
  209. return '<span class="label label-danger">不通过</span>';
  210. }else if(data==2){
  211. return '<span class="label label-primary">已转账</span>';
  212. }
  213. },
  214. "orderable": true
  215. },{
  216. targets: 5,
  217. render: function(data, type, row, meta) {
  218. if(data!=0){
  219. return timeStamp2String(parseInt(data));
  220. }else{
  221. return "";
  222. }
  223. },
  224. "orderable": true
  225. }],
  226. "sPaginationType": "full_numbers",
  227. dom: '<"html5buttons"B>lTfgitp',
  228. buttons: [{
  229. extend: 'copy'
  230. },
  231. {
  232. extend: 'csv'
  233. },
  234. {
  235. extend: 'excel'
  236. },
  237. {
  238. extend: 'pdf'
  239. },
  240. {
  241. extend: 'print',
  242. customize: function(win) {
  243. $(win.document.body).addClass('white-bg');
  244. $(win.document.body).css('font-size', '10px');
  245. $(win.document.body).find('table').addClass('compact').css('font-size', 'inherit');
  246. }
  247. }]
  248. });
  249. $('#datatables tbody').on('click', 'tr',
  250. function() {
  251. if ($(this).hasClass('selected')) {
  252. $(this).removeClass('selected');
  253. } else {
  254. table.$('tr.selected').removeClass('selected');
  255. $(this).addClass('selected');
  256. }
  257. });
  258. });
  259. </script>
  260. <?php $this->endBlock(); ?>