Commit 940cf2d0 by 胡悦

提交

1 parent dd263083
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="statistics-item" v-for="(item, index) in list" :key="index" :style="{'width': 100 / list.length + '%'}"> <div class="statistics-item" v-for="(item, index) in list" :key="index" :style="{'width': 100 / list.length + '%'}">
<div class="statistics-top"> <div class="statistics-top">
<div class="statistics-name">{{item.name}}</div> <div class="statistics-name">{{item.name}}</div>
<div class="statistics-price"><span v-if="item.unit == '¥'">¥</span><span class="statistics-price-number">{{numAddSymbol(item.value)}}</span><span v-if="item.unit == '%'">%</span></div> <div class="statistics-price"><span class="statistics-unit" v-if="item.unit == '¥'">¥</span><span class="statistics-price-number">{{numAddSymbol(item.value)}}</span><span v-if="item.unit == '%'">%</span></div>
<div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}%</span></div> <div v-if="item.rate" class="statistics-top-rate">占比<span>{{item.rate}}%</span></div>
</div> </div>
<div class="statistics-bottom" v-if="item.bottomLabel || item.bottomType"> <div class="statistics-bottom" v-if="item.bottomLabel || item.bottomType">
...@@ -86,6 +86,9 @@ export default { ...@@ -86,6 +86,9 @@ export default {
margin-bottom: 0.89vh; margin-bottom: 0.89vh;
height: 2.22vh; height: 2.22vh;
} }
&-unit {
padding-right: 0.56vw;
}
&-price { &-price {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -94,7 +97,7 @@ export default { ...@@ -94,7 +97,7 @@ export default {
font-size: 14px; font-size: 14px;
height: 3.11vh; height: 3.11vh;
&-number { &-number {
padding: 0 0.56vw; padding-right: 0.56vw;
font-size: 20px; font-size: 20px;
color: #5894FF; color: #5894FF;
background-image:-webkit-linear-gradient(left,#24D8FF,#7787FF); background-image:-webkit-linear-gradient(left,#24D8FF,#7787FF);
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: limin * @Author: limin
* @Date: 2021-06-07 14:12:32 * @Date: 2021-06-07 14:12:32
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-19 14:27:28 * @LastEditTime: 2023-07-21 15:00:41
*/ */
const state = { const state = {
reportParams: { reportParams: {
...@@ -14,7 +14,11 @@ const state = { ...@@ -14,7 +14,11 @@ const state = {
solarTime: '', solarTime: '',
merchantRankingList: [], merchantRankingList: [],
boutique: { boutique: {
year: '' year: '',
channel: {
label: '',
value: ''
}
} }
} }
const mutations = { const mutations = {
...@@ -32,6 +36,9 @@ const mutations = { ...@@ -32,6 +36,9 @@ const mutations = {
}, },
SET_BOUTIQUE_YEAR(state, meta) { SET_BOUTIQUE_YEAR(state, meta) {
state.boutique.year = meta state.boutique.year = meta
},
SET_BOUTIQUE_CHANNEL(state, meta) {
state.boutique.channel = meta
} }
} }
const actions = { const actions = {
...@@ -50,6 +57,9 @@ const actions = { ...@@ -50,6 +57,9 @@ const actions = {
}, },
setBoutiqueYear({ commit }, year) { setBoutiqueYear({ commit }, year) {
commit('SET_BOUTIQUE_YEAR', year) commit('SET_BOUTIQUE_YEAR', year)
},
setBoutiqueChannel({ commit }, channel) {
commit('SET_BOUTIQUE_CHANNEL', channel)
} }
} }
......
<!--
* @Description: 柱状图
* @Author: huyue
* @Date: 2023-07-07 14:01:42
* @LastEditors: huyue
* @LastEditTime: 2023-07-21 15:11:43
-->
<template>
<div>
<div :id="domId" style="width: 100%;" :style="{ height }"></div>
</div>
</template>
<script type="text/ecmascript-6">
import * as echarts from 'echarts'
import BarOptions from './BarOptions'
import utils from '../../utils/util'
export default {
name: 'BarChart',
props: {
height: {
type: String
},
domId: {
type: String,
default: 'bar-line'
},
dataList: {
type: Array,
default: () => []
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
barLineOptions: [],
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null
}
},
created() {
this.barLineOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter })
},
mounted() {
this.barLineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.barLineDom)
this.chartBindEvent()
},
methods: {
tooltipFormatter(obj) {
var _currentItem = this.dataList[obj[0].dataIndex]
var _html = ''
var _txt = ''
this.tooltipFormatterObj.forEach(item => {
_txt += `<div style="display:flex;"><div style="color: #c9c9c9">${item.label}:</div><div style="color: #fff;">${utils.numAddSymbol(_currentItem[item.attrName])}${item.addSymbol || ''}</div></div>`
})
_html += `<div style="backdrop-filter: blur(4px);background-color: #051526;border: 2px solid;border-image: linear-gradient(90deg, #074989, #30DCFF, #074989) 1;padding: 10px;">
${_txt}
</div>`
return _html
},
drawBar() {
this.barLineOptions.xAxis.data = this.dataList.map(item => item.month)
this.barLineOptions.series[0].data = this.dataList.map(item => item.data1)
this.barLineOptions.series[1].data = this.dataList.map(item => item.data2)
this[this.domId].setOption(this.barLineOptions)
},
chartBindEvent() {
// resize
window.addEventListener('resize', () => {
this[this.domId].resize()
})
}
}
}
</script>
<style scoped lang="scss">
</style>
/*
* @Description:
* @Author: huyue
* @Date: 2023-07-07 14:04:52
* @LastEditors: huyue
* @LastEditTime: 2023-07-21 15:11:21
*/
import * as echarts from 'echarts'
function getBarLineOptions(obj) {
const { tooltipFormatter } = obj
var barLineOption = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
padding: 0,
formatter: tooltipFormatter || '',
confine: true
},
xAxis: {
data: []
},
yAxis: {
name: '',
type: 'value',
// min: 0,
// max: 100,
splitLine: {
lineStyle: {
color: '#1d2a38'
}
}
},
grid: {
left: '3%',
right: '4%',
top: '20%',
bottom: '6%',
containLabel: true
},
series: [
{
name: 'bar',
type: 'bar',
data: [],
label: {
show: true,
position: 'top',
color: '#fff'
},
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#22D8FF'
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: '#223FA9'
},
{
offset: 1, // 指100%处的颜色
color: '#061422'
}]
)
}
}
},
{
name: 'bar2',
type: 'bar',
label: {
show: true,
position: 'top',
color: '#fff'
},
data: [],
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#2AD191'
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: '#0E958D'
},
{
offset: 1, // 指100%处的颜色
color: '#061422'
}]
)
}
}
},
{
name: 'bar3',
type: 'bar',
label: {
show: true,
position: 'top',
color: '#fff'
},
data: [],
show: false,
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#FFC200'
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: '#F2C101'
},
{
offset: 1, // 指100%处的颜色
color: '#061422'
}]
)
}
}
},
{
name: 'bar4',
type: 'bar',
label: {
show: true,
position: 'top',
color: '#fff'
},
data: [],
itemStyle: {
barBorderRadius: [2, 2, 0, 0], // 柱体圆角
color: function(params) {
return new echarts.graphic.LinearGradient(
0, 0, 0, 1, [{ // 代表渐变色从正上方开始
offset: 0, // offset范围是0~1,用于表示位置,0是指0%处的颜色
color: '#E65C01'
}, // 柱图渐变色
{
offset: 0.5, // 指100%处的颜色
color: '#E65C17'
},
{
offset: 1, // 指100%处的颜色
color: '#061422'
}]
)
}
}
}
]
}
return barLineOption
}
export default getBarLineOptions
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-05 10:35:43 * @Date: 2023-07-05 10:35:43
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-19 14:49:07 * @LastEditTime: 2023-07-21 15:09:33
--> -->
<template> <template>
<div class="view-date"> <div class="view-date">
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
统计渠道: 统计渠道:
<div class="year-plugin"> <div class="year-plugin">
<div class="year" @click.stop="switchChannel"> <div class="year" @click.stop="switchChannel">
全部渠道 {{$store.state.app.boutique.channel.label ? $store.state.app.boutique.channel.label : '全部渠道'}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt=""> <img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div> </div>
<SelectBox :isShow="channelShow" isObject :defaultValue="defaultChannel" @clickOutside="clickChannelOutside" :dataList="channelList" :boxWidth="'8.61vw'" @selectVal="selectChannelVal"></SelectBox> <SelectBox :isShow="channelShow" isObject :defaultValue="defaultChannel" @clickOutside="clickChannelOutside" :dataList="channelList" :boxWidth="'8.61vw'" @selectVal="selectChannelVal"></SelectBox>
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
if (defaultYear) this.setBoutiqueYear(defaultYear) if (defaultYear) this.setBoutiqueYear(defaultYear)
}, },
methods: { methods: {
...mapActions(['setBoutiqueYear']), ...mapActions(['setBoutiqueYear', 'setBoutiqueChannel']),
switchYear() { switchYear() {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
...@@ -81,6 +81,9 @@ export default { ...@@ -81,6 +81,9 @@ export default {
// 选择渠道触发事件 // 选择渠道触发事件
selectChannelVal(value) { selectChannelVal(value) {
console.log(value) console.log(value)
this.setBoutiqueChannel(value)
this.$emit('selectChannel', value)
this.switchChannel()
} }
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-04 13:55:35 * @Date: 2023-07-04 13:55:35
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-19 17:31:22 * @LastEditTime: 2023-07-21 15:49:39
--> -->
<template> <template>
<div class="left"> <div class="left">
...@@ -25,13 +25,17 @@ export default { ...@@ -25,13 +25,17 @@ export default {
computed: { computed: {
tabName() { tabName() {
let sname let sname
console.log(this.$store.state.app)
switch (this.activeName) { switch (this.activeName) {
case 0: case 0:
sname = 'BusinessTrends' sname = this.$store.state.app.boutique.channel.value == '1' ? 'BarTrends' : 'BusinessTrends'
break break
case 1: case 1:
sname = 'StoreMap' sname = 'StoreMap'
break break
case 2:
sname = 'BarTrends'
break
} }
return sname return sname
} }
...@@ -51,7 +55,7 @@ export default { ...@@ -51,7 +55,7 @@ export default {
label: '全部渠道', label: '全部渠道',
value: '' value: ''
}, { }, {
label: '春蕾兴东', label: '春蕾行动',
value: '1' value: '1'
}, { }, {
label: '广汇渠道', label: '广汇渠道',
......
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-21 15:31:16
-->
<template>
<div>
<box-title title="业务趋势"></box-title>
<BarChart ref="barTrendsRef" height="44.89vh" domId="barTrends" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarChart>
</div>
</template>
<script>
import BarChart from '../BarChart.vue'
import { changeMixin } from '@/mixins'
export default {
name: 'BarTrends',
components: {
BarChart
},
mixins: [changeMixin],
data() {
return {
tooltipFormatterObj: [
{
label: '开通商户',
attrName: 'data1'
},
{
label: '采购商户',
attrName: 'data2'
}
],
dataList: [],
isEmpty: false
}
},
mounted() {
},
methods: {
init() {
this.getDataList()
},
async getDataList() {
this.dataList = []
const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statDate,
data1: item.shopamount,
data2: item.selfamount,
data3: item.shopratio
})
})
this.$refs.barTrendsRef.drawBar()
}
}
}
</script>
...@@ -3,12 +3,18 @@ ...@@ -3,12 +3,18 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-19 17:18:33 * @Date: 2023-07-19 17:18:33
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-20 10:39:02 * @LastEditTime: 2023-07-20 17:42:42
--> -->
<template> <template>
<div> <div>
<box-title title="区域门店数据"></box-title> <box-title title="区域门店数据"></box-title>
<div class="content">
<Map></Map> <Map></Map>
<div class="content-right">
<div class="rank-title">区域门店排行</div>
<Ranking :id="'storeDistrict'" :rankingsList="storeDistrictList" :rankingDataObj="rankStoreObj"></Ranking>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
...@@ -17,6 +23,85 @@ export default { ...@@ -17,6 +23,85 @@ export default {
name: 'StoreMap', name: 'StoreMap',
components: { components: {
Map Map
},
data() {
return {
storeDistrictList: [
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '广东省',
per: '1225家'
},
{
name: '宁夏回族自治区',
per: '1225家'
},
{
name: '西藏自治区',
per: '1225家'
},
{
name: '新疆',
per: '1225家'
}
],
rankStoreObj: [
{
name: 'name',
width: '9.72vw'
},
{
name: 'per'
}
]
}
} }
} }
</script> </script>
<style lang="scss">
.content {
display: flex;
&-right {
margin-left: 4.41vw;
}
.rank-title {
width: 7.5vw;
height: 2.2vh;
line-height: 2.2vh;
padding-left: 0.83vw;
font-weight: 500;
font-size: 14px;
color: #FFFFFF;
background-image: linear-gradient(90deg, #003F57 0%, #111056 54%, #061422 100%);
margin-bottom: 1.86vh;
}
}
</style>
<template> <template>
<div class="detail-left-box"> <div class="detail-left-box">
<StatisticsBox :list="boutiqueDetailList"></StatisticsBox> <StatisticsBox :list="boutiqueDetailList"></StatisticsBox>
<BusinessDetailTrends class="trends-charts"></BusinessDetailTrends>
</div> </div>
</template> </template>
<script> <script>
import BusinessDetailTrends from './BusinessDetailTrends.vue'
export default { export default {
name: 'BoutiqueDetailLeft', name: 'BoutiqueDetailLeft',
components: {
BusinessDetailTrends
},
data() { data() {
return { return {
boutiqueDetailList: [ boutiqueDetailList: [
...@@ -71,4 +75,11 @@ export default { ...@@ -71,4 +75,11 @@ export default {
.detail-left-box { .detail-left-box {
width: 64.17vw; width: 64.17vw;
} }
.trends-charts {
width: 64.17vw;
height: 65.56vh;
background: #061422;
box-shadow: inset 0 0 20px 0 #3d57ff69;
margin-top: 1.78vh;
}
</style> </style>
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-21 16:32:58
-->
<template>
<div>
<box-title title="业务趋势"></box-title>
<BarLineChart ref="purchaseRef" height="58vh" domId="business" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
</div>
</template>
<script>
import BarLineChart from '../boutique/BarLineChart.vue'
import { changeMixin } from '@/mixins'
export default {
name: 'BusinessDetailTrends',
components: {
BarLineChart
},
mixins: [changeMixin],
data() {
return {
tooltipFormatterObj: [
{
label: '商城',
attrName: 'data1'
},
{
label: '自采',
attrName: 'data2'
},
{
label: '占比',
attrName: 'data3',
addSymbol: '%'
}
],
dataList: [],
isEmpty: false
}
},
mounted() {
},
methods: {
init() {
this.getDataList()
},
async getDataList() {
this.dataList = []
const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statDate,
data1: item.shopamount,
data2: item.selfamount,
data3: item.shopratio
})
})
this.$refs.purchaseRef.drawBarLine()
}
}
}
</script>
<style lang="scss">
</style>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2023-07-04 13:55:35 * @Date: 2023-07-04 13:55:35
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-07-20 15:22:15 * @LastEditTime: 2023-07-20 16:06:26
--> -->
<template> <template>
<div class="layout"> <div class="layout">
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
}, },
data() { data() {
return { return {
activeName: '1' activeName: '2'
} }
}, },
mounted() { mounted() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!