<template>
|
<view>
|
<!-- <up-sticky bgColor="#fff">
|
<view class="coreshop-ff content c-p-10">
|
|
<up-search placeholder="请输入工作名称" @clear='clear' @custom='search'
|
v-model="state.orderName" @search='search'></up-search>
|
</view>
|
|
</up-sticky> -->
|
<view class="full-page">
|
<view class="c-p-l-20 c-p-r-20" v-if="list.staffList&&list.staffList.length>0">
|
<view class="listrecord c-p-t-20" v-for="(item,index) in list.staffList" :key="item.id">
|
<view class="coreshop-ff chuany-bradius20">
|
<view class="c-p-24">
|
<view class="chuany-flex chuany-justify-between">
|
<text class="chuany-font34">
|
{{item.nickname}}
|
</text>
|
<view class="chuany-flex chuany-justify-between">
|
<up-tag class='c-m-r-10' :text="item.isAdmin?'管理员':'员工'" shape="circle"
|
type="success" plain plainFill size='mini'></up-tag>
|
</view>
|
|
</view>
|
<view class="chuany-flex chuany-justify-between c-p-t-12">
|
<view>
|
电话:{{item.phone}}
|
</view>
|
<view>
|
<!-- v-if="item.isShenPiName!=='已结算'" -->
|
<up-button class="button-layout__item" :text="item.isAdmin?'取消管理员':'设为管理员'"
|
size="mini" :loading='item.isLoading' :loadingText="item.isAdmin?'取消中':'设置中'"
|
@click.stop='setAdmin(item)' type="primary"></up-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<view v-else>
|
<up-empty text='暂无' icon="/static/order.png">
|
</up-empty>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script setup>
|
import {
|
onLoad,
|
onShow,
|
onReachBottom
|
} from "@dcloudio/uni-app";
|
import {
|
reactive,
|
ref,
|
getCurrentInstance
|
} from 'vue';
|
const {
|
$upload,
|
$api,
|
$util,
|
$db
|
} = getCurrentInstance().appContext.config.globalProperties
|
let list = reactive({
|
staffList: []
|
})
|
onLoad(() => {
|
PostMystaffList()
|
})
|
const setAdmin = (item) => {
|
let obj = {
|
comId: item.id,
|
isAdmin: !item.isAdmin
|
}
|
$api.SaveStaffAdmin(obj).then(res => {
|
if (res.code == 1) {
|
$util.showToast({
|
title: item.isAdmin ? '取消成功!' : "设置成功!",
|
icon: "success"
|
})
|
PostMystaffList()
|
} else {
|
$util.showToast({
|
title: res.error,
|
})
|
}
|
})
|
}
|
const search = (index) => {
|
PostMystaffList()
|
}
|
const clear = () => {
|
state.orderName = ''
|
state.wordStartTime = ""
|
state.wordEndTime = ""
|
}
|
const clickTime = () => {
|
datePickerShow.value = !datePickerShow.value
|
}
|
const PostMystaffList = () => {
|
|
$api.PostMystaffList().then(res => {
|
if (res.code == 1) {
|
list.staffList = res.data
|
list.staffList.forEach(item => {
|
item.isLoading = false
|
})
|
// if (state.pageIndex == 1) {
|
// list.staffList = res.data.items
|
// } else {
|
// list.staffList.concat(...res.data.items)
|
// }
|
// console.log(list.staffList, 'list.staffList’');
|
// // totalPages.value = res.data.totalCount
|
// // 根据count数量判断是否还有数据
|
// if (res.data.totalCount > list.staffList.length) {
|
// loadStatus.value = 'loadmore'
|
// state.pageIndex++
|
// } else {
|
// // 数据已加载完毕
|
// loadStatus.value = 'nomore'
|
// }
|
} else {
|
// _that.$refs.uToast.show({ message: res.msg, type: 'error' });
|
}
|
})
|
}
|
</script>
|
|
<style>
|
.content {
|
/* width: 100%; */
|
box-sizing: border-box;
|
}
|
|
.bgblue {
|
background-color: #4e96f5;
|
border-radius: 20rpx 20rpx 0 0;
|
color: #fff;
|
}
|
|
.listrecord {
|
width: 100%;
|
box-sizing: border-box;
|
}
|
</style>
|