my_discount.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Page({
  2. data: {
  3. list:[]
  4. },
  5. onLoad: function (options) {
  6. var that = this;
  7. wx.request({
  8. url: 'https://yutang.web.ximengnaikang.com/api/user/coupons',
  9. method: 'GET',
  10. header: {
  11. 'content-type': 'application/x-www-form-urlencoded',
  12. 'Authorization':wx.getStorageSync('token')
  13. },
  14. success: function (res) {
  15. console.log(res)
  16. if (res.statusCode == 200) {
  17. that.setData({list:res.data.data})
  18. }
  19. }
  20. })
  21. },
  22. buy:function(){
  23. wx.reLaunch({
  24. url: '/pages/index/index',
  25. })
  26. },
  27. onReady: function () {
  28. },
  29. onShow: function () {
  30. },
  31. onHide: function () {
  32. },
  33. onUnload: function () {
  34. },
  35. onPullDownRefresh: function () {
  36. wx.showNavigationBarLoading();
  37. var that = this;
  38. wx.request({
  39. url: 'https://yutang.web.ximengnaikang.com/api/user/coupons',
  40. method: 'GET',
  41. header: {
  42. 'content-type': 'application/x-www-form-urlencoded',
  43. 'Authorization':wx.getStorageSync('token')
  44. },
  45. success: function (res) {
  46. console.log(res)
  47. if (res.statusCode == 200) {
  48. that.setData({list:res.data.data})
  49. wx.hideNavigationBarLoading();
  50. wx.stopPullDownRefresh();
  51. }
  52. }
  53. })
  54. },
  55. onReachBottom: function () {
  56. },
  57. onShareAppMessage: function () {
  58. }
  59. })