Commit be2c47e0 by 匡雅琴

样式调整

1 parent 7849151c
<template> <template>
<div class="legend-box" :style="legendStyle"> <div class="legend-box">
<div class="legend-item flex" v-for="(item, index) in dataList" :key="index"> <div class="legend-item flex" v-for="(item, index) in dataList" :key="index">
<div v-for="(itm, inx) in legentList" :key="inx"> <div class="legend-item-text" v-for="(itm, inx) in legentList" :key="inx">
<template v-if="inx == 0"> <template v-if="inx == 0">
<div class="flex legend-item-right"> <div class="flex legend-item-right">
<div class="icon" :style="{ background: colors[index] }"></div> <div class="icon" :style="{ background: colors[index] }"></div>
<div class="item-content">{{ item[itm.name] }}</div> <div class="item-content" :style="{ width: itm.width,'max-width': itm.width }">{{ item[itm.name] }}</div>
</div> </div>
</template> </template>
<template v-else> <template v-else>
<div class="flex item-content"> <div class="flex item-content" :style="{ width: itm.width,'max-width': itm.width }">
<div v-show="itm.hasIcon">{{ itm.hasIcon }}</div> <div v-show="itm.hasIcon">{{ itm.hasIcon }}</div>
<div v-if="itm.type == 'number'">{{numAddSymbol(item[itm.name])}}</div> <div v-if="itm.type == 'number'">{{numAddSymbol(item[itm.name])}}</div>
<div v-else-if="itm.type == 'decimal'">{{toPercent(item[itm.name])}}</div> <div v-else-if="itm.type == 'decimal'">{{toPercent(item[itm.name])}}</div>
...@@ -40,10 +40,6 @@ export default { ...@@ -40,10 +40,6 @@ export default {
colors: { colors: {
type: Array, type: Array,
default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#BF98FF', '#58D9F9'] default: () => ['#FF6E76', '#7CFFB2', ' #FDF006', '#4FA0FF', '#EB6001', '#BF98FF', '#BF98FF', '#58D9F9']
},
legendStyle: {
type: String,
default: ''
} }
}, },
watch: { watch: {
...@@ -64,13 +60,22 @@ export default { ...@@ -64,13 +60,22 @@ export default {
font-weight: 400; font-weight: 400;
line-height: 18px; line-height: 18px;
color: #c9c9c9ff; color: #c9c9c9ff;
justify-content: space-between; // justify-content: space-between;
&-text {
margin-right: 1.39vw;
}
&-text:last-child {
margin-right: 0;
}
&-right { &-right {
// margin-right: 1.39vw; // margin-right: 1.39vw;
} }
.item-content { .item-content {
text-align: left; text-align: left;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.icon { .icon {
width: 5px; width: 5px;
......
...@@ -87,6 +87,10 @@ export default { ...@@ -87,6 +87,10 @@ export default {
color: #ffffff; color: #ffffff;
margin-left: 1.11vw; margin-left: 1.11vw;
cursor: default; cursor: default;
max-width: 20.3vw;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
} }
.marquee { .marquee {
width: 17vw; width: 17vw;
......
...@@ -31,16 +31,19 @@ export default { ...@@ -31,16 +31,19 @@ export default {
progressData: [], progressData: [],
progressLegend: [ progressLegend: [
{ {
name: 'progress' name: 'progress',
width: '2.5vw'
}, },
{ {
name: 'rate', name: 'rate',
type: 'decimal' type: 'decimal',
width: '1.88vw'
}, },
{ {
name: 'purchaseamount', name: 'purchaseamount',
hasIcon: '¥', hasIcon: '¥',
type: 'number' type: 'number',
width: '3.1vw'
} }
] ]
} }
......
...@@ -31,23 +31,27 @@ export default { ...@@ -31,23 +31,27 @@ export default {
propertionData: [], propertionData: [],
propertionLegend: [ propertionLegend: [
{ {
name: 'goodsname' name: 'goodsname',
width: '2.5vw'
}, },
{ {
name: 'rate', name: 'rate',
type: 'decimal' type: 'decimal',
width: '1.88vw'
}, },
{ {
name: 'purchaseamount', name: 'purchaseamount',
hasIcon: '¥', hasIcon: '¥',
type: 'number' type: 'number',
width: '3.06vw'
}, },
{ {
name: 'averprice', name: 'averprice',
hasIcon: '均价¥', hasIcon: '均价¥',
type: 'number' type: 'number',
width: '4.24vw'
} }
], ]
} }
}, },
......
...@@ -35,8 +35,8 @@ export default { ...@@ -35,8 +35,8 @@ export default {
default: () => [] default: () => []
}, },
isEmpty: { isEmpty: {
type: Boolean, type: Boolean,
default: false default: false
} }
}, },
data() { data() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<view-date :defaultYear="defaultYear" :dataList="yearList" :businessTime="businessTime"></view-date> <view-date :defaultYear="defaultYear" :dataList="yearList" :businessTime="businessTime"></view-date>
<StatisticsBox class="statistic-box" :list="solarDetailList"></StatisticsBox> <StatisticsBox class="statistic-box" :list="solarDetailList"></StatisticsBox>
<!-- 采购趋势 --> <!-- 采购趋势 -->
<MerchantsPurchaseTrends :dataList="dataList" :isEmpty="isEmpty"></MerchantsPurchaseTrends> <MerchantsPurchaseTrends ref="merchantsTrends" :dataList="dataList" :isEmpty="isEmpty"></MerchantsPurchaseTrends>
<!-- 商品占比 --> <!-- 商品占比 -->
<MerchantsPropotion :shopmallData="shopmallData" :selfPickData="selfPickData"></MerchantsPropotion> <MerchantsPropotion :shopmallData="shopmallData" :selfPickData="selfPickData"></MerchantsPropotion>
</div> </div>
...@@ -123,7 +123,7 @@ export default { ...@@ -123,7 +123,7 @@ export default {
this.api.solar.getMerchantPurchase({ year: year, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchase({ year: year, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店采购额趋势失败')
return return
} }
const _dataList = res.data.dataList[0] const _dataList = res.data.dataList[0]
...@@ -134,6 +134,29 @@ export default { ...@@ -134,6 +134,29 @@ export default {
}) })
}) })
}, },
// 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势
getMerchantPurchaseTrend(year, merchantid) {
this.dataList = []
this.api.solar.getMerchantPurchaseTrend({ year: year, MerchantId: merchantid }).then(res => {
console.log(res)
if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败')
return
}
const _dataList = res.data.dataList
if (!_dataList.length) this.isEmpty = true
_dataList.forEach(item => {
this.dataList.push({
month: item.statDate,
data1: item.shopamount,
data2: item.selfamount,
data3: item.shopratio
})
})
this.$refs.merchantsTrends.$refs.purchaseTrend.drawBarLine()
})
},
// 获取所有门店数据
getAllRanking(purchaseType) { getAllRanking(purchaseType) {
return new Promise(resolve => { return new Promise(resolve => {
let _merchantList let _merchantList
...@@ -169,5 +192,4 @@ export default { ...@@ -169,5 +192,4 @@ export default {
margin-top: 1.78vh; margin-top: 1.78vh;
} }
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!