|
@@ -0,0 +1,71 @@
|
|
|
|
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|
|
|
+
|
|
|
|
+ var Controller = {
|
|
|
|
+ index: function () {
|
|
|
|
+ // 初始化表格参数配置
|
|
|
|
+ Table.api.init({
|
|
|
|
+ extend: {
|
|
|
|
+ index_url: 'usercoupon/index' + location.search,
|
|
|
|
+ // add_url: 'usercoupon/add',
|
|
|
|
+ // edit_url: 'usercoupon/edit',
|
|
|
|
+ del_url: 'usercoupon/del',
|
|
|
|
+ multi_url: 'usercoupon/multi',
|
|
|
|
+ // import_url: 'usercoupon/import',
|
|
|
|
+ table: 'user_coupon',
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ var table = $("#table");
|
|
|
|
+
|
|
|
|
+ // 初始化表格
|
|
|
|
+ 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: 'user_id', title: __('User_id')},
|
|
|
|
+ {field: 'coupon_id', title: __('Coupon_id')},
|
|
|
|
+ {field: 'title', title: __('Title'), operate: 'LIKE'},
|
|
|
|
+ {field: 'desc', title: __('Desc'), operate: 'LIKE'},
|
|
|
|
+ {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
|
|
|
|
+ {field: 'money', title: __('Money')},
|
|
|
|
+ {field: 'minmoney', title: __('Minmoney')},
|
|
|
|
+ {field: 'purpose', title: __('Purpose'), searchList: {"0":__('Purpose 0'),"1":__('Purpose 1'),"2":__('Purpose 2'),"3":__('Purpose 3'),"4":__('Purpose 4'),"5":__('Purpose 5')}, formatter: Table.api.formatter.normal},
|
|
|
|
+ {field: 'starttime', title: __('Starttime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
+ {field: 'endtime', title: __('Endtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
+ {field: 'active_id', title: __('Active_id')},
|
|
|
|
+ {field: 'order_id', title: __('Order_id')},
|
|
|
|
+ {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status,
|
|
|
|
+ custom: {0: 'success', 1: 'danger'}
|
|
|
|
+ },
|
|
|
|
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
|
|
|
|
+ // {field: 'coupon.title', title: __('Coupon.title'), operate: 'LIKE'},
|
|
|
|
+ // {field: 'coupon.desc', title: __('Coupon.desc'), operate: 'LIKE'},
|
|
|
|
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
|
|
|
|
+ ]
|
|
|
|
+ ]
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 为表格绑定事件
|
|
|
|
+ Table.api.bindevent(table);
|
|
|
|
+ },
|
|
|
|
+ add: function () {
|
|
|
|
+ Controller.api.bindevent();
|
|
|
|
+ },
|
|
|
|
+ edit: function () {
|
|
|
|
+ Controller.api.bindevent();
|
|
|
|
+ },
|
|
|
|
+ api: {
|
|
|
|
+ bindevent: function () {
|
|
|
|
+ Form.api.bindevent($("form[role=form]"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ return Controller;
|
|
|
|
+});
|