ReceptionSence.vue
2.16 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<template>
<MessageBox
ref="receptionSceneVisible"
position="bottom"
:isFooter="false"
title="请选择接待场景"
:maxHeight="1000"
@close="$emit('close')"
>
<view class="select-box">
<view
class="select-item"
:class="{ checked: id == item.id }"
@click="handleSelect(item)"
v-for="(item, index) in list"
:key="index"
>
{{ item.receptionSceneName }}
</view>
</view>
</MessageBox>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'ReceptionSence',
props: {
customerInfo: Object
},
data () {
return {
list: [],
id: ''
}
},
watch: {
watchStatus: {
immediate: true,
handler (newval) {
this.close()
}
},
watchCustomerInfo: {
immediate: true,
handler (newval) {
console.log(newval)
this.id = newval.receptionScene
}
},
},
computed: {
watchStatus () {
return this.$store.state.user.historyStatus
},
watchCustomerInfo () {
return this.customerInfo
},
},
mounted () {
},
methods: {
open () {
this.$refs.receptionSceneVisible.open()
const userInfo = uni.$storage.get("userInfo"),
{ sceneType } = userInfo;
/**获取接待场景 */
uni.$api.customerApi
.findAllSence({
scene: sceneType,
})
.then((res) => {
this.list = res || []
}).catch(err => {
this.list = []
})
},
handleSelect (item) {
this.close();
this.id = item.id
this.$emit('select', item)
},
close () {
this.$refs?.receptionSceneVisible?.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: #292d33;
font-size: 28rpx;
border-radius: 8rpx;
&.checked {
border: 2rpx solid #292d33;
}
}
}
</style>