define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { var Controller = { index: function () { Table.api.init({ extend: { index_url: 'wallet_log/index' + location.search, detail_url: 'wallet_log/detail', table: 'wallet_log', } }); var table = $("#table"); table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', sortOrder: 'desc', fixedColumns: true, fixedRightNumber: 1, columns: [ [ {field: 'index', title: '序号', operate: false, formatter: Table.api.formatter.index, width: '60px'}, {field: 'user_type', title: '账户角色', searchList: {"master":"认证师傅","user":"业主/企业用户"}, formatter: Table.api.formatter.label, custom: {master: 'warning', user: 'info'}}, {field: 'account_name', title: '账户主体', operate: false, formatter: function (v, row) { var mob = row.account_mobile ? ' (' + Fast.api.escape(row.account_mobile) + ')' : ''; return '' + Fast.api.escape(v || '-') + '' + mob; }}, {field: 'type', title: '变动类型', searchList: {"settle":"佣金结算","withdraw":"余额提现","refund":"退回/退款","recharge":"账户充值","pay":"余额支付","deduct":"判责扣款"}, formatter: Table.api.formatter.label, custom: {settle: 'success', withdraw: 'primary', refund: 'info', recharge: 'success', pay: 'warning', deduct: 'danger'}}, {field: 'amount', title: '变动金额', operate: 'BETWEEN', formatter: function (v) { var num = Number(v || 0); if (num > 0) return '+¥' + num.toFixed(2) + ''; if (num < 0) return '-¥' + Math.abs(num).toFixed(2) + ''; return '¥0.00'; }}, {field: 'balance', title: '变动后余额', operate: 'BETWEEN', formatter: function (v) { return '¥' + Number(v || 0).toFixed(2); }}, {field: 'order_no', title: '关联工单', operate: false, formatter: function (v) { return v ? '' + Fast.api.escape(v) + '' : '-'; }}, {field: 'remark', title: '流水摘要', operate: 'LIKE', class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'createtime', title: '记账时间', operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime, width: '150px'}, {field: 'operate', title: '溯源', table: table, events: Table.api.events.operate, buttons: [ { name: 'detail', text: '凭证详情', title: '资金流水审计凭证', classname: 'btn btn-xs btn-info btn-detailone', extend: 'data-area=\'["820px","76%"]\'' } ], formatter: Table.api.formatter.operate} ] ] }); Table.api.bindevent(table); }, detail: function () { Controller.api.bindevent(); }, api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); } } }; return Controller; });