C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

66 行
1.4 KiB

  1. // pages/index/sw/index.js
  2. let config = require("../../../config/config.js");
  3. let Http = require("../../../utils/HttpBasics");
  4. // let Http = require("../../../utils/HttpBasics");
  5. const app = getApp();
  6. Component({
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {},
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. list: [],
  16. total:''
  17. },
  18. /**
  19. * 组件的方法列表
  20. */
  21. methods: {
  22. gotomore: function() {
  23. wx.navigateTo({
  24. url: "/pages/rushToBuy/index"
  25. });
  26. },
  27. gotodetail: function(e) {
  28. console.log(e);
  29. wx.navigateTo({
  30. url: `/pages/coupon/detail/index?couponChannelId=${
  31. e.currentTarget.dataset.couponchannelid
  32. }&couponId=${
  33. e.currentTarget.dataset.couponid
  34. }&targetAd=${
  35. e.currentTarget.dataset.targetad
  36. }`
  37. });
  38. }
  39. },
  40. ready() {
  41. app.couponChannelListCallback = token => {
  42. Http.setToken(token);
  43. Http.get({
  44. url: config.api.couponChannelList,
  45. data: {
  46. pageNum: 1,
  47. pageSize: 5,
  48. targetAd: 2
  49. }
  50. }).then(res => {
  51. console.log(res);
  52. this.setData({
  53. list: res.data.list,
  54. total:res.data.total
  55. });
  56. });
  57. };
  58. if (app.globalData.token && app.globalData.token != null) {
  59. console.log("couponChannelList init 1");
  60. app.couponChannelListCallback(app.globalData.token);
  61. }
  62. }
  63. });