Commit 257c47d8 by xinlaa

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

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