user.js 5.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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: 'service/user/index' + location.search,
  8. multi_url: 'service/user/multi',
  9. import_url: 'service/user/import',
  10. table: 'service_user_info',
  11. }
  12. });
  13. var table = $("#table");
  14. // 初始化表格
  15. table.bootstrapTable({
  16. url: $.fn.bootstrapTable.defaults.extend.index_url,
  17. pk: 'id',
  18. sortName: 'id',
  19. fixedColumns: true,
  20. fixedRightNumber: 1,
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'user_id', title: __('User_id')},
  26. {field: 'user.nickname', title: __('Nickname'),operate: false},
  27. {field: 'user.avatar', title: __('Avatar'),events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
  28. {field: 'mobile', title: __('Mobile')},
  29. {field: 'is_skill', title: __('Is_skill'), searchList: {"0":__('Is_skill 0'),"1":__('Is_skill 1')}, formatter: Table.api.formatter.normal},
  30. {field: 'is_shop', title: __('Is_shop'), searchList: {"0":__('Is_shop 0'),"1":__('Is_shop 1')}, formatter: Table.api.formatter.normal},
  31. // {field: 'unionid', title: __('Unionid'), operate: 'LIKE'},
  32. // {field: 'user_openid', title: __('User_openid'), operate: 'LIKE'},
  33. // {field: 'skill_openid', title: __('Skill_openid'), operate: 'LIKE'},
  34. // {field: 'shop_openid', title: __('Shop_openid'), operate: 'LIKE'},
  35. // {field: 'alipay_name', title: __('Alipay_name')},
  36. // {field: 'alipay_account', title: __('Alipay_account'), operate: 'LIKE'},
  37. // {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
  38. // {field: 'bank_user', title: __('Bank_user')},
  39. // {field: 'bank_card', title: __('Bank_card')},
  40. {field: 'user.usermoney', title: __('Usermoney'),operate: false},
  41. {field: 'money', title: __('Money'), operate:'BETWEEN'},
  42. {field: 'shop_money', title: __('Shop_money'), operate:'BETWEEN'},
  43. {field: 'shop_user_money', title: __('Shop_user_money'), operate:'BETWEEN'},
  44. {field: 'is_plus', title: __('Is_plus'), searchList: {"0":__('Is_plus 0'),"1":__('Is_plus 1')}, formatter: Table.api.formatter.normal},
  45. {field: 'discount', title: __('Discount')},
  46. {field: 'plusname', title: __('Plusname'), operate: 'LIKE'},
  47. {field: 'plustime', title: __('Plustime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  49. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  51. buttons: [
  52. {
  53. name: 'money',
  54. text: __('充值'),
  55. title: __('充值'),
  56. classname: 'btn btn-xs btn-success btn-dialog',
  57. url: function(row){
  58. return 'service/money/usermoneylog/deduct?user_id='+row.user_id;
  59. },
  60. },
  61. {
  62. name: 'list',
  63. text: __('余额明细'),
  64. title: __('余额明细'),
  65. classname: 'btn btn-xs btn-info btn-dialog',
  66. icon: 'fa fa-list-o',
  67. url: function(row){
  68. return 'service/money/usermoneylog/index?user_id='+row.user_id;
  69. },
  70. },
  71. ],
  72. formatter: Table.api.formatter.operate}
  73. ]
  74. ]
  75. });
  76. // 为表格绑定事件
  77. Table.api.bindevent(table);
  78. },
  79. add: function () {
  80. Controller.api.bindevent();
  81. },
  82. edit: function () {
  83. Controller.api.bindevent();
  84. },
  85. api: {
  86. bindevent: function () {
  87. Form.api.bindevent($("form[role=form]"));
  88. }
  89. }
  90. };
  91. return Controller;
  92. });