123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import {
- getProducts
- } from '~/api/global'
- import {
- getWxQrcode,
- } from '~/api/user'
- const app = getApp()
- Component({
- properties: {
- },
- data: {
- show: false,
- products: [],
- // 是否购买过vip
- isIos: app.globalData.isIOS,
- qrCode: '',
- isPreferential: false
- },
- methods: {
- async open() {
- if (!this.data.isIos) {
- this.getProducts()
- } else {
- let qrCode = await getWxQrcode()
- console.log(qrCode);
- this.setData({
- qrCode: qrCode.ticketUrl
- })
- }
- this.setData({
- show: true,
- })
- },
- closeModal() {
- this.setData({
- show: false
- })
- },
- async getProducts() {
- let {
- isPreferential,
- productList: products,
- } = await getProducts()
- this.setData({
- products,
- isPreferential
- })
- },
- toBuy({
- currentTarget
- }) {
- this.triggerEvent('toBuy', currentTarget.dataset.goods)
- }
- }
- })
|