bought.js 810 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. var util = require('../../../utils/util.js');
  2. var api = require('../../../config/api.js');
  3. var app = getApp();
  4. Page({
  5. data: {
  6. boughtList: []
  7. },
  8. getBoughtList() {
  9. let that = this;
  10. util.request(api.BoughtList).then(function (res) {
  11. if (res.errno === 0) {
  12. console.log(res.data);
  13. that.setData({
  14. boughtList: res.data
  15. });
  16. }
  17. });
  18. },
  19. onLoad: function (options) {
  20. this.getBoughtList();
  21. },
  22. onReady: function () {
  23. },
  24. onShow: function () {
  25. },
  26. onHide: function () {
  27. // 页面隐藏
  28. },
  29. onUnload: function () {
  30. // 页面关闭
  31. },
  32. openGoods(event) {
  33. let goodsId = this.data.boughtList[event.currentTarget.dataset.index].id;
  34. wx.navigateTo({
  35. url: '/pages/goods/goods?id=' + goodsId,
  36. });
  37. },
  38. })