Commit bbb8988f by 匡雅琴

样式调整。bug修复

1 parent d9064f44
...@@ -168,7 +168,7 @@ export default { ...@@ -168,7 +168,7 @@ export default {
_html = '' _html = ''
break break
default: default:
_html = params.name _html = utils.legend(params.name)
} }
return _html return _html
}, },
......
...@@ -140,6 +140,18 @@ const toPercent = num => { ...@@ -140,6 +140,18 @@ const toPercent = num => {
str += '%' str += '%'
return str return str
} }
// piechart文字超出六个字换行
const legend = val => {
if (val.length > 6) {
const firstText = val.substring(0, 6)
const lastText = val.substring(6)
return `${firstText}\n{c|${lastText}}`
} else {
return val
}
}
const utils = { const utils = {
getParams, getParams,
getQuery, getQuery,
...@@ -153,7 +165,8 @@ const utils = { ...@@ -153,7 +165,8 @@ const utils = {
debounce, debounce,
setChartFontSize, setChartFontSize,
deepClone, deepClone,
toPercent toPercent,
legend
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
......
...@@ -19,14 +19,14 @@ ...@@ -19,14 +19,14 @@
<div class="ratio"> <div class="ratio">
<div class="ratio-left"> <div class="ratio-left">
周同比 周同比
<span class="positive">{{toPercent(tb)}}</span> <span class="positive">{{ toPercent(tb) }}</span>
</div> </div>
<div class="ratio-right"> <div class="ratio-right">
日环比 日环比
<span class="negative">{{toPercent(hb)}}</span> <span class="negative">{{ toPercent(hb) }}</span>
</div> </div>
</div> </div>
<BarChart ref="amountChartRef" domId="amountChart" :dataList.sync="dataList.amountDataList" :colorList="color.amountColorList" :tooltipFormatterObj="tooltips.outputvalueTooltip"></BarChart> <BarChart ref="amountChartRef" domId="amountChart" formatYAxis :dataList.sync="dataList.amountDataList" :colorList="color.amountColorList" :tooltipFormatterObj="tooltips.outputvalueTooltip"></BarChart>
</div> </div>
</div> </div>
<div class="left-box"> <div class="left-box">
...@@ -184,6 +184,11 @@ export default { ...@@ -184,6 +184,11 @@ export default {
display: flex; display: flex;
width: 100%; width: 100%;
justify-content: space-between; justify-content: space-between;
&-left,
&-right {
font-size: 12px;
color: #95acd9;
}
.positive, .positive,
.negative { .negative {
display: inline-block; display: inline-block;
......
...@@ -45,7 +45,8 @@ export default { ...@@ -45,7 +45,8 @@ export default {
isMultiple: { isMultiple: {
type: Boolean, type: Boolean,
default: false default: false
} },
formatYAxis: Boolean
}, },
data() { data() {
return { return {
...@@ -53,7 +54,7 @@ export default { ...@@ -53,7 +54,7 @@ export default {
} }
}, },
created() { created() {
this.barOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter }, this.colorList, this.isMultiple, this.barWidth) this.barOptions = BarOptions({ tooltipFormatter: this.tooltipFormatter }, this.colorList, this.isMultiple, this.barWidth, this.formatYAxis)
}, },
mounted() { mounted() {
this.barDom = document.getElementById(this.domId) this.barDom = document.getElementById(this.domId)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @LastEditTime: 2023-08-03 16:42:12 * @LastEditTime: 2023-08-03 16:42:12
*/ */
import * as echarts from 'echarts' import * as echarts from 'echarts'
function getBarOptions(obj, colorList, isMultiple, barwidth) { function getBarOptions(obj, colorList, isMultiple, barwidth, formatYAxis) {
const barWidth = barwidth || '14' const barWidth = barwidth || '14'
const multiple = isMultiple || false const multiple = isMultiple || false
const { tooltipFormatter } = obj const { tooltipFormatter } = obj
...@@ -31,6 +31,16 @@ function getBarOptions(obj, colorList, isMultiple, barwidth) { ...@@ -31,6 +31,16 @@ function getBarOptions(obj, colorList, isMultiple, barwidth) {
lineStyle: { lineStyle: {
color: '#1d2a38' color: '#1d2a38'
} }
},
axisLabel: {
// 这种做法就是在y轴的数据的值旁边拼接单位,貌似也挺方便的
formatter: function(value) {
if (formatYAxis) {
return `${value / 10000}万`
} else {
return value
}
}
} }
}, },
grid: { grid: {
......
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
data() { data() {
return { return {
tabList: ['AR导航', '360全景导航', '座椅通风', '氛围灯'], tabList: ['AR导航', '360全景导航', '座椅通风', '氛围灯', '数字化美容'],
sessionRankList: [], sessionRankList: [],
productionRankList: [], productionRankList: [],
percentRankList: [], percentRankList: [],
...@@ -91,7 +91,8 @@ export default { ...@@ -91,7 +91,8 @@ export default {
width: '3vw', width: '3vw',
type: 'decimal' type: 'decimal'
} }
] ],
tabItem: 'AR'
} }
}, },
created() { created() {
...@@ -104,10 +105,10 @@ export default { ...@@ -104,10 +105,10 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
async getBrandRank(month, queryItem = 'AR') { async getBrandRank(month, queryItem) {
const _params = { const _params = {
month, month,
queryItem queryItem: queryItem || this.tabItem
} }
const _result = await this.api.crowdFunding.getBrandRank(_params) const _result = await this.api.crowdFunding.getBrandRank(_params)
const { actiRank, avgChargebackRank, avgTransRank, outputRank } = _result.data.dataList[0] const { actiRank, avgChargebackRank, avgTransRank, outputRank } = _result.data.dataList[0]
...@@ -121,15 +122,23 @@ export default { ...@@ -121,15 +122,23 @@ export default {
switch (val) { switch (val) {
case 0: case 0:
this.getBrandRank(this.month, 'AR') this.getBrandRank(this.month, 'AR')
this.tabItem = 'AR'
break break
case 1: case 1:
this.getBrandRank(this.month, 'navigation360') this.getBrandRank(this.month, 'navigation360')
this.tabItem = 'navigation360'
break break
case 2: case 2:
this.getBrandRank(this.month, 'seat') this.getBrandRank(this.month, 'seat')
this.tabItem = 'seat'
break break
case 3: case 3:
this.getBrandRank(this.month, 'light') this.getBrandRank(this.month, 'light')
this.tabItem = 'light'
break
case 4:
this.getBrandRank(this.month, 'digitalbeauty')
this.tabItem = 'digitalbeauty'
break break
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<box-title title="门店排名"></box-title> <box-title title="门店排名"></box-title>
<inner-tab class="tab-box" :list="tabList" :width="21.16" :itemPadding="1.53" @changeTab="changeTab"></inner-tab> <inner-tab class="tab-box" :list="tabList" :width="21.16" :itemPadding="1.53" @changeTab="changeTab"></inner-tab>
<div class="rank-content" v-if="merchantRankList.length"> <div class="rank-content" v-if="merchantRankList.length">
<Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="rankingDataObj" @goDetailPage="goDetailPage"></Ranking> <Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="isRate ? rankingRateObj : rankingDataObj" @goDetailPage="goDetailPage"></Ranking>
</div> </div>
<div v-else class="empty"> <div v-else class="empty">
<Empty></Empty> <Empty></Empty>
...@@ -20,13 +20,14 @@ export default { ...@@ -20,13 +20,14 @@ export default {
data() { data() {
return { return {
isRate: false,
dataList: {}, dataList: {},
tabList: ['产值排名', '转化率排名', ' 退单率排名'], tabList: ['产值排名', '转化率排名', ' 退单率排名'],
merchantRankList: [], merchantRankList: [],
rankingDataObj: [ rankingDataObj: [
{ {
name: 'merchantName', name: 'merchantName',
width: '17vw', width: '20vw',
action: true action: true
}, },
{ {
...@@ -34,6 +35,18 @@ export default { ...@@ -34,6 +35,18 @@ export default {
width: '8vw', width: '8vw',
type: 'number' type: 'number'
} }
],
rankingRateObj: [
{
name: 'merchantName',
width: '20vw',
action: true
},
{
name: 'num',
width: '8vw',
type: 'decimal'
}
] ]
} }
}, },
...@@ -68,12 +81,15 @@ export default { ...@@ -68,12 +81,15 @@ export default {
switch (val) { switch (val) {
case 0: case 0:
this.merchantRankList = this.dataList.outputRank this.merchantRankList = this.dataList.outputRank
this.isRate = false
break break
case 1: case 1:
this.merchantRankList = this.dataList.transRank this.merchantRankList = this.dataList.transRank
this.isRate = true
break break
case 2: case 2:
this.merchantRankList = this.dataList.chargebackRank this.merchantRankList = this.dataList.chargebackRank
this.isRate = true
break break
} }
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<box-title title="近一年门店活动排名"></box-title> <box-title title="近一年门店活动排名"></box-title>
<inner-tab class="tab-box" :list="tabList" :width="25" :itemPadding="1.05" @changeTab="changeTab"></inner-tab> <inner-tab class="tab-box" :list="tabList" :width="25" :itemPadding="1.05" @changeTab="changeTab"></inner-tab>
<div class="rank-content" v-if="merchantRankList.length"> <div class="rank-content" v-if="merchantRankList.length">
<Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="rankingDataObj" @goDetailPage="goDetailPage"></Ranking> <Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="isRate ? rankingRateObj : rankingDataObj" @goDetailPage="goDetailPage"></Ranking>
</div> </div>
<div v-else class="empty"> <div v-else class="empty">
<Empty></Empty> <Empty></Empty>
...@@ -18,13 +18,14 @@ export default { ...@@ -18,13 +18,14 @@ export default {
data() { data() {
return { return {
isRate: false,
dataList: {}, dataList: {},
tabList: ['活动场次排名', '活动平均客单价排名', '活动退单率排名'], tabList: ['活动场次排名', '活动平均客单价排名', '活动退单率排名'],
merchantRankList: [], merchantRankList: [],
rankingDataObj: [ rankingDataObj: [
{ {
name: 'merchantName', name: 'merchantName',
width: '17vw', width: '20vw',
action: true action: true
}, },
{ {
...@@ -32,6 +33,18 @@ export default { ...@@ -32,6 +33,18 @@ export default {
width: '8vw', width: '8vw',
type: 'number' type: 'number'
} }
],
rankingRateObj: [
{
name: 'merchantName',
width: '20vw',
action: true
},
{
name: 'num',
width: '8vw',
type: 'decimal'
}
] ]
} }
}, },
...@@ -63,12 +76,15 @@ export default { ...@@ -63,12 +76,15 @@ export default {
switch (val) { switch (val) {
case 0: case 0:
this.merchantRankList = this.dataList.activityRank this.merchantRankList = this.dataList.activityRank
this.isRate = false
break break
case 1: case 1:
this.merchantRankList = this.dataList.percRank this.merchantRankList = this.dataList.percRank
this.isRate = false
break break
case 2: case 2:
this.merchantRankList = this.dataList.chargebackRank this.merchantRankList = this.dataList.chargebackRank
this.isRate = true
break break
} }
} }
......
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
paymentLegend: [ paymentLegend: [
{ {
name: 'paymentModel', name: 'paymentModel',
width: '8vw' width: '12vw'
}, },
{ {
name: 'rate', name: 'rate',
......
...@@ -44,6 +44,11 @@ ...@@ -44,6 +44,11 @@
{{ toPercent(scope.row.chargebackRate) }} {{ toPercent(scope.row.chargebackRate) }}
</template> </template>
</el-table-column> </el-table-column>
<template slot="empty">
<div class="empty">
<Empty></Empty>
</div>
</template>
</el-table> </el-table>
<el-pagination <el-pagination
class="pagination-box" class="pagination-box"
...@@ -193,6 +198,9 @@ export default { ...@@ -193,6 +198,9 @@ export default {
.el-table__empty-block { .el-table__empty-block {
background-color: #051526; background-color: #051526;
} }
.el-table .cell {
line-height: 1vw;
}
.usual-row { .usual-row {
background: #051526 !important; background: #051526 !important;
} }
...@@ -200,3 +208,9 @@ export default { ...@@ -200,3 +208,9 @@ export default {
background: #072545 !important; background: #072545 !important;
} }
</style> </style>
<style lang="scss" scoped>
.empty {
margin: 15vh 0;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!