import { createAndroidOrder, payQrCode, pollingOrder } from '~/api/global' let polling Component({ data: { qrCode: '', product: {} }, lifetimes: { attached() { /* this.selectComponent("#popUp").showModal() this.getTabBar().setData({ show: false }) */ }, }, methods: { async open(product) { let orderId = await createAndroidOrder({ productId: product.id }) let qrCode = await payQrCode({ orderId, productId: product.id, channel: wx.getStorageSync('channelCode') }) if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ show: false }) } this.setData({ product, qrCode }) this.selectComponent("#popUp").showModal() polling = setInterval(async () => { let res = await pollingOrder(orderId) if (res.payStatus == 'SUCCESS') { this.triggerEvent('paySuccess') this.close() } }, 2000); }, closeEvent() { if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ show: true }) } clearInterval(polling) }, close() { this.selectComponent("#popUp").hideModal() clearInterval(polling) if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ show: true }) } } } })