| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'user/user/index',
- edit_url: 'user/user/edit',
- del_url: 'user/user/del',
- balance_url: 'user/user/balance',
- cardslip_url: 'user/user/cardslip',
- collection_url: 'user/user/collection',
- table: 'user',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id'), operate: false},
- {field: 'agent', title: __('Group_id'), operate: false},
- {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
- {field: 'parent_name', title: __('Parent_id'), operate: false},
- {field: 'balance', title: __('Balance'), operate: false},
- {field: 'freeze', title: __('Freeze'), operate: false},
- {field: 'task_num', title: __('Task'), operate: false},
- {field: 'id', title: __('Recharge'), operate: false},
- {field: 'id', title: __('Withdrawal'), operate: false},
- {field: 'id', title: __('Income'), operate: false},
- {field: 'invitation_code', title: __('Invitation_code'), operate: false},
- {field: 'is_agent', title: __('Is_agent'), searchList: {1: __('Yes'), 0: __('No')}, formatter: Table.api.formatter.status},
-
- {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.toggle,
- searchList: {0: __('Dummy'), 1: __('Real person')}
- },
- {field: 'is_lock', title: __('Status'), formatter: Table.api.formatter.toggle,
- searchList: {0: __('Normal'), 1: __('Locking')}
- },
- {field: 'operate', title: __('Operate'), table: table,
- buttons: [
- {
- name: "account",
- text: __('Account change'),
- classname: 'btn btn-xs btn-info btn-magic btn-dialog',
- url: 'trade/moneylog/index',
- refresh: true
- },{
- name: "clear",
- text: __('Clear'),
- classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
- url: 'user/user/clear',
- visible: function (row) {
- if(row.task_num > 0) return true;
- return false;
- },
- refresh: true
- },{
- name: "team",
- text: __('Team'),
- classname: 'btn btn-xs btn-success btn-magic btn-dialog',
- url: 'user/team/index',
- extend: 'data-area=\'["80%","80%"]\'',
- refresh: true
- },{
- name: "edit",
- text: __('Edit'),
- classname: 'btn btn-xs btn-warning btn-magic btn-dialog',
- url: 'user/user/edit',
- refresh: true
- },{
- name: "del",
- text: __('Del'),
- classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
- confirm: __('Confirm review'),
- url: 'user/user/del',
- refresh: true
- }],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- //余额
- $(document).on('click','.btn-balance',function () {
- var ids = Table.api.selectedids(table);
- Fast.api.open($.fn.bootstrapTable.defaults.extend.balance_url + "?ids=" + ids, __('Balance'))
- });
- //卡单
- $(document).on('click','.btn-cardslip',function () {
- var ids = Table.api.selectedids(table);
- Fast.api.open($.fn.bootstrapTable.defaults.extend.cardslip_url + "?ids=" + ids, __('Card slip'))
- });
- //收款
- $(document).on('click','.btn-collection',function () {
- var ids = Table.api.selectedids(table);
- Fast.api.open($.fn.bootstrapTable.defaults.extend.collection_url + "?ids=" + ids, __('Collection'))
- });
- },
- balance: function () {
- //余额
- Controller.api.bindevent();
- },
- cardslip: function () {
- //卡单
- Controller.api.bindevent();
- },
- collection: function () {
- //收款
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|