C端小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

106 righe
2.0 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. Component({
  6. /**
  7. * 组件的属性列表
  8. */
  9. properties: {
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. tabs: [],
  16. list: [],
  17. current: '1',
  18. current_scroll: '1',
  19. },
  20. /**
  21. * 组件的方法列表
  22. */
  23. methods: {
  24. handleChange({
  25. detail
  26. }) {
  27. this.setData({
  28. current: detail.key
  29. });
  30. },
  31. handleChangeScroll({
  32. detail
  33. }) {
  34. this.setData({
  35. current_scroll: detail.key
  36. });
  37. },
  38. },
  39. ready() {
  40. if (app.globalData.token && app.globalData.token != null) {
  41. // business获取
  42. Http.get({
  43. url: config.api.businessList,
  44. data: {
  45. pageNum: 1,
  46. pageSize: 10,
  47. type: 1
  48. }
  49. })
  50. .then(res => {
  51. console.log(res)
  52. that.setData({
  53. list: res.data.list
  54. })
  55. })
  56. // 券list获取
  57. Http.get({
  58. url: config.api.couponList,
  59. data: {
  60. pageNum: 1,
  61. pageSize: 10
  62. }
  63. }).then(res => {
  64. console.log(res);
  65. this.setData({
  66. list: res.data.list
  67. })
  68. })
  69. } else {
  70. app.couponListCallback = token => {
  71. // business获取
  72. Http.get({
  73. url: config.api.businessList,
  74. data: {
  75. pageNum: pageNum,
  76. pageSize: 10,
  77. type: 1
  78. }
  79. })
  80. .then(res => {
  81. console.log(res)
  82. that.setData({
  83. list: res.data.list
  84. })
  85. })
  86. // 券list获取
  87. Http.get({
  88. url: config.api.couponList,
  89. data: {
  90. pageNum: 1,
  91. pageSize: 10
  92. }
  93. }).then(res => {
  94. console.log(res);
  95. this.setData({
  96. list: res.data.list
  97. })
  98. })
  99. }
  100. }
  101. }
  102. })