|
@@ -0,0 +1,93 @@
|
|
|
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
+
|
|
|
+ var Controller = {
|
|
|
+ index: function () {
|
|
|
+ // 初始化表格参数配置
|
|
|
+ Table.api.init({
|
|
|
+ extend: {
|
|
|
+ index_url: 'recharge_config/index' + location.search,
|
|
|
+ add_url: 'recharge_config/add',
|
|
|
+ edit_url: 'recharge_config/edit',
|
|
|
+ del_url: 'recharge_config/del',
|
|
|
+ multi_url: 'recharge_config/multi',
|
|
|
+ import_url: 'recharge_config/import',
|
|
|
+ table: 'recharge_config',
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ var table = $("#table");
|
|
|
+
|
|
|
+ // 初始化表格
|
|
|
+ table.bootstrapTable({
|
|
|
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
+ pk: 'id',
|
|
|
+ sortName: 'id',
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {checkbox: true},
|
|
|
+ {field: 'id', title: __('Id')},
|
|
|
+ {field: 'company_id', title: __('Company_id')},
|
|
|
+ {field: 'company.name', title: __('Company.name'), operate: 'LIKE'},
|
|
|
+ {field: 'price', title: __('Price'), operate:'BETWEEN'},
|
|
|
+ {field: 'giftprice', title: __('Giftprice'), operate:'BETWEEN'},
|
|
|
+ {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0')}, formatter: Table.api.formatter.status},
|
|
|
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
|
|
|
+ buttons:[
|
|
|
+ {
|
|
|
+ name: 'recharge_gift',
|
|
|
+ text: '赠送列表',
|
|
|
+ title: '赠送列表',
|
|
|
+ classname: 'btn btn-xs btn-primary btn-dialog',
|
|
|
+ icon: 'fa fa-list',
|
|
|
+ url: function (row, column) {
|
|
|
+ return "recharge_gift/index?config_id="+row.id;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'edit',
|
|
|
+ text:__('Edit'),
|
|
|
+ title:__('Edit'),
|
|
|
+ classname: 'btn btn-xs btn-success btn-editone',
|
|
|
+ icon: 'fa fa-pencil',
|
|
|
+ url: function (row, column) {
|
|
|
+ return "recharge_config/edit?ids="+row.id;
|
|
|
+ },
|
|
|
+ refresh:true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name:'del',
|
|
|
+ text:__('Del'),
|
|
|
+ title: __('Del'),
|
|
|
+ classname: 'btn btn-xs btn-danger btn-delone',
|
|
|
+ icon: 'fa fa-trash',
|
|
|
+ url: function (row, column) {
|
|
|
+ return "recharge_config/del?ids="+row.id;
|
|
|
+ },
|
|
|
+ refresh:true
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ });
|
|
|
+
|
|
|
+ // 为表格绑定事件
|
|
|
+ Table.api.bindevent(table);
|
|
|
+ },
|
|
|
+ add: function () {
|
|
|
+ Controller.api.bindevent();
|
|
|
+ },
|
|
|
+ edit: function () {
|
|
|
+ Controller.api.bindevent();
|
|
|
+ },
|
|
|
+ api: {
|
|
|
+ bindevent: function () {
|
|
|
+ $(document).on("fa.event.appendfieldlist", "#second-table .btn-append", function (e, obj) {
|
|
|
+ Form.events.selectpage(obj);//绑定动态下拉组件
|
|
|
+ });
|
|
|
+ Form.api.bindevent($("form[role=form]"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return Controller;
|
|
|
+});
|