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.

80 lines
1.4 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. app.couponListCallback = token =>{
  42. Http.setToken(token)
  43. // business获取
  44. Http.get({
  45. url: config.api.businessList,
  46. data: {
  47. pageNum: 1,
  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: 1,
  63. pageSize: 10
  64. }
  65. }).then(res => {
  66. console.log(res);
  67. that.setData({
  68. list: res.data.list
  69. })
  70. })
  71. }
  72. if (app.globalData.token && app.globalData.token != null) {
  73. app.couponListCallback(app.globalData.token)
  74. }
  75. }
  76. })