소스 검색

员工管理新增员工

kk.shi 3 년 전
부모
커밋
7bd4096824
4개의 변경된 파일229개의 추가작업 그리고 53개의 파일을 삭제
  1. 7 0
      api/welfareMall.js
  2. 99 46
      pages/welfareMall/staffManage/staffManage.js
  3. 22 6
      pages/welfareMall/staffManage/staffManage.wxml
  4. 101 1
      pages/welfareMall/staffManage/staffManage.wxss

+ 7 - 0
api/welfareMall.js

@@ -194,6 +194,13 @@ class WelfareMall extends request {
     return this.postRequest(`${this.BASE_URL}open/staff/get-store-staff-list`, params);
   }
 
+  /**
+   * 添加门店职员
+   */
+  static addStoreStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/add-store-staff`, params);
+  }
+
 
 
 

+ 99 - 46
pages/welfareMall/staffManage/staffManage.js

@@ -11,17 +11,22 @@ Page({
     lock: false,
     noResult: false,
     noMore: false,
+    hidden: true,
     mobileTop: 'TONY WU',
-    storeList: [],
     storeStaffList: [],
+    storeInfo: '',
+    storeName: '',
+    storeNo: '',
+    storePhone: '',
+    inputName: '',
+    inputPhone: '',
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    this.getStoreListByStaff();
-    this.getStoreStaffList();
+    
   },
 
   /**
@@ -35,7 +40,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.getStoreStaffList();
   },
 
   /**
@@ -72,48 +77,6 @@ Page({
   onShareAppMessage: function () {
 
   },
-  // 根据职员获取门店列表
-  getStoreListByStaff: function() {
-    WelfareMall.getStoreListByStaff({
-      mobile: getMobileCache(),
-    }).then(res => {
-        if (res.code == 200) {
-            this.userStaffListView(res.data)
-        }
-        this.data.lock = false
-    }).catch(_ => {
-        console.log(_)
-        this.data.lock = false
-    })
-},
-
-  userStaffListView: function(data) {
-    if (!Array.isArray(data) || data.length == 0) {
-        console.log("门店列表数据为空");
-        if (this.data.page == 1) {
-            this.setData({
-                mobileTop:getMobileCache(),
-                noResult: true
-            })
-        } else {
-            this.setData({
-                mobileTop:getMobileCache(),
-                noMore: true
-            })
-        }
-        return
-    }
-    // data.forEach(v => {
-    //     let payeTime = v.payedAt
-    //     v.payedAt = parseTime(payeTime, "{y}.{m}.{d} {h}:{i}:{s}")
-    // })
-
-    this.data.storeList = this.data.storeList.concat(...data)
-    this.setData({
-        mobileTop:getMobileCache(),
-        storeList: this.data.storeList
-    })
-  }, 
 
    // 根据登录手机号获取职员列表
    getStoreStaffList: function() {
@@ -157,4 +120,94 @@ Page({
         storeStaffList: this.data.storeStaffList
     })
   }, 
+
+  /**
+   * 新增店员
+   */
+  toStaffAdd: function(e){
+    this.setData({
+         hidden: false,
+         storeValue: e.currentTarget.dataset.storename,
+         storeNo: e.currentTarget.dataset.storeno,
+         storeName: '',
+         storePhone: '',
+    });
+},
+
+  /**
+   * 取消
+   */
+  cancel: function(){
+        this.setData({
+          hidden: true,
+          storeName: '',
+          storePhone: '',
+        });
+    },
+    /**
+     * 提交
+     */
+    confirm: function(){
+      this.setData({
+        hidden: false
+      });
+      var resName = this.data.inputName;
+      var resPhone = this.data.inputPhone;
+      if(resName == null || resName =='' || resName == undefined){
+        wx.showToast({
+          title: '店员名字必填',
+          icon: 'none',
+          duration: 1500
+        })
+      }else if(resPhone == null || resPhone =='' || resPhone == undefined){
+        wx.showToast({
+          title: '店员手机号码必填',
+          icon: 'none',
+          duration: 1500
+        })
+      } else {
+        this.goAddStaff(resName,resPhone);
+      }
+    },
+
+    /**
+     * 店员名称
+     */
+    getName: function(e){
+      this.setData({
+        inputName: e.detail.value
+      })
+    },
+
+    /**
+     * 店员手机号
+     */
+    getPhone: function(e){
+      this.setData({
+        inputPhone: e.detail.value
+      })
+    },
+
+  /**
+   * 
+   * 提交人员信息
+   */ 
+  goAddStaff: async function(resName,resPhone) {
+    var that = this;
+    await WelfareMall.addStoreStaff({
+      storeNo: that.data.storeNo,
+      staffName: resName,
+      staffMobile: resPhone,
+    });
+    await that.cancel();
+    wx.showToast({
+      title: '新增店员信息已提交',
+      icon: 'none',
+      duration: 1500,
+      success: function(){
+        that.onShow();
+      }
+    });
+    
+  },
 })

+ 22 - 6
pages/welfareMall/staffManage/staffManage.wxml

@@ -1,14 +1,30 @@
 <!--pages/welfareMall/staffManage/staffManage.wxml-->
-<view class="staffManage" wx:for="{{storeList}}" wx:key="index" data-storeno="{{item.storeNo}}">
+<view class="staffManage" wx:for="{{storeStaffList}}" wx:key="index" data-storeno="{{item.storeNo}}">
   <view class="staffManage-store flex-row">
     <view class="store-name">{{item.storeName}}</view>
-    <view class="store-refund flex-row" catchtap="toStaffAdd">
+    <view class="store-refund flex-row" catchtap="toStaffAdd" data-storename="{{item.storeName}}" data-storeno="{{item.storeNo}}">
       <view class="lower-store-text">+ 新增店员</view>
     </view>
   </view>
-  <view class="staffManage-staff flex-row" wx:for="{{storeStaffList}}" wx:key="index" data-storeno="{{item.storeNo}}">
-    <view class="staff-name">沪上阿姨</view>
-    <view class="staff-phone">18703607235</view>
-    <view class="staff-delete">删除店员</view>
+  <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">{{list.staffName}}</view>
+    <view class="staff-phone">{{list.mobile}}</view>
+    <view class="staff-delete">删除员工</view>
+  </view>
+  <view class="bg-zindex" hidden="{{hidden}}">
+    <view class="success_window flex-column">
+      <view class="w_title">新增店员</view>
+      <view class="w_textNo text-top"><view>{{storeValue}}</view></view>
+      <view class="w_text text-middle"><input bindinput="getName" type="text" placeholder="请输入店员名字" value="{{storeName}}" maxlength="10" /></view>
+      <view class="w_text text-lower"><input bindinput="getPhone" type="text" placeholder="请输入店员手机号码" value="{{storePhone}}" maxlength="11" /></view>
+      <view class="w_button flex-row">
+        <view class="w_go_order toCancel flex-row" catchtap="cancel">
+          <view class="text_style">取消</view>
+        </view>
+        <view class="w_go_order toDetermine flex-row" catchtap="confirm">
+          <view class="text_style">提交</view>
+        </view>
+      </view>
+    </view>
   </view>
 </view>

+ 101 - 1
pages/welfareMall/staffManage/staffManage.wxss

@@ -82,4 +82,104 @@ page{
   font-weight: 500;
   color: #BD2021;
   margin-right: 36rpx;
-}
+}
+
+.bg-zindex{
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top: 0;
+  background: #040404;
+  opacity: 0.6;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
+  z-index: 999;
+}
+.success_window{
+  width: 680rpx;
+  height: 626rpx;
+  background: #FFFFFF;
+  border-radius: 20rpx;
+  position: relative;
+  z-index: 9999;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.w_title{
+  font-size: 36rpx;
+  font-weight: 500;
+  color: #444444;
+  padding-top: 50rpx;
+}
+
+.w_text{
+  width: 606rpx;
+  height: 80rpx;
+  background: #F8F8F8;
+  border: 2rpx solid #9A9A9A;
+  border-radius: 10rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
+.w_textNo{
+  width: 606rpx;
+  height: 80rpx;
+  background: #F8F8F8;
+  border-radius: 10rpx;
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+}
+
+/* .text-top{
+  margin-top: 44rpx;
+}
+
+.text-middle{
+  margin-top: 30rpx;
+}
+
+.text-lower{
+  margin-top: 28rpx;
+} */
+
+
+.hsay_text{
+  margin-top: 8px;
+  font-size: 12px;
+  font-weight: 500;
+  color: #444444;
+}
+
+.w_button{
+  width: 680rpx;
+  height: 118rpx;
+}
+.w_go_order{
+  width: 50%;
+  height: 118rpx;
+  text-align: center;
+}
+
+.toCancel{
+  color: #D84436;
+  background: #FFFFFF;
+  border-top: 2rpx solid #D84436;
+  border-radius: 0 0 0 20rpx;
+}
+
+.toDetermine{
+  color: #FFFFFF;
+  background: #D84436;
+  border-radius: 0 0 20rpx 0;
+}
+
+.text_style{
+  font-size: 36rpx;
+  font-weight: 500;
+}