liukangdong
2024-07-19 1b897c74e44d185669d87abd4c3a29c90d6fe225
wechat_staff/pages/store/staff.js
@@ -1,4 +1,6 @@
// pages/store/staff.js
// pages/store/staff.jsdownloadImg
import { getUserCard } from '../../api/index'
import { downloadImg } from '../../utils/common'
Page({
  /**
@@ -6,7 +8,10 @@
   */
  data: {
    bottomLift: 0,
    isShow: false
    isShow: false,
    userCard:'',
    isShow2: false,
    userInfo:{}
  },
  /**
@@ -14,12 +19,37 @@
   */
  onLoad(options) {
    var app = getApp().globalData
    var userType = options.userType
    if(userType == 1){
      //如果查询自己的信息
      this.setData({userInfo: wx.getStorageSync('member')})
      console.log(this.data)
    }
    this.setData({
      bottomLift: app.bottomLift
    })
  },
  showQrcode(){
    this.setData({isShow:true})
  },
  closeCard(){
    this.setData({isShow2: false})
  },
  saveCard(){
   downloadImg(this.data.userCard);
  },
  openModal() {
    this.setData({isShow: true})
    if(this.data.userCard !=null && this.data.userCard != ''){
      this.setData({isShow2: true})
      return;
    }
    getUserCard().then(res =>{
      this.setData({userCard: res.data})
      this.setData({isShow2: true})
    })
  },
  onClose() {
    this.setData({isShow: false})