user_list.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. Page({
  2. data: {
  3. arr:[],
  4. link:'',
  5. mobile:'',
  6. name:'',
  7. return:false,
  8. user_id:'',
  9. money:'',
  10. userMoney:''
  11. },
  12. onLoad: function (options) {
  13. this.method()
  14. },
  15. mobile:function(e){
  16. this.setData({mobile:e.detail.value})
  17. },
  18. name:function(){
  19. this.setData({name:e.detail.name})
  20. },
  21. chaxun:function(){
  22. this.method()
  23. },
  24. chongzhi:function(){
  25. this.setData({name:'',mobile:''})
  26. this.method()
  27. },
  28. quxiao:function(){
  29. this.setData({return:false,user_id:'',money:''})
  30. },
  31. fanxian:function(e){
  32. this.setData({return:true,user_id:e.currentTarget.dataset.id,money:e.currentTarget.dataset.money})
  33. },
  34. userMoney:function(e){
  35. this.setData({userMoney:e.detail.value})
  36. },
  37. queding:function(){
  38. var that = this;
  39. var data={
  40. user_id:that.data.user_id,
  41. money:that.data.userMoney
  42. }
  43. wx.request({
  44. url: 'https://yutang.web.ximengnaikang.com/api/admin/handTiXian',
  45. method: 'POST',
  46. header: {
  47. 'content-type': 'application/x-www-form-urlencoded',
  48. 'Authorization':wx.getStorageSync('token')
  49. },
  50. data:data,
  51. success: function (res) {
  52. console.log(res)
  53. if(res.statusCode==200){
  54. wx.showToast({
  55. title: '操作成功!',
  56. icon:'none'
  57. })
  58. }else{
  59. wx.showToast({
  60. title: res.data.message,
  61. icon:'none'
  62. })
  63. }
  64. that.setData({return:false})
  65. }
  66. })
  67. },
  68. method:function(){
  69. var that = this;
  70. wx.request({
  71. url: 'https://yutang.web.ximengnaikang.com/api/admin/users?mobile='+that.data.mobile+'&nickname='+that.data.name,
  72. method: 'GET',
  73. header: {
  74. 'content-type': 'application/x-www-form-urlencoded',
  75. 'Authorization':wx.getStorageSync('token')
  76. },
  77. success: function (res) {
  78. console.log(res.data.data)
  79. if(res.statusCode==200){
  80. that.setData({arr:res.data.data.data,link:res.data.data.next_page_url})
  81. }
  82. }
  83. })
  84. },
  85. onReady: function () {
  86. },
  87. onShow: function () {
  88. },
  89. onHide: function () {
  90. },
  91. onUnload: function () {
  92. },
  93. onPullDownRefresh: function () {
  94. },
  95. onReachBottom: function () {
  96. var that = this;
  97. wx.request({
  98. url: that.data.link,
  99. method: 'GET',
  100. header: {
  101. 'content-type': 'application/x-www-form-urlencoded',
  102. 'Authorization':wx.getStorageSync('token')
  103. },
  104. success: function (res) {
  105. console.log(res.data.data)
  106. if(res.statusCode==200){
  107. that.setData({arr:that.data.arr.concat(res.data.data.data),link:res.data.data.next_page_url})
  108. }
  109. }
  110. })
  111. },
  112. onShareAppMessage: function () {
  113. }
  114. })