index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. const app = getApp()
  2. var api = require('../../utils/request');
  3. Page({
  4. data: {
  5. islogin: false,
  6. config: [],
  7. },
  8. /**
  9. * 生命周期函数--监听页面显示
  10. */
  11. onShow: function () {
  12. app.setTabBarCartNumber();
  13. this.getInfo();
  14. },
  15. /**
  16. * 读取我的订单
  17. */
  18. getInfo: function() {
  19. let that = this;
  20. api.Get("api/v3/fastshop/index/config", function(result) {
  21. if (result.code == 200) {
  22. app.globalData.config = result.data;
  23. that.setData({
  24. config: result.data,
  25. islogin: !app.util().isNull(app.globalData.loginuser),
  26. });
  27. }
  28. })
  29. },
  30. /**
  31. * 判断是微信IOS还是Android
  32. */
  33. openVip: function(res) {
  34. let that = this;
  35. wx.getSystemInfo({
  36. success: function(res) {
  37. that.setData({
  38. systemInfo: res,
  39. })
  40. if (res.platform == "ios") {
  41. wx.showModal({
  42. content: '十分抱歉,由于相关规定,暂时不支苹果用户开通会员.',
  43. })
  44. } else {
  45. wx.navigateTo({
  46. url: '/pages/user/vip'
  47. })
  48. }
  49. }
  50. })
  51. },
  52. /**
  53. * 分享按钮
  54. */
  55. onShareAppMessage: function (res) {
  56. let that = this;
  57. var ucode = app.globalData.loginuser.ucode;
  58. return {
  59. desc: app.appname,
  60. path: '/pages/index/index?ucode=' + ucode
  61. }
  62. },
  63. })