Commit 6a5129ca by chenwq

分析sop-3个列表

1 parent 55c2c325
<template>
<div></div>
</template>
<script>
export default {
name: 'baseInfo',
data() {
return {}
},
mounted() { },
methods: {}
}
</script>
<style>
</style>
......@@ -189,6 +189,7 @@ export default {
let myChart = echarts.init(chartDom)
let option = JSON.parse(JSON.stringify(this.pieOption))
// option.title.text = item.completedPercent == '100' ? '√' : item.completedPercent + '%'
option.title.text = item.completedPercent + '%'
option.series[0].name = item.sopName
option.series[0].data = [
......
<!-- 完成率分析-->
<template>
<div class="marketing">
<div class="container">
<div>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="default" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<glsx-combi-form ref="showSearch">
<span slot="footer" class="footer-btns">
<GLButton :size="size" class="default-blue-btn" type="default" fn="导出" @click="handleExport">导出</GLButton>
</span>
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div class="p-b-12">礼包明细</div>
<div class="gift-detail flex-wrap">
<div class="gift-item" v-for="(item, index) in scope.scope.couponList" :key="index">
<p :class="['gift-coupon-name', item.status == '3' ? ' txt-grey' : '']">{{ item.couponName }} × {{ item.couponAmount }}</p>
<p v-show="item.status == '3'" class="gift-tips">已失效</p>
</div>
</div>
</div>
<div slot="name" slot-scope="scope">
<p class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</p>
</div>
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLButton type="text" fn="编辑" @click="handleEdit('edit', scope.scope)">编辑</GLButton>
<GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton>
</div>
</GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
export default {
name: 'giftList',
data() {
return {
size: 'small',
url: url,
searchForm: {
name: '',
staffName: '',
createDate: []
},
tableSearchForm: {},
// 搜索
searchFormData: [
{
label: '礼包名称',
name: 'name',
type: 'input',
maxlength: 30,
placeholder: '请输入礼包名称或备注名称',
isClear: true
},
{
label: '发放员工',
name: 'staffName',
type: 'input',
maxlength: 30,
isClear: true
},
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
}
],
// 表格
getListApi: this.$apis.giftBag.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
},
{
label: '序号',
prop: 'idx',
width: '60'
},
{
label: '礼包名称',
prop: 'name',
addHtml: 'name'
},
{
label: '备注名称',
prop: 'remarkName',
width: '200'
},
{
label: '预估成本/元',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '发放员工',
prop: 'staffList',
formatter: cellValue => {
return cellValue.staffList.map(item => item.staffName).join(',')
}
},
{
label: '赠送原因',
prop: 'giveReason',
formatter: cellValue => {
return cellValue.giveReason || '-'
}
},
{
label: '创建时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
commentStatusList: [
{
confId: '0',
confName: '未发布'
},
{
confId: '1',
confName: '已发布'
}
]
}
}
},
mounted() {
this.getOptionsList('searchFormData')
},
methods: {
getParams() {
var params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm.createDate.length) {
params.startTime = new Date(this.searchForm.createDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endTime = new Date(this.searchForm.createDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createDate
return params
},
beforeSearchFn() {
return new Promise(resolve => {
this.tableSearchForm = this.getParams()
resolve()
})
},
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
handleExport() {
var params = this.getParams()
this.$apis.giftBag.giftExportApi(params).then(res => {
aToExport(res)
})
},
handleDelete(row) {
this.secondConfirm('删除', '是否确认删除该礼包?', 'giftBag', 'deleteGiftApi', { id: row.id })
},
// 查看
handleDetail(row) {
this.$router.push({
path: '/giftBag/giftDetail',
query: {
id: row.id
}
})
},
// add-新增;edit-编辑
handleEdit(addOrEdit, row) {
var params = {
addOrEdit: addOrEdit,
$title: encodeURI(addOrEdit == 'add' ? '新增礼包' : '编辑礼包')
}
addOrEdit != 'add' && (params.id = row.id)
this.$router.push({
path: '/giftBag/editGift',
query: params
})
},
getOptionsList(formName, hasAll = true, refreshSigle) {
if (refreshSigle) {
var item = this[formName].find(k => k.name == refreshSigle)
var index = this[formName].findIndex(k => k.name == refreshSigle)
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
} else {
this[formName].forEach((item, index) => {
if (item.type === 'select' && this.baseData[item.optionsName].length) {
this.$set(this[formName][index], 'optionList', this.$common.utils.deepClone(this.baseData[item.optionsName]))
if (hasAll && this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this[formName][index].optionLabel] !== '全部') {
const temp = {}
temp[this[formName][index].optionId] = ''
temp[this[formName][index].optionLabel] = '全部'
this[formName][index].optionList.unshift(temp)
}
}
})
}
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
this.$refs.giftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
},
handleReset() {
this.searchForm = {
name: '',
staffName: '',
createDate: []
}
this.handleSearch()
}
}
}
</script>
<style lang="scss">
.p-b-12 {
margin-bottom: 14px;
}
.gift-detail .gift-item {
margin-right: 80px;
.gift-coupon-name {
display: inline-block;
margin-right: 7px;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
}
}
.gift-detail .gift-item:last-child {
margin-right: 0;
}
</style>
<!-- 完成率分析-->
<template>
<div class="marketing sop-analysis complete-list">
<div class="container">
<div class="title m-b-20">
SOP名称:
<span>这是某次营销sop</span>
</div>
<div class="analysis-box flex-default">
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
营销时间总数
<img src="@/assets/sop/sop-event.png" />
</div>
<p class="analysis-num">20</p>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
已完成事件数
<img src="@/assets/sop/completed-event.png" />
</div>
<p class="analysis-num">12</p>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
完成率
</div>
<p class="analysis-num">60%</p>
<div id="completePie" class="chart-pie"></div>
</div>
</div>
<p class="m-b-10">日营销事件明细</p>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :noDataImg="url" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" @setTableFinishFun="setTableFinishFun"></GLTable>
<!-- 表格区域 end -->
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
import { pieOption } from './pieOption'
export default {
name: 'completeList',
data() {
return {
size: 'small',
url: url,
searchForm: {},
// 表格
getListApi: this.$apis.giftBag.getListApi,
tableParams: {
listName: 'list',
tableColumns: [
{
label: '营销事件',
prop: 'name'
},
{
label: '营销渠道',
prop: 'remarkName',
width: '200'
},
{
label: '营销事件总数',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '已完成事件数',
prop: 'staffList',
formatter: cellValue => {
return cellValue.staffList.map(item => item.staffName).join(',')
}
}
]
},
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
baseData: {
commentStatusList: [
{
confId: '0',
confName: '未发布'
},
{
confId: '1',
confName: '已发布'
}
]
}
}
},
mounted() {
this.drawPie()
},
methods: {
secondConfirm(title, txt, apiModule, apiName, apiParams, fn) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: action => {
if (action == 'confirm') {
this.$apis[apiModule][apiName](apiParams).then(res => {
this.$message({
message: res.code == '0' ? '操作成功' : res.message,
type: res.code == '0' ? 'success' : 'error'
})
if (res.code == '0') {
fn && fn()
this.handleSearch()
}
})
}
}
})
},
setTableFinishFun() {
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
drawPie() {
let chartDom = document.getElementById('completePie')
let myChart = echarts.init(chartDom)
let option = JSON.parse(JSON.stringify(pieOption))
// option.series[0].name = item.sopName
option.series[0].data = [
{
value: 60,
name: '已触发的营销事件'
},
{
value: 40,
name: '未触发的营销事件'
}
]
console.log(option)
option && myChart.setOption(option)
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
}
}
}
</script>
<style lang="scss">
.sop-analysis {
.title {
height: 32px;
line-height: 32px;
font-size: 20px;
font-weight: 600;
}
.analysis-box {
margin-bottom: 40px;
.analysis-block {
position: relative;
box-sizing: border-box;
width: 216px;
height: 116px;
padding: 10px 20px 20px;
margin-right: 20px;
flex-basis: 0 0 auto;
background: #ffffff;
background-image: linear-gradient(0deg, #f8f8fc 0%, #f4f4ff 100%);
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.analysis-title-block {
display: flex;
justify-content: space-between;
align-items: center;
height: 40px;
line-height: 40px;
font-size: 14px;
color: #666666;
}
.chart-pie {
position: absolute;
top: 20px;
right: 20px;
width: 70px;
height: 74px;
}
.analysis-num {
font-size: 26px;
font-weight: 600;
}
}
}
}
</style>
var pieOption = {
tooltip: {
trigger: 'item'
},
color: ['#7A80FF', '#e6e6ef'],
series: [
{
name: '',
type: 'pie',
radius: ['60%', '90%'],
avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: false
}
},
labelLine: {
show: false
},
data: []
}
]
}
export { pieOption }
<!-- 定向礼包-->
<!-- 完成率分析-->
<template>
<div class="marketing">
<div class="m-b-10">
<!-- <el-button :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</el-button> -->
<GLButton :size="size" type="primary" fn="新增礼包" class="el-icon-plus" @click="handleEdit('add')">新增礼包</GLButton>
</div>
<div class="list-tips m-b-10">
<img class="tips-img" src="@/assets/icon-info.png" />
<span>定向礼包:将多种券和服务组合成定向礼包,由指定的员工向指定的客户发放,客户需准确输入设定内容才能成功领取。</span>
</div>
<div class="marketing sop-analysis touch-list">
<div class="container">
<div class="title m-b-20">
SOP名称:
<span>这是某次营销sop</span>
</div>
<div>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer">
<el-button :size="size" type="default" @click="handleReset">重置</el-button>
<!-- <span slot="footer">
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
</glsx-combi-form>
<glsx-combi-form ref="showSearch">
<span slot="footer" class="footer-btns">
<GLButton :size="size" class="default-blue-btn" type="default" fn="导出" @click="handleExport">导出</GLButton>
</span>
</span> -->
</glsx-combi-form>
</div>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :hasNum="false" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="giftInfo" slot-scope="scope">
<div class="p-b-12">礼包明细</div>
<div class="gift-detail flex-wrap">
<div class="gift-item" v-for="(item, index) in scope.scope.couponList" :key="index">
<p :class="['gift-coupon-name', item.status == '3' ? ' txt-grey' : '']">{{ item.couponName }} × {{ item.couponAmount }}</p>
<p v-show="item.status == '3'" class="gift-tips">已失效</p>
</div>
<div class="analysis-box flex-default">
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
客户总数
<img src="@/assets/sop/customer-total.png" />
</div>
<p class="analysis-num">20</p>
</div>
<div slot="name" slot-scope="scope">
<p class="cursor-pointer" @click="handleDetail(scope.scope)">{{ scope.scope.name }}</p>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
已触达客户数
<img src="@/assets/sop/touch-customer.png" />
</div>
<p class="analysis-num">12</p>
</div>
<div class="analysis-block">
<div class="analysis-title-block m-b-20">
触达率
</div>
<p class="analysis-num">60%</p>
<div id="completePie" class="chart-pie"></div>
</div>
</div>
<p class="m-b-10">客户触达明细</p>
<!-- 表格区域 开始 -->
<GLTable ref="giftListRef" :getListApi="getListApi" :noDataImg="url" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div class="table-btns" slot="auth-button" slot-scope="scope">
<GLButton type="text" fn="编辑" @click="handleEdit('edit', scope.scope)">编辑</GLButton>
<GLButton type="text" fn="删除" @click="handleDelete(scope.scope)">删除</GLButton>
......@@ -49,11 +54,13 @@
</template>
<script>
import * as echarts from 'echarts'
import * as dayjs from 'dayjs'
import url from '@/assets/empty.png'
import { aToExport } from '@/common/constant'
import { pieOption } from './pieOption'
export default {
name: 'giftList',
name: 'completeList',
data() {
return {
size: 'small',
......@@ -67,85 +74,39 @@ export default {
// 搜索
searchFormData: [
{
label: '礼包名称',
label: '营销事件',
name: 'name',
type: 'input',
maxlength: 30,
placeholder: '请输入礼包名称或备注名称',
isClear: true
},
{
label: '发放员工',
name: 'staffName',
type: 'input',
maxlength: 30,
isClear: true
},
{
label: '创建时间',
name: 'createDate',
type: 'datePicker',
isClear: true,
pickerOptions: 'beforeRangePickerOptions'
type: 'select',
width: '415px'
}
],
// 表格
getListApi: this.$apis.giftBag.getListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '',
prop: '',
columnattrs: {
type: 'expand'
},
addHtml: 'giftInfo'
label: '客户名称',
prop: 'name'
},
{
label: '序号',
prop: 'idx',
width: '60'
},
{
label: '礼包名称',
prop: 'name',
addHtml: 'name'
},
{
label: '备注名称',
label: '客户手机号',
prop: 'remarkName',
width: '200'
},
{
label: '预估成本/元',
label: '初次查看事件',
prop: 'anticipatedCost',
formatter: cellValue => {
return (cellValue.anticipatedCost / 100).toFixed(2)
}
},
{
label: '发放员工',
label: '营销事件总数',
prop: 'staffList',
formatter: cellValue => {
return cellValue.staffList.map(item => item.staffName).join(',')
}
},
{
label: '赠送原因',
prop: 'giveReason',
formatter: cellValue => {
return cellValue.giveReason || '-'
}
},
{
label: '创建时间',
prop: 'createdDate',
width: '180',
formatter: cellValue => {
return dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss')
}
}
]
},
......@@ -166,6 +127,7 @@ export default {
},
mounted() {
this.drawPie()
this.getOptionsList('searchFormData')
},
......@@ -268,52 +230,81 @@ export default {
}
},
setTableFinishFun() {
var page = this.$refs.giftListRef.page
// 添加序号
this.$refs.giftListRef.data.forEach((item, index) => {
item.idx = index + (page[this.pageConf.pageNum] - 1) * page[this.pageConf.pageSize] + 1
})
//接收到的数据为空
this.$refs.giftListRef.data.length ? (this.$refs.giftListRef.tableHeightValues = '') : this.$refs.giftListRef.setTableHeightFun()
},
handleSearch() {
this.$refs.giftListRef.refreshTable()
drawPie() {
let chartDom = document.getElementById('completePie')
let myChart = echarts.init(chartDom)
let option = JSON.parse(JSON.stringify(pieOption))
// option.series[0].name = item.sopName
option.series[0].data = [
{
value: 60,
name: '已触发的营销事件'
},
{
value: 40,
name: '未触发的营销事件'
}
]
console.log(option)
option && myChart.setOption(option)
},
handleReset() {
this.searchForm = {
name: '',
staffName: '',
createDate: []
}
this.handleSearch()
handleSearch() {
this.$refs.giftListRef.refreshTable()
}
}
}
</script>
<style lang="scss">
.p-b-12 {
margin-bottom: 14px;
}
.gift-detail .gift-item {
margin-right: 80px;
.gift-coupon-name {
display: inline-block;
margin-right: 7px;
.sop-analysis {
.title {
height: 32px;
line-height: 32px;
font-size: 20px;
font-weight: 600;
}
.gift-tips {
display: inline-block;
font-size: 12px;
height: 18px;
line-height: 18px;
color: #999999;
background-color: #eeeded;
margin-right: 7px;
.analysis-box {
margin-bottom: 40px;
.analysis-block {
position: relative;
box-sizing: border-box;
width: 216px;
height: 116px;
padding: 10px 20px 20px;
margin-right: 20px;
flex-basis: 0 0 auto;
background: #ffffff;
background-image: linear-gradient(0deg, #f8f8fc 0%, #f4f4ff 100%);
box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
.analysis-title-block {
display: flex;
justify-content: space-between;
align-items: center;
height: 40px;
line-height: 40px;
font-size: 14px;
color: #666666;
}
.chart-pie {
position: absolute;
top: 20px;
right: 20px;
width: 70px;
height: 74px;
}
.analysis-num {
font-size: 26px;
font-weight: 600;
}
}
}
}
.gift-detail .gift-item:last-child {
margin-right: 0;
}
</style>
......@@ -3,7 +3,7 @@
<div class="sop-analysis">
<el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="完成率分析" name="compleList">
<comple-list v-if="activeName == 'compleList'"></comple-list>
<complete-list v-if="activeName == 'compleList'"></complete-list>
</el-tab-pane>
<el-tab-pane label="触达率分析" name="touchList">
<touch-list v-if="activeName == 'touchList'"></touch-list>
......@@ -16,7 +16,7 @@
</template>
<script>
import compleList from './sopAnalysis/compleList.vue'
import completeList from './sopAnalysis/completeList.vue'
import touchList from './sopAnalysis/touchList.vue'
import staffList from './sopAnalysis/staffList.vue'
export default {
......@@ -28,7 +28,7 @@ export default {
},
components: {
compleList,
completeList,
touchList,
staffList
},
......
......@@ -8,7 +8,7 @@
<div class="container">
<div>
<glsx-combi-form ref="showSearch" :formObj="searchForm" :formData="searchFormData">
<span slot="footer" class="footer-btns">
<span slot="footer">
<el-button :size="size" type="default" @click="handleReset">重置</el-button>
<el-button :size="size" type="primary" @click="handleSearch">查询</el-button>
</span>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!