瀏覽代碼

删除员工

kk.shi 3 年之前
父節點
當前提交
2b12dd11f2
共有 3 個文件被更改,包括 59 次插入4 次删除
  1. 7 0
      api/welfareMall.js
  2. 51 3
      pages/welfareMall/staffManage/staffManage.js
  3. 1 1
      pages/welfareMall/staffManage/staffManage.wxml

+ 7 - 0
api/welfareMall.js

@@ -201,6 +201,13 @@ class WelfareMall extends request {
     return this.postRequest(`${this.BASE_URL}open/staff/add-store-staff`, params);
   }
 
+  /**
+   * 删除门店职员
+   */
+  static delStoreStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/del-store-staff`, params);
+  }
+
 
 
 

+ 51 - 3
pages/welfareMall/staffManage/staffManage.js

@@ -26,7 +26,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    
+    wx.hideShareMenu();
   },
 
   /**
@@ -199,9 +199,9 @@ Page({
       staffName: resName,
       staffMobile: resPhone,
     });
-    await that.cancel();
+    that.cancel();
     wx.showToast({
-      title: '新增店员信息已提交',
+      title: '新增店员已提交',
       icon: 'none',
       duration: 1500,
       success: function(){
@@ -210,4 +210,52 @@ Page({
     });
     
   },
+
+  /**
+   * 
+   * 删除人员信息
+   */ 
+  toDelete: function(e) {
+   let staffId = e.currentTarget.dataset.id;
+   console.log(staffId);
+    wx.showModal({
+      title: '删除员工',
+      content: '',
+      showCancel: true,//是否显示取消按钮
+      cancelText:"取消",//默认是“取消”
+      cancelColor:'#00000',//取消文字的颜色
+      confirmText:"确定",//默认是“确定”
+      confirmColor: '#00000',//确定文字的颜色
+      success: res => {if (res.cancel) {
+            //点击取消,默认隐藏弹框
+        } else {
+            //点击确定 
+            WelfareMall.delStoreStaff({
+              mobile: getMobileCache(),
+              staffId: staffId,
+            }).then(res => {
+                if (res.code == 200) {
+                  that.cancel();
+                  wx.showToast({
+                    title: '员工已删除',
+                    icon: 'none',
+                    duration: 1500,
+                    success: function(){
+                      that.onShow();
+                    }
+                  });
+                }
+                that.data.lock = false
+            }).catch(_ => {
+                console.log(_)
+                that.data.lock = false
+            })
+        }
+      },
+      fail: function (res) {
+        console.log(res)
+       },//接口调用失败的回调函数 
+    })
+    
+  },
 })

+ 1 - 1
pages/welfareMall/staffManage/staffManage.wxml

@@ -9,7 +9,7 @@
   <view class="staffManage-staff flex-row" wx:for="{{item.hsayStoreStaffList}}" wx:key="index" wx:for-item="list" data-storeno="{{list.storeNo}}">
     <view class="staff-name over-ellipsis">{{list.staffName}}</view>
     <view class="staff-phone">{{list.mobile}}</view>
-    <view class="staff-delete">删除员工</view>
+    <view class="staff-delete" catchtap="toDelete" data-id="{{list.id}}">删除员工</view>
   </view>
   <view class="bg-zindex" hidden="{{hidden}}">
     <view class="success_window flex-column">