Employee.vue
2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<template>
<MessageBox ref="employeeBoxVisible" position="bottom" :isFooter="false" :title="`请选择${title}`" :maxHeight="1000" @close="$emit('close')">
<view class="select-box">
<view class="select-item" :class="{ checked: salesUuid == item.uuid }" @click="handleSelect(item)" v-for="(item, index) in employeeList" :key="index">
{{ item.staffName }}
</view>
</view>
</MessageBox>
</template>
<script type="text/ecmascript-6">
export default {
name: 'Employee',
props: {
title: {
type: String,
default: '销售'
},
salesPropsUuid: {
type: String,
default: ''
}
},
data () {
return {
}
},
watch: {
watchStatus: {
immediate: true,
handler (newval) {
this.close()
}
},
},
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
salesUuid () {
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
},
employeeList () {
return this.$store.state.user.employeeList
}
},
mounted () {
},
methods: {
open () {
this.$refs.employeeBoxVisible.open()
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo;
/**获取销售人员 */
uni.$api.commonApi
.getEmployeeList({
merchantId: shopMerchantId,
})
.then((res) => {
this.$store.dispatch("setEmployeeList", res);
uni.$storage.set("employeeList", res || []);
})
},
handleSelect (item) {
this.close();
this.$emit('select', item)
},
close () {
this.$refs?.employeeBoxVisible?.close()
}
}
}
</script>
<style scoped lang="scss">
.select-box {
margin: 40rpx 0;
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 32rpx;
overflow-y: scroll;
max-height: 50vh;
padding-bottom: 60rpx;
.select-item {
text-align: center;
height: 68rpx;
line-height: 44rpx;
opacity: 1;
border: 2rpx solid #dce0e6;
color: #333;
font-size: 32rpx;
border-radius: 8rpx;
&.checked {
border: 2rpx solid #292d33;
}
}
}
</style>