offline_withdraw.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'offline/offline_withdraw/index' + location.search,
  8. add_url: 'offline/offline_withdraw/add',
  9. edit_url: 'offline/offline_withdraw/edit',
  10. del_url: 'offline/offline_withdraw/del',
  11. multi_url: 'offline/offline_withdraw/multi',
  12. import_url: 'offline/offline_withdraw/import',
  13. table: 'offline_withdraw_record',
  14. }
  15. });
  16. var table = $("#table");
  17. $(".btn-refresh").click(function (){
  18. getBalances();
  19. });
  20. // 初始化表格
  21. table.bootstrapTable({
  22. url: $.fn.bootstrapTable.defaults.extend.index_url,
  23. pk: 'id',
  24. sortName: 'id',
  25. fixedColumns: true,
  26. fixedRightNumber: 1,
  27. columns: [
  28. [
  29. {checkbox: true},
  30. {field: 'id', title: __('Id')},
  31. // {field: 'frozen_id', title: __('Frozen_id')},
  32. {field: 'tx_hash', title: __('Tx_hash'), operate: 'LIKE'},
  33. {field: 'user_id', title: __('User_id')},
  34. {field: 'address', title: '账号地址',cellStyle : function(value, row, index, field){
  35. return {
  36. css: {
  37. "white-space": "nowrap",
  38. "text-overflow": "ellipsis",
  39. "overflow": "hidden",
  40. "max-width":"300px"
  41. }
  42. };
  43. }},
  44. {field: 'to_address', title: '提现地址',cellStyle : function(value, row, index, field){
  45. return {
  46. css: {
  47. "white-space": "nowrap",
  48. "text-overflow": "ellipsis",
  49. "overflow": "hidden",
  50. "max-width":"300px"
  51. }
  52. };
  53. }},
  54. {field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
  55. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  56. {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
  57. {
  58. field: 'status', title: '充值状态', searchList: {
  59. '0': '待处理',
  60. '100': '自动提现中',
  61. '200': '自动打款成功',
  62. '201': '手动打款成功',
  63. '300': '驳回',
  64. '400': '提现失败',
  65. '500': '取消',
  66. }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
  67. },
  68. {field: 'usdt', title: __('实际到账金额')},
  69. {field: 'rate', title: __('汇率')},
  70. {field: 'fee', title: __('手续费')},
  71. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  72. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  73. {
  74. field: 'operate', title: __('Operate'), table: table,
  75. events: Table.api.events.operate,
  76. buttons: [{
  77. name: 'approve',
  78. text: '审核订单',
  79. title: '审核订单',
  80. classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
  81. icon: 'fa fa-keyboard-o',
  82. url: 'offline/offline_withdraw/approve',
  83. extend: 'data-area=\'["50%", "50%"]\'',
  84. visible: function (row) {
  85. // 自定义按钮 动态是否显示
  86. return row.status === 0;
  87. }
  88. },],
  89. formatter: Table.api.formatter.operate
  90. }
  91. ]
  92. ]
  93. });
  94. // 为表格绑定事件
  95. Table.api.bindevent(table);
  96. },
  97. add: function () {
  98. Controller.api.bindevent();
  99. },
  100. approve: function () {
  101. Form.api.bindevent($("form[role=form]"), function () {
  102. }, function () {
  103. }, function (success, error) {
  104. layer.confirm('请先仔细确认提现数据!', {
  105. btn: ['确定', '取消'] //按钮
  106. }, function (index) {
  107. Form.api.submit($("form[role=form]"), function (data, ret) {
  108. //如果我们需要在提交表单成功后做跳转,可以在此使用location.href="链接";进行跳转
  109. setTimeout(function () {
  110. parent.Layer.close(parent.Layer.getFrameIndex(window.name));
  111. //刷新页面
  112. window.parent.location.reload();
  113. }, 1000);
  114. });
  115. Layer.close(index);
  116. }, function () {
  117. });
  118. return false;
  119. });
  120. },
  121. api: {
  122. bindevent: function () {
  123. Form.api.bindevent($("form[role=form]"));
  124. }
  125. }
  126. };
  127. setTimeout(getBalances, 500);
  128. return Controller;
  129. });
  130. //头部统计
  131. function getBalances(){
  132. $.post("offline/offline_withdraw/getBalance",{},
  133. function (data) {
  134. $("#wallet_balance").text(data.reqBalance);
  135. $("#handling_balance").text(data.reqFee);
  136. $("#residual_amount").text(data.reqAmount);
  137. })
  138. }