define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'offline/offline_withdraw/index' + location.search, add_url: 'offline/offline_withdraw/add', edit_url: 'offline/offline_withdraw/edit', del_url: 'offline/offline_withdraw/del', multi_url: 'offline/offline_withdraw/multi', import_url: 'offline/offline_withdraw/import', table: 'offline_withdraw_record', } }); var table = $("#table"); $(".btn-refresh").click(function (){ getBalances(); }); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {checkbox: true}, {field: 'id', title: __('Id')}, // {field: 'frozen_id', title: __('Frozen_id')}, {field: 'tx_hash', title: __('Tx_hash'), operate: 'LIKE'}, {field: 'user_id', title: __('User_id')}, {field: 'address', title: '账号地址'}, {field: 'to_address', title: '提现地址'}, {field: 'symbol', title: __('Symbol'), operate: 'LIKE'}, {field: 'amount', title: __('Amount'), operate:'BETWEEN'}, {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'}, { field: 'status', title: '充值状态', searchList: { '0': '待处理', '100': '自动提现中', '200': '自动打款成功', '201': '手动打款成功', '300': '驳回', '400': '提现失败', '500': '取消', }, operate: 'FIND_IN_SET', formatter: Table.api.formatter.label }, // {field: 'admin_id', title: __('Admin_id')}, {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, { field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, buttons: [{ name: 'approve', text: '审核订单', title: '审核订单', classname: 'btn btn-xs btn-primary btn-dialog btn-receivable', icon: 'fa fa-keyboard-o', url: 'offline/offline_withdraw/approve', extend: 'data-area=\'["50%", "50%"]\'', visible: function (row) { // 自定义按钮 动态是否显示 return row.status === 0; } },], formatter: Table.api.formatter.operate } ] ] }); // 为表格绑定事件 Table.api.bindevent(table); }, add: function () { Controller.api.bindevent(); }, approve: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; setTimeout(getBalances, 500); return Controller; }); //头部统计 function getBalances(){ $.post("offline/offline_withdraw/getBalance",{}, function (data) { $("#wallet_balance").text(data.reqBalance); $("#handling_balance").text(data.reqFee); $("#residual_amount").text(data.reqAmount); }) }