fufengroup.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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: 'fufengroup/index',
  8. add_url: 'fufengroup/add',
  9. edit_url: 'fufengroup/edit',
  10. del_url: 'fufengroup/del',
  11. multi_url: 'fufengroup/multi',
  12. table: 'fufen_group',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'name', title: __('Name'),operate:'LIKE'},
  26. {
  27. field: '关联支付号', title: __('关联支付号'), operate:false,
  28. formatter:function (value, row) {
  29. var text = '';
  30. text += "<a href='javascript:;' class='wxpay_relation' data-type='index' data-fufenid='" + row.id + "'>关联</a>&nbsp;&nbsp;";
  31. text += "<a href='javascript:;' class='wxpay_relation' data-type='show' data-fufenid='" + row.id + "'>查看</a>";
  32. return text;
  33. }
  34. },
  35. {field: '关联渠道', title: __('关联渠道'), operate:false,
  36. formatter: function (value, row) {
  37. var text = '';
  38. text += "<a href='javascript:;' class='channel_relation' data-type='index' data-fufenid='" + row.id + "'>关联</a>&nbsp;&nbsp;";
  39. text += "<a href='javascript:;' class='channel_relation' data-type='show' data-fufenid='" + row.id + "'>查看</a>";
  40. return text;
  41. }},
  42. {
  43. field: 'status',
  44. title: __('Status'),
  45. visible: false,
  46. searchList: {"1": __('Status 1'), "2": __('Status 2')}
  47. },
  48. {field: 'status_text', title: __('Status'), operate: false},
  49. {
  50. field: 'createtime',
  51. title: __('Createtime'),
  52. operate:false,
  53. formatter: Table.api.formatter.datetime
  54. },
  55. {
  56. field: 'updatetime',
  57. title: __('Updatetime'),
  58. operate:false,
  59. formatter: Table.api.formatter.datetime
  60. },
  61. {
  62. field: 'operate',
  63. title: __('Operate'),
  64. table: table,
  65. events: Table.api.events.operate,
  66. formatter: Table.api.formatter.operate
  67. }
  68. ]
  69. ]
  70. });
  71. $(document).delegate('.channel_relation', 'click', function () {
  72. var ids = $(this).data('fufenid');
  73. var type = $(this).data('type');
  74. layer.open({
  75. type: 2,
  76. area: ['900px', '750px'],
  77. fixed: false, //不固定
  78. maxmin: true,
  79. title:"关联渠道",
  80. content: '/admin/channelfufen/' + type + '?ids=' + ids
  81. });
  82. });
  83. $(document).delegate('.wxpay_relation', 'click', function () {
  84. var ids = $(this).data('fufenid');
  85. var type = $(this).data('type');
  86. layer.open({
  87. type: 2,
  88. area: ['900px', '750px'],
  89. fixed: false, //不固定
  90. maxmin: true,
  91. title:"关联支付号",
  92. content: '/admin/wxpayfufen/' + type + '?ids=' + ids
  93. });
  94. });
  95. // 为表格绑定事件
  96. Table.api.bindevent(table);
  97. },
  98. add: function () {
  99. Controller.api.bindevent();
  100. },
  101. edit: function () {
  102. Controller.api.bindevent();
  103. },
  104. api: {
  105. bindevent: function () {
  106. Form.api.bindevent($("form[role=form]"));
  107. }
  108. }
  109. };
  110. return Controller;
  111. });