const app=getApp(); const utils=require("../../../utils/http"); let mpage=1,dpage=1; Page({ /** * 页面的初始数据 */ data: { type:1, teamnumflag:false, aid:'', qrcodeimg:'', teamlist:[], dailylist:[], membertype:'fans',//fans deposit contract memberlist:[], nowidx:'', imgUrl:app.globalData.imgUrl }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ aid:options.aid, imgUrl:app.globalData.imgUrl }) wx.showLoading({ title: '加载中...', }) this.teamsgfun(); this.dailyfun(); }, qrcodefun(){ const that=this; utils.$post({ url: app.globalData.webUrl + 'api/wechatActivity/qrcode', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ activity_id:this.data.aid }, success: function (res) { if(res.data.code=='0'){ wx.hideLoading() that.setData({ qrcodeimg:res.data.data }) wx.previewImage({ current: that.data.qrcodeimg, // 当前显示图片的 http 链接 urls: [that.data.qrcodeimg] // 需要预览的图片 http 链接列表 }) }else{ setTimeout(res=>{ wx.hideLoading() },2000) } } }) }, sharememtap(){ wx.showLoading({ title: '加载中...', }) this.qrcodefun(); }, setypetap(e){ this.setData({ type:e.currentTarget.dataset.type }) }, opentfuntap(e){ this.setData({ teamnumflag:true, membertype:'fans', nowidx:e.currentTarget.dataset.idx }) this.memberdatafun(); }, closefuntap(){ this.setData({ teamnumflag:false }) }, opentdesptap(e){ this.setData({ teamnumflag:true, membertype:'deposit', nowidx:e.currentTarget.dataset.idx }) this.memberdatafun(); }, opentcontractap(e){ this.setData({ teamnumflag:true, membertype:'contract', nowidx:e.currentTarget.dataset.idx }) this.memberdatafun(); }, teamsgfun(){ const that=this; utils.$post({ url: app.globalData.webUrl + 'api/wechatActivity/members', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ activity_id:this.data.aid }, success: function (res) { if(res.data.code=='0'){ that.setData({ teamlist:res.data.data }) } setTimeout(function(){ wx.hideLoading() },1000) } }) }, dailyfun(){ const that=this; dpage=1; utils.$post({ url: app.globalData.webUrl + 'api/wechatActivity/work', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ page:1, activity_id:this.data.aid }, success: function (res) { if(res.data.code=='0'){ that.setData({ dailylist:res.data.data }) } setTimeout(function(){ wx.hideLoading() },1000) } }) }, memberdatafun(){ const that=this; mpage=1; utils.$post({ url: app.globalData.webUrl + 'api/wechatActivity/memberLog', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ activity_id:this.data.aid, page:1, type:this.data.membertype, employee_id:that.data.teamlist[that.data.nowidx].employee_id }, success: function (res) { if(res.data.code=='0'){ that.setData({ memberlist:res.data.data }) }else{ that.setData({ memberlist:[] }) } setTimeout(function(){ wx.hideLoading() },1000) } }) }, morememberdatafun(){ const that=this; mpage=mpage*1+1; utils.$post({ url: app.globalData.webUrl + 'api/wechatActivity/memberLog', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ activity_id:this.data.aid, page:mpage, type:this.data.membertype, employee_id:that.data.teamlist[that.data.nowidx].employee_id }, success: function (res) { let memberlist=that.data.memberlist; if(res.data.code=='0'){ memberlist=memberlist.concat(res.data.data); that.setData({ memberlist:memberlist }) } setTimeout(function(){ wx.hideLoading() },1000) } }) }, lookimgtap(e){ var arr=[]; for(var i=0;i