couponvip.js 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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: 'couponvip/index/coupon_id/' + Config.coupon_id + location.search,
  8. // add_url: 'couponvip/add',
  9. // edit_url: 'couponvip/edit',
  10. // del_url: 'couponvip/del',
  11. // multi_url: 'couponvip/multi',
  12. // import_url: 'couponvip/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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. showToggle: false,
  25. showColumns: false,
  26. showExport: false,
  27. columns: [
  28. [
  29. {checkbox: true},
  30. {field: 'id', title: __('Id')},
  31. {field: 'title', title: __('Title'), operate: 'LIKE'},
  32. {field: 'level', title: __('Level'), operate: 'LIKE'},
  33. {field: 'growthvalue', title: __('Growthvalue')},
  34. {field: 'free', title: __('Free')},
  35. {field: 'vipdiscount', title: __('Vipdiscount')},
  36. {field: 'birthdiscount', title: __('Birthdiscount')},
  37. {field: 'manypeople', title: __('Manypeople')},
  38. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  39. buttons: [
  40. {
  41. name: 'giveout',
  42. text: '发放',
  43. title: __('发放'),
  44. extend: 'data-area=\'["85%", "85%"]\'',
  45. classname: 'btn btn-xs btn-success btn-ajax',
  46. icon: 'fa fa-pencil',
  47. confirm: '确认发放?',
  48. url: 'couponvip/giveout/coupon_id/' + Config.coupon_id,
  49. // refresh: true,
  50. // success: function (data, ret) {
  51. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  52. // Layer.alert(ret.msg);
  53. // //如果需要阻止成功提示,则必须使用return false;
  54. // return false;
  55. // },
  56. // error: function (data, ret) {
  57. // // console.log(data, ret);
  58. // Layer.alert(ret.msg);
  59. // return false;
  60. // },
  61. // callback: function (data) {
  62. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  63. // },
  64. // visible: function (row) {
  65. // if (row.status == 0) {
  66. // return true;
  67. // } else {
  68. // return false;
  69. // }
  70. // }
  71. }
  72. ]
  73. }
  74. ]
  75. ]
  76. });
  77. // 为表格绑定事件
  78. Table.api.bindevent(table);
  79. },
  80. add: function () {
  81. Controller.api.bindevent();
  82. },
  83. edit: function () {
  84. Controller.api.bindevent();
  85. },
  86. api: {
  87. bindevent: function () {
  88. Form.api.bindevent($("form[role=form]"));
  89. }
  90. }
  91. };
  92. return Controller;
  93. });