123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- mui.init({
- pullRefresh: {
- container: '#pullrefresh',
- down: {},
- up: {contentrefresh: '正在加载...', callback: pullupRefresh}
- }
- });
- var pageNumber = 0, pagesize = 10, tabindex = 1;
- mui.ready(function () {
- var btnArray = ['否', '是'];
- console.log("----------getParam('openid)-------------" + getParam("openid"));
- $.ajax(base_path + '/rebackStatic/underDrpListInfoInit?dates=' + new Date().getTime(), {
- dataType: 'json',
- type: 'post',
- timeout: 15000,
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- data: ("openid=" + (getParam("openid") == null ? "" : getParam("openid"))),
- success: function (dt) {
- if (dt.status) {
- var rolesList_data = [];
- if (dt.data.rolesList != null) {
- rolesList_data = dt.data.rolesList
- }
- var table = document.body.querySelector('.tab-with-user');
- mui(rolesList_data).each(function (index) {
- var li = document.createElement('a');
- if (index == 0) {
- li.className = 'mui-control-item mui-active';
- tabindex = this.roleId
- } else {
- li.className = 'mui-control-item'
- }
- li.setAttribute('id', this.roleId);
- li.innerHTML = '<span class="mui-tab-label">' + this.roleName + '</span>';
- table.appendChild(li)
- });
- mui('#pullrefresh').pullRefresh().pullupLoading();
- mui.each(document.querySelectorAll('.tab-with-user .mui-control-item'), function (index, el) {
- el.addEventListener('tap', function () {
- pageNumber = 0;
- tabindex = this.getAttribute('id');
- $('.my-tab-view-pull').empty();
- mui('#pullrefresh').pullRefresh().refresh(true);
- mui('#pullrefresh').pullRefresh().pullupLoading()
- }, false)
- })
- } else {
- mui.confirm(dt.message, '提示', btnArray, function (e) {
- if (e.index == 1) {
- }
- })
- }
- },
- error: function (xhr, type, errorThrown) {
- console.log(xhr)
- }
- });
- document.querySelector('.loading-bg').style.display = 'none'
- });
- function pullupRefresh() {
- pageNumber += 1;
- var btnArray = ['否', '是'];
- $.ajax(base_path + '/rebackStatic/underDrpListInfo?dates=' + new Date().getTime(), {
- data: {
- "pageSize": pagesize,
- "pageNumber": pageNumber,
- "roleId": tabindex,
- "openid": (getParam("openid") == null ? "" : getParam("openid"))
- },
- dataType: 'json',
- type: 'post',
- timeout: 15000,
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- success: function (dt) {
- if (dt.isRedirect) {
- location.href = dt.redirectURL;
- } else {
- if (dt.status) {
- var chanpin_data = [];
- if (dt.data.list != null) {
- chanpin_data = dt.data.list
- }
- document.querySelector("#b_accounts").innerHTML = dt.data.size;
- mui('#pullrefresh').pullRefresh().endPullupToRefresh(chanpin_data.length < pagesize);
- var table = document.body.querySelector('.my-tab-view-pull');
- mui(chanpin_data).each(function (index) {
- var li = document.createElement('li');
- li.setAttribute('openid', this.openid);
- if (this.roleName == "门店" || this.roleName == "母婴店") {
- li.className = 'mui-table-view-cell daili'
- } else if (this.roleName == "代理") {
- li.className = 'mui-table-view-cell qita'
- }
- 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>';
- table.appendChild(li)
- });
- mui.each(document.querySelectorAll(".my-tab-view-pull .daili"), function (index, el) {
- el.addEventListener('tap', function () {
- console.log("11111");
- mui.openWindow({url: base_path + '/drp/MendianTerminalUser?openid=' + this.getAttribute('openid')})
- }, false)
- });
- mui.each(document.querySelectorAll(".my-tab-view-pull .qita"), function (index, el) {
- el.addEventListener('tap', function () {
- console.log("2222");
- mui.openWindow({url: base_path + '/drp/xialianUser?openid=' + this.getAttribute('openid')})
- }, false)
- })
- } else {
- mui.confirm(dt.message, '提示', btnArray, function (e) {
- if (e.index == 1) {
- }
- })
- }
- }
- }, error: function (xhr, type, errorThrown) {
- console.log(xhr)
- }
- })
- };
|