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

108 行
2.0 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. 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. var that = this
  41. var pageNum = 1
  42. if (app.globalData.token && app.globalData.token != null) {
  43. // business获取
  44. Http.get({
  45. url: config.api.businessList,
  46. data: {
  47. pageNum: pageNum,
  48. pageSize: 10,
  49. type: 1
  50. }
  51. })
  52. .then(res => {
  53. console.log(res)
  54. that.setData({
  55. tabs: res.data.list
  56. })
  57. })
  58. // 券list获取
  59. Http.get({
  60. url: config.api.couponList,
  61. data: {
  62. pageNum: pageNum,
  63. pageSize: 10
  64. }
  65. }).then(res => {
  66. console.log(res);
  67. that.setData({
  68. list: res.data.list
  69. })
  70. })
  71. } else {
  72. app.couponListCallback = token => {
  73. // business获取
  74. Http.get({
  75. url: config.api.businessList,
  76. data: {
  77. pageNum: pageNum,
  78. pageSize: 10,
  79. type: 1
  80. }
  81. })
  82. .then(res => {
  83. console.log(res)
  84. that.setData({
  85. tabs: res.data.list
  86. })
  87. })
  88. // 券list获取
  89. Http.get({
  90. url: config.api.couponList,
  91. data: {
  92. pageNum: pageNum,
  93. pageSize: 10
  94. }
  95. }).then(res => {
  96. console.log(res);
  97. that.setData({
  98. list: res.data.list
  99. })
  100. })
  101. }
  102. }
  103. }
  104. })