提交 3bad689a 作者: 毛细亚

更新 6.9.1

上级 e48452af
<template>
<div class="service-message-dialog">
<el-popover placement="top" trigger="hover" content="发送客服二维码">
<svg-icon slot="reference" icon-class="kfworks" class="service-message-dialog__icon" @click="show" />
</el-popover>
<el-dialog title="客服号添加二维码" :visible.sync="visible" width="500px" @close="handleClose">
<div v-if="taskStatus.is_band">
<div class="service-message-dialog__title">
VIP客服:
<span v-for="item in tracerUser" :key="item.id" style="margin-right:10px;">
{{ item.tracer_name }}
</span>
</div>
<div class="service-message-dialog__info">
当前有转VIP/SVIP任务,请推送指定客服的客服号
</div>
</div>
<div v-else class="service-message-dialog__info">
当前无分配转VIP/SVIP任务
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="客服类型" prop="service_type">
<el-select v-model="form.service_type" :clearable="false" placeholder="请选择客服类型" style="width:100%;"
@change="handleServiceTypeChange">
<el-option v-for="item in serviceTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="客服号" prop="service_id">
<el-select v-model="form.service_id" style="width:100%;" :clearable="false" :loading="loading"
placeholder="请选择客服号">
<el-option v-for="item in serviceList" :key="item.id" :label="item.service_wechat_number_name"
:value="item.id" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer">
<el-button @click="handleClose">取 消</el-button>
<el-button type="primary" :loading="submitting" @click="handleSubmit">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { searchcondition, getTaskTracer, memberTaskStatus, getTaskTracerTouch, getTaskTracerTouchAdd } from '@/api/game'
import { mapState, mapMutations } from 'vuex'
export default {
name: 'ServiceMessageDialog',
data() {
return {
visible: false,
loading: false,
submitting: false,
form: {
service_type: '',
service_id: '',
send_text: ''
},
tracerUser: [],
taskStatus: {},
rules: {
service_type: [{ required: true, message: '请选择客服类型', trigger: 'change' }],
service_id: [{ required: true, message: '请选择客服号', trigger: 'change' }]
},
serviceTypeOptions: [
{ label: '个微', value: 3 },
{ label: '掌微工作台', value: 4 },
{ label: '企微工作台', value: 5 }
],
serviceList: []
}
},
computed: {
...mapState('game', ['accountSelect']),
...mapState('user', ['userInfo'])
},
watch: {
accountSelect: {
handler: 'initData',
immediate: true
}
},
methods: {
...mapMutations('common', ['set_sendSkillMessage']),
// 初始化数据
async initData() {
if (!this.accountSelect) return
await Promise.all([
this.getTaskTracer(),
this.memberTaskStatus()
])
},
show() {
if (this.accountSelect && this.accountSelect !== '') {
this.visible = true
this.initData()
} else {
this.$message.error('请关联W账号')
}
},
// 获取任务状态
async memberTaskStatus() {
try {
const res = await memberTaskStatus({ member_id: [this.accountSelect] })
if (res.status_code === 1) {
this.taskStatus = res.data[0] || {}
} else {
this.$message.error(res.message || '获取任务状态失败')
}
} catch (error) {
console.error('获取任务状态失败:', error)
this.$message.error('获取任务状态失败')
}
},
// 获取任务追踪者
async getTaskTracer() {
try {
const res = await getTaskTracer({ member_id: this.accountSelect })
if (res.status_code === 1) {
this.tracerUser = res.data || []
} else {
this.$message.error(res.message || '获取任务追踪者失败')
}
} catch (error) {
console.error('获取任务追踪者失败:', error)
this.$message.error('获取任务追踪者失败')
}
},
handleClose() {
this.$refs.form.resetFields()
this.visible = false
this.loading = false
this.submitting = false
},
// 客服类型变更
async handleServiceTypeChange(value) {
this.form.service_id = ''
this.serviceList = []
this.loading = true
try {
const tracer_id = this.tracerUser.map(item => item.tracer_id) || []
const params = {
type: 'tracer_service_info',
tracer_id,
member_id: this.accountSelect,
system: 'zhangwei',
service_type: value
}
const res = await searchcondition(params)
if (res?.data?.data) {
this.serviceList = res.data.data
} else {
this.$message.error(res.message || '获取客服号列表失败')
}
} catch (error) {
console.error('获取客服号列表失败:', error)
this.$message.error('获取客服号列表失败')
} finally {
this.loading = false
}
},
// 发送消息
async sendMessage(image_url) {
const list = [{
msgtype: 'image',
image: { picurl: image_url }
}]
await this.getTaskTracerTouch()
if (this.taskStatus.is_band) {
await this.getTaskTracerTouchAdd()
}
// 生成二维码有延迟 立即发送会导致二维码加载失败 加个小延迟解决问题
setTimeout(() => {
this.submitting = false
this.set_sendSkillMessage(list)
this.handleClose()
}, 2000)
},
// 发送的时候如果当前W 账号如果有 转 vip/svip的任务 记录一条发送日志
async getTaskTracerTouchAdd() {
const res = await getTaskTracerTouchAdd({ member_id: this.accountSelect, zw_user_name: this.userInfo.username })
},
// 获取任务追踪者接触信息记录日志
async getTaskTracerTouch() {
try {
const res = await getTaskTracerTouch({ member_id: this.accountSelect })
if (res.status_code !== 1) {
this.$message.error(res.message || '更新任务追踪者接触信息失败')
}
} catch (error) {
console.error('更新任务追踪者接触信息失败:', error)
this.$message.error('更新任务追踪者接触信息失败')
}
},
// 提交表单
async handleSubmit() {
if (this.submitting) return
try {
await this.$refs.form.validate()
const serve_info = this.serviceList.find(item => item.id === this.form.service_id)
if (!serve_info) {
this.$message.error('未找到选中的客服信息')
return
}
if (!serve_info.qr_code) {
this.$message.error('当前客服号未维护添加二维码,请维护后再发送')
return
}
this.submitting = true
await this.sendMessage(serve_info.qr_code)
} catch (error) {
this.submitting = false
console.error('提交失败:', error)
this.$message.error('提交失败')
}
}
}
}
</script>
<style lang="scss" scoped>
.service-message-dialog {
&__icon {
font-size: 23px;
margin-left: 20px;
position: relative;
top: 2px;
cursor: pointer;
}
&__title {
font-family: PingFangSC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
line-height: 22px;
text-align: left;
font-style: normal;
margin-bottom: 5px;
}
&__info {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #86909C;
line-height: 20px;
text-align: justify;
font-style: normal;
margin-bottom: 10px;
}
}
.dialog-footer {
text-align: right;
}
</style>
\ No newline at end of file
......@@ -14,6 +14,12 @@
>
<sendGame v-if="activeName === 'sendGame'"/>
</el-tab-pane>
<el-tab-pane
label="客服二维码"
name="sendQrCode"
>
<sendQrCode v-if="activeName === 'sendQrCode'"/>
</el-tab-pane>
</el-tabs>
</div>
</div>
......@@ -23,11 +29,13 @@
import vipTools from './components/quickSendGame/vipTools.vue'
import sendGame from './components/quickSendGame/sendGame.vue'
import { mapActions } from 'vuex'
import sendQrCode from './components/quickSendGame//ServiceMessageDialog.vue'
export default {
name: 'quickSendGame',
components: {
vipTools,
sendGame,
sendQrCode,
},
data() {
return {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论