123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'vip/index' + location.search,
- // add_url: 'vip/add',
- edit_url: 'vip/edit',
- // del_url: 'vip/del',
- multi_url: 'vip/multi',
- import_url: 'vip/import',
- table: 'vip',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- sortOrder: 'asc',
- fixedColumns: true,
- fixedRightNumber: 1,
- columns: [
- [
- {checkbox: true},
- {field: 'id', title: __('Id')},
- {field: 'title', title: __('Title'), operate: 'LIKE'},
- {field: 'level', title: __('Level'), operate: 'LIKE'},
- {field: 'growthvalue', title: __('Growthvalue')},
- {field: 'free', title: __('Free')},
- {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
- {field: 'price', title: __('Price'), operate: 'LIKE'},
- {field: 'day', title: __('Day')},
- {field: 'vipdiscount', title: __('Vipdiscount')},
- {field: 'birthdiscount', title: __('Birthdiscount')},
- {field: 'manypeople', title: __('Manypeople')},
- {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
- {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
- buttons: [
- {
- name: 'couponuser',
- text: '发放用户',
- title: __('发放用户'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-success btn-dialog',
- icon: 'fa fa-list',
- url: 'vipuser/index',
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // }
- // success: function (data, ret) {
- // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
- // Layer.alert(ret.msg);
- // //如果需要阻止成功提示,则必须使用return false;
- // return false;
- // },
- // error: function (data, ret) {
- // // console.log(data, ret);
- // Layer.alert(ret.msg);
- // return false;
- // },
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // },
- visible: function (row) {
- if (row.id != 1) {
- return true;
- } else {
- return false;
- }
- }
- },
- {
- name: 'detail',
- text: '会员特权',
- title: __('会员特权'),
- extend: 'data-area=\'["85%", "85%"]\'',
- classname: 'btn btn-xs btn-primary btn-dialog',
- icon: 'fa fa-list',
- url: 'vipprivilege/index',
- // callback: function (data) {
- // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
- // }
- },
- ]
- }
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|