user.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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: 'agent/user/index' + location.search,
  8. // add_url: 'agent/user/add',
  9. // edit_url: 'agent/user/edit',
  10. // del_url: 'agent/user/del',
  11. multi_url: 'agent/user/multi',
  12. import_url: 'agent/user/import',
  13. table: 'user',
  14. }
  15. });
  16. var table = $("#table");
  17. //在普通搜索渲染后
  18. table.on('post-common-search.bs.table', function (event, table) {
  19. var form = $("form", table.$commonsearch);
  20. $("input[name='gh_id']", form).addClass("selectpage").data("source", "gonghui/index").data("primaryKey", "id").data("field", "name").data("orderBy", "id asc");
  21. Form.events.cxselect(form);
  22. Form.events.selectpage(form);
  23. });
  24. // 初始化表格
  25. table.bootstrapTable({
  26. url: $.fn.bootstrapTable.defaults.extend.index_url,
  27. pk: 'id',
  28. sortName: 'id',
  29. // fixedColumns: true,
  30. // fixedRightNumber: 1,
  31. columns: [
  32. [
  33. {checkbox: true},
  34. {field: 'id', title: __('Id')},
  35. // {field: 'gh_id', title: __('Gh_id')},
  36. // {field: 'gonghui.name', title: __('Gonghui.name'), operate: false},
  37. {field: 'intro_uid', title: __('Intro_uid')},
  38. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  39. {field: 'username', title: __('Username'), operate: 'LIKE'},
  40. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  41. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0'),"-1":__('Gender -1')}, formatter: Table.api.formatter.normal},
  42. {field: 'userwallet.pay_money', title: __('累计充值金额')},
  43. {field: 'userwallet.money', title: __('余额')},
  44. {field: 'userwallet.get_money', title: __('累计余额')},
  45. {field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  46. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  47. {field: 'is_active', title: __('在线状态'), searchList: {"1":__('在线'),"0":__('离线')}, formatter: Table.api.formatter.status},
  48. {field: 'idcard_status', title: __('Idcard_status'), searchList: {"-1":__('Idcard_status -1'),"0":__('Idcard_status 0'),"1":__('Idcard_status 1'),"2":__('Idcard_status 2')}, formatter: Table.api.formatter.status},
  49. {field: 'real_status', title: __('Real_status'), searchList: {"-1":__('Real_status -1'),"0":__('Real_status 0'),"1":__('Real_status 1'),"2":__('Real_status 2')}, formatter: Table.api.formatter.status},
  50. // {field: 'sharing_ratio', title: __('分成比例')},
  51. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  52. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  53. //{field: 'password', title: __('Password'), operate: 'LIKE'},
  54. //{field: 'salt', title: __('Salt'), operate: 'LIKE'},
  55. //{field: 'email', title: __('Email'), operate: 'LIKE'},
  56. // {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  57. // {field: 'introcode', title: __('Introcode'), operate: 'LIKE'},
  58. //{field: 'height', title: __('Height'), operate: 'LIKE'},
  59. //{field: 'weight', title: __('Weight'), operate: 'LIKE'},
  60. //{field: 'birthday', title: __('Birthday')},
  61. //{field: 'bio', title: __('Bio'), operate: 'LIKE'},
  62. //{field: 'audio_bio', title: __('Audio_bio'), operate: 'LIKE'},
  63. //{field: 'successions', title: __('Successions')},
  64. //{field: 'maxsuccessions', title: __('Maxsuccessions')},
  65. // {field: 'prevtime', title: __('Prevtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  66. //{field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  67. //{field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
  68. //{field: 'loginfailure', title: __('Loginfailure')},
  69. //{field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
  70. //{field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  71. //{field: 'token', title: __('Token'), operate: 'LIKE'},
  72. {field: 'frozentime', title: __('Frozentime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  73. //{field: 'verification', title: __('Verification'), operate: 'LIKE'},
  74. //{field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
  75. //{field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
  76. // {field: 'register_from', title: __('Register_from'), operate: 'LIKE'},
  77. // {field: 'cityname', title: __('Cityname'), operate: 'LIKE'},
  78. //{field: 'photo_images', title: __('Photo_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  79. //{field: 'education_id', title: __('Education_id')},
  80. //{field: 'hobby_ids', title: __('Hobby_ids'), operate: 'LIKE'},
  81. //{field: 'job_id', title: __('Job_id')},
  82. //{field: 'marital_id', title: __('Marital_id')},
  83. //{field: 'tag_ids', title: __('Tag_ids'), operate: 'LIKE'},
  84. //{field: 'wages_id', title: __('Wages_id')},
  85. //{field: 'hometown_cityid', title: __('Hometown_cityid')},
  86. //{field: 'open_match_video', title: __('Open_match_video'), searchList: {"1":__('Open_match_video 1'),"0":__('Open_match_video 0')}, formatter: Table.api.formatter.normal},
  87. //{field: 'open_match_audio', title: __('Open_match_audio'), searchList: {"1":__('Open_match_audio 1'),"0":__('Open_match_audio 0')}, formatter: Table.api.formatter.normal},
  88. //{field: 'open_match_typing', title: __('Open_match_typing'), searchList: {"1":__('Open_match_typing 1'),"0":__('Open_match_typing 0')}, formatter: Table.api.formatter.normal},
  89. //{field: 'free_video', title: __('Free_video'), searchList: {"1":__('Free_video 1'),"0":__('Free_video 0')}, formatter: Table.api.formatter.normal},
  90. //{field: 'free_audio', title: __('Free_audio'), searchList: {"1":__('Free_audio 1'),"0":__('Free_audio 0')}, formatter: Table.api.formatter.normal},
  91. //{field: 'free_typing', title: __('Free_typing'), searchList: {"1":__('Free_typing 1'),"0":__('Free_typing 0')}, formatter: Table.api.formatter.normal},
  92. //{field: 'gonghui.id', title: __('Gonghui.id')},
  93. // {field: 'ios_openid', title: __('苹果账号标识'), operate: 'LIKE'},
  94. // {field: 'is_appointment', title: __('是否接受约会'), searchList: {"1":__('接受'),"0":__('不接受')}, formatter: Table.api.formatter.status},
  95. // {field: 'chat_price', title: __('文字价格')},
  96. // {field: 'voice_price', title: __('语音价格')},
  97. // {field: 'video_price', title: __('视频价格')},
  98. // {field: 'is_kefu', title: __('是否客服'), searchList: {"1":__('是'),"0":__('否')}, formatter: Table.api.formatter.status},
  99. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  100. buttons: [
  101. {
  102. name: 'statistics',
  103. text: '统计',
  104. title: __('统计'),
  105. extend: 'data-area=\'["85%", "85%"]\'',
  106. classname: 'btn btn-xs btn-success btn-dialog',
  107. icon: 'fa fa-list',
  108. url: 'agent/dashboard/statistics',
  109. // callback: function (data) {
  110. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  111. // }
  112. // success: function (data, ret) {
  113. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  114. // Layer.alert(ret.msg);
  115. // //如果需要阻止成功提示,则必须使用return false;
  116. // return false;
  117. // },
  118. // error: function (data, ret) {
  119. // // console.log(data, ret);
  120. // Layer.alert(ret.msg);
  121. // return false;
  122. // },
  123. // callback: function (data) {
  124. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  125. // },
  126. visible: function (row) {
  127. if (row.is_show == 1) {
  128. return true;
  129. } else {
  130. return false;
  131. }
  132. }
  133. }
  134. ,{
  135. name: 'detail',
  136. text: '主播统计',
  137. title: __('主播统计'),
  138. classname: 'btn btn-xs btn-success btn-dialog',
  139. icon: 'fa fa-list',
  140. url: 'agent/user/detail',
  141. },
  142. ]
  143. }
  144. ]
  145. ]
  146. });
  147. // 为表格绑定事件
  148. Table.api.bindevent(table);
  149. },
  150. add: function () {
  151. Controller.api.bindevent();
  152. },
  153. edit: function () {
  154. Controller.api.bindevent();
  155. },
  156. api: {
  157. bindevent: function () {
  158. Form.api.bindevent($("form[role=form]"));
  159. }
  160. }
  161. };
  162. return Controller;
  163. });