Browse Source

feature/v1.0
xpz2018 5 years ago
parent
commit
a92398ea79
4 changed files with 37 additions and 37 deletions
  1. 27
      pages/home/employee/index.js
  2. 34
      pages/home/employee/index.wxml
  3. 9
      pages/home/employee/index.wxss
  4. 4
      pages/home/index/index.wxml

27
pages/home/employee/index.js

@ -26,20 +26,20 @@ Page({
},
fetchMemberList: function(){
getCheckList({enterpriseId: app.userInfo.enterpriseId}).then(result => {
this.setData({ checkList: result.data, loading: false})
this.setData({ checkList: result.data.records, loading: false})
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
this.data.eemidList = []
getEmployeList({enterpriseId: app.userInfo.enterpriseId, isPassFromBackstage: 1}).then(result => {
for (let index = 0; index < result.data.length; index++) {
const element = result.data[index]
for (let index = 0; index < result.data.records.length; index++) {
const element = result.data.records[index]
if(element.position == 'ADMINISTRATOR'){
this.data.eemidList.push(element.id)
}
}
this.setData({ memberList: result.data, loading: false })
this.setData({ memberList: result.data.records, loading: false })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
@ -48,16 +48,11 @@ Page({
},
lookItem: function(event){
var item = this.data.memberList[event.currentTarget.dataset.index]
if(item.position == 'ADMINISTRATOR'){
return
}
var that = this
wx.showActionSheet({
itemList: ['设为管理员'],
itemList: ['删除该员工'],
success(res){
if (res.tapIndex === 0){
that.setAdmin(event.currentTarget.dataset.index, item)
}if (res.tapIndex === 1){
that.deleteItem(event.currentTarget.dataset.index, item)
}
}
@ -96,24 +91,22 @@ Page({
util.showToast(err)
})
},
agreeItem: function(event){
agreeItem: function(e){
// /employees/audit 员工审核
wx.showLoading({ title: '加载中', mask: true })
var item = this.data.checkList[event.currentTarget.dataset.index]
var item = this.data.checkList[e.currentTarget.dataset.index]
auditEmploye({id: item.id, status: 1 }).then(result => {
//成功回调
this.fetchMemberList()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
},
refuseItem: function(event){
refuseItem: function(e){
wx.showLoading({ title: '加载中', mask: true })
var item = this.data.checkList[event.currentTarget.dataset.index]
var item = this.data.checkList[e.currentTarget.dataset.index]
auditEmploye({id: item.id, status: 2 }).then(result => {
this.setData({ ['checkList[' + event.currentTarget.dataset.index + '].applicantStatus']: 2})
this.setData({ ['checkList[' + e.currentTarget.dataset.index + '].status']: 2})
wx.hideLoading()
}).catch(err => {
wx.hideLoading()

34
pages/home/employee/index.wxml

@ -14,37 +14,43 @@
<view wx:if="{{checkList.length}}">
<van-index-anchor use-slot><text>待审核</text></van-index-anchor>
<van-cell wx:for="{{ checkList }}" wx:key="index">
<view slot="title" class="flex flex-justify">
<view class="flex flex-center">
<van-image custom-class="e-image" round fit="{{ fit }}" width="90rpx" height="90rpx" src="{{ item.avatarUrl }}" />
<view class="bg-white" wx:for="{{ checkList }}" wx:key="index">
<view class="flex flex-justify item-content">
<view class="flex flex-center" style="height:90rpx">
<van-image use-loading-slot width="90rpx" height="90rpx" lazy-load round src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}">
<image class="image-load" slot="loading" src="/assets/image/ygImg.png"></image>
</van-image>
<view class="flex flex-column" style="margin-left:18rpx">
<text class="text-sg text-bold">{{item.applicantName || item.enterpriseMemberName}}</text>
<text class="text-sm text-gray" style="line-height:18px">{{item.phone || ''}}</text>
<text class="text-sm text-gray" style="line-height:18px">{{item.phone || item.applicationMobile || ''}}</text>
</view>
</view>
<view class="flex" wx:if="{{item.applicantStatus == 0}}">
<van-button type="info" size="small" custom-style="margin-right:12rpx" data-index="{{index}}"
bind:click="agreeItem">同意加入</van-button>
<view class="flex flex-center" wx:if="{{item.status == 0}}" style="height:90rpx">
<van-button type="info" size="small" custom-style="margin-right:12rpx" data-index="{{index}}" bind:click="agreeItem">同意加入</van-button>
<van-button type="danger" size="small" data-index="{{index}}" bind:click="refuseItem">拒绝加入</van-button>
</view>
<view class="text-gray" wx:if="{{item.applicantStatus == 2}}">已拒绝</view>
<view class="flex flex-center" wx:if="{{item.status == 2}}" style="height:90rpx">
<view class="text-gray">已拒绝</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 3}}" style="height:90rpx">
<view class="text-gray">已过期</view>
</view>
</view>
</van-cell>
</view>
</view>
<view wx:if="{{memberList.length}}">
<van-index-anchor use-slot><text>所有员工</text></van-index-anchor>
<van-cell clickable wx:for="{{ memberList }}" wx:key="index" data-index="{{index}}" bindtap="lookItem">
<view slot="title" class="flex" style="align-items: center">
<van-image custom-class="e-image" round fit="{{ fit }}" width="90rpx" height="90rpx" src="{{ item.avatarUrl }}" />
<view slot="title" class="flex" style="margin-bottom:-12rpx">
<van-image round width="90rpx" height="90rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" />
<view style="margin-left:18rpx;width:100%">
<view class="flex flex-justify">
<text class="text-sg text-bold">{{item.userName || ''}}</text>
<text class="text-sg text-bold">{{item.enterpriseMemberName || ''}}</text>
<van-tag plain round type="primary" wx:if="{{item.position == 'PRIMARY'}}">企业主</van-tag>
<van-tag plain round type="primary" wx:elif="{{item.position == 'ADMINISTRATOR'}}">管理员</van-tag>
</view>
<view class="text-sm text-gray" style="line-height:18px">{{item.phone || ''}}</view>
<view class="text-sm text-gray" style="line-height:18px">{{item.mobile || ''}}</view>
</view>
</view>
</van-cell>

9
pages/home/employee/index.wxss

@ -1,8 +1,9 @@
/* pages/home/employee/index.wxss */
.e-image{
width: 90rpx;
height: 90rpx;
margin-top: 12rpx;
.item-content{
padding: 20rpx 32rpx 20rpx 0rpx;
border-bottom:1rpx solid #f3f3f3;
margin-left:32rpx;
align-items: flex-start;
}

4
pages/home/index/index.wxml

@ -29,7 +29,7 @@
<text class="cuIcon-right text-gray" style="font-size:18px"></text>
</view>
<!-- 授信信息 -->
<view class="bg-white" wx:if="{{userInfo.position != 'ORDINARY'}}" style="margin-top: 16rpx">
<!-- <view class="bg-white" wx:if="{{userInfo.position != 'ORDINARY'}}" style="margin-top: 16rpx">
<view class="flex" style="padding: 20rpx 32rpx">
<text class="text-lg text-bold">先用后付</text>
<text class="text-df text-gray" style="padding-top:6rpx;margin-left:8rpx">最高200万限额采购商品,满意了再付款</text>
@ -47,7 +47,7 @@
<view class="text-gray text-sm">查看订单明细</view>
</view>
</view>
</view>
</view> -->
<!-- 企业信息 -->
<view style="height:16rpx"></view>
<van-cell-group>

Loading…
Cancel
Save