const app = getApp(); var utils = require("../../../utils/http"),page=1; const util = require("../../../utils/util"); Page({ /** * 页面的初始数据 */ data: { customerlist:[], datashow:false, aid:'', tid:'' }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ aid:options.cid, tid:options.tid?options.tid:'' }) wx.showLoading({ title: '加载中...', }) this.customerfun(); }, customerfun:function(){ let that=this; page=1; utils.$post({ url: app.globalData.webUrl + 'api/spellgroup/join_user_list', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ page:page, spellgroup_id:that.data.aid, team_id:that.data.tid }, success: function (res) { if(res.data.code=='0'){ that.setData({ customerlist:res.data.data, datashow:true }) wx.hideLoading() } } }) }, recevicetap:function(e){ let that=this; wx.showLoading({ title: '领取中...', }) utils.$post({ url: app.globalData.webUrl + 'api/spellgroup/receive', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ id:e.currentTarget.dataset.cid }, success: function (res) { if(res.data.code=='0'){ let customerlist=that.data.customerlist; customerlist[e.currentTarget.dataset.idx].status=1; that.setData({ customerlist:customerlist }) } setTimeout(() => { wx.hideLoading() }, 1200); } }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { let that=this; page=1; utils.$post({ url: app.globalData.webUrl + 'api/spellgroup/join_user_list', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ page:page, spellgroup_id:that.data.aid, team_id:that.data.tid }, success: function (res) { wx.stopPullDownRefresh() if(res.data.code=='0'){ that.setData({ customerlist:res.data.data, datashow:true }) wx.hideLoading() } } }) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { let that=this; page=page+1; utils.$post({ url: app.globalData.webUrl + 'api/spellgroup/join_user_list', header: { 'Authorization':'bearer '+app.globalData.token }, data:{ page:page, spellgroup_id:that.data.aid, team_id:that.data.tid }, success: function (res) { let customerlist=that.data.customerlist; if(res.data.code=='0'){ customerlist=customerlist.concat(res.data.data); that.setData({ customerlist:customerlist, }) wx.hideLoading() } } }) }, /** * 用户点击右上角分享 */ })