collagecustomer.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. const app = getApp();
  2. var utils = require("../../../utils/http"),page=1;
  3. const util = require("../../../utils/util");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. customerlist:[],
  10. datashow:false,
  11. aid:'',
  12. tid:''
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. this.setData({
  19. aid:options.cid,
  20. tid:options.tid?options.tid:''
  21. })
  22. wx.showLoading({
  23. title: '加载中...',
  24. })
  25. this.customerfun();
  26. },
  27. customerfun:function(){
  28. let that=this;
  29. page=1;
  30. utils.$post({
  31. url: app.globalData.webUrl + 'api/spellgroup/join_user_list',
  32. header: {
  33. 'Authorization':'bearer '+app.globalData.token
  34. },
  35. data:{
  36. page:page,
  37. spellgroup_id:that.data.aid,
  38. team_id:that.data.tid
  39. },
  40. success: function (res) {
  41. if(res.data.code=='0'){
  42. that.setData({
  43. customerlist:res.data.data,
  44. datashow:true
  45. })
  46. wx.hideLoading()
  47. }
  48. }
  49. })
  50. },
  51. recevicetap:function(e){
  52. let that=this;
  53. wx.showLoading({
  54. title: '领取中...',
  55. })
  56. utils.$post({
  57. url: app.globalData.webUrl + 'api/spellgroup/receive',
  58. header: {
  59. 'Authorization':'bearer '+app.globalData.token
  60. },
  61. data:{
  62. id:e.currentTarget.dataset.cid
  63. },
  64. success: function (res) {
  65. if(res.data.code=='0'){
  66. let customerlist=that.data.customerlist;
  67. customerlist[e.currentTarget.dataset.idx].status=1;
  68. that.setData({
  69. customerlist:customerlist
  70. })
  71. }
  72. setTimeout(() => {
  73. wx.hideLoading()
  74. }, 1200);
  75. }
  76. })
  77. },
  78. /**
  79. * 生命周期函数--监听页面初次渲染完成
  80. */
  81. onReady: function () {
  82. },
  83. /**
  84. * 生命周期函数--监听页面显示
  85. */
  86. onShow: function () {
  87. },
  88. /**
  89. * 生命周期函数--监听页面隐藏
  90. */
  91. onHide: function () {
  92. },
  93. /**
  94. * 生命周期函数--监听页面卸载
  95. */
  96. onUnload: function () {
  97. },
  98. /**
  99. * 页面相关事件处理函数--监听用户下拉动作
  100. */
  101. onPullDownRefresh: function () {
  102. let that=this;
  103. page=1;
  104. utils.$post({
  105. url: app.globalData.webUrl + 'api/spellgroup/join_user_list',
  106. header: {
  107. 'Authorization':'bearer '+app.globalData.token
  108. },
  109. data:{
  110. page:page,
  111. spellgroup_id:that.data.aid,
  112. team_id:that.data.tid
  113. },
  114. success: function (res) {
  115. wx.stopPullDownRefresh()
  116. if(res.data.code=='0'){
  117. that.setData({
  118. customerlist:res.data.data,
  119. datashow:true
  120. })
  121. wx.hideLoading()
  122. }
  123. }
  124. })
  125. },
  126. /**
  127. * 页面上拉触底事件的处理函数
  128. */
  129. onReachBottom: function () {
  130. let that=this;
  131. page=page+1;
  132. utils.$post({
  133. url: app.globalData.webUrl + 'api/spellgroup/join_user_list',
  134. header: {
  135. 'Authorization':'bearer '+app.globalData.token
  136. },
  137. data:{
  138. page:page,
  139. spellgroup_id:that.data.aid,
  140. team_id:that.data.tid
  141. },
  142. success: function (res) {
  143. let customerlist=that.data.customerlist;
  144. if(res.data.code=='0'){
  145. customerlist=customerlist.concat(res.data.data);
  146. that.setData({
  147. customerlist:customerlist,
  148. })
  149. wx.hideLoading()
  150. }
  151. }
  152. })
  153. },
  154. /**
  155. * 用户点击右上角分享
  156. */
  157. })