coupon.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. var app = getApp()
  2. Page({
  3. data: {
  4. index:0,
  5. arr:[],
  6. arr1:[]
  7. },
  8. onLoad: function (options) {
  9. var that = this;
  10. wx.showLoading({
  11. title: '加载中...',
  12. mask:true
  13. })
  14. app.request('/coupon?status=1', '', 'GET').then(res => {
  15. //未使用
  16. console.log(res)
  17. that.setData({arr:res.data.data})
  18. })
  19. app.request('/coupon?status=0', '', 'GET').then(res => {
  20. //已过期
  21. console.log(res)
  22. that.setData({arr1:res.data.data})
  23. app.request('/coupon?status=2', '', 'GET').then(res => {
  24. //已使用
  25. console.log(res)
  26. that.setData({arr1:that.data.arr1.concat(res.data.data)})
  27. wx.hideLoading({
  28. complete: (res) => {},
  29. })
  30. })
  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. })