C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 rivejä
1.8 KiB

  1. // pages/index/sw/index.js
  2. let config = require("../../../config/config.js");
  3. let Http = require("../../../utils/HttpBasics");
  4. const app = getApp();
  5. const imgurl = require("../../../utils/imgurl");
  6. Component({
  7. /**
  8. * 组件的属性列表
  9. */
  10. properties: {},
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. jianUrl: imgurl.jian.url,
  16. pintuan: imgurl.pintuan.url,
  17. wangmeimeipintuan: imgurl.wangmeimeipintuan.url,
  18. list: [],
  19. total:''
  20. },
  21. /**
  22. * 组件的方法列表
  23. */
  24. methods: {
  25. gotomore: function() {
  26. wx.navigateTo({
  27. url: "/pages/spellGroup/spellGroup"
  28. });
  29. },
  30. gotospellGroupList(){
  31. wx.navigateTo({
  32. url: "/pages/spellGroup/spellGroup"
  33. })
  34. },
  35. gotodetail: function(e) {
  36. wx.navigateTo({
  37. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
  38. e.currentTarget.dataset.couponchannelid
  39. }&couponId=${
  40. e.currentTarget.dataset.couponid
  41. }&targetAd=${
  42. e.currentTarget.dataset.targetad
  43. }`
  44. });
  45. },
  46. getList(){
  47. Http.get({
  48. url: config.api.couponChannelList,
  49. data: {
  50. pageNum: 1,
  51. pageSize: 4,
  52. targetAd: 7
  53. }
  54. }).then(res => {
  55. this.setData({
  56. list: res.data.list,
  57. total: res.data.total
  58. });
  59. })
  60. .catch(err => {
  61. wx.showToast({
  62. title: err.errMsg,
  63. icon: 'none',
  64. duration: 2000,
  65. mask: false
  66. });
  67. })
  68. }
  69. },
  70. ready() {
  71. app.couponChannelListCallback = token => {
  72. Http.setToken(token);
  73. this.getList();
  74. };
  75. if (app.globalData.token && app.globalData.token != null) {
  76. app.couponChannelListCallback(app.globalData.token);
  77. }
  78. }
  79. });