membercenter.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsAccredit: false,
  7. },
  8. onLoad: function (options) {
  9. var member = "非会员";
  10. if (app.globalData.userInfo.IsMember == 1)
  11. member = "付费会员";
  12. this.setData({
  13. Height: common.getSystemHeight(),
  14. Member: member,
  15. });
  16. this.init();
  17. },
  18. init: function () {
  19. var that = this;
  20. server.getData('GetWXUsersAllTime?ProductID=' + app.globalData.ProgramID + '&UserID=' + app.globalData.userInfo.UserID, function (data) {
  21. if (data) {
  22. for (var i = 0; i < data.length; i++) {
  23. if (data[i].ID == app.globalData.ProgramID) {
  24. if (that.data.Member == "非会员") {
  25. data[i].Time = common.formatDateCHS(app.globalData.userInfo.CreateTime);
  26. }
  27. }
  28. }
  29. that.setData({
  30. ProductList: data,
  31. });
  32. }
  33. });
  34. wx.getSetting({
  35. success(res) {
  36. if (res.authSetting['scope.userInfo']) {
  37. that.setData({
  38. IsAccredit: true,
  39. });
  40. }
  41. }
  42. });
  43. },
  44. gotoPaylist: function () {
  45. var that = this;
  46. wx.getSetting({
  47. success(res) {
  48. if (res.authSetting['scope.userInfo']) {
  49. wx.navigateTo({
  50. url: '../about/paylist',
  51. });
  52. }
  53. else {
  54. that.getAccredit();
  55. }
  56. }
  57. });
  58. },
  59. gotoPayFinished: function () {
  60. wx.navigateTo({
  61. url: '../about/payfinished?type=accredit',
  62. });
  63. },
  64. })