From 2c08a98f7e85ec7c9376f27a7933e75e44d672f7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 27 八月 2024 15:52:59 +0800
Subject: [PATCH] ll

---
 wechat_staff/pages/store/staff.js |   72 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/wechat_staff/pages/store/staff.js b/wechat_staff/pages/store/staff.js
index c951641..25aef41 100644
--- a/wechat_staff/pages/store/staff.js
+++ b/wechat_staff/pages/store/staff.js
@@ -1,4 +1,7 @@
-// pages/store/staff.js
+import {
+  getUserCard
+} from '../../api/index'
+// import { downloadImg } from '../../utils/common'
 Page({
 
   /**
@@ -6,7 +9,10 @@
    */
   data: {
     bottomLift: 0,
-    isShow: false
+    isShow: false,
+    userCard: '',
+    isShow2: false,
+    userInfo: {}
   },
 
   /**
@@ -14,15 +20,73 @@
    */
   onLoad(options) {
     var app = getApp().globalData
+    var userType = options.userType || 1
+    if (userType == 1) {
+      //濡傛灉鏌ヨ鑷繁鐨勪俊鎭�
+      this.setData({
+        userInfo: wx.getStorageSync('member')
+      })
+      console.log(this.data)
+    }
     this.setData({
       bottomLift: app.bottomLift
     })
   },
+  jumpUser() {
+    wx.navigateTo({
+      url: '/pages/userinfo/index',
+    })
+  },
+  showQrcode() {
+    this.setData({
+      isShow: true
+    })
+  },
+  closeCard() {
+    this.setData({
+      isShow2: false
+    })
+  },
+  saveCard() {
+    wx.downloadFile({
+      url: this.data.userCard,
+      success: function (res) {
+        console.log('涓嬭浇鎴愬姛', res);
+        wx.saveImageToPhotosAlbum({
+          filePath: res.tempFilePath,
+          success(result) {
+            console.log(result)
+            wx.showToast({
+              title: '淇濆瓨鎴愬姛',
+              icon: 'success',
+              duration: 2000
+            })
+          }
+        })
+      
+      }
+    })
+  },
   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})
+    this.setData({
+      isShow: false
+    })
   },
 
   /**

--
Gitblit v1.9.3