wangfukang 3 years ago
parent
commit
9946983185
  1. BIN
      package1/.DS_Store
  2. BIN
      package1/staff/.DS_Store
  3. 107
      package1/staff/addStaff.vue
  4. 144
      package1/staff/clock.vue
  5. 92
      package1/staff/performance.vue
  6. 141
      package1/staff/signRule.vue

BIN
package1/.DS_Store

Binary file not shown.

BIN
package1/staff/.DS_Store

Binary file not shown.

107
package1/staff/addStaff.vue

@ -0,0 +1,107 @@
<template>
<view>
<view class="popup-height">
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx"
label-align="right">
<uni-forms-item label="员工姓名" required name="nickname">
<uni-easyinput type="text" v-model="addForm.nickname" placeholder="请输入员工姓名" />
</uni-forms-item>
<uni-forms-item label="手机号" required name="mobile">
<uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入员工手机号" />
</uni-forms-item>
<uni-forms-item label="权限" required name="type">
<uni-data-select style="width: 100%" v-model="addForm.type" :localdata="typeList"></uni-data-select>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="onFormSubmit">保存</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
addForm: {
nickname: '',
mobile: '',
type: '',
password:'123456'
},
id: '',
typeList: [{
value: 0,
text: "管理员"
},
{
value: 1,
text: "员工"
},
],
rules: {
nickname: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
mobile: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
type: {
rules: [{
required: true,
errorMessage: '不能为空'
}]
},
}
}
},
onLoad(options) {
const type = options.type
const item = JSON.parse(options.item)
this.type = options.type
if (type === 'edit') {
this.addForm.nickname = item.nickname
this.addForm.mobile = item.mobile
this.addForm.type = Number(item.type)
this.id = item.id
}
uni.setNavigationBarTitle({
title: type === 'add' ? '新增员工' : '编辑信息'
});
},
methods: {
onFormSubmit() {
this.$refs.addForm.validate().then(async () => {
let url;
if(this.type=='edit'){
url = '/app/common/user/edit'
this.addForm.id = this.id
}else{
url = '/app/common/user/add'
}
const res = await this.tui.request(url, 'post', this.addForm, false,
true, false)
if (res.code == 200) {
uni.navigateBack()
} else {
this.tui.toast(res.message)
}
}, (reason) => {
})
}
}
}
</script>
<style lang="scss" scoped>
.popup-height {
padding: 0 25upx;
background-color: #fff;
}
</style>

144
package1/staff/clock.vue

@ -0,0 +1,144 @@
<template>
<view>
<view class="" v-if="peopleType=='1'">
<view class="status">当前状态:{{value}}</view>
<view class="clock-button" :class="{isClock:isClock}" type="success" @click="onClock">打卡</view>
</view>
<view class="" v-else>
<uni-section class="mb-10" title="时间选择" type="line">
<uni-datetime-picker v-model="range" type="daterange" />
</uni-section>
<uni-card title="打卡情况">
<uni-list>
<uni-list-item direction="row" v-for="(item , index) in staffList" :key="index">
<template #body>
<view class="tag-wrap">
<view v-if="item.departmentTitle">
<u-tag :text="item.departmentTitle" size="12" />
</view>
</view>
</template>
<template #header>
<view class="avatar-wrap">
<!-- <u-avatar :src="item.avatar" size="24">
</u-avatar> -->
<text class="staff-name">{{ item.nickname }}</text>
</view>
</template>
<template #footer>
<view style="font-size: 24rpx;">
<text style="margin-right: 10px;">正常:20</text>
<text style="margin-right: 10px;">迟到:<text style="color: red;">2</text></text>
<text>早退:<text style="color: red;">3</text></text>
</view>
</template>
</uni-list-item>
</uni-list>
</uni-card>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex'
export default {
data() {
return {
value: '未打卡',
isClock: false,
peopleType: '0',
staffList:[]
}
},
computed: mapState(['userId']),
onLoad() {
//明珠A 116.805796,38.335286
//明珠D 116.806408,38.338111
//明珠B 116.806913,38.336937
//明珠C 116.80562,38.337177
//明珠早市精品二合一给一个大的范围 116.810029,38.335321
this.peopleType = uni.getStorageSync('type')
if(this.peopleType == 0){
this.getStaffList()
}
},
methods: {
getStaffList() {
this.tui.request('/app/common/user/findAllUserByShopId', 'get', {}, false, false, true).then((res) => {
if (res.code !== 200) return
this.staffList = res.result
})
},
onClock() {
uni.getLocation({
type: 'wgs84',
isHighAccuracy:true,
accuracy:'best',
success: function (res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
}
});
// if (!this.isClock) {
// this.tui.request("/app/clockIn/", "get", {
// userId: this.userId
// }, false, true).then((res) => {
// if (res.code == 200) {
// this.tui.toast('打卡成功', 2000, true)
// this.value = '已打卡'
// this.isClock = true
// } else {
// this.tui.toast(res.message)
// }
// })
// }
}
}
}
</script>
<style lang="scss">
.status {
font-size: 40upx;
color: #333333;
text-align: center;
padding: 80upx;
}
.clock-button {
width: 200upx;
height: 200upx;
line-height: 200upx;
border-radius: 200upx;
text-align: center;
background-color: #5fd9ee;
color: #fef0f0;
font-size: 56upx;
margin: 50upx auto;
}
.isClock {
background: grey;
}
.tag-wrap {
width: 100rpx;
flex: 1;
display: flex;
view {
margin: 0 2upx;
}
}
.avatar-wrap {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24upx;
}
</style>

