myCashCardDetails.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const app = getApp()
  2. const api = require("../../../../../request/api.js");
  3. const http = require('../../../../../request/http');
  4. const utils = require('../../../../../utils/util.js');
  5. const storeKeys = require('../../../../../utils/storageKeys.js');
  6. Page({
  7. data: {
  8. isLoading: true, //是否处于加载中
  9. cardId: "", //礼品卡id
  10. detail:{}, //礼品卡详情
  11. },
  12. onLoad: function (options) {
  13. if (options) {
  14. this.data.cardId = options.cardId || "";
  15. }
  16. this.getDetails()
  17. },
  18. //获取页面数据
  19. getDetails() {
  20. wx.showLoading({
  21. title: "加载中",
  22. mask: true
  23. });
  24. http.request({
  25. url: api.URL + "/api/card.UserRiceCard/detail?user_rice_card_id="+this.data.cardId,
  26. token: utils.getStorageSync(storeKeys.TOKEN),
  27. method: 'GET',
  28. success: (res) => {
  29. wx.hideLoading();
  30. let detail = res.data.data.detail || {};
  31. this.setData({
  32. detail,
  33. isLoading: false
  34. });
  35. },
  36. error: (res) => {}
  37. })
  38. },
  39. })