fenxiao_next_user_list.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. mui.init({
  2. pullRefresh: {
  3. container: '#pullrefresh',
  4. down: {},
  5. up: {contentrefresh: '正在加载...', callback: pullupRefresh}
  6. }
  7. });
  8. var pageNumber = 0, pagesize = 10, tabindex = 1;
  9. mui.ready(function () {
  10. var btnArray = ['否', '是'];
  11. console.log("----------getParam('openid)-------------" + getParam("openid"));
  12. $.ajax(base_path + '/rebackStatic/underDrpListInfoInit?dates=' + new Date().getTime(), {
  13. dataType: 'json',
  14. type: 'post',
  15. timeout: 15000,
  16. xhrFields: {
  17. withCredentials: true
  18. },
  19. crossDomain: true,
  20. data: ("openid=" + (getParam("openid") == null ? "" : getParam("openid"))),
  21. success: function (dt) {
  22. if (dt.status) {
  23. var rolesList_data = [];
  24. if (dt.data.rolesList != null) {
  25. rolesList_data = dt.data.rolesList
  26. }
  27. var table = document.body.querySelector('.tab-with-user');
  28. mui(rolesList_data).each(function (index) {
  29. var li = document.createElement('a');
  30. if (index == 0) {
  31. li.className = 'mui-control-item mui-active';
  32. tabindex = this.roleId
  33. } else {
  34. li.className = 'mui-control-item'
  35. }
  36. li.setAttribute('id', this.roleId);
  37. li.innerHTML = '<span class="mui-tab-label">' + this.roleName + '</span>';
  38. table.appendChild(li)
  39. });
  40. mui('#pullrefresh').pullRefresh().pullupLoading();
  41. mui.each(document.querySelectorAll('.tab-with-user .mui-control-item'), function (index, el) {
  42. el.addEventListener('tap', function () {
  43. pageNumber = 0;
  44. tabindex = this.getAttribute('id');
  45. $('.my-tab-view-pull').empty();
  46. mui('#pullrefresh').pullRefresh().refresh(true);
  47. mui('#pullrefresh').pullRefresh().pullupLoading()
  48. }, false)
  49. })
  50. } else {
  51. mui.confirm(dt.message, '提示', btnArray, function (e) {
  52. if (e.index == 1) {
  53. }
  54. })
  55. }
  56. },
  57. error: function (xhr, type, errorThrown) {
  58. console.log(xhr)
  59. }
  60. });
  61. document.querySelector('.loading-bg').style.display = 'none'
  62. });
  63. function pullupRefresh() {
  64. pageNumber += 1;
  65. var btnArray = ['否', '是'];
  66. $.ajax(base_path + '/rebackStatic/underDrpListInfo?dates=' + new Date().getTime(), {
  67. data: {
  68. "pageSize": pagesize,
  69. "pageNumber": pageNumber,
  70. "roleId": tabindex,
  71. "openid": (getParam("openid") == null ? "" : getParam("openid"))
  72. },
  73. dataType: 'json',
  74. type: 'post',
  75. timeout: 15000,
  76. xhrFields: {
  77. withCredentials: true
  78. },
  79. crossDomain: true,
  80. success: function (dt) {
  81. if (dt.isRedirect) {
  82. location.href = dt.redirectURL;
  83. } else {
  84. if (dt.status) {
  85. var chanpin_data = [];
  86. if (dt.data.list != null) {
  87. chanpin_data = dt.data.list
  88. }
  89. document.querySelector("#b_accounts").innerHTML = dt.data.size;
  90. mui('#pullrefresh').pullRefresh().endPullupToRefresh(chanpin_data.length < pagesize);
  91. var table = document.body.querySelector('.my-tab-view-pull');
  92. mui(chanpin_data).each(function (index) {
  93. var li = document.createElement('li');
  94. li.setAttribute('openid', this.openid);
  95. if (this.roleName == "门店" || this.roleName == "母婴店") {
  96. li.className = 'mui-table-view-cell daili'
  97. } else if (this.roleName == "代理") {
  98. li.className = 'mui-table-view-cell qita'
  99. }
  100. li.innerHTML = '<table class="my-dl-tb-order"><tr><td><img class="wh-50" src="' + this.img + '"></td><td class="mui-text-left"></td><td style="color:blue;">' + this.roleName + '</td><td>' + this.strDate + '</td></tr></table>';
  101. table.appendChild(li)
  102. });
  103. mui.each(document.querySelectorAll(".my-tab-view-pull .daili"), function (index, el) {
  104. el.addEventListener('tap', function () {
  105. console.log("11111");
  106. mui.openWindow({url: base_path + '/drp/MendianTerminalUser?openid=' + this.getAttribute('openid')})
  107. }, false)
  108. });
  109. mui.each(document.querySelectorAll(".my-tab-view-pull .qita"), function (index, el) {
  110. el.addEventListener('tap', function () {
  111. console.log("2222");
  112. mui.openWindow({url: base_path + '/drp/xialianUser?openid=' + this.getAttribute('openid')})
  113. }, false)
  114. })
  115. } else {
  116. mui.confirm(dt.message, '提示', btnArray, function (e) {
  117. if (e.index == 1) {
  118. }
  119. })
  120. }
  121. }
  122. }, error: function (xhr, type, errorThrown) {
  123. console.log(xhr)
  124. }
  125. })
  126. };