92
package1/staff/performance.vue

@ -0,0 +1,92 @@
<template>
<view>
<uni-section class="mb-10" title="业绩查看范围" type="line">
<uni-datetime-picker v-model="range" type="daterange" @change="change" />
</uni-section>
<view class="">
<uni-card title="业绩排名">
<uni-list>
<uni-list-item direction="row" v-for="(item , index) in staffList" :key="index">
<template #header>
<view class="avatar-wrap">
<text class="staff-name">{{ item.createByName?item.createByName:'暂无' }}</text>
</view>
</template>
<template #footer>
<view style="font-size: 24rpx;display: flex;flex-direction: column;width: 250rpx;">
<text style="display: inline-block;width: auto;">单数:{{item.totalCount?item.totalCount:'暂无'}}单</text>
<text style="display: inline-block;width: auto;">总金额:{{item.totalPrice?item.totalPrice:'暂无'}}元</text>
</view>
</template>
</uni-list-item>
</uni-list>
</uni-card>
</view>
</view>
</template>
<script>
export default {
data() {
return {
range: [],
name: '',
staffList:[]
}
},
onLoad() {
this.getMonth();
this.getStaffList()
},
methods: {
//改变时间选择
change(e){
var start = e[0]
var end = e[1]
this.range = [start,end]
this.getStaffList();
},
//获取业绩列表
getStaffList() {
this.tui.request('/app/sale/getSalesRankingByShopId', 'post', {
startTime:this.range[0],
endTime:this.range[1],
}, false, false, true).then((res) => {
if (res.code !== 200) return
this.staffList = res.result
})
},
//获取当月1日到当前时间
getMonth() {
let date = new Date()
let year = date.getFullYear().toString()
let month = date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1).toString():(date.getMonth()+1).toString() //'月'
let da = date.getDate() < 10 ? '0'+date.getDate().toString():date.getDate().toString() //'日'
let end = year + '-' + month + '-' + da
let beg = year + '-' + month + '-01'
this.range = [beg,end]
}
}
}
</script>
<style lang="scss" scoped>
.example-body {}
.tag-wrap {
width: 100rpx;
flex: 1;
display: flex;
view {
margin: 0 2upx;
}
}
.avatar-wrap {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 24upx;
}
</style>

141
package1/staff/signRule.vue

@ -0,0 +1,141 @@
<template>
<view>
<view class="popup-height">
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx"
label-align="right">
<uni-forms-item label="上班时间" required>
<picker mode="time" :value="addForm.startTime" start="00:00" end="23:59" @change="start">
<view class="uni-input">{{addForm.startTime}}</view>
</picker>
</uni-forms-item>
<uni-forms-item label="下班时间" required>
<picker mode="time" :value="addForm.endTime" start="00:00" end="23:59" @change="end">
<view class="uni-input">{{addForm.endTime}}</view>
</picker>
</uni-forms-item>
<uni-forms-item label="定位" name="latitude" required>
<input type="text" v-model="addForm.latitude + ','+addForm.longitude" style="text-align:center;width:70%;border: 1px solid #eee;height: 72rpx;line-height: 72rpx !important;" disabled placeholder="获取位置用于员工打卡">
<view class="dw-btn" @tap="clockPosi">一键定位</view>
</uni-forms-item>
<uni-forms-item label="打卡范围" name="categoryId" required>
<uni-data-select class="uni-data-select" :localdata="categoryList" v-model="formData.categoryId"
placeholder="请选择打卡范围"></uni-data-select>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="onFormSubmit">保存</u-button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
addForm: {
startTime: '06:00',
endTime: '14:00',
latitude:'',
longitude:'',
categoryId: '',
},
categoryList: [{
value: 1,
text: '100米'
},{
value: 2,
text: '200米'
},{
value: 3,
text: '500米'
}],
rules: {
categoryId: {
rules: [{
required: true,
errorMessage: '请选择打卡范围',
}],
},
latitude: {
rules: [{
required: true,
errorMessage: '请定位店铺位置',
}],
}
}
}
},
onLoad() {
},
methods: {
bindTimeChange(e) {
this.time = e.detail.value;
},
clockPosi(){
let that = this;
uni.getLocation({
type: 'wgs84',
isHighAccuracy:true,
accuracy:'best',
success: function (res) {
that.addForm.latitude = res.latitude
that.addForm.longitude = res.longitude
}
});
},
onFormSubmit() {
this.$refs.addForm.validate().then(async () => {
let url;
if (this.type == 'edit') {
url = '/app/common/user/edit'
this.addForm.id = this.id
} else {
url = '/app/common/user/add'
}
const res = await this.tui.request(url, 'post', this.addForm, false,
true, false)
if (res.code == 200) {
uni.navigateBack()
} else {
this.tui.toast(res.message)
}
}, (reason) => {
})
},
start(e) {
this.addForm.startTime = e.detail.value
},
end(e) {
this.addForm.endTime = e.detail.value
}
}
}
</script>
<style lang="scss" scoped>
.popup-height {
padding: 0 25upx;
background-color: #fff;
}
.uni-date__input {
height: 40px;
width: 100%;
line-height: 40px;
font-size: 14px;
}
.text-center {
text-align: center;
}
.dw-btn{
width: 30%;
line-height: 72rpx;
text-align: center;
background: #088FEB;
color: #fff;
}
.uni-data-select {
width: 100%;
}
</style>
Loading…
Cancel
Save