vip.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'vip/index' + location.search,
  8. // add_url: 'vip/add',
  9. edit_url: 'vip/edit',
  10. // del_url: 'vip/del',
  11. multi_url: 'vip/multi',
  12. import_url: 'vip/import',
  13. table: 'vip',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. sortOrder: 'asc',
  23. fixedColumns: true,
  24. fixedRightNumber: 1,
  25. columns: [
  26. [
  27. {checkbox: true},
  28. {field: 'id', title: __('Id')},
  29. {field: 'title', title: __('Title'), operate: 'LIKE'},
  30. {field: 'level', title: __('Level'), operate: 'LIKE'},
  31. {field: 'growthvalue', title: __('Growthvalue')},
  32. {field: 'free', title: __('Free')},
  33. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  34. {field: 'price', title: __('Price'), operate: 'LIKE'},
  35. {field: 'day', title: __('Day')},
  36. {field: 'vipdiscount', title: __('Vipdiscount')},
  37. {field: 'birthdiscount', title: __('Birthdiscount')},
  38. {field: 'manypeople', title: __('Manypeople')},
  39. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  41. buttons: [
  42. {
  43. name: 'couponuser',
  44. text: '发放用户',
  45. title: __('发放用户'),
  46. extend: 'data-area=\'["85%", "85%"]\'',
  47. classname: 'btn btn-xs btn-success btn-dialog',
  48. icon: 'fa fa-list',
  49. url: 'vipuser/index',
  50. // callback: function (data) {
  51. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  52. // }
  53. // success: function (data, ret) {
  54. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  55. // Layer.alert(ret.msg);
  56. // //如果需要阻止成功提示,则必须使用return false;
  57. // return false;
  58. // },
  59. // error: function (data, ret) {
  60. // // console.log(data, ret);
  61. // Layer.alert(ret.msg);
  62. // return false;
  63. // },
  64. // callback: function (data) {
  65. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  66. // },
  67. visible: function (row) {
  68. if (row.id != 1) {
  69. return true;
  70. } else {
  71. return false;
  72. }
  73. }
  74. },
  75. {
  76. name: 'detail',
  77. text: '会员特权',
  78. title: __('会员特权'),
  79. extend: 'data-area=\'["85%", "85%"]\'',
  80. classname: 'btn btn-xs btn-primary btn-dialog',
  81. icon: 'fa fa-list',
  82. url: 'vipprivilege/index',
  83. // callback: function (data) {
  84. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  85. // }
  86. },
  87. ]
  88. }
  89. ]
  90. ]
  91. });
  92. // 为表格绑定事件
  93. Table.api.bindevent(table);
  94. },
  95. add: function () {
  96. Controller.api.bindevent();
  97. },
  98. edit: function () {
  99. Controller.api.bindevent();
  100. },
  101. api: {
  102. bindevent: function () {
  103. Form.api.bindevent($("form[role=form]"));
  104. }
  105. }
  106. };
  107. return Controller;
  108. });