123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'userwallet/index' + location.search,
- add_url: 'userwallet/add',
- // edit_url: 'userwallet/edit',
- // del_url: 'userwallet/del',
- multi_url: 'userwallet/multi',
- import_url: 'userwallet/import',
- table: 'user_wallet',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- columns: [
- [
- {checkbox: true},
- // {field: 'id', title: __('Id')},
- // {field: 'user_id', title: __('User_id')},
- {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
- {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
- {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
- {field: 'gold', title: __('Gold')},
- {field: 'money', title: __('Money')},
- {field: 'jewel', title: __('Jewel')},
- {field: 'vip_endtime', title: __('Vip_endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- // {field: 'vip_level', title: __('Vip_level'),searchList: {"0":__('Vip_level 0'),"10":__('Vip_level 10'),"20":__('Vip_level 20'),"30":__('Vip_level 30'),"40":__('Vip_level 40')}, formatter: Table.api.formatter.status},
- {field: 'pay_money', title: __('累计消费金额')},
- {field: 'get_money', title: __('累计获得金额')},
- {field: 'operate', title: __('Operate'), table: table,
- buttons:[
- {
- name:'updategold',
- text:'充值金币',
- title:'充值金币',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'userwallet/updategold/id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'updatemoney',
- text:'充值积分',
- title:'充值积分',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'userwallet/updatemoney/id/{ids}?dialog=1',
- target:'_self',
- },
- {
- name:'updatejewel',
- text:'充值钻石',
- title:'充值钻石',
- icon:'fa fa-exclamation-circle',
- classname:'btn btn-xs btn-info btn-dialog',
- url:'userwallet/updatejewel/id/{ids}?dialog=1',
- target:'_self',
- },
- ],
- events: Table.api.events.operate, formatter: Table.api.formatter.operate}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- updategold: function () {
- Controller.api.bindevent();
- },
- updatemoney: function () {
- Controller.api.bindevent();
- },
- updatejewel: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }
- }
- };
- return Controller;
- });
|