Commit 257c47d8 by xinlaa

引流码接口对接与功能基本完成

1 parent 20b6a0d2
......@@ -9,5 +9,8 @@ import request from '@/utils/request'
}
*/
export function download(url, name) {
return `/common/download/url?url=${url}&name=${name}`
return (
process.env.VUE_APP_BASE_API +
`/common/download/url?url=${url}&name=${name}`
)
}
......@@ -134,5 +134,23 @@ export function getQrcode(params) {
* @param {*} 员工活码ids,多个逗号隔开
*/
export function downloadBatch(ids) {
return service + '/downloadBatch/' + ids
return request({
url: service + '/downloadBatch',
params: {
ids,
},
})
return process.env.VUE_APP_BASE_API + service + '/downloadBatch/?ids=' + ids
}
/**
* 成员添加客户统计
* @param {*} params
* userId=成员id&addWay=添加类型,二维码:1&beginTime=开始时间&endTime=结束时间
*/
export function getUserAddCustomerStat(params) {
return request({
url: service + '/getUserAddCustomerStat',
params,
})
}
<script>
import { getDetail } from '@/api/drainageCode/staff'
import { getDetail, getUserAddCustomerStat } from '@/api/drainageCode/staff'
import { download, downloadBatch } from '@/api/common'
import ClipboardJS from 'clipboard'
import echarts from 'echarts'
......@@ -20,13 +20,11 @@ export default {
// 表单参数
form: {},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
title: undefined,
operName: undefined,
businessType: undefined,
status: undefined,
query: {
userId: undefined,
addWay: undefined,
beginTime: undefined,
endTime: undefined,
},
type: { 1: '单人', 2: '多人', 3: '批量单人' },
}
......@@ -48,23 +46,6 @@ export default {
clipboard.on('error', (e) => {
this.$message.error('链接复制失败')
})
var option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
},
yAxis: {
type: 'value',
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: 'line',
},
],
}
var myChart = echarts.init(this.$refs.chart)
myChart.setOption(option)
},
methods: {
/** 获取详情 */
......@@ -73,39 +54,58 @@ export default {
getDetail(id).then(({ data }) => {
this.form = data
this.loading = false
this.query.userId = data.weEmpleCodeUseScops[0].businessId
this.query.addWay = 1
this.setTime(7)
this.getList()
})
},
/** */
getList() {
this.loading = false
list(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => {
this.list = response.rows
this.total = response.total
this.loading = false
this.query.beginTime = this.dateRange[0]
this.query.endTime = this.dateRange[1]
getUserAddCustomerStat(this.query).then(({ data }) => {
this.total = data.total
this.loading = false
let option = {
xAxis: {
type: 'category',
data: data.dateList,
},
yAxis: {
type: 'value',
},
series: [
{
data: data.statList,
type: 'line',
},
],
}
)
var myChart = echarts.init(this.$refs.chart)
myChart.setOption(option)
this.$nextTick(() => {})
})
},
/** 删除按钮操作 */
handleDelete(row) {
const operIds = row.operId || this.ids
this.$confirm(
'是否确认删除日志编号为"' + operIds + '"的数据项?',
'警告',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(function() {
return delOperlog(operIds)
})
.then(() => {
this.getList()
this.msgSuccess('删除成功')
})
.catch(function() {})
setTime(days) {
let date = new Date()
date.setDate(date.getDate() - days)
this.dateRange = [this.getTime(date), this.getTime()]
},
getHandledValue(num) {
return num < 10 ? '0' + num : num
},
getTime(datePar) {
const d = datePar ? new Date(datePar) : new Date()
const year = d.getFullYear()
const month = this.getHandledValue(d.getMonth() + 1)
const date = this.getHandledValue(d.getDate())
return year + '-' + month + '-' + date
},
download() {
window.open(this.form.qrCode)
},
},
}
......@@ -113,18 +113,17 @@ export default {
<template>
<div v-loading="loading">
<div>员工活码信息</div>
<div class="title">员工活码信息</div>
<div class="flex top">
<div>
<div class="ac">
<el-image
:src="form.qrCode"
fit="fit"
style="width: 100px; height: 100px"
:preview-src-list="[form.qrCode]"
style="width: 150px; height: 150px"
></el-image>
<div>
<el-button type="text" @click="downloadBatch(row.id)"
>下载二维码</el-button
>
<el-button type="text" @click="download()">下载二维码</el-button>
<el-button
type="text"
class="copy-btn"
......@@ -136,10 +135,10 @@ export default {
<el-form ref="form" label-width="100px">
<el-form-item label="使用成员:">
<el-tag
size="medium"
size="small"
v-for="(item, index) in form.weEmpleCodeUseScops"
:key="index"
>{{ item.userUserName }}</el-tag
>{{ item.businessName }}</el-tag
>
</el-form-item>
<el-form-item label="活动场景:">{{ form.activityScene }}</el-form-item>
......@@ -156,7 +155,7 @@ export default {
<el-form ref="form" label-width="100px">
<el-form-item label="扫码标签:"
><el-tag
size="medium"
size="small"
v-for="(item, index) in form.weEmpleCodeTags"
:key="index"
>{{ item.tagName }}</el-tag
......@@ -166,26 +165,32 @@ export default {
</el-form>
</div>
<el-divider></el-divider>
<div>扫码人数</div>
<div>累计总人数:0</div>
<div class="title">扫码人数</div>
<div class="mb15">累计总人数:{{ total }}</div>
<div>
<el-button-group>
<el-button type="primary">近7日</el-button>
<el-button type="primary">近30日</el-button>
<el-button size="small" type="primary" plain @click="setTime(7)"
>近7日</el-button
>
<el-button size="small" type="primary" plain @click="setTime(30)"
>近30日</el-button
>
</el-button-group>
<el-date-picker
v-model="dateRange"
size="small"
style="width: 240px"
class="ml20"
style="width: 260px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="getList"
></el-date-picker>
</div>
<div class="chart" ref="chart" style="width: 600px;height:400px;"></div>
<div class="chart" ref="chart" style="width: 90%;height:400px;"></div>
</div>
</template>
......@@ -193,4 +198,9 @@ export default {
.top {
align-items: flex-start;
}
.title {
font-size: 16px;
font-weight: 600;
margin: 0 0 20px;
}
</style>
<script>
import { getList, remove, batchAdd } from '@/api/drainageCode/staff'
import { download, downloadBatch } from '@/api/common'
import {
getList,
remove,
batchAdd,
downloadBatch,
} from '@/api/drainageCode/staff'
import { download } from '@/api/common'
import SelectUser from '@/components/SelectUser'
import ClipboardJS from 'clipboard'
export default {
......@@ -125,18 +130,18 @@ export default {
})
},
/** 下载 */
downloadBatch(id) {
const ids = id || this.ids
downloadBatch(qrCode) {
// window.open(download(row.qrCode, row.createBy.split(',')[0] + '.png'))
id && window.open(row.qrCode)
id ||
qrCode && window.open(qrCode)
qrCode ||
this.$confirm('是否确认下载所有图片吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(function() {
return window.open(downloadBatch(ids))
.then(() => {
downloadBatch(this.ids + '')
// window.open(downloadBatch(this.ids))
})
.catch(function() {})
},
......@@ -225,7 +230,7 @@ export default {
>批量新建</el-button
>
<el-button type="primary" size="mini" @click="remove">删除</el-button>
<el-button type="primary" size="mini" @click="downloadBatch"
<el-button type="primary" size="mini" @click="downloadBatch()"
>批量下载</el-button
>
</div>
......@@ -242,6 +247,7 @@ export default {
<el-image
:src="row.qrCode"
fit="fit"
:preview-src-list="[row.qrCode]"
style="width: 100px; height: 100px"
></el-image>
</template>
......@@ -281,7 +287,7 @@ export default {
<template slot-scope="{ row }">
<el-button
type="text"
@click="downloadBatch(row.id)"
@click="downloadBatch(row.qrCode)"
v-hasPermi="['monitor:operlog:query']"
>下载</el-button
>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!