C端小程序
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

119 satır
2.8 KiB

  1. // pages/index/sw/index.js
  2. let config = require("../../config/config.js");
  3. let Http = require("../../utils/HttpBasics");
  4. let app = getApp();
  5. const imgurl = require("../../utils/imgurl");
  6. const bgColor = require("../../utils/bgColor.js")
  7. Component({
  8. /**
  9. * 组件的属性列表
  10. */
  11. properties: {},
  12. /**
  13. * 组件的初始数据
  14. */
  15. data: {
  16. sql: bgColor.colorFirst.main.sql,
  17. txt: bgColor.colorFirst.main.txt,
  18. change: imgurl.change.url,
  19. None: imgurl.None.url,
  20. jianUrl: imgurl.jian.url,
  21. barginicon: imgurl.barginicon.url,
  22. wangmeimeibargin: imgurl.wangmeimeibargin.url,
  23. list: [],
  24. pintuanList:[],
  25. total: ''
  26. },
  27. /**
  28. * 组件的方法列表
  29. */
  30. methods: {
  31. //获取砍价列表
  32. getList() {
  33. let that = this;
  34. Http.get({
  35. url: config.api.couponChannelList,
  36. data: {
  37. pageNum: 1,
  38. pageSize: 5,
  39. targetAd: 6
  40. }
  41. }).then(res => {
  42. that.setData({
  43. list: res.data.list,
  44. total: res.data.total
  45. });
  46. })
  47. .catch(err => {
  48. console.log(err)
  49. wx.showToast({
  50. title: err.errMsg,
  51. icon: 'none',
  52. duration: 2000,
  53. mask: false
  54. });
  55. })
  56. },
  57. //获取拼团列表
  58. getptList() {
  59. Http.get({
  60. url: config.api.couponChannelList,
  61. data: {
  62. pageNum: 1,
  63. pageSize: 4,
  64. targetAd: 7
  65. }
  66. }).then(res => {
  67. this.setData({
  68. pintuanList: res.data.list,
  69. total: res.data.total
  70. });
  71. console.log(this.data.pintuanList)
  72. })
  73. .catch(err => {
  74. wx.showToast({
  75. title: err.errMsg,
  76. icon: 'none',
  77. duration: 2000,
  78. mask: false
  79. });
  80. })
  81. },
  82. //跳转砍价详情
  83. gotokjdetail: function (e) {
  84. wx.navigateTo({
  85. url: `/pages/coupon/detail/index?couponChannelId=${
  86. e.currentTarget.dataset.couponchannelid
  87. }&couponId=${
  88. e.currentTarget.dataset.couponid
  89. }&targetAd=${
  90. e.currentTarget.dataset.targetad
  91. }`
  92. });
  93. },
  94. //跳转拼团详情
  95. gotoptdetail: function (e) {
  96. wx.navigateTo({
  97. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${
  98. e.currentTarget.dataset.couponchannelid
  99. }&couponId=${
  100. e.currentTarget.dataset.couponid
  101. }&targetAd=${
  102. e.currentTarget.dataset.targetad
  103. }`
  104. });
  105. },
  106. },
  107. ready() {
  108. app.couponChannelListCallback = token => {
  109. Http.setToken(token);
  110. this.getList();
  111. this.getptList();
  112. };
  113. if (app.globalData.token && app.globalData.token != null) {
  114. app.couponChannelListCallback(app.globalData.token);
  115. }
  116. }
  117. });