Commit 8a7af916 by 姜鹏凯

商品中心调试

1 parent f06cadfd
...@@ -132,7 +132,8 @@ export function setOrderSync() { ...@@ -132,7 +132,8 @@ export function setOrderSync() {
export function exportOrder(data) { export function exportOrder(data) {
return request({ return request({
url: service + '/order/export', url: service + '/order/export',
params: data params: data,
responseType: 'blob',
}) })
} }
...@@ -157,10 +158,47 @@ export function getGoodsTotal() { ...@@ -157,10 +158,47 @@ export function getGoodsTotal() {
}) })
} }
// 商品分析 // 商品分析 折线图
export function getLineChartTotal(data) { export function getLineChartTotal(data) {
return request({ return request({
url: service + '/analyze/lineChart', url: service + '/analyze/lineChart',
method: 'post',
data
})
}
// 商品分析 商品top5
export function getGoodsTop5(data) {
return request({
url: service + '/analyze/top5',
method: 'post',
data
})
}
// 商品分析 员工top5
export function getMembersTop5(data) {
return request({
url: service + '/analyze/user/top5',
method: 'post',
data
})
}
// 商品分析 数据报表
export function getTableTotal(data) {
return request({
url: service + '/analyze/data/report',
params: data params: data
}) })
}
// 商品分析 数据报表 导出
export function getTableExport(params) {
return request({
url: service + '/analyze/data/report/export',
method: 'post',
responseType: 'blob',
params,
})
} }
\ No newline at end of file \ No newline at end of file
<script> <script>
import { getCosConfig, getVideoPic } from '@/api/common' import { getCosConfig, getVideoPic } from '@/api/common'
import { dateFormat, uuid } from '@/utils/index' import { dateFormat, uuid } from '@/utils/index'
import Video from 'video.js' import Video from 'video.js'
import Cos from 'cos-js-sdk-v5' import Cos from 'cos-js-sdk-v5'
import BenzAMRRecorder from 'benz-amr-recorder' import BenzAMRRecorder from 'benz-amr-recorder'
import MP4Box from 'mp4box' import MP4Box from 'mp4box'
export default { export default {
components: {}, components: {},
props: { props: {
// 单文件上传时使用 // 单文件上传时使用
fileUrl: { fileUrl: {
type: String, type: String,
default: '', default: ''
}, },
fileName: { fileName: {
type: String, type: String,
default: '', default: ''
}, },
// 多文件上传时使用,例如: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}] // 多文件上传时使用,例如: [{name: 'food.jpg', url: 'https://xxx.cdn.com/xxx.jpg'}]
fileList: { fileList: {
type: Array, type: Array,
default: () => [], default: () => []
}, },
// 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) // 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
type: { type: {
type: String, type: String,
default: '0', default: '0',
validator: function (value) { validator: function (value) {
// 这个值必须匹配下列字符串中的一个 // 这个值必须匹配下列字符串中的一个
return ['0', '1', '2', '3'].includes(value) return ['0', '1', '2', '3'].includes(value)
}
}, },
}, // 上传文件大小不能超过 maxSize MB, 各类型有默认限制 参见: maxSizeDefault
// 上传文件大小不能超过 maxSize MB, 各类型有默认限制 参见: maxSizeDefault maxSize: {
maxSize: { type: Number,
type: Number, default: undefined
default: undefined, },
}, // 图片的宽高像素限制 [width(number), height(number)],默认null不限制
// 图片的宽高像素限制 [width(number), height(number)],默认null不限制 maxImgPx: {
maxImgPx: { type: Array,
type: Array, default: null // () => [100, 100]
default: null, // () => [100, 100] },
}, // 允许上传的文件格式后缀名 eg:["jpg", "png"],['*']为不限制,各类型有默认限制 参见: formatDefault
// 允许上传的文件格式后缀名 eg:["jpg", "png"],['*']为不限制,各类型有默认限制 参见: formatDefault format: {
format: { type: Array,
type: Array, default: undefined
default: undefined, },
}, // 选择上传文件类型, 用于过滤系统选择文件类型, 默认根据类型自动匹配:见 acceptAuto,
// 选择上传文件类型, 用于过滤系统选择文件类型, 默认根据类型自动匹配:见 acceptAuto, accept: {
accept: { type: String,
type: String, default: ''
default: '', },
}, // 是否能上传多个
// 是否能上传多个 multiple: {
multiple: { type: Boolean,
type: Boolean, default: false
default: false, },
}, // multiple为true是有效,最多上传几个,默认不限制,最小为1,大于1是自动开启可多选,
// multiple为true是有效,最多上传几个,默认不限制,最小为1,大于1是自动开启可多选, limit: {
limit: { type: Number,
type: Number, default: undefined
default: undefined, }
}, // onProgress: {
// onProgress: { // type: Function,
// type: Function, // default: null,
// default: null, // },
// }, // beforeUpload: {
// beforeUpload: { // type: Function,
// type: Function, // default: function() {
// default: function() { // return function() {}
// return function() {} // },
// }, // },
// },
// 图片操作 目前支持有 view:查看,remove:删除,download:下载 // 图片操作 目前支持有 view:查看,remove:删除,download:下载
// action: { // action: {
// type: Array, // type: Array,
// default: () => ["view", "remove"], // default: () => ["view", "remove"],
// }, // },
}, },
data() { data() {
return { return {
loading: false, loading: false,
fileUrlWatch: this.fileUrl, fileUrlWatch: this.fileUrl,
fileNameWatch: this.fileName, fileNameWatch: this.fileName,
fileListWatch: this.fileList, fileListWatch: this.fileList,
picUrl: '', // 视频第一帧 picUrl: '', // 视频第一帧
file: undefined, file: undefined,
speed: 0, // 上传网速 speed: 0, // 上传网速
percentage: 0, //上传进度 percentage: 0, //上传进度
// cos配置信息 // cos配置信息
cosConfig: { bucketName: '', cosImgUrlPrefix: '', region: '' }, cosConfig: { bucketName: '', cosImgUrlPrefix: '', region: '' },
cosInstance: undefined, // cos实例 cosInstance: undefined // cos实例
} }
},
watch: {
fileUrl: {
handler(value) {
this.fileUrlWatch = value
},
}, },
fileName: { watch: {
handler(value) { fileUrl: {
this.fileNameWatch = value handler(value) {
this.fileUrlWatch = value
}
}, },
fileName: {
handler(value) {
this.fileNameWatch = value
}
},
fileList: {
handler(value) {
this.fileListWatch = value
}
},
loading(val) {
this.$emit('loadingChange', val)
}
}, },
loading(val) { computed: {
this.$emit('loadingChange', val) // 识别选择文件类型
}, acceptAuto() {
}, return ['image/*', 'amr/*', 'video/*'][this.type]
computed: { }
// 识别选择文件类型
acceptAuto() {
return ['image/*', 'amr/*', 'video/*'][this.type]
}, },
}, created() {
created() { getCosConfig().then((res) => {
getCosConfig().then((res) => { this.cosConfig = res
this.cosConfig = res this.cosInstance = new Cos({
this.cosInstance = new Cos({ SecretId: res.secretId,
SecretId: res.secretId, SecretKey: res.secretKey
SecretKey: res.secretKey, })
}) })
}) },
}, mounted() {
mounted() { // const cosInstance = new Cos({
// const cosInstance = new Cos({ // // getAuthorization 必选参数
// // getAuthorization 必选参数 // getAuthorization: function (options, callback) {
// getAuthorization: function (options, callback) { // // 服务端例子:https://github.com/tencentyun/qcloud-cos-sts-sdk/blob/master/scope.md
// // 服务端例子:https://github.com/tencentyun/qcloud-cos-sts-sdk/blob/master/scope.md // // 异步获取临时密钥
// // 异步获取临时密钥 // var url = window.lwConfig.SYSTEM_API + '/file/get/config' // url替换成您自己的后端服务
// var url = window.lwConfig.SYSTEM_API + '/file/get/config' // url替换成您自己的后端服务 // var xhr = new XMLHttpRequest()
// var xhr = new XMLHttpRequest() // xhr.open('get', url, true)
// xhr.open('get', url, true) // xhr.setRequestHeader('Content-Type', 'application/json')
// xhr.setRequestHeader('Content-Type', 'application/json') // xhr.onload = function (e) {
// xhr.onload = function (e) { // try {
// try { // var data = JSON.parse(e.target.responseText)
// var data = JSON.parse(e.target.responseText) // var credentials = data.credentials
// var credentials = data.credentials // } catch (e) {}
// } catch (e) {} // if (!data || !credentials) {
// if (!data || !credentials) { // return console.error('credentials invalid:\n' + JSON.stringify(data, null, 2))
// return console.error('credentials invalid:\n' + JSON.stringify(data, null, 2)) // }
// } // callback({
// callback({ // TmpSecretId: decrypt(credentials.secretId),
// TmpSecretId: decrypt(credentials.secretId), // TmpSecretKey: credentials.secretKey,
// TmpSecretKey: credentials.secretKey, // SecurityToken: credentials.sessionToken,
// SecurityToken: credentials.sessionToken, // // 建议返回服务器时间作为签名的开始时间,避免用户浏览器本地时间偏差过大导致签名错误
// // 建议返回服务器时间作为签名的开始时间,避免用户浏览器本地时间偏差过大导致签名错误 // StartTime: data.startTime, // 时间戳,单位秒,如:1580000000
// StartTime: data.startTime, // 时间戳,单位秒,如:1580000000 // ExpiredTime: data.expiredTime, // 时间戳,单位秒,如:1580000000
// ExpiredTime: data.expiredTime, // 时间戳,单位秒,如:1580000000 // // ScopeLimit: true, // 细粒度控制权限需要设为 true,会限制密钥只在相同请求时重复使用
// // ScopeLimit: true, // 细粒度控制权限需要设为 true,会限制密钥只在相同请求时重复使用 // })
// }) // }
// } // xhr.send()
// xhr.send() // // xhr.send(JSON.stringify(options.Scope))
// // xhr.send(JSON.stringify(options.Scope)) // },
// }, // })
// }) },
}, methods: {
methods: { upload() {
upload() { this.loading = true
this.loading = true let file = undefined
let file = undefined if (!this.multiple || this.limit == 1) {
if (!this.multiple || this.limit == 1) { file = this.file
file = this.file } else {
} else { // 多选上传是多次调用单传的
// 多选上传是多次调用单传的 file = this.file.shift()
file = this.file.shift() }
} let date = new Date()
let date = new Date() let format = file.name.match(/\.(\w+)$/g)
let format = file.name.match(/\.(\w+)$/g) format = format && format[0]
format = format && format[0] const params = {
const params = { Bucket: this.cosConfig.bucketName /* 填入您自己的存储桶,必须字段 */,
Bucket: this.cosConfig.bucketName /* 填入您自己的存储桶,必须字段 */, Region: this.cosConfig.region /* 存储桶所在地域,例如ap-beijing,必须字段 */,
Region: this.cosConfig.region /* 存储桶所在地域,例如ap-beijing,必须字段 */, Key: `/${dateFormat(date, 'yyyy-MM-dd')}/t${date.getTime()}-${uuid()}${format}`
Key: `/${dateFormat(date, 'yyyy-MM-dd')}/t${date.getTime()}-${uuid()}${format}`, /* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),必须字段。*/
/* 存储在桶里的对象键(例如1.jpg,a/b/test.txt),必须字段。*/ // 此处使用的格式: /日期/t时间戳-uid-文件后缀名
// 此处使用的格式: /日期/t时间戳-uid-文件后缀名 }
}
// 实例可能未初始化完成 // 实例可能未初始化完成
if (!this.cosInstance) { if (!this.cosInstance) {
this.$message.error('存储空间正忙,请稍后再试') this.$message.error('存储空间正忙,请稍后再试')
return return
} }
this.cosInstance.uploadFile( this.cosInstance.uploadFile(
{ {
...params, ...params,
Body: file /* 必须,上传文件对象,可以是input[type="file"]的file对象 */, Body: file /* 必须,上传文件对象,可以是input[type="file"]的file对象 */,
onProgress: (progressData) => { onProgress: (progressData) => {
this.percentage = progressData.percent * 100 this.percentage = progressData.percent * 100
this.speed = (progressData.speed / 1024 / 1024).toFixed(2) this.speed = (progressData.speed / 1024 / 1024).toFixed(2)
// this.onProgress && this.onProgress(this.percentage, this.speed) // this.onProgress && this.onProgress(this.percentage, this.speed)
}
}, },
}, (err1, data) => {
(err1, data) => { this.percentage = this.speed = 0
this.percentage = this.speed = 0
if (err1) { if (err1) {
this.loading = false this.loading = false
this.$message.error('上传失败,请稍后再试') this.$message.error('上传失败,请稍后再试')
} else { } else {
let location = 'https://' + data.Location let location = 'https://' + data.Location
this.type == 2 this.type == 2
? //获取视频第一帧画面 ? //获取视频第一帧画面
getVideoPic({ url: location }).then((res) => { getVideoPic({ url: location }).then((res) => {
this.loading = false this.loading = false
this.$emit('getPicUrl', res.data.url) this.$emit('getPicUrl', res.data.url)
}) })
: (this.loading = false) : (this.loading = false)
// 使用本地链接提供预览,避免上传后下载的问题 // 使用本地链接提供预览,避免上传后下载的问题
let url = window.URL.createObjectURL(file) let url = window.URL.createObjectURL(file)
let name = file.name let name = file.name
if (!this.multiple) { if (!this.multiple) {
this.fileUrlWatch = url this.fileUrlWatch = url
this.$emit('update:fileUrl', location) this.$emit('update:fileUrl', location)
this.$emit('update:fileName', (this.fileNameWatch = name)) this.$emit('update:fileName', (this.fileNameWatch = name))
} else { } else {
this.fileListWatch = this.fileListWatch.concat({ name, url }) this.fileListWatch = this.fileListWatch.concat({ name, url })
this.$emit('update:fileList', this.fileList.concat({ name, url: location })) this.$emit('update:fileList', this.fileList.concat({ name, url: location }))
}
} }
} }
}, )
) },
}, remove(i) {
remove(i) { this.$confirm('确定要删除吗?', '提示', {
this.$confirm('确定要删除吗?', '提示', { confirmButtonText: '确定',
confirmButtonText: '确定', cancelButtonText: '取消',
cancelButtonText: '取消', type: 'warning'
type: 'warning', }).then(() => {
}).then(() => { let clone = JSON.parse(JSON.stringify(this.fileList))
let clone = JSON.parse(JSON.stringify(this.fileList)) this.fileListWatch.splice(i, 1)
this.fileListWatch.splice(i, 1) clone.splice(i, 1)
clone.splice(i, 1) this.$emit('update:fileList', clone)
this.$emit('update:fileList', clone) })
}) },
}, handleExceed(file, fileList) {
handleExceed(file, fileList) { this.$message.error('最多上传' + this.limit + '张')
this.$message.error('最多上传' + this.limit + '张') this.loading = false
this.loading = false },
}, async handleBeforeUpload(file, filelist) {
async handleBeforeUpload(file, filelist) { this.loading = true
this.loading = true let isFormat = true
let isFormat = true let isSize = true
let isSize = true
// type: 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) // type: 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file)
// 统一校验文件后缀名格式 // 统一校验文件后缀名格式
// 如果没有显示配置 format 格式限制,则使用默认下面校验 // 如果没有显示配置 format 格式限制,则使用默认下面校验
let format = this.format let format = this.format
let tip = '' let tip = ''
if (!format || !format.length) { if (!format || !format.length) {
let formatDefault = { let formatDefault = {
0: { tip: 'png/jpg', value: ['png', 'jpg', 'jpeg'] }, 0: { tip: 'png/jpg', value: ['png', 'jpg', 'jpeg'] },
1: { value: ['amr'] }, 1: { value: ['amr'] },
2: { value: ['mp4'] }, 2: { value: ['mp4'] },
3: { tip: 'word/pdf/ppt', value: ['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx'] }, 3: { tip: 'word/pdf/ppt', value: ['doc', 'docx', 'pdf', 'ppt', 'pptx', 'pps', 'pptsx'] }
}
format = formatDefault[this.type].value
tip = formatDefault[this.type].tip
}
let match = file.name.match(/\.(\w+)$/g)
let fileFormat = match && match[0].replace('.', '').toLowerCase()
isFormat = format[0] === '*' || format.includes(fileFormat)
if (!isFormat) {
this.$message.error('文件格式错误,仅支持 ' + (tip || format.join(',')) + ' 格式!')
this.loading = false
return Promise.reject()
} }
format = formatDefault[this.type].value
tip = formatDefault[this.type].tip
}
let match = file.name.match(/\.(\w+)$/g)
let fileFormat = match && match[0].replace('.', '').toLowerCase()
isFormat = format[0] === '*' || format.includes(fileFormat)
if (!isFormat) {
this.$message.error('文件格式错误,仅支持 ' + (tip || format.join(',')) + ' 格式!')
this.loading = false
return Promise.reject()
}
// 统一校验文件体积 // 统一校验文件体积
// 如果没有显式配置 maxSize 限制大小,则使用下面默认值,单位 MB, // 如果没有显式配置 maxSize 限制大小,则使用下面默认值,单位 MB,
let maxSize = this.maxSize let maxSize = this.maxSize
if (!maxSize) { if (!maxSize) {
let maxSizeDefault = { 0: 2, 1: 2, 2: 100, 3: 50 } let maxSizeDefault = { 0: 2, 1: 2, 2: 100, 3: 50 }
maxSize || (maxSize = maxSizeDefault[this.type]) maxSize || (maxSize = maxSizeDefault[this.type])
} }
isSize = file.size / 1024 / 1024 < maxSize isSize = file.size / 1024 / 1024 < maxSize
if (!isSize) { if (!isSize) {
this.$message.error('上传文件大小不能超过 ' + maxSize + 'MB!') this.$message.error('上传文件大小不能超过 ' + maxSize + 'MB!')
this.loading = false this.loading = false
return Promise.reject() return Promise.reject()
} }
// 各类型独有的校验 // 各类型独有的校验
let validate = true let validate = true
if (this.type === '0') { if (this.type === '0') {
// 图片 // 图片
let maxImgPx = this.maxImgPx let maxImgPx = this.maxImgPx
if (maxImgPx) { if (maxImgPx) {
try { try {
await new Promise((resolve) => { await new Promise((resolve) => {
let width, height let width, height
let image = new Image() let image = new Image()
//加载图片获取图片真实宽度和高度 //加载图片获取图片真实宽度和高度
image.onload = () => { image.onload = () => {
width = image.width width = image.width
height = image.height height = image.height
if (width > maxImgPx[0]) { if (width > maxImgPx[0]) {
validate = false validate = false
this.$message.error(`图片“宽”度超过${maxImgPx[0]}像素,请重新选择`) this.$message.error(`图片“宽”度超过${maxImgPx[0]}像素,请重新选择`)
} else if (height > maxImgPx[1]) { } else if (height > maxImgPx[1]) {
this.$message.error(`图片“高”度超过${maxImgPx[1]}像素,请重新选择`) this.$message.error(`图片“高”度超过${maxImgPx[1]}像素,请重新选择`)
validate = false validate = false
}
window.URL && window.URL.revokeObjectURL(image.src)
resolve()
} }
window.URL && window.URL.revokeObjectURL(image.src) if (window.URL) {
resolve() let url = window.URL.createObjectURL(file)
} image.src = url
if (window.URL) { } else if (window.FileReader) {
let url = window.URL.createObjectURL(file) let reader = new FileReader()
image.src = url reader.onload = function (e) {
} else if (window.FileReader) { let data = e.target.result
let reader = new FileReader() image.src = data
reader.onload = function (e) { }
let data = e.target.result reader.readAsDataURL(file)
image.src = data
} }
reader.readAsDataURL(file) })
} } catch (e) {
}) console.error(e)
} catch (e) { }
console.error(e)
} }
} } else if (this.type === '1') {
} else if (this.type === '1') { // 语音
// 语音 let amr = new BenzAMRRecorder()
let amr = new BenzAMRRecorder() try {
try { await amr.initWithBlob(file)
await amr.initWithBlob(file) validate = amr.getDuration() <= 60
validate = amr.getDuration() <= 60 if (!validate) {
if (!validate) { this.$message.error('上传文件时长不能超过 60秒!')
this.$message.error('上传文件时长不能超过 60秒!') }
} catch (error) {
console.log(error)
this.$message.error('文件已损坏')
}
} else if (this.type === '2') {
// 视频
let result = await this.checkVideoCode(file)
if (result.mime.indexOf('video/mp4') === -1) {
this.$message.error('mp4 格式不正确, 请使用标准编码视频!')
this.loading = false
return Promise.reject()
} }
} catch (error) { } else if (this.type === '3') {
console.log(error) // 普通文件
this.$message.error('文件已损坏')
} }
} else if (this.type === '2') { if (!validate) {
// 视频
let result = await this.checkVideoCode(file)
if (result.mime.indexOf('video/mp4') === -1) {
this.$message.error('mp4 格式不正确, 请使用标准编码视频!')
this.loading = false this.loading = false
return Promise.reject()
} }
} else if (this.type === '3') { // if (beforeUpload) {
// 普通文件 // return beforeUpload(file)
} // }
if (!validate) { if (!this.multiple || this.limit == 1) {
this.loading = false this.file = file
} } else {
// if (beforeUpload) { Array.isArray(this.file) || (this.file = []) // 多选
// return beforeUpload(file) this.file.push(file)
// }
if (!this.multiple || this.limit == 1) {
this.file = file
} else {
Array.isArray(this.file) || (this.file = []) // 多选
this.file.push(file)
}
return validate || Promise.reject()
},
onError(err, file, fileList) {
this.loading = false
this.$message.error('上传文件失败')
},
checkVideoCode(file) {
return new Promise((resolve, reject) => {
const mp4boxFile = MP4Box.createFile()
const reader = new FileReader()
reader.readAsArrayBuffer(file)
reader.onload = function (e) {
const arrayBuffer = e.target.result
arrayBuffer.fileStart = 0
mp4boxFile.appendBuffer(arrayBuffer)
}
mp4boxFile.onReady = function (info) {
resolve(info)
} }
mp4boxFile.onError = function (info) { return validate || Promise.reject()
reject(info) },
} onError(err, file, fileList) {
}) this.loading = false
}, this.$message.error('上传文件失败')
showView(index) { },
let imager = index !== undefined ? this.$refs.image[index] : this.$refs.image checkVideoCode(file) {
imager.clickHandler() return new Promise((resolve, reject) => {
this.$nextTick(() => { const mp4boxFile = MP4Box.createFile()
// 为遮罩层添加关闭事件 const reader = new FileReader()
let maskEl = imager.$children[0].$refs['el-image-viewer__wrapper'].firstChild reader.readAsArrayBuffer(file)
maskEl.addEventListener('click', () => { reader.onload = function (e) {
event.stopPropagation() const arrayBuffer = e.target.result
imager.closeViewer() arrayBuffer.fileStart = 0
mp4boxFile.appendBuffer(arrayBuffer)
}
mp4boxFile.onReady = function (info) {
resolve(info)
}
mp4boxFile.onError = function (info) {
reject(info)
}
}) })
}) },
// this.$refs.image.$refs.closeViewer(); showView(index) {
}, let imager = index !== undefined ? this.$refs.image[index] : this.$refs.image
}, imager.clickHandler()
} this.$nextTick(() => {
// 为遮罩层添加关闭事件
let maskEl = imager.$children[0].$refs['el-image-viewer__wrapper'].firstChild
maskEl.addEventListener('click', () => {
event.stopPropagation()
imager.closeViewer()
})
})
// this.$refs.image.$refs.closeViewer();
}
}
}
</script> </script>
<template> <template>
...@@ -423,7 +428,8 @@ export default { ...@@ -423,7 +428,8 @@ export default {
:src="item.url" :src="item.url"
fit="contain" fit="contain"
:preview-src-list="fileListWatch.map((e) => e.url)" :preview-src-list="fileListWatch.map((e) => e.url)"
alt="" /> alt=""
/>
<div class="action-mask"> <div class="action-mask">
<i class="el-icon-search mr5" @click="showView(index)"></i> <i class="el-icon-search mr5" @click="showView(index)"></i>
<!-- <span v-if="action.includes('download')" @click="download(item)"> <!-- <span v-if="action.includes('download')" @click="download(item)">
...@@ -451,7 +457,8 @@ export default { ...@@ -451,7 +457,8 @@ export default {
:limit="limit" :limit="limit"
:on-error="onError" :on-error="onError"
:on-exceed="handleExceed" :on-exceed="handleExceed"
:before-upload="handleBeforeUpload"> :before-upload="handleBeforeUpload"
>
<!-- <!--
element-loading-text="正在上传..." element-loading-text="正在上传..."
:on-success="onSuccess" :on-success="onSuccess"
...@@ -469,7 +476,7 @@ export default { ...@@ -469,7 +476,7 @@ export default {
<circle cx="50" cy="50" r="20" fill="none" class="path"></circle> <circle cx="50" cy="50" r="20" fill="none" class="path"></circle>
</svg> </svg>
</div> </div>
<div class="cc" style="margin-top: 35px"> <div class="cc" style="margin-top: 35px;">
{{ speed + 'M/s' }} {{ speed + 'M/s' }}
</div> </div>
</div> </div>
...@@ -483,7 +490,8 @@ export default { ...@@ -483,7 +490,8 @@ export default {
:src="fileUrlWatch" :src="fileUrlWatch"
class="upload-img" class="upload-img"
:preview-src-list="[fileUrlWatch]" :preview-src-list="[fileUrlWatch]"
fit="contain" /> fit="contain"
/>
<div class="action-mask" @click.self.stop> <div class="action-mask" @click.self.stop>
<i class="el-icon-search" @click.prevent.stop="showView()"></i> <i class="el-icon-search" @click.prevent.stop="showView()"></i>
...@@ -507,10 +515,11 @@ export default { ...@@ -507,10 +515,11 @@ export default {
playsinline="true" playsinline="true"
:autoplay="false" :autoplay="false"
:key="fileUrlWatch" :key="fileUrlWatch"
preload="auto"> preload="auto"
>
<source :src="fileUrlWatch" type="video/mp4" /> <source :src="fileUrlWatch" type="video/mp4" />
</video> </video>
<div class="action-mask" style="height: 50%" @click.self.stop> <div class="action-mask" style="height: 50%;" @click.self.stop>
<i class="el-icon-edit"></i> <i class="el-icon-edit"></i>
</div> </div>
</div> </div>
...@@ -519,7 +528,7 @@ export default { ...@@ -519,7 +528,7 @@ export default {
<i class="el-icon-edit ml10"></i> <i class="el-icon-edit ml10"></i>
<!-- a链接用本地视频打不开,视频地址使用远程地址 --> <!-- a链接用本地视频打不开,视频地址使用远程地址 -->
<a @click.stop :href="/\.mp4$/.test(fileNameWatch) ? fileUrl : fileUrlWatch" target="_blank"> <a @click.stop :href="/\.mp4$/.test(fileNameWatch) ? fileUrl : fileUrlWatch" target="_blank">
<i class="el-icon-view ml10" style="vertical-align: middle"></i> <i class="el-icon-view ml10" style="vertical-align: middle;"></i>
</a> </a>
</div> </div>
</template> </template>
...@@ -535,76 +544,76 @@ export default { ...@@ -535,76 +544,76 @@ export default {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep.uploader { ::v-deep.uploader {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
.el-upload { .el-upload {
border-radius: 6px; border-radius: 6px;
cursor: pointer; cursor: pointer;
position: relative;
overflow: hidden;
}
}
.upload-action {
width: 178px;
height: 178px;
position: relative; position: relative;
text-align: center;
}
.uploader-icon {
display: block;
font-size: 28px;
line-height: 178px;
text-align: center;
color: #8c939d;
border-radius: 6px;
border: 1px dashed #d9d9d9;
transition: all 0.3s;
&:hover {
border-color: $blue;
color: $blue;
}
}
.progress {
overflow: hidden; overflow: hidden;
} }
} .upload-img {
width: 178px;
.upload-action { height: 178px;
width: 178px; display: block;
height: 178px; }
position: relative; .tip {
text-align: center; color: #aaa;
} font-size: 12px;
.uploader-icon { }
display: block; .img-item {
font-size: 28px; position: relative;
line-height: 178px; display: inline-block;
text-align: center; vertical-align: middle;
color: #8c939d; margin: 0 10px 10px 0;
border-radius: 6px; transition: all 0.3s;
border: 1px dashed #d9d9d9; }
transition: all 0.3s; .action-mask {
&:hover { position: absolute;
border-color: $blue; display: flex;
color: $blue; justify-content: space-around;
align-items: center;
padding: 0 30px;
width: 100%;
height: 100%;
left: 0;
top: 0;
cursor: pointer;
text-align: center;
color: #fff;
opacity: 0;
font-size: 20px;
transition: opacity 0.3s;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
}
.action-mask:hover {
opacity: 1;
} }
}
.progress {
overflow: hidden;
}
.upload-img {
width: 178px;
height: 178px;
display: block;
}
.tip {
color: #aaa;
font-size: 12px;
}
.img-item {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 10px 10px 0;
transition: all 0.3s;
}
.action-mask {
position: absolute;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 30px;
width: 100%;
height: 100%;
left: 0;
top: 0;
cursor: pointer;
text-align: center;
color: #fff;
opacity: 0;
font-size: 20px;
transition: opacity 0.3s;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
}
.action-mask:hover {
opacity: 1;
}
</style> </style>
...@@ -34,16 +34,23 @@ ...@@ -34,16 +34,23 @@
multiple: true, multiple: true,
total: 0, total: 0,
list: [], list: [],
lastSyncTime: 0 lastSyncTime: 0,
fileList: []
} }
}, },
computed: {}, computed: {},
created() { created() {
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>快捷创建商品图册,员工一键发送给客户,客户直接购买。</div>
`
)
this.getList() this.getList()
}, },
methods: { methods: {
resetForm() { resetForm() {
this.query.name = 1 this.query.name = ''
this.getList(1) this.getList(1)
}, },
getList(page) { getList(page) {
...@@ -62,12 +69,18 @@ ...@@ -62,12 +69,18 @@
}) })
}, },
edit(data) { edit(data) {
data this.fileList = []
? api.getDetail(data.id).then((res) => { if (data) {
this.form = res.data api.getDetail(data.id).then((res) => {
this.form.attachments = this.form.attachments.split(',') this.form = res.data
let arr = this.form.attachments.split(',')
arr.forEach((dd) => {
this.fileList.push({ url: dd })
}) })
: (this.form = JSON.parse(JSON.stringify(defaultForm))) })
} else {
this.form = JSON.parse(JSON.stringify(defaultForm))
}
this.dialogVisible = true this.dialogVisible = true
}, },
sync() { sync() {
...@@ -92,7 +105,7 @@ ...@@ -92,7 +105,7 @@
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
let form = JSON.parse(JSON.stringify(this.form)) let form = JSON.parse(JSON.stringify(this.form))
form.price = form.price.toFixed(2) form.price = form.price.toFixed(2)
form.attachments = form.attachments.join(',') form.attachments = this.fileList.map((dd) => dd.url).join(',')
this.submitLoading = true this.submitLoading = true
api[form.id ? 'update' : 'add'](form, form.id) api[form.id ? 'update' : 'add'](form, form.id)
.then(() => { .then(() => {
...@@ -136,7 +149,7 @@ ...@@ -136,7 +149,7 @@
} }
</script> </script>
<template> <template>
<div class=""> <div class="g-card g-pad20">
<el-form ref="queryForm" :inline="true" :model="query" label-width="110px" class="top-search"> <el-form ref="queryForm" :inline="true" :model="query" label-width="110px" class="top-search">
<el-form-item label="商品名称或描述" prop="name"> <el-form-item label="商品名称或描述" prop="name">
<el-input v-model="query.name" placeholder="请输入"></el-input> <el-input v-model="query.name" placeholder="请输入"></el-input>
...@@ -157,7 +170,7 @@ ...@@ -157,7 +170,7 @@
<div slot-scope="{ row }"> <div slot-scope="{ row }">
<div style="display: flex;"> <div style="display: flex;">
<el-image <el-image
style="width: 50px; height: 50px; margin-right: 3px; flex-shrink: 0;" style="width: 50px; height: 50px; margin-right: 5px; flex-shrink: 0;"
:src="row.picture" :src="row.picture"
></el-image> ></el-image>
<span class="limit_span">{{ row.describe }}</span> <span class="limit_span">{{ row.describe }}</span>
...@@ -214,7 +227,7 @@ ...@@ -214,7 +227,7 @@
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品详情"> <el-form-item label="商品详情">
<upload :fileUrls.sync="form.attachments" :limit="8" type="0"> <upload :fileList.sync="fileList" :multiple="true" :limit="8" type="0">
<div slot="tip" class="tip">最多添加八张详情</div> <div slot="tip" class="tip">最多添加八张详情</div>
</upload> </upload>
</el-form-item> </el-form-item>
...@@ -230,12 +243,7 @@ ...@@ -230,12 +243,7 @@
></el-image> ></el-image>
<div class="price">¥{{ form.price }}</div> <div class="price">¥{{ form.price }}</div>
<div class="content">{{ form.describe }}</div> <div class="content">{{ form.describe }}</div>
<el-image <el-image v-for="(item, index) in fileList" class="commodity-img" :src="item.url" :key="index"></el-image>
v-for="(item, index) in form.attachments"
class="commodity-img"
:src="item"
:key="index"
></el-image>
</div> </div>
</PhoneTemplate> </PhoneTemplate>
</el-col> </el-col>
......
<template> <template>
<div class=""> <div class="g-card g-pad20">
<el-form :inline="true" label-width="110px" class="top-search"> <el-form :inline="true" label-width="110px" class="top-search">
<el-form-item label="商品名称或描述" prop="productName"> <el-form-item label="商品名称或描述" prop="productName">
<el-input v-model="query.productName" placeholder="请输入商品名称或描述"></el-input> <el-input v-model="query.productName" placeholder="请输入商品名称或描述"></el-input>
...@@ -74,6 +74,24 @@ ...@@ -74,6 +74,24 @@
{{ { 1: '@微信', 2: '@企业微信' }[row.externalType] }} {{ { 1: '@微信', 2: '@企业微信' }[row.externalType] }}
</span> </span>
</div> </div>
<div v-if="row.address && row.phone" class="ml10" style="align-self: baseline;">
<el-popover trigger="hover" width="400">
<el-form ref="form" label-width="100px">
<el-form-item label="联系人:">
{{ row.contact }}
</el-form-item>
<el-form-item label="联系地址:">
{{ row.address }}
</el-form-item>
<el-form-item label="联系电话:">
{{ row.phone }}
</el-form-item>
</el-form>
<div style="display: inline;" slot="reference">
<i class="el-icon-warning"></i>
</div>
</el-popover>
</div>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -81,8 +99,28 @@ ...@@ -81,8 +99,28 @@
<el-table-column label="付款金额(元)" align="center" prop="totalFee" /> <el-table-column label="付款金额(元)" align="center" prop="totalFee" />
<el-table-column label="收款员工" align="center" prop="weUserName" /> <el-table-column label="收款员工" align="center" prop="weUserName" />
<el-table-column label="收款商户" align="center" prop="mchName"> </el-table-column> <el-table-column label="收款商户" align="center" prop="mchName"> </el-table-column>
<el-table-column label="交易状态" align="center" prop="orderStateStr" /> <el-table-column label="交易状态" align="center" prop="orderStateStr">
<el-table-column label="退款状态" align="center" prop="refundStateStr" /> <template slot-scope="{ row }">
<a
v-if="row.orderStateStr"
style="color: #0079de; border-bottom: 1px solid #0079de;"
@click="tradingStateFn(row.orderNo)"
>{{ row.orderStateStr }}</a
>
<span v-else> - </span>
</template>
</el-table-column>
<el-table-column label="退款状态" align="center" prop="refundStateStr">
<template slot-scope="{ row }">
<a
v-if="row.refundStateStr"
style="color: #0079de; border-bottom: 1px solid #0079de;"
@click="refundStateFn(row.refundNo)"
>{{ row.refundStateStr }}</a
>
<span v-else> - </span>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total > 0" v-show="total > 0"
...@@ -97,13 +135,15 @@ ...@@ -97,13 +135,15 @@
<el-col :span="12"> <el-col :span="12">
<el-form ref="form" label-width="100px"> <el-form ref="form" label-width="100px">
<el-form-item label="交易时间:"> <el-form-item label="交易时间:">
<!-- {{}} --> {{ orderState.payTime }}
</el-form-item> </el-form-item>
<el-form-item label="交易单号:"> <el-form-item label="交易单号:">
<!-- {{}} --> {{ orderState.orderNo }}
<el-button type="text" plain size="mini" @click="handleCopy(orderState.orderNo)">复制</el-button>
</el-form-item> </el-form-item>
<el-form-item label="商户单号:"> <el-form-item label="商户单号:">
<!-- {{}} --> {{ orderState.mchNo }}
<el-button type="text" plain size="mini" @click="handleCopy(orderState.mchNo)">复制</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
...@@ -117,19 +157,20 @@ ...@@ -117,19 +157,20 @@
<el-col :span="12"> <el-col :span="12">
<el-form ref="form" label-width="100px"> <el-form ref="form" label-width="100px">
<el-form-item label="退款发起时间:"> <el-form-item label="退款发起时间:">
<!-- {{}} --> {{ refundState.refundTime }}
</el-form-item> </el-form-item>
<el-form-item label="退款发起人:"> <el-form-item label="退款发起人:">
<!-- {{}} --> {{ refundState.refundUserName }}
</el-form-item> </el-form-item>
<el-form-item label="退款备注:"> <el-form-item label="退款备注:">
<!-- {{}} --> {{ refundState.remark }}
</el-form-item> </el-form-item>
<el-form-item label="退款金额(元)"> <el-form-item label="退款金额(元)">
<!-- {{}} --> {{ refundState.refundFee }}
</el-form-item> </el-form-item>
<el-form-item label="退款单号:"> <el-form-item label="退款单号:">
<!-- {{}} --> {{ refundState.refundNo }}
<el-button type="text" plain size="mini" @click="handleCopy(orderState.refundNo)">复制</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
...@@ -149,6 +190,8 @@ ...@@ -149,6 +190,8 @@
<script> <script>
import * as api from '@/api/commodityCenter/commodityManage' import * as api from '@/api/commodityCenter/commodityManage'
import { dateFormat } from '@/utils/index'
export default { export default {
components: {}, components: {},
props: {}, props: {},
...@@ -176,19 +219,53 @@ ...@@ -176,19 +219,53 @@
dialogVisibleSelect: false, dialogVisibleSelect: false,
dateRange: [], dateRange: [],
dialogStateVisible: false, dialogStateVisible: false,
dialogVisible: false dialogVisible: false,
orderState: {
payTime: '',
orderNo: '',
mchNo: ''
},
refundState: {
refundTime: '',
refundNo: '',
refundUserName: '',
refundFee: '',
remark: ''
}
} }
}, },
computed: {}, computed: {},
created() { created() {
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>查看商品所有订单及明细记录。</div>
`
)
this.getList() this.getList()
}, },
methods: { methods: {
handleCopy(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' })
},
tradingStateFn(id) { tradingStateFn(id) {
api.getOrderState(id) api.getOrderState(id).then((res) => {
this.orderState = res.data
this.dialogVisible = true
})
}, },
refundStateFn(orderNo) { refundStateFn(id) {
api.getRefundOrderState(orderNo) api.getRefundOrderState(id).then((res) => {
this.refundState = res.data
this.dialogStateVisible = true
})
}, },
resetForm() { resetForm() {
this.query = { this.query = {
...@@ -227,10 +304,31 @@ ...@@ -227,10 +304,31 @@
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
api api
.exportOrder() .exportOrder({
productName: this.query.productName,
externalName: this.query.externalName,
weUserId: this.query.weUserId,
orderState: this.query.orderState,
refundState: this.query.refundState,
beginTime: this.query.beginTime,
endTime: this.query.endTime
})
.then((res) => { .then((res) => {
if (!res) return
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
if (window.navigator.msSaveOrOpenBlob) {
//兼容IE10
navigator.msSaveBlob(blob, '订单')
} else {
const href = URL.createObjectURL(blob)
const a = document.createElement('a')
a.style.display = 'none'
a.href = href
a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_订单.xlsx'
a.click() //触发下载
URL.revokeObjectURL(a.href) //释放URL对象
}
loading.close() loading.close()
console.log(res)
}) })
.catch(() => { .catch(() => {
loading.close() loading.close()
......
...@@ -14,19 +14,69 @@ ...@@ -14,19 +14,69 @@
</div> </div>
</div> </div>
</div> </div>
<div class="g-card g-pad20" style="margin-top: 20px;"> <div class="column">
<div class="title"> <div class="column-item" style="margin-right: 20px;">
访问场景top5 <div class="g-card g-pad20" style="margin-top: 20px; height: 450px;">
</div> <div class="title">
<div class="data-content" style="margin-top: 20px;"> 商品订单top5
<div class="chart-content"> </div>
<search-title @search="getTop5Fn"></search-title> <div class="data-content" style="margin-top: 20px;">
<div class="column"> <div class="chart-content">
<div class="column-item"> <search-title @search="getGoodsTop5Fn"></search-title>
<chart-bar style="height: 300px;" :xData="bar1" :series="value1" :legend="barLegend1"></chart-bar> <el-table v-loading="goodsTableLoading" :data="goodsTableList" style="width: 100%;">
<el-table-column label="商品" align="center" width="200" prop="xtime" show-overflow-tooltip>
<div slot-scope="{ row }">
<div style="display: flex;">
<el-image
style="width: 50px; height: 50px; margin-right: 5px; flex-shrink: 0;"
:src="row.picture"
></el-image>
<span class="limit_span">{{ row.productDesc }}</span>
</div>
</div>
</el-table-column>
<el-table-column label="订单总数" align="center" prop="orderNum" show-overflow-tooltip />
<el-table-column
label="订单总额(元)"
align="center"
prop="totalFee"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="净收入(元)"
align="center"
prop="netIncome"
show-overflow-tooltip
></el-table-column>
</el-table>
</div> </div>
<div class="column-item"> </div>
<chart-bar style="height: 300px;" :xData="bar2" :series="value2" :legend="barLegend2"></chart-bar> </div>
</div>
<div class="column-item">
<div class="g-card g-pad20" style="margin-top: 20px; height: 450px;">
<div class="title">
员工订单top5
</div>
<div class="data-content" style="margin-top: 20px;">
<div class="chart-content">
<search-title @search="getMemebersTop5Fn"></search-title>
<el-table v-loading="memberTableLoading" :data="memberTableList" style="width: 100%;">
<el-table-column
label="员工"
align="center"
min-width="100"
prop="weUserName"
show-overflow-tooltip
></el-table-column>
<el-table-column label="订单总数" align="center" prop="orderNum" show-overflow-tooltip />
<el-table-column
label="订单总额(元)"
align="center"
prop="totalFee"
show-overflow-tooltip
></el-table-column>
</el-table>
</div> </div>
</div> </div>
</div> </div>
...@@ -43,46 +93,26 @@ ...@@ -43,46 +93,26 @@
</div> </div>
<div class="table-content"> <div class="table-content">
<el-table v-loading="loading" :data="tableList" style="width: 100%;"> <el-table v-loading="loading" :data="tableList" style="width: 100%;">
<el-table-column label="日期" align="center" min-width="100" prop="xtime" show-overflow-tooltip /> <el-table-column label="日期" align="center" min-width="100" prop="dateStr" show-overflow-tooltip />
<el-table-column <el-table-column label="订单总数" align="center" min-width="100" prop="orderNum" show-overflow-tooltip />
label="访问客户总数"
align="center"
min-width="100"
prop="visitTotalCnt"
show-overflow-tooltip
/>
<el-table-column
label="咨询客户总数"
align="center"
prop="consultTotalCnt"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column
label="接待客户总数"
align="center"
prop="receptionTotalCnt"
min-width="100"
show-overflow-tooltip
></el-table-column>
<el-table-column <el-table-column
label="今日新增访问客户" label="订单总额(元)"
align="center" align="center"
prop="tdVisitCnt" prop="totalFee"
min-width="100" min-width="100"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="今日新增咨询客户" label="退款总额(元)"
align="center" align="center"
prop="tdConsultCnt" prop="refundFee"
min-width="100" min-width="100"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> ></el-table-column>
<el-table-column <el-table-column
label="今日新增接待客户" label="净收入(元)"
align="center" align="center"
prop="tdReceptionCnt" prop="netIncome"
min-width="100" min-width="100"
show-overflow-tooltip show-overflow-tooltip
></el-table-column> ></el-table-column>
...@@ -106,7 +136,8 @@ ...@@ -106,7 +136,8 @@
import { import {
getTableExport, getTableExport,
getTableTotal, getTableTotal,
getBarTop5Total, getGoodsTop5,
getMembersTop5,
getLineChartTotal, getLineChartTotal,
getGoodsTotal getGoodsTotal
} from '@/api/commodityCenter/commodityManage' } from '@/api/commodityCenter/commodityManage'
...@@ -123,8 +154,6 @@ ...@@ -123,8 +154,6 @@
data() { data() {
return { return {
exportLoading: false, exportLoading: false,
barLegend1: ['访问客户总数'],
barLegend2: ['咨询客户总数'],
legend: ['订单总额(元)', '退款总额(元)', '净收入(元)'], legend: ['订单总额(元)', '退款总额(元)', '净收入(元)'],
xdata: [], xdata: [],
series: [], series: [],
...@@ -186,10 +215,10 @@ ...@@ -186,10 +215,10 @@
}, },
tableList: [], tableList: [],
loading: false, loading: false,
bar1: [], goodsTableLoading: false,
bar2: [], goodsTableList: [],
value1: [], memberTableLoading: false,
value2: [], memberTableList: [],
tableSearch: {} tableSearch: {}
} }
}, },
...@@ -202,20 +231,20 @@ ...@@ -202,20 +231,20 @@
}) })
.then(() => { .then(() => {
this.exportLoading = true this.exportLoading = true
return getTableExport(Object.assign({}, this.query, this.tableSearch)) return getTableExport(Object.assign({}, this.tableSearch))
}) })
.then((res) => { .then((res) => {
if (!res) return if (!res) return
const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) // 构造一个blob对象来处理数据,并设置文件类型 const blob = new Blob([res], { type: 'application/vnd.ms-excel' }) // 构造一个blob对象来处理数据,并设置文件类型
if (window.navigator.msSaveOrOpenBlob) { if (window.navigator.msSaveOrOpenBlob) {
//兼容IE10 //兼容IE10
navigator.msSaveBlob(blob, '场景分析') navigator.msSaveBlob(blob, '商品分析')
} else { } else {
const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象 const href = URL.createObjectURL(blob) //创建新的URL表示指定的blob对象
const a = document.createElement('a') //创建a标签 const a = document.createElement('a') //创建a标签
a.style.display = 'none' a.style.display = 'none'
a.href = href // 指定下载链接 a.href = href // 指定下载链接
a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_场景分析.xlsx' //指定下载文件名 a.download = dateFormat(new Date(), 'yyyy-MM-dd') + '_商品分析.xlsx' //指定下载文件名
a.click() //触发下载 a.click() //触发下载
URL.revokeObjectURL(a.href) //释放URL对象 URL.revokeObjectURL(a.href) //释放URL对象
} }
...@@ -246,6 +275,7 @@ ...@@ -246,6 +275,7 @@
getLineData(data) { getLineData(data) {
this.$forceUpdate() this.$forceUpdate()
getLineChartTotal({ getLineChartTotal({
type: 'customization',
startDate: data.beginTime, startDate: data.beginTime,
endDate: data.endTime endDate: data.endTime
}).then((res) => { }).then((res) => {
...@@ -254,41 +284,33 @@ ...@@ -254,41 +284,33 @@
let arr1 = [] let arr1 = []
let arr2 = [] let arr2 = []
let arr3 = [] let arr3 = []
if (res.data && res.data.length) { this.xdata = res.data.xAxis.data
res.data.forEach((dd) => { arr1 = res.data.series[0].data
this.xdata.push(dd.xtime) arr2 = res.data.series[1].data
arr1.push(dd.visitTotalCnt) arr3 = res.data.series[2].data
arr2.push(dd.consultTotalCnt) this.series = [arr1, arr2, arr3]
arr3.push(dd.receptionTotalCnt)
})
this.series = [arr1, arr2, arr3]
}
}) })
}, },
getTop5Fn(data) { getGoodsTop5Fn(data) {
getBarTop5Total(data).then((res) => { this.goodsTableLoading = true
if (res.data.consult && res.data.consult.length) { getGoodsTop5({
this.bar1 = [] type: 'customization',
this.value1 = [] startDate: data.beginTime,
res.data.consult.forEach((dd) => { endDate: data.endTime
this.bar1.push(dd.sceneName) }).then((res) => {
this.value1.push(dd.total) this.goodsTableList = res.data
}) this.goodsTableLoading = false
} else { })
this.bar1 = [] },
this.value1 = [] getMemebersTop5Fn(data) {
} this.memberTableLoading = true
if (res.data.visit && res.data.visit.length) { getMembersTop5({
this.bar2 = [] type: 'customization',
this.value2 = [] startDate: data.beginTime,
res.data.visit.forEach((dd) => { endDate: data.endTime
this.bar2.push(dd.sceneName) }).then((res) => {
this.value2.push(dd.total) this.memberTableList = res.data
}) this.memberTableLoading = false
} else {
this.bar2 = []
this.value2 = []
}
}) })
}, },
getTableChangeSize() { getTableChangeSize() {
...@@ -301,8 +323,13 @@ ...@@ -301,8 +323,13 @@
}, },
getTableFn(data) { getTableFn(data) {
this.loading = true this.loading = true
this.tableSearch = data let obj = {
getTableTotal(Object.assign({}, this.query, data)).then((res) => { type: 'customization',
startDate: data.beginTime,
endDate: data.endTime
}
this.tableSearch = obj
getTableTotal(Object.assign({}, this.query, obj)).then((res) => {
this.tableList = res.rows this.tableList = res.rows
this.total = Number(res.total) this.total = Number(res.total)
this.loading = false this.loading = false
...@@ -310,6 +337,12 @@ ...@@ -310,6 +337,12 @@
} }
}, },
created() { created() {
this.$store.dispatch(
'app/setBusininessDesc',
`
<div>全部商品及订单数据总览与数据分析。</div>
`
)
this.getSceneTotalFn() this.getSceneTotalFn()
} }
} }
...@@ -326,6 +359,12 @@ ...@@ -326,6 +359,12 @@
color: #333; color: #333;
font-weight: 600; font-weight: 600;
} }
.column {
display: flex;
.column-item {
flex: 1;
}
}
.data-content { .data-content {
margin-top: 10px; margin-top: 10px;
.chart-content { .chart-content {
...@@ -333,12 +372,6 @@ ...@@ -333,12 +372,6 @@
.my_button { .my_button {
float: right; float: right;
} }
.column {
display: flex;
.column-item {
flex: 1;
}
}
} }
.search-content { .search-content {
display: flex; display: flex;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!