coupon.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var app = getApp()
  2. Page({
  3. data: {
  4. index:0,
  5. arr:[],
  6. arr1:[],
  7. arr2:[],
  8. img:app.globalData.imgUrl
  9. },
  10. onLoad: function (options) {
  11. var that = this;
  12. wx.showLoading({
  13. title: '加载中...',
  14. mask:true
  15. })
  16. app.request('/coupon?status=1', '', 'GET').then(res => {
  17. //未使用
  18. console.log(res)
  19. that.setData({arr:res.data.data})
  20. })
  21. app.request('/coupon?status=0', '', 'GET').then(res => {
  22. //已过期
  23. console.log(res)
  24. that.setData({arr1:res.data.data})
  25. })
  26. app.request('/coupon?status=2', '', 'GET').then(res => {
  27. //已使用
  28. console.log(res)
  29. that.setData({arr2:res.data.data})
  30. wx.hideLoading()
  31. })
  32. },
  33. select:function(e){
  34. // console.log(e)
  35. this.setData({index:e.currentTarget.dataset.index})
  36. },
  37. onReady: function () {
  38. },
  39. onShow: function () {
  40. },
  41. onHide: function () {
  42. },
  43. onUnload: function () {
  44. },
  45. onPullDownRefresh: function () {
  46. },
  47. onReachBottom: function () {
  48. },
  49. onShareAppMessage: function () {
  50. }
  51. })