index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {
  2. getWxQrcode,
  3. } from '~/api/user'
  4. const app = getApp()
  5. Component({
  6. properties: {},
  7. data: {
  8. show: false,
  9. isIos: app.globalData.isIOS,
  10. qrCode: '',
  11. },
  12. methods: {
  13. async open() {
  14. if (!this.data.isIos) {
  15. wx.navigateTo({
  16. url: '/pages/commodity/index',
  17. })
  18. } else {
  19. let qrCode = await getWxQrcode()
  20. this.setData({
  21. qrCode: qrCode.ticketUrl
  22. })
  23. console.log(typeof this.getTabBar === 'function' &&
  24. this.getTabBar());
  25. if (typeof this.getTabBar === 'function' &&
  26. this.getTabBar()) {
  27. this.getTabBar().setData({
  28. mask: true
  29. })
  30. }
  31. this.setData({
  32. show: true,
  33. })
  34. }
  35. },
  36. closeModal() {
  37. this.setData({
  38. show: false
  39. })
  40. if (typeof this.getTabBar === 'function' &&
  41. this.getTabBar()) {
  42. this.getTabBar().setData({
  43. mask: false
  44. })
  45. }
  46. },
  47. }
  48. })