offline_withdraw.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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: '账号地址'},
  35. {field: 'to_address', title: '提现地址'},
  36. {field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
  37. {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
  38. {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
  39. {
  40. field: 'status', title: '充值状态', searchList: {
  41. '0': '待处理',
  42. '100': '自动提现中',
  43. '200': '自动打款成功',
  44. '201': '手动打款成功',
  45. '300': '驳回',
  46. '400': '提现失败',
  47. '500': '取消',
  48. }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label
  49. },
  50. // {field: 'admin_id', title: __('Admin_id')},
  51. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  52. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  53. {
  54. field: 'operate', title: __('Operate'), table: table,
  55. events: Table.api.events.operate,
  56. buttons: [{
  57. name: 'approve',
  58. text: '审核订单',
  59. title: '审核订单',
  60. classname: 'btn btn-xs btn-primary btn-dialog btn-receivable',
  61. icon: 'fa fa-keyboard-o',
  62. url: 'offline/offline_withdraw/approve',
  63. extend: 'data-area=\'["50%", "50%"]\'',
  64. visible: function (row) {
  65. // 自定义按钮 动态是否显示
  66. return row.status === 0;
  67. }
  68. },],
  69. formatter: Table.api.formatter.operate
  70. }
  71. ]
  72. ]
  73. });
  74. // 为表格绑定事件
  75. Table.api.bindevent(table);
  76. },
  77. add: function () {
  78. Controller.api.bindevent();
  79. },
  80. approve: function () {
  81. Controller.api.bindevent();
  82. },
  83. api: {
  84. bindevent: function () {
  85. Form.api.bindevent($("form[role=form]"));
  86. }
  87. }
  88. };
  89. setTimeout(getBalances, 500);
  90. return Controller;
  91. });
  92. //头部统计
  93. function getBalances(){
  94. $.post("offline/offline_withdraw/getBalance",{},
  95. function (data) {
  96. $("#wallet_balance").text(data.reqBalance);
  97. $("#handling_balance").text(data.reqFee);
  98. $("#residual_amount").text(data.reqAmount);
  99. })
  100. }