Commit 0e7d6b76 by 胡悦

提交概览

1 parent fbf2af39
import { http } from '@/main'
const timePeriodStatistics = params => {
params.method = 'scrm.api.shopmall.order.timePeriodStatistics'
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
const couponStatistical = params => {
params.method = 'scrm.api.coupon.statistical.marketing.effect'
return http({
url: 'rop-scrm-coupon/router',
method: 'GET',
data: params,
sign: true
})
}
const equityStatistical = params => {
params.method = 'scrm.api.equity.statistical.marketing.effect'
return http({
url: 'rop-scrm-equity/router',
method: 'GET',
data: params,
sign: true
})
}
const merchantStatistical = params => {
params.method = 'scrm.api.shopmall.activity.get.merchant.statistics'
return http({
url: 'rop-scrm-shopmall/router',
method: 'GET',
data: params,
sign: true
})
}
export default { timePeriodStatistics, couponStatistical, equityStatistical, merchantStatistical }
<template>
<div id="bar" class="chart-bar"></div>
<div class="chart-box">
<div id="bar" class="chart-bar"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'BarChart',
props: ['list'],
data() {
return {}
},
methods: {
getChart() {
let chartDom = document.getElementById('bar')
let myChart = echarts.init(chartDom)
let option
const data = []
for (let i = 0; i < 5; ++i) {
data.push(Math.round(Math.random() * 200))
}
option = {
return {
myChart: {},
option: {
xAxis: {
max: 'dataMax'
},
yAxis: {
type: 'category',
data: ['A', 'B', 'C', 'D', 'E'],
data: [],
inverse: true,
animationDuration: 300,
animationDurationUpdate: 300,
max: 2 // only the largest 3 bars will be displayed
max: 4 // only the largest 3 bars will be displayed
},
grid: {
x: 120,
y: 0,
x2: 50,
y2: 0
},
series: [
{
realtimeSort: true,
name: 'X',
type: 'bar',
data: data,
data: [],
label: {
show: true,
position: 'right',
valueAnimation: true,
normal: [20, 0]
valueAnimation: true
},
itemStyle: {
normal: {
label: {
show: true,
textStyle: {
color: '#fff',
fontSize: 16
}
},
color: '#5850FF' // 修改柱状颜色
}
}
}
],
......@@ -52,19 +63,42 @@ export default {
animationEasing: 'linear',
animationEasingUpdate: 'linear'
}
option && myChart.setOption(option)
}
},
watch: {
list(val) {
const yData = val.map(i => i.packageName)
const data = val.map(i => i.totalSales)
this.option.yAxis.data = yData
this.option.series[0].data = data
console.log(this.option)
this.option && this.myChart.setOption(this.option)
}
},
methods: {
getChart() {
let option
const data = []
for (let i = 0; i < 5; ++i) {
data.push(Math.round(Math.random() * 200))
}
}
},
mounted() {
this.getChart()
// this.getChart()
let chartDom = document.getElementById('bar')
this.myChart = echarts.init(chartDom)
this.option && this.myChart.setOption(this.option)
}
}
</script>
<style lang="scss" scoped>
.chart-box {
width: 100%;
height: 207px;
}
.chart-bar {
width: 235px;
height: 207px;
}
</style>
<template>
<div id="line" class="chart-line"></div>
<div class="chart-box">
<div class="chart-line" id="line"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'LineChart',
props: ['list'],
data() {
return {}
},
methods: {
getChart() {
let chartDom = document.getElementById('line')
let myChart = echarts.init(chartDom)
let option
option = {
return {
option: {
tooltip: {
trigger: 'axis',
// formatter: `{b}\r \n成交金额:{c}\n \n 订单总数:{d}单`
formatter: function(params) {
var tips = ''
console.log(params)
if (params != null && params.length > 0) {
tips += params[0].name + '<br />'
for (var i = 0; i < params.length; i++) {
params[i].marker = '<span style="display:inline-block;margin-right:4px;border-radius:10px;width:10px;height:10px;background-color:#5850FF;"></span>'
tips += params[i].marker + '成交金额: ' + params[i].value + '元'
}
}
return tips
// var res = `<div>${params[0].name}</div>
// <div>成交金额:${params[0].data}元</div>
// <div>订单总数:${params[0].value}</div>`
// return res
}
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data: []
},
yAxis: {
type: 'value'
},
// legend: {
// height: 260,
// width: 1184
// },
grid: {
x: 80,
y: 50,
x2: 50,
y2: 50
},
series: [
{
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
data: [],
type: 'line',
itemStyle: {
normal: {
lineStyle: {
color: '#5850FF' // 改变折线颜色
}
}
}
}
]
}
option && myChart.setOption(option)
},
myChart: {}
}
},
watch: {
list(val) {
console.log(val)
const xData = val.map(i => i.dataDateStr)
const yData = val.map(i => i.amount)
this.option.xAxis.data = xData.reverse()
this.option.series[0].data = yData
this.option.series[0].count = val.map(i => i.count)
this.option && this.myChart.setOption(this.option)
}
},
methods: {},
mounted() {
this.getChart()
let chartDom = document.getElementById('line')
this.myChart = echarts.init(chartDom)
// this.option && this.myChart.setOption(this.option)
}
}
</script>
<style lang="scss" scoped>
.chart-box {
height: 260px;
width: 100%;
}
.chart-line {
height: 260px;
width: 880px;
}
</style>
<template>
<div id="pie" class="chart-pie"></div>
<div class="chart-box">
<div id="pie" class="chart-pie"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
const DISCOUNT_TYPE = {
1: '满减券',
2: '折扣券',
3: '代金券',
4: '兑换券',
5: '购车代金券',
6: '商品折扣券',
7: '会员服务'
}
export default {
name: 'PieChart',
props: ['list'],
data() {
return {}
},
methods: {
getChart() {
let chartDom = document.getElementById('pie')
let myChart = echarts.init(chartDom)
let option
option = {
// title: {
// text: 'Referer of a Website',
// subtext: 'Fake Data',
// left: 'center'
// },
return {
DISCOUNT_TYPE,
option: {
tooltip: {
trigger: 'item',
formatter: '{b}\n \n{c} 张'
},
// legend: {
// orient: 'vertical',
// left: 'left'
// },
series: [
{
name: '券类营销',
......@@ -40,15 +36,12 @@ export default {
itemStyle: {
normal: {
color: function(params) {
var colorList = ['#5850FF', '#FE9C1C']
var colorList = ['#5850FF', '#FE9C1C', '#FDB757', '#6495FA']
return colorList[params.dataIndex]
}
}
},
data: [
{ value: 1048, name: '折扣券' },
{ value: 75, name: '兑换券' }
],
data: [],
emphasis: {
itemStyle: {
shadowBlur: 10,
......@@ -58,20 +51,38 @@ export default {
}
}
]
}
option && myChart.setOption(option)
},
myChart: {}
}
},
watch: {
list(val) {
const arr = this.list.map(item => {
return {
name: this.DISCOUNT_TYPE[item.discountType],
value: item.totalIssue
}
})
this.option.series[0].data = arr
console.log(arr)
this.option && this.myChart.setOption(this.option)
}
},
methods: {},
mounted() {
this.getChart()
let chartDom = document.getElementById('pie')
this.myChart = echarts.init(chartDom)
this.option && this.myChart.setOption(this.option)
}
}
</script>
<style lang="scss" scoped>
.chart-box {
width: 100%;
height: 185px;
}
.chart-pie {
width: 330px;
height: 185px;
}
</style>
......@@ -12,13 +12,13 @@
<div class="marketing-title">
<div>
{{item.title}}
<img class="marketing-icon" src="@/assets/edit.png" alt />
<!-- <img class="marketing-icon" src="@/assets/edit.png" alt /> -->
</div>
<img class="marketing-img" src="@/assets/memberCard.png" alt />
<img class="marketing-img" src="@/assets/icon-d.png" alt />
</div>
<div class="marketing-content">{{item.content}}</div>
<div class="marketing-btn">
<el-button type="primary" size="small">{{item.linkName}}</el-button>
<el-button type="primary" size="small" @click="jumpPage(item.path)">{{item.linkName}}</el-button>
</div>
</div>
</div>
......@@ -37,7 +37,7 @@
<img :src="iconUrl" alt />
</span>
<span class="date-content">
<span class="data-num">1245</span>张
<span class="data-num">{{coupon.totalIssue}}</span>张
</span>
</div>
<div class="data-item">
......@@ -46,7 +46,7 @@
<img :src="iconUrl" alt />
</span>
<span class="date-content">
<span class="data-num">155</span>张
<span class="data-num">{{coupon.totalIssue}}</span>张
</span>
</div>
<div class="data-item">
......@@ -55,15 +55,18 @@
<img :src="iconUrl" alt />
</span>
<span class="date-content">
<span class="data-num">44</span>张
<span class="data-num">{{coupon.totalVerification}}</span>张
</span>
</div>
<div class="data-last">
<span class="data-name">核销总数</span>
<span class="data-percentage">60%</span>
<span class="data-percentage">{{coupon.verificationRate}}</span>
</div>
</div>
<PieChart class="coupons-right" v-show="true"></PieChart>
<div class="pie-box">
<PieChart :list.sync="coupon.list" class="coupons-right"></PieChart>
<!-- <div v-else class="no-data">暂无数据</div> -->
</div>
</div>
</div>
<!-- 秒杀活动 -->
......@@ -72,28 +75,55 @@
<div class="data-item">
<span class="data-title w-118">
参与活动总人数
<img :src="iconUrl" alt />
<el-popover
placement="top-start"
title="参与活动总人数"
width="200"
trigger="hover"
content="购买活动商品的账号数量。"
>
<img slot="reference" :src="iconUrl" alt />
</el-popover>
<!-- <img :src="iconUrl" alt /> -->
</span>
<span class="date-content">
<span class="data-num">1245</span>人
<span class="data-num">{{merchant.saleAmount}}</span>人
</span>
</div>
<div class="data-item">
<span class="data-title w-118">
浏览量
<img :src="iconUrl" alt />
<el-popover
placement="top-start"
title="浏览量"
width="200"
trigger="hover"
content="购买活动商品的账号数量。"
>
<img slot="reference" :src="iconUrl" alt />
</el-popover>
<!-- <img :src="iconUrl" alt /> -->
</span>
<span class="date-content">
<span class="data-num">155</span>人
<span class="data-num">{{merchant.viewAmount}}</span>人
</span>
</div>
<div class="data-item">
<span class="data-title w-118">
累计销量
<img :src="iconUrl" alt />
<el-popover
placement="top-start"
title="累计销量"
width="200"
trigger="hover"
content="购买活动商品的账号数量。"
>
<img slot="reference" :src="iconUrl" alt />
</el-popover>
<!-- <img :src="iconUrl" alt /> -->
</span>
<span class="date-content">
<span class="data-num">121,144</span>元
<span class="data-num">{{merchant.salePrice}}</span>元
</span>
</div>
</div>
......@@ -107,28 +137,32 @@
<div class="data-item" style="margin-top: 10px;">
<span class="data-title w-118">总会员数</span>
<span class="date-content">
<span class="data-num">1245</span>人
<span class="data-num">{{equity.totalMembership}}</span>人
</span>
</div>
<div class="data-item" style="margin-top: 10px;">
<span class="data-title w-118">今日新增</span>
<span class="date-content">
<span class="data-num">2</span>人
<span class="data-num">{{equity.todayMembership}}</span>人
</span>
</div>
<div class="data-item" style="margin-top: 10px;">
<div class="data-half" style="margin-right: 20px;">
<span class="data-half-name">周同比</span>
<span class="data-half-red data-red-percentage">
<span class="data-red-triangle"></span>
<span>11%</span>
<span
:class="[equity.weekFlag ? 'data-red-percentage data-half-red':'data-green-percentage data-half-green']"
>
<span :class="[equity.weekFlag ? 'data-red-triangle':'data-green-triangle']"></span>
<span>{{equity.lastWeekDayMemberShipCompared}}</span>
</span>
</div>
<div class="data-half">
<span class="data-half-name">日环比</span>
<span class="data-half-green data-green-percentage">
<span class="data-green-triangle"></span>
<span>11%</span>
<span
:class="[equity.dayFlag ? 'data-red-percentage data-half-red':'data-green-percentage data-half-green']"
>
<span :class="[equity.dayFlag ? 'data-red-triangle':'data-green-triangle']"></span>
<span>{{equity.yesterdayMembershipSequential}}</span>
</span>
</div>
</div>
......@@ -137,16 +171,20 @@
<div class="title">
<span>套餐总售卖</span>
<span class="sold-num">
14
{{equity.totalSales}}
<span>单</span>
</span>
</div>
<BarChart></BarChart>
<div class="bar-box">
<BarChart :list.sync="equity.countMerchantOrderList"></BarChart>
<!-- <div v-else class="no-data">暂无数据</div> -->
</div>
<div>
<div class="data-item">
<span class="data-title w-118">累计产值</span>
<span class="date-content">
<span class="data-num orange">1100</span>元
<span class="data-num orange">{{equity.totalProductionValue}}</span>元
</span>
</div>
<div class="data-tips">注:仅体现套餐售卖数最多的前5单</div>
......@@ -157,23 +195,27 @@
<div class="border home-bottom">
<div class="title bottom-title">
<div>微店数据</div>
<div>
<el-button type="text">本周</el-button>
<el-button type="text">本月</el-button>
<el-button type="text">全年</el-button>
<div style="width: 32%;">
<el-button type="text" @click="storeData('week')">本周</el-button>
<el-button type="text" @click="storeData('month')">本月</el-button>
<el-button type="text" @click="storeData('year')">全年</el-button>
<el-date-picker
class="bottom-picker"
v-model="value1"
v-model="date"
type="daterange"
size="small"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
@change="dateChange"
></el-date-picker>
</div>
</div>
<div class="bottom-content">
<LineChart></LineChart>
<div class="line-box">
<LineChart :list.sync="order.list"></LineChart>
<!-- <div v-else class="no-data">暂无数据</div> -->
</div>
<div class="bottom-right">
<div class="bottom-right-item">
<div class="item-content">
......@@ -181,31 +223,31 @@
<div>
<div>成交金额</div>
<div class="item-number">
12600
{{order.totalAmount}}
<span>元</span>
</div>
</div>
</div>
<div class="item-chain">
<!-- <div class="item-chain">
<span>同比上月</span>
<span class="green-num">0.3%</span>
</div>
</div>-->
</div>
<div class="bottom-right-item">
<div class="item-content">
<img src="@/assets/icon-order.png" alt />
<div>
<div>成交金额</div>
<div>订单总数</div>
<div class="item-number">
12600
<span>元</span>
{{order.totalCount}}
<span>单</span>
</div>
</div>
</div>
<div class="item-chain">
<!-- <div class="item-chain">
<span>同比上月</span>
<span class="red-num">0.3%</span>
</div>
</div>-->
</div>
</div>
</div>
......@@ -219,6 +261,7 @@ const iconUrl =
import PieChart from './components/pieChart'
import BarChart from './components/barChart'
import LineChart from './components/lineChart'
import * as dayjs from 'dayjs'
export default {
name: 'home',
components: {
......@@ -233,23 +276,123 @@ export default {
{
title: '日常关怀',
content: '可把通知、祝福、活动等消息批量发送给客户,员工可对客户进行后续的服务。',
linkName: '群发关怀信息'
linkName: '群发关怀信息',
path: '/customerTransform/index'
},
{
title: '活动促销',
content: '门店做营销活动时,可通过优惠卡券、门店商品秒杀的形式配置活动内容。',
linkName: '设置营销活动'
title: '会员服务',
content: '会员服务由门店根据自店服务项目创建的线上服务券,如“一年十二次洗车券”、“陶瓷镀膜”等,客户购买后可到店出示服务券享受服务,门店扫码进行次数核销。',
linkName: '设置会员服务',
path: '/memberCenter/center'
},
{
title: '商品销售',
content: '管理上下架门店自有的商品,可配置带货商品活动商品销售分润。',
linkName: '上架商品'
linkName: '上架商品',
path: '/homeSet/index'
}
],
value1: ''
date: [],
order: {
list: []
},
coupon: {
list: []
},
equity: {
countMerchantOrderList: []
},
merchant: {}
}
},
methods: {}
mounted() {
const start = new Date()
this.$set(this.date, 0, start.setTime(start.getTime() - 3600 * 1000 * 24 * 14))
this.$set(this.date, 1, new Date())
this.init(this.date)
},
methods: {
init(date) {
this.couponStatistical()
this.timePeriodStatistics({
dataStartDateStr: dayjs(date[0]).format('YYYY-MM-DD'),
dataEndDateStr: dayjs(date[1]).format('YYYY-MM-DD')
})
this.equityStatistical()
this.merchantStatistical()
},
dateChange(val) {
console.log(val)
const params = {
dataStartDateStr: dayjs(val[0]).format('YYYY-MM-DD'),
dataEndDateStr: dayjs(val[1]).format('YYYY-MM-DD')
}
this.timePeriodStatistics(params)
},
storeData(name) {
let startTime, endTime
let now = new Date()
let nowDayOfWeek = now.getDay()
let nowDay = now.getDate()
let nowMonth = now.getMonth()
let nowYear = now.getFullYear()
switch (name) {
case 'week':
startTime = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek)
endTime = new Date(nowYear, nowMonth, nowDay + 6 - nowDayOfWeek)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
break
case 'month':
startTime = new Date(nowYear, nowMonth, 1)
endTime = new Date(nowYear, nowMonth + 1, 0)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
break
case 'year':
startTime = new Date(nowYear, 0, 1)
endTime = new Date(nowYear, 11, 31)
this.$set(this.date, 0, startTime)
this.$set(this.date, 1, endTime)
this.dateChange(this.date)
break
}
},
jumpPage(path) {
console.log(path)
this.$router.push(path)
},
couponStatistical() {
const params = {
discountTypes: [2, 3, 4, 7]
}
this.$apis.home.couponStatistical(params).then(res => {
this.coupon = res
})
},
equityStatistical() {
this.$apis.home.equityStatistical({}).then(res => {
this.equity = res
this.equity.weekFlag = this.equity.lastWeekDayMemberShipCompared.indexOf('-') == -1
this.equity.dayFlag = this.equity.yesterdayMembershipSequential.indexOf('-') == -1
})
},
merchantStatistical() {
this.$apis.home.merchantStatistical({}).then(res => {
console.log(res)
this.merchant = res
})
},
timePeriodStatistics(params) {
this.$apis.home.timePeriodStatistics(params).then(res => {
if (res) {
this.order = res
}
})
}
}
}
</script>
......@@ -330,7 +473,7 @@ export default {
}
&-red-triangle {
display: inline-block;
margin-top: -1px;
margin-top: -4px;
border-width: 6.5px;
margin-right: 2px;
border-style: dashed dashed solid dashed;
......@@ -338,7 +481,7 @@ export default {
}
&-green-triangle {
display: inline-block;
margin-bottom: -3px;
margin-bottom: -4px;
border-width: 6.5px;
margin-right: 2px;
border-style: solid dashed dashed dashed;
......@@ -364,13 +507,16 @@ export default {
}
.home-top {
display: flex;
width: 100%;
.home-left {
margin-right: 20px;
width: 75%;
.marketing {
display: flex;
margin-bottom: 20px;
&-item {
width: 275px;
width: 33%;
// width: 275px;
box-sizing: border-box;
margin-right: 20px;
&:last-child {
......@@ -399,7 +545,7 @@ export default {
color: #333333;
line-height: 20px;
margin-bottom: 20px;
min-height: 60px;
min-height: 80px;
}
&-btn {
text-align: center;
......@@ -411,22 +557,26 @@ export default {
justify-content: space-between;
}
.coupons {
width: 570px;
// width: 570px;
width: 66.6%;
box-sizing: border-box;
&-content {
display: inline-flex;
width: 100%;
}
&-left {
width: 200px;
width: 50%;
}
&-right {
flex: 1;
// flex: 1;
// width: 50%;
display: inline-block;
}
}
.activity {
display: inline-block;
width: 275px;
// width: 275px;
width: calc(33.3% - 20px);
box-sizing: border-box;
}
.name {
......@@ -444,8 +594,8 @@ export default {
.home-right {
// flex: 1;
width: 275px;
height: 540px;
width: 25%;
height: 555px;
box-sizing: border-box;
.membership-data {
padding-bottom: 20px;
......@@ -471,7 +621,8 @@ export default {
}
}
.home-bottom {
width: 1160px;
// width: 1160px;
width: 100%;
box-sizing: border-box;
margin-top: 20px;
.bottom {
......@@ -480,7 +631,8 @@ export default {
justify-content: space-between;
}
&-picker {
width: 240px;
// width: 240px;
// width: 25%;
margin-left: 20px;
}
&-content {
......@@ -548,4 +700,25 @@ export default {
}
}
}
.line-box {
position: relative;
height: 260px;
width: 77%;
}
.bar-box {
position: relative;
width: 100%;
height: 207px;
}
.pie-box {
position: relative;
width: 50%;
height: 185px;
}
.no-data {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%, -50%);
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!