You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
399 lines
9.5 KiB
399 lines
9.5 KiB
<template>
|
|
<van-popup
|
|
v-model:show="show"
|
|
position="bottom"
|
|
round
|
|
closeable
|
|
:close-on-click-overlay="false"
|
|
safe-area-inset-bottom
|
|
class="human-appraise-popup"
|
|
>
|
|
<div class="appraise-container">
|
|
<div class="sub-title">当前人工服务已结束</div>
|
|
<div class="appraise-title">{{ title }}</div>
|
|
|
|
<div v-if="loading" class="loading-container">
|
|
<van-loading type="spinner" size="24px" color="#025CEA">加载中...</van-loading>
|
|
</div>
|
|
|
|
<div v-else class="rating-list" :class="{ 'two-ratings': ratings.length === 2 }">
|
|
<div
|
|
v-for="item in ratings"
|
|
:key="item.value"
|
|
class="rating-item"
|
|
:class="{ active: selectedRating === item.value }"
|
|
@click="selectRating(item.value)"
|
|
>
|
|
<div
|
|
class="rating-icon"
|
|
:style="{
|
|
backgroundImage:
|
|
'url(' + (selectedRating === item.value ? item.activeImg : item.inactiveImg) + ')',
|
|
}"
|
|
></div>
|
|
<div v-if="ratings.length !== 2" class="rating-label">{{ item.label }}</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div v-if="showDetails" class="details-section">
|
|
<div class="tags-list">
|
|
<div
|
|
v-for="tag in subTags"
|
|
:key="tag"
|
|
class="tag-item"
|
|
:class="{ active: selectedTags.includes(tag) }"
|
|
@click="toggleTag(tag)"
|
|
>
|
|
{{ tag }}
|
|
</div>
|
|
</div>
|
|
<textarea
|
|
class="appraise-textarea"
|
|
placeholder="您的督促会帮助我们做的更好"
|
|
v-model="commentText"
|
|
maxlength="100"
|
|
></textarea>
|
|
</div>
|
|
|
|
<div v-if="showSubmit" class="submit-btn-wrap">
|
|
<button class="submit-btn" @click="submitAppraise">提交</button>
|
|
</div>
|
|
</div>
|
|
</van-popup>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, computed, watch, inject } from 'vue'
|
|
import { showToast, showLoadingToast, closeToast, Popup, Loading } from 'vant'
|
|
import { Post } from '@/utils/https'
|
|
|
|
const RATING_IMAGES = {
|
|
1: {
|
|
active: require('@/assets/images/Satisfaction/angry2.png'),
|
|
inactive: require('@/assets/images/Satisfaction/angry2-g.png'),
|
|
},
|
|
2: {
|
|
active: require('@/assets/images/Satisfaction/angry.png'),
|
|
inactive: require('@/assets/images/Satisfaction/angry-g.png'),
|
|
},
|
|
3: {
|
|
active: require('@/assets/images/Satisfaction/ordinary.png'),
|
|
inactive: require('@/assets/images/Satisfaction/ordinary-g.png'),
|
|
},
|
|
4: {
|
|
active: require('@/assets/images/Satisfaction/good.png'),
|
|
inactive: require('@/assets/images/Satisfaction/good-g.png'),
|
|
},
|
|
5: {
|
|
active: require('@/assets/images/Satisfaction/good2.png'),
|
|
inactive: require('@/assets/images/Satisfaction/good2-g.png'),
|
|
},
|
|
6: {
|
|
active: require('@/assets/images/Satisfaction/unresolved.png'),
|
|
inactive: require('@/assets/images/Satisfaction/unresolved-g.png'),
|
|
},
|
|
7: {
|
|
active: require('@/assets/images/Satisfaction/resolve.png'),
|
|
inactive: require('@/assets/images/Satisfaction/resolve-g.png'),
|
|
},
|
|
}
|
|
|
|
const store = inject('appStore', null)
|
|
const userId = inject('userId', ref(''))
|
|
const sessionId = inject('sessionId', ref(''))
|
|
|
|
const title = ref('您对本次坐席人工服务满意吗?')
|
|
const ratings = ref([])
|
|
const subTags = ref(['问题未解决', '服务态度不佳', '等待时间过长'])
|
|
const selectedRating = ref(null)
|
|
const selectedTags = ref([])
|
|
const commentText = ref('')
|
|
const isSubmitted = ref(false)
|
|
const loading = ref(false)
|
|
|
|
const show = computed({
|
|
get: () => store?.state?.showHumanAppraise || false,
|
|
set: (val) => store?.commit?.('set_showHumanAppraise', val),
|
|
})
|
|
|
|
const showDetails = computed(() => selectedRating.value === 1 || selectedRating.value === 2)
|
|
const showSubmit = computed(() => selectedRating.value !== null)
|
|
|
|
watch(show, (val) => {
|
|
if (val) {
|
|
resetData()
|
|
queryConfig()
|
|
isSubmitted.value = false
|
|
} else {
|
|
if (!isSubmitted.value) submitCloseAppraise()
|
|
}
|
|
})
|
|
|
|
function selectRating(value) {
|
|
selectedRating.value = value
|
|
if (value !== 1 && value !== 2) {
|
|
selectedTags.value = []
|
|
commentText.value = ''
|
|
}
|
|
}
|
|
|
|
function toggleTag(tag) {
|
|
const index = selectedTags.value.indexOf(tag)
|
|
if (index > -1) selectedTags.value.splice(index, 1)
|
|
else selectedTags.value.push(tag)
|
|
}
|
|
|
|
function resetData() {
|
|
selectedRating.value = null
|
|
selectedTags.value = []
|
|
commentText.value = ''
|
|
}
|
|
|
|
function queryConfig() {
|
|
loading.value = true
|
|
Post('config/queryManyiduConfig', { userInfoId: userId.value })
|
|
.then((res) => {
|
|
if (res.code !== 0) {
|
|
showToast(res.msg || '获取配置失败')
|
|
return
|
|
}
|
|
if (res.data) {
|
|
let data = res.data
|
|
if (typeof data === 'string') {
|
|
try {
|
|
data = JSON.parse(data)
|
|
} catch (e) {
|
|
console.error('解析配置失败', e)
|
|
return
|
|
}
|
|
}
|
|
if (data) {
|
|
if (data.title) title.value = data.title
|
|
if (data.options && data.options.length > 0) {
|
|
ratings.value = data.options.map((item) => {
|
|
const val = Number(item.code)
|
|
return {
|
|
label: item.name,
|
|
value: val,
|
|
activeImg: RATING_IMAGES[val]?.active || '',
|
|
inactiveImg: RATING_IMAGES[val]?.inactive || '',
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
.catch((err) => console.error('获取满意度配置失败', err))
|
|
.finally(() => {
|
|
loading.value = false
|
|
})
|
|
}
|
|
|
|
function submitCloseAppraise() {
|
|
const param = {
|
|
hxSessionId: store?.state?.hxSessionId,
|
|
sessionId: sessionId.value,
|
|
code: '',
|
|
name: '',
|
|
resonDescList: selectedTags.value,
|
|
advice: commentText.value,
|
|
userInfoId: userId.value,
|
|
}
|
|
Post('manyidu/saveManyidu', param)
|
|
.then((res) => {
|
|
if (res.code && res.code != 0) console.warn('被动关闭提交评价失败:', res.msg)
|
|
})
|
|
.catch((err) => console.error('被动关闭提交评价失败:', err))
|
|
}
|
|
|
|
function submitAppraise() {
|
|
const ratingItem = ratings.value.find((r) => r.value === selectedRating.value)
|
|
const param = {
|
|
hxSessionId: store?.state?.hxSessionId,
|
|
sessionId: sessionId.value,
|
|
code: selectedRating.value ? String(selectedRating.value) : '',
|
|
name: ratingItem ? ratingItem.label : '',
|
|
resonDescList: selectedTags.value,
|
|
advice: commentText.value,
|
|
userInfoId: userId.value,
|
|
}
|
|
|
|
showLoadingToast({ message: '提交中...', duration: 0, loadingType: 'spinner', forbidClick: true })
|
|
|
|
Post('manyidu/saveManyidu', param)
|
|
.then((res) => {
|
|
closeToast()
|
|
if (res.code && res.code != 0) {
|
|
showToast(res.msg || '提交失败')
|
|
return
|
|
}
|
|
isSubmitted.value = true
|
|
showToast('您已完成本次满意度调查,谢谢您的参与!')
|
|
show.value = false
|
|
})
|
|
.catch((err) => {
|
|
closeToast()
|
|
console.error('提交评价失败', err)
|
|
showToast('提交评价失败,请稍后重试')
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.human-appraise-popup {
|
|
border-top-left-radius: 16px;
|
|
border-top-right-radius: 16px;
|
|
}
|
|
|
|
.appraise-container {
|
|
padding: 16px 16px 16px 16px;
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
|
|
sans-serif;
|
|
background: linear-gradient(0deg, #ffffff 73%, #e4edff 99%);
|
|
}
|
|
|
|
.sub-title {
|
|
font-size: 14px;
|
|
font-weight: normal;
|
|
color: #7e849f;
|
|
text-align: center;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.appraise-title {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
line-height: 22px;
|
|
color: #17204d;
|
|
text-align: center;
|
|
margin-bottom: 28px;
|
|
}
|
|
|
|
.loading-container {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 80px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.rating-list {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.rating-list.two-ratings {
|
|
justify-content: center;
|
|
gap: 16px;
|
|
}
|
|
|
|
.two-ratings .rating-item {
|
|
flex: none;
|
|
}
|
|
|
|
.two-ratings .rating-icon {
|
|
width: 86px;
|
|
height: 30px;
|
|
margin-bottom: 0;
|
|
border-radius: 0;
|
|
transition: none;
|
|
}
|
|
|
|
.rating-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
flex: 1;
|
|
}
|
|
|
|
.rating-icon {
|
|
width: 38.98px;
|
|
height: 36.63px;
|
|
border-radius: 6px;
|
|
margin-bottom: 8px;
|
|
transition: all 0.25s ease;
|
|
background-size: contain;
|
|
background-repeat: no-repeat;
|
|
}
|
|
|
|
.rating-label {
|
|
font-size: 12px;
|
|
color: #7e849f;
|
|
text-align: center;
|
|
}
|
|
|
|
.rating-item.active .rating-icon {
|
|
transform: scale(1.08);
|
|
}
|
|
|
|
.rating-item.active .rating-label {
|
|
color: #2c3562;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.details-section {
|
|
margin-top: 16px;
|
|
animation: fadeIn 0.3s ease;
|
|
}
|
|
|
|
.tags-list {
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
gap: 8px;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.tag-item {
|
|
flex: 1;
|
|
padding: 4px 4px;
|
|
border: 0.5px solid #b5bace;
|
|
border-radius: 4px;
|
|
background: #fff;
|
|
font-size: 13px;
|
|
text-align: center;
|
|
color: #7e849f;
|
|
white-space: nowrap;
|
|
transition: all 0.2s ease;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.tag-item.active {
|
|
border-color: #025cea;
|
|
background: #f0f6ff;
|
|
color: #025cea;
|
|
}
|
|
|
|
.appraise-textarea {
|
|
width: 100%;
|
|
height: 80px;
|
|
background: #f7f8fa;
|
|
border-radius: 8px;
|
|
border: none;
|
|
padding: 12px;
|
|
font-size: 14px;
|
|
color: #333;
|
|
box-sizing: border-box;
|
|
resize: none;
|
|
}
|
|
|
|
.appraise-textarea::placeholder {
|
|
color: #d0d2db;
|
|
}
|
|
|
|
.submit-btn-wrap {
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.submit-btn {
|
|
width: 100%;
|
|
height: 48px;
|
|
background: linear-gradient(90deg, #025cea 0%, #0595f6 100%);
|
|
border-radius: 32px;
|
|
color: #fff;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
border: none;
|
|
cursor: pointer;
|
|
}
|
|
</style> |