Преглед изворни кода

判断员工是否是店长

kk.shi пре 3 година
родитељ
комит
91bca9fb8b

+ 12 - 2
pages/welfareMall/staff/distinguish.js

@@ -76,10 +76,20 @@ Page({
         mobile: getMobileCache(),
       });
       if(resStaff.data.found){
-        let staffString = JSON.stringify(resStaff)
+        let staffInfo = resStaff.data;
+        let shopowner = "no";
+        if(staffInfo.staffList != null && staffInfo.staffList.length >0){
+          for(var i=0;i<staffInfo.staffList.length;i++){
+            //判断员工是否是店长
+            if(1 == staffInfo.staffList[i].staff.isShopowner){
+              shopowner = "have";
+              break;
+            }
+          }
+        }
         setTimeout(function () {
           wx.redirectTo({
-            url:"../staff/isStaff?resStaff="+staffString,
+            url:"../staff/isStaff?shopowner="+shopowner,
           })
         }, 2000) //延迟时间
         

+ 6 - 5
pages/welfareMall/staff/isStaff.js

@@ -9,6 +9,7 @@ Page({
    */
   data: {
     isLogin: false,
+    staffShow: '',
   },
 
   /**
@@ -16,11 +17,11 @@ Page({
    */
   onLoad: function (options) {
    wx.hideShareMenu();
-   let staffInfo = JSON.parse(options.resStaff);
-   console.log(staffInfo)
-    this.setData({
-      isLogin: getMobileCache() != ''
-    })
+   let shopowner = options.shopowner;
+   this.setData({
+    isLogin: getMobileCache() != '',
+    staffShow: shopowner,
+   })
     if(this.data.isLogin){
       
     }

+ 1 - 1
pages/welfareMall/staff/isStaff.wxml

@@ -11,7 +11,7 @@
       </view>
       <view class="noStaff-content flex-column">
         <view class="content-join" catchtap="toWriteOff"></view>
-        <view class="content-partnership" catchtap="toStaff"></view>
+        <view class="content-partnership" wx:if="{{staffShow == 'have'}}" catchtap="toStaff"></view>
       </view>
     </view>
   </custom-page>