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.

84 lines
2.2 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. list: [
  16. // {
  17. // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg",
  18. // name: "海鲜焗饭",
  19. // time: "2天12小时25分钟",
  20. // oPrice: "59.00",
  21. // pPrice: "1.00",
  22. // },
  23. // {
  24. // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg",
  25. // name: "海鲜焗饭",
  26. // time: "2天12小时25分钟",
  27. // oPrice: "59.00",
  28. // pPrice: "1.00",
  29. // },
  30. // {
  31. // img: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg",
  32. // name: "海鲜焗饭",
  33. // time: "2天12小时25分钟",
  34. // oPrice: "59.00",
  35. // pPrice: "1.00",
  36. // },
  37. // {
  38. // img: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg",
  39. // name: "海鲜焗饭",
  40. // time: "2天12小时25分钟",
  41. // oPrice: "59.00",
  42. // pPrice: "1.00",
  43. // },
  44. ]
  45. },
  46. /**
  47. * 组件的方法列表
  48. */
  49. methods: {
  50. },
  51. ready() {
  52. if (app.globalData.token && app.globalData.token != null) {
  53. Http.get({
  54. url: config.api.couponChannelList,
  55. data: {
  56. pageNum: 1,
  57. pageSize: 10
  58. }
  59. }).then(res => {
  60. this.setData({
  61. list: res.data.list
  62. })
  63. })
  64. } else {
  65. app.couponChannelListCallback = token => {
  66. Http.setToken(token);
  67. Http.get({
  68. url: config.api.couponChannelList,
  69. data: {
  70. pageNum: 1,
  71. pageSize: 10
  72. }
  73. }).then(res => {
  74. this.setData({
  75. list: res.data.list
  76. })
  77. })
  78. }
  79. }
  80. }
  81. })