浏览代码

员工管理

kk.shi 3 年之前
父节点
当前提交
aed0f121d6

+ 16 - 2
api/welfareMall.js

@@ -167,19 +167,33 @@ class WelfareMall extends request {
   }
 
     /**
-   * 获取订单
+   * 获取核销记录
    */
   static getHexiaoList(params) {
     return this.postRequest(`${this.BASE_URL}open/hexiao/list`, params);
   }
 
   /**
-   * 获取订单
+   * 根据手机识别职员信息
    */
   static discernStoreStaff(params) {
     return this.postRequest(`${this.BASE_URL}open/staff/discern-store-staff`, params);
   }
 
+  /**
+   * 根据职员获取门店列表
+   */
+  static getStoreListByStaff(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/get-store-list-by-staff`, params);
+  }
+
+  /**
+   * 根据登录手机号获取职员列表
+   */
+  static getStoreStaffList(params) {
+    return this.postRequest(`${this.BASE_URL}open/staff/get-store-staff-list`, params);
+  }
+
 
 
 

+ 2 - 1
app.json

@@ -25,7 +25,8 @@
     "pages/welfareMall/staff/staff",
     "pages/welfareMall/staff/isStaff",
     "pages/welfareMall/staff/distinguish",
-    "pages/welfareMall/staff/noStaff"
+    "pages/welfareMall/staff/noStaff",
+    "pages/welfareMall/staffManage/staffManage"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 1 - 0
pages/welfareMall/staff/distinguish.js

@@ -15,6 +15,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    wx.hideShareMenu();
     this.discernStoreStaff();
   },
 

+ 1 - 0
pages/welfareMall/staff/isStaff.js

@@ -15,6 +15,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    wx.hideShareMenu();
     this.setData({
       isLogin: getMobileCache() != ''
     })

+ 1 - 0
pages/welfareMall/staff/noStaff.js

@@ -15,6 +15,7 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    wx.hideShareMenu();
     this.setData({
       isLogin: getMobileCache() != ''
     })

+ 160 - 0
pages/welfareMall/staffManage/staffManage.js

@@ -0,0 +1,160 @@
+// pages/welfareMall/staffManage/staffManage.js
+import WelfareMall from '../../../api/welfareMall'
+import { parseTime } from '../../../utils/util'
+import {getMobileCache, getPhoneNumber as getPhoneNumberSync} from '../../../utils/user'
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    lock: false,
+    noResult: false,
+    noMore: false,
+    mobileTop: 'TONY WU',
+    storeList: [],
+    storeStaffList: [],
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.getStoreListByStaff();
+    this.getStoreStaffList();
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  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() {
+    WelfareMall.getStoreStaffList({
+      mobile: getMobileCache(),
+    }).then(res => {
+        if (res.code == 200) {
+            this.userStoreStaffListView(res.data)
+        }
+        this.data.lock = false
+    }).catch(_ => {
+        console.log(_)
+        this.data.lock = false
+    })
+},
+
+  userStoreStaffListView: 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.storeStaffList = this.data.storeStaffList.concat(...data)
+    this.setData({
+        mobileTop:getMobileCache(),
+        storeStaffList: this.data.storeStaffList
+    })
+  }, 
+})

+ 4 - 0
pages/welfareMall/staffManage/staffManage.json

@@ -0,0 +1,4 @@
+{
+  "usingComponents": {},
+  "navigationBarTitleText": "员工管理"
+}

+ 14 - 0
pages/welfareMall/staffManage/staffManage.wxml

@@ -0,0 +1,14 @@
+<!--pages/welfareMall/staffManage/staffManage.wxml-->
+<view class="staffManage" wx:for="{{storeList}}" 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="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>
+</view>

+ 85 - 0
pages/welfareMall/staffManage/staffManage.wxss

@@ -0,0 +1,85 @@
+/* pages/welfareMall/staffManage/staffManage.wxss */
+page{
+  background: #F7F7F7;
+  display:flex;
+  flex-flow: column nowrap;
+  justify-content: left;
+  align-items: center;
+  box-sizing: border-box;
+}
+
+/* 垂直方向布局,水平居中 **/
+.flex-column{
+  display: flex;
+  flex-flow: column nowrap;
+  align-items: center;
+  justify-content: left;
+}
+
+/* 水平方向布局,垂直居中 **/
+.flex-row{
+  display: flex;
+  flex-flow: row nowrap;
+  align-items: center;
+  justify-content: center;
+}
+
+.staffManage{
+  margin-bottom: 34rpx;
+}
+
+.staffManage-store{
+  width: 750rpx;
+  height: 94rpx;
+  background: #FFFFFF;
+  justify-content: space-between;
+  margin-bottom: 8rpx;
+}
+
+.store-refund{
+  width: 178rpx;
+  height: 50rpx;
+  background: #D84436;
+  border-radius: 50rpx;
+  margin-right: 22rpx;
+}
+
+.lower-store-text{
+  font-size: 24rpx;
+  font-weight: 500;
+  color: #FFFFFF;
+}
+
+.store-name{
+  margin-left: 50rpx;
+  font-size: 30rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.staffManage-staff{
+  justify-content: space-between;
+  width: 750rpx;
+  height: 140rpx;
+  background: #FFFFFF;
+}
+
+.staff-name{
+  margin-left: 68rpx;
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.staff-phone{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #444444;
+}
+
+.staff-delete{
+  font-size: 28rpx;
+  font-weight: 500;
+  color: #BD2021;
+  margin-right: 36rpx;
+}