shop_user.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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: 'shop_user/index' + location.search,
  8. add_url: 'shop_user/add',
  9. edit_url: 'shop_user/edit',
  10. multi_url: 'shop_user/multi',
  11. table: 'shop_user',
  12. }
  13. });
  14. var table = $("#table");
  15. // 初始化表格
  16. table.bootstrapTable({
  17. url: $.fn.bootstrapTable.defaults.extend.index_url,
  18. pk: 'id',
  19. sortName: 'id',
  20. height: $(window).height() - 100,
  21. search:false,
  22. showToggle: false,
  23. showColumns: false,
  24. visible: false,
  25. showExport: false,
  26. commonSearch: false,
  27. columns: [
  28. [
  29. {checkbox: true},
  30. {field: 'id', title: __('Id')},
  31. {field: 'member.nickname', title: __('会员昵称')},
  32. {field: 'shopname', title: __('Shopname')},
  33. {field: 'name', title: __('Name')},
  34. {field: 'phone', title: __('Phone')},
  35. {field: 'description', title: __('Description')},
  36. {field: 'image', title: __('Image'), events: Table.api.events.image, formatter: Table.api.formatter.image},
  37. {field: 'balance', title: __('Balance'), operate:'BETWEEN'},
  38. {field: 'order_price', title: __('Order_price'), operate:'BETWEEN'},
  39. {field: 'order_num', title: __('Order_num')},
  40. {field: 'effect_city', title: __('管理城市')},
  41. {field: 'is_recommend', title: __('是否推荐'), searchList: {"1":__('Yes'),"0":__('No')}, formatter: Table.api.formatter.toggle},
  42. {field: 'status', title: __('状态'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2'),"4":__('资料修改'),"5":__('修改驳回')}, formatter: Table.api.formatter.normal},
  43. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  44. {
  45. field: 'operate', title: __('Operate'), table: table,
  46. buttons: [
  47. {
  48. name: 'detail',
  49. text: '订单查看',
  50. title: function (row) {
  51. return row.shopname+'的订单';
  52. },
  53. classname: 'btn btn-xs btn-success btn-addtabs',
  54. icon: 'fa fa-list',
  55. dropdown:'更多操作',
  56. url: function (row) {
  57. return 'shop_order/index?suser_id='+ row.id;
  58. }
  59. },
  60. {
  61. name: 'detail',
  62. text: '提现查看',
  63. title: function (row) {
  64. return row.shopname+'的提现';
  65. },
  66. classname: 'btn btn-xs btn-warning btn-addtabs',
  67. icon: 'fa fa-list',
  68. dropdown:'更多操作',
  69. url: function (row) {
  70. return 'member_extract/index?suser_id='+ row.id;
  71. }
  72. }
  73. ],
  74. events: Table.api.events.operate, formatter: Table.api.formatter.operate
  75. }
  76. ]
  77. ]
  78. });
  79. // 为表格绑定事件
  80. Table.api.bindevent(table);
  81. },
  82. add: function () {
  83. Controller.api.bindevent();
  84. },
  85. edit: function () {
  86. Controller.api.bindevent();
  87. },
  88. api: {
  89. bindevent: function () {
  90. Form.api.bindevent($("form[role=form]"));
  91. }
  92. }
  93. };
  94. return Controller;
  95. });