user.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. var app = getApp();
  2. // pages/user/user.js
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. url: app.globalData.urlImages,
  9. userinfo:[],
  10. orderStatusNum:[],
  11. coupon:'',
  12. collect:''
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. app.setBarColor();
  19. app.setUserInfo();
  20. var header = {
  21. 'content-type': 'application/x-www-form-urlencoded',
  22. };
  23. var that = this;
  24. wx.request({
  25. url: app.globalData.url + '/routine/auth_api/my?uid=' + app.globalData.uid,
  26. method: 'POST',
  27. header: header,
  28. success: function (res) {
  29. that.setData({
  30. userinfo: res.data.data,
  31. orderStatusNum: res.data.data.orderStatusNum
  32. })
  33. that.coupon();
  34. that.collect();
  35. }
  36. });
  37. },
  38. goNotification:function(){
  39. wx.navigateTo({
  40. url: '/pages/news-list/news-list',
  41. })
  42. },
  43. onShow: function () {
  44. var header = {
  45. 'content-type': 'application/x-www-form-urlencoded',
  46. };
  47. var that = this;
  48. wx.request({
  49. url: app.globalData.url + '/routine/auth_api/my?uid=' + app.globalData.uid,
  50. method: 'POST',
  51. header: header,
  52. success: function (res) {
  53. that.setData({
  54. userinfo: res.data.data
  55. })
  56. that.coupon();
  57. that.collect();
  58. }
  59. });
  60. },
  61. /**
  62. * 生命周期函数--优惠卷个数
  63. */
  64. coupon: function () {
  65. var header = {
  66. 'content-type': 'application/x-www-form-urlencoded',
  67. };
  68. var that = this;
  69. wx.request({
  70. url: app.globalData.url + '/routine/auth_api/get_use_coupons?uid=' + app.globalData.uid,
  71. data:{types:0},
  72. method: 'GET',
  73. header: header,
  74. success: function (res) {
  75. that.setData({
  76. // coupon: res.data.data.length
  77. })
  78. }
  79. })
  80. },
  81. /**
  82. * 生命周期函数--收藏个数
  83. */
  84. collect: function () {
  85. var header = {
  86. 'content-type': 'application/x-www-form-urlencoded',
  87. 'cookie': app.globalData.sessionId//读取cookie
  88. };
  89. var that = this;
  90. wx.request({
  91. url: app.globalData.url + '/routine/auth_api/get_user_collect_product?uid=' + app.globalData.uid,
  92. method: 'GET',
  93. header: header,
  94. success: function (res) {
  95. that.setData({
  96. // collect: res.data.data.length
  97. })
  98. }
  99. })
  100. },
  101. /**
  102. * 生命周期函数--我的余额
  103. */
  104. money:function(){
  105. wx.navigateTo({
  106. url: '/pages/main/main?now=' + this.data.userinfo.now_money + '&uid='+app.globalData.uid,
  107. success: function (res) { },
  108. fail: function (res) { },
  109. complete: function (res) { },
  110. })
  111. },
  112. /**
  113. * 生命周期函数--我的积分
  114. */
  115. integral: function () {
  116. wx.navigateTo({
  117. url: '/pages/integral-con/integral-con?inte=' + this.data.userinfo.integral + '&uid=' + app.globalData.uid,
  118. success: function (res) { },
  119. fail: function (res) { },
  120. complete: function (res) { },
  121. })
  122. },
  123. /**
  124. * 生命周期函数--我的优惠卷
  125. */
  126. coupons: function () {
  127. wx.navigateTo({
  128. url: '/pages/coupon/coupon',
  129. success: function (res) { },
  130. fail: function (res) { },
  131. complete: function (res) { },
  132. })
  133. },
  134. /**
  135. * 生命周期函数--我的收藏
  136. */
  137. collects: function () {
  138. wx.navigateTo({
  139. url: '/pages/collect/collect',
  140. success: function (res) { },
  141. fail: function (res) { },
  142. complete: function (res) { },
  143. })
  144. },
  145. /**
  146. * 生命周期函数--我的推广人
  147. */
  148. extension:function(){
  149. wx.navigateTo({
  150. url: '/pages/feree/feree',
  151. success: function (res) { },
  152. fail: function (res) { },
  153. complete: function (res) { },
  154. })
  155. },
  156. /**
  157. * 生命周期函数--我的推广
  158. */
  159. myextension: function () {
  160. wx.navigateTo({
  161. url: '/pages/extension/extension',
  162. success: function (res) { },
  163. fail: function (res) { },
  164. complete: function (res) { },
  165. })
  166. },
  167. /**
  168. * 生命周期函数--我的砍价
  169. */
  170. // cut_down_the_price:function(){
  171. // wx.navigateTo({
  172. // url: '../../pages/feree/feree',
  173. // success: function (res) { },
  174. // fail: function (res) { },
  175. // complete: function (res) { },
  176. // })
  177. // }
  178. })