Commit a1f15277 by 怪兽?别跑

获客助手调试

1 parent d8f0c403
......@@ -92,12 +92,14 @@
{{ detail.linkUrl }}
<el-button text @click="copyFn(detail.linkUrl)">复制</el-button>
</div>
<div class="sub-des">企微官方的获客长链接,可直接使用</div>
</el-form-item>
<el-form-item label="获客短链:">
<div style="text-align: left;">
{{ detail.linkShortUrl }}
<el-button text @click="copyFn(detail.linkShortUrl)">复制</el-button>
</div>
<div class="sub-des">系统生成的获客短链,满足短链场景</div>
</el-form-item>
</el-form>
</div>
......
......@@ -41,3 +41,41 @@ export function editItem(data) {
method: 'post'
})
}
// 同步
export function syncData(id) {
return request({
url: service + '/synchCustomerCount/' + id
})
}
//tab 数据
export function getTabData(id) {
return request({
url: service + '/selectLinkCountTab/' + id
})
}
// 折线图
export function getLineData(data) {
return request({
url: service + '/selectLinkCountTrend',
params: data
})
}
// 数据报表
export function getTableData(data) {
return request({
url: service + '/selectLinkCountTable',
params: data
})
}
// 导出
export function getTableExport(data) {
return request({
url: service + '',
params: data
})
}
<template>
<div>
<div class="card-tab">
<div class="item" :class="activeIndex === 0 ? 'active' : ''" @click="activeIndex = 0">链接配置</div>
<div class="item" :class="activeIndex === 1 ? 'active' : ''" @click="activeIndex = 1">数据统计</div>
<div class="item" :class="activeIndex === 2 ? 'active' : ''" @click="activeIndex = 2">数据明细</div>
</div>
<div style="margin-top: 10px;">
<template v-if="activeIndex === 0">
<info></info>
</template>
<template v-if="activeIndex === 1">
<!-- <store-code-analyse></store-code-analyse> -->
</template>
<template>
<div v-if="activeIndex === 2"></div>
</template>
</div>
</div>
</template>
<script>
import Info from './info'
// import StoreCodeAnalyse from './store_code_analyse'
export default {
name: 'customer-assistant-detail',
data() {
return {
activeIndex: 0
}
},
components: {
Info
// StoreCodeAnalyse,
}
}
</script>
<style lang="scss" scoped>
.active {
font-weight: 600;
color: var(--color) !important;
background: var(--bg-white) !important;
box-shadow: 0px 6px 30px 5px rgba(59, 59, 59, 0.05);
}
.card-tab {
// margin-top: 10px;
display: flex;
div {
width: 88px;
height: 30px;
background: var(--bg-black-11);
border-radius: 32px 32px 32px 32px;
font-size: 14px;
color: var(--font-black-7);
line-height: 30px;
text-align: center;
margin-top: 15px;
margin-right: 12px;
margin-bottom: 6px;
}
.item:hover {
cursor: pointer;
opacity: 0.8;
}
}
</style>
......@@ -163,7 +163,6 @@
.then((res) => {
if (res.code === 200) {
this.list = res.rows
this.list = [{ linkUrl: 'https://www.baidu.com' }]
this.total = parseInt(res.total)
}
this.loading = false
......
<template>
<div>
<CardGroupIndex :data="cardData"></CardGroupIndex>
<div class="g-card">
<div class="g-card-title">数据趋势</div>
<search-title :showMore="true" @search="getLineData"></search-title>
<chart-line style="height: 300px;" :legend="legend" :xData="xdata" :series="series"></chart-line>
</div>
<div class="g-card">
<div class="g-card-title">数据明细</div>
<el-button type="primary" @click="exportFn" v-loading="exportLoading">导出Excel</el-button>
<el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column label="日期" align="center" min-width="100" prop="date" show-overflow-tooltip />
<el-table-column
label="累计新增客户数"
align="center"
prop="newCustomerScanNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="累计活跃客户数"
align="center"
prop="addCustomerNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日新增客户数"
align="center"
prop="oldCustomerScanNumber"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="今日活跃客户数"
align="center"
prop="lostCustomerNumber"
min-width="120"
show-overflow-tooltip
></el-table-column>
</el-table>
<!-- <div class="bottom"> -->
<pagination
:total="total"
v-model:page="query.pageNum"
v-model:limit="query.pageSize"
@pagination="getTableChangeSize()"
/>
<!-- </div> -->
</div>
</div>
</template>
<script>
import { dateFormat } from '@/utils/index'
import ChartBar from '@/components/ChartBar.vue'
import ChartLine from '@/components/ChartLine.vue'
import SearchTitle from '../components/SearchTitle.vue'
import { getTabData, getLineData, getTableData, getTableExport } from './api.js'
export default {
name: 'identity-code-statistics',
components: {
SearchTitle,
ChartLine,
ChartBar
},
data() {
return {
exportLoading: false,
legend: ['今日新增客户数', '今日活跃客户数'],
xdata: [],
series: [],
cardData: [
{
title: '累计新增客户数',
tips: '通过当前链接新增的全部客户数(去重)',
value: 0
},
{
title: '累计活跃客户数',
tips: '新增客户中累计发起会话的客户数(去重)',
value: 0
},
{
title: '今日新增客户数',
tips: '今日通过当前链接新增的客户数(去重)',
value: 0
},
{
title: '今日活跃客户数',
tips: '今日新增客户中发起会话的客户数(去重)',
value: 0
}
],
total: 0,
query: {
pageSize: 10,
pageNum: 1
},
tableList: [],
loading: false,
searchData: {},
bar: [],
value: [],
tableSearch: {},
addWeUserState: null,
id: ''
}
},
methods: {
exportFn() {
this.$confirm('确认导出吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.exportLoading = true
return getTableExport(Object.assign({}, this.query, this.tableSearch))
})
.then((res) => {
if (res) {
let blob = new Blob([res], { type: 'application/vnd.ms-excel' })
let url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = '数据明细-' + dateFormat(new Date()) + '.xlsx' // 重命名文件
link.click()
URL.revokeObjectURL(url)
}
})
.catch((error) => {
console.error(error)
})
.finally(() => {
this.exportLoading = false
})
},
getTabTotalFn() {
getTabData({ id: this.id, addWeUserState: this.addWeUserState }).then((res) => {
this.cardData[0].value = res.data.tdNewCustomerScanNumber
this.cardData[1].value = res.data.tdAddCustomerNumber
this.cardData[2].value = res.data.tdOldCustomerScanNumber
this.cardData[3].value = res.data.tdLostCustomerNumber
})
},
getLineData(data) {
data.id = this.id
getLineData(data).then((res) => {
this.xdata = []
this.series = []
let arr1 = []
let arr2 = []
if (res.data && res.data.length) {
res.data.forEach((dd) => {
this.xdata.push(dd.date)
arr1.push(dd.newCustomerScanNumber)
arr2.push(dd.addCustomerNumber)
})
this.series = [arr1, arr2]
}
})
},
getTableChangeSize() {
this.loading = true
this.query.id = this.id
getTableData(Object.assign({}, this.query, this.tableSearch)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
},
getTableFn(data) {
this.loading = true
this.tableSearch = data
this.query.id = this.id
getTableData(Object.assign({}, this.query, data)).then((res) => {
this.tableList = res.rows
this.total = Number(res.total)
this.loading = false
})
}
},
created() {
this.id = this.$route.query.id
this.getTabTotalFn()
this.getTableFn()
}
}
</script>
<style lang="scss" scoped></style>
<template>
<div>
<div style="margin-top: var(--card-margin);">
<div class="flex">
<div style="width: calc(100% - 425px); padding-right: var(--card-margin);">
<el-form :model="form" :rules="rules" ref="form" label-width="140px">
<div class="g-card">
<div style="display: flex; justify-content: space-between;">
<div class="card-title">
基础信息
</div>
<div>
<el-button
type="primary"
@click="
$router.push({
path: 'add',
query: {
id: id
}
})
"
>
编辑
</el-button>
<el-button type="primary" @click="getData()">
同步数据
</el-button>
</div>
</div>
<el-row>
<el-col :sm="24" :md="18">
<el-form-item label="链接名称:" prop="linkName">
<span>{{ form.linkName }}</span>
</el-form-item>
<el-form-item label="自动通过好友:">
<el-switch v-model="form.skipVerify" disabled :active-value="1" :inactive-value="0"></el-switch>
</el-form-item>
<el-form-item label="新客户标签:">
<template v-for="(item, index) in tagList">
<el-tag v-if="item.name" :key="index">{{ item.name }}</el-tag>
</template>
</el-form-item>
<el-form-item label="链接员工:" prop="weUserList">
<div v-if="userList.length > 0">
<el-tag v-for="(item, index) in userList" :key="index">
{{ item.name }}
</el-tag>
</div>
</el-form-item>
</el-col>
</el-row>
</div>
<div class="g-card">
<div class="card-title">
链接信息
</div>
<el-row>
<el-col :sm="24" :md="18">
<div class="page">
<div class="code-wrapper">
<el-form label-width="140px" style="display: inline-block;">
<el-form-item label="获客链接:">
<div style="text-align: left;">
{{ form.linkUrl }}
<el-button text @click="copyFn(form.linkUrl)">复制</el-button>
</div>
<div class="sub-des">企微官方的获客长链接,可直接使用</div>
</el-form-item>
<el-form-item label="获客短链:">
<div style="text-align: left;">
{{ form.linkShortUrl }}
<el-button text @click="copyFn(form.linkShortUrl)">复制</el-button>
</div>
<div class="sub-des">系统生成的获客短链,满足短链场景</div>
</el-form-item>
</el-form>
</div>
</div>
</el-col>
</el-row>
</div>
</el-form>
</div>
<div class="g-card" style="width: 425px; margin-top: 0;">
<div class="card-title">欢迎语预览</div>
<PreviewInPhone :list="previewData" :templateInfo="templateInfo"></PreviewInPhone>
</div>
</div>
</div>
</div>
</template>
<script>
import { detail, syncData } from './api.js'
import PreviewInPhone from '@/components/ContentCenter/PreviewInPhone'
export default {
components: {
PreviewInPhone
},
data() {
return {
id: '',
tagList: [],
userList: [],
form: {
linkName: '',
tagIds: '',
tagNames: '',
skipVerify: 1,
attachments: [],
weUserList: '',
weUserNames: ''
},
templateInfo: '',
attachmentsData: {
templateInfo: '',
attachments: []
},
previewData: []
}
},
created() {
if (this.$route.query.id) {
this.id = this.$route.query.id
this.getDetail()
}
},
methods: {
getData() {
syncData(this.id).then((res) => {
if (res.code == 200) {
this.msgSuccess('操作成功')
}
})
},
copyFn(text) {
const input = document.createElement('input')
input.style.cssText = 'opacity: 0;'
input.type = 'text'
input.value = text // 修改文本框的内容
document.body.appendChild(input)
input.select() // 选中文本
document.execCommand('copy') // 执行浏览器复制命令
this.$message({ message: '复制成功', type: 'success' })
},
getDetail() {
detail(this.id).then((res) => {
if (res.code == 200) {
this.form = res.data
if (this.form.tagIds) {
let id = this.form.tagIds.split(',')
let name = this.form.tagNames.split(',')
let arr = []
id.forEach((dd, index) => {
arr.push({
name: name[index],
tagId: dd
})
})
this.tagList = arr
}
if (this.form.weUserList) {
let id = this.form.weUserList.split(',')
let name = this.form.weUserNames.split(',')
let arr = []
id.forEach((dd, index) => {
arr.push({
name: name[index],
weUserId: dd
})
})
this.userList = arr
}
if (this.form.attachments) {
let arr = []
this.form.attachments.forEach((dd) => {
if (dd.msgType == 'text') {
this.templateInfo = dd.content
} else {
arr.push(dd)
}
})
let data = this.setAttachments(arr)
;(this.attachmentsData = {
templateInfo: this.templateInfo,
attachments: data
}),
(this.previewData = data)
}
}
})
},
setAttachments(list) {
let arr = []
if (list && list.length) {
list.forEach((dd) => {
if (dd.msgType === 'image') {
let obj = {
id: dd.materialId,
mediaType: '0',
materialUrl: dd.picUrl
}
arr.push(obj)
} else if (dd.msgType === 'video') {
let obj = {
id: dd.materialId,
mediaType: '2',
materialUrl: dd.fileUrl,
coverUrl: dd.picUrl,
digest: dd.description,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'file') {
let obj = {
id: dd.materialId,
mediaType: '3',
materialUrl: dd.fileUrl,
digest: dd.description,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'text') {
let obj = {
id: dd.materialId,
mediaType: '4',
content: dd.content
}
arr.push(obj)
} else if (dd.msgType === 'link') {
let obj = {
id: dd.materialId,
mediaType: '9',
content: dd.content,
coverUrl: dd.picUrl,
materialUrl: dd.linkUrl,
materialName: dd.title
}
arr.push(obj)
} else if (dd.msgType === 'miniprogram') {
let ff = {
id: dd.materialId,
mediaType: '11',
digest: dd.appId,
materialName: dd.title,
coverUrl: dd.picUrl,
materialUrl: dd.fileUrl
}
arr.push(ff)
} else if (dd.msgType === 'news') {
let ff = {
id: dd.materialId,
mediaType: '12',
digest: dd.description,
materialUrl: dd.fileUrl,
coverUrl: dd.picUrl,
content: dd.content,
materialName: dd.title
}
arr.push(ff)
} else if (dd.msgType === 'posters') {
let obj = {
id: dd.materialId,
mediaType: '5',
materialUrl: dd.fileUrl,
materialName: dd.title
}
arr.push(obj)
}
})
}
return arr
}
}
}
</script>
<style lang="scss" scoped>
.card-title {
font-size: 16px;
font-weight: 500;
color: var(--font-black);
margin-bottom: 20px;
}
.sub-des {
font-size: 12px;
font-weight: 400;
color: var(--font-black-6);
}
.code-wrapper {
// text-align: center;
.code-success,
.code-text,
.code-actions {
padding: 20px 0;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!