Commit ec6f3c37 by 胡悦

Merge branch 'v1.0.0' of http://192.168.3.233:8090/h5/glsk-data-view-pd into v1.0.0

2 parents 865c4297 be2c47e0
<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;
......
...@@ -8,16 +8,23 @@ ...@@ -8,16 +8,23 @@
<template> <template>
<div class="merchant-box"> <div class="merchant-box">
<box-title title="商户开通及使用趋势"></box-title> <box-title title="商户开通及使用趋势"></box-title>
<div v-if="!isEmpty">
<div class="legend"> <div class="legend">
<div class="legend-item"> <div class="legend-item">
<span class="open"></span>开通商户 <span class="open"></span>
开通商户
</div> </div>
<div class="legend-item"> <div class="legend-item">
<span class="procure"></span>采购商户 <span class="procure"></span>
采购商户
</div> </div>
</div> </div>
<BarChart ref="merchantTrendsRef" height="28.67vh" domId="merchantTrends" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarChart> <BarChart ref="merchantTrendsRef" height="28.67vh" domId="merchantTrends" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarChart>
</div> </div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -37,7 +44,8 @@ export default { ...@@ -37,7 +44,8 @@ export default {
attrName: 'data2' attrName: 'data2'
} }
], ],
dataList: [] dataList: [],
isEmpty: false
} }
}, },
mounted() { mounted() {
...@@ -50,6 +58,7 @@ export default { ...@@ -50,6 +58,7 @@ export default {
this.dataList = [] this.dataList = []
const _data = await this.api.solar.getAllOpenBuyTrend({ year: this.$store.state.app.solarYear }) const _data = await this.api.solar.getAllOpenBuyTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList const _dataList = _data.data.dataList
if (!_dataList.length) this.isEmpty = true
_dataList.forEach(item => { _dataList.forEach(item => {
this.dataList.push({ this.dataList.push({
month: item.statDate, month: item.statDate,
...@@ -62,7 +71,7 @@ export default { ...@@ -62,7 +71,7 @@ export default {
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.merchant-box { .merchant-box {
position: relative; position: relative;
// margin: 1.78vh 0; // margin: 1.78vh 0;
...@@ -90,12 +99,17 @@ export default { ...@@ -90,12 +99,17 @@ export default {
margin-right: 0.28vw; margin-right: 0.28vw;
} }
.open { .open {
background-image: linear-gradient(180deg, #22D8FF 0%, #223FA9 100%); background-image: linear-gradient(180deg, #22d8ff 0%, #223fa9 100%);
} }
.procure { .procure {
background-image: linear-gradient(180deg, #38FBB0 1%, #00A89E 100%); background-image: linear-gradient(180deg, #38fbb0 1%, #00a89e 100%);
}
} }
} }
.empty {
height: 28.67vh;
display: flex;
align-items: center;
} }
} }
</style> </style>
...@@ -38,16 +38,19 @@ export default { ...@@ -38,16 +38,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'
} }
], ]
} }
}, },
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<template> <template>
<div class="purchase-box"> <div class="purchase-box">
<box-title title="近一年采购额趋势"></box-title> <box-title title="近一年采购额趋势"></box-title>
<div v-if="!isEmpty">
<BarLineChart ref="purchaseRef" height="30.23vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart> <BarLineChart ref="purchaseRef" height="30.23vh" domId="purchase" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
<div class="legend"> <div class="legend">
<div class="legend-item shop"> <div class="legend-item shop">
...@@ -21,10 +22,15 @@ ...@@ -21,10 +22,15 @@
自采 自采
</div> </div>
<div class="legend-item"> <div class="legend-item">
<img class="icon-line" src="@/assets/images/icon-line.png" alt="">商城采购占比 <img class="icon-line" src="@/assets/images/icon-line.png" alt="" />
商城采购占比
</div> </div>
</div> </div>
</div> </div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
...@@ -49,7 +55,8 @@ export default { ...@@ -49,7 +55,8 @@ export default {
addSymbol: '%' addSymbol: '%'
} }
], ],
dataList: [] dataList: [],
isEmpty: false
} }
}, },
mounted() { mounted() {
...@@ -62,6 +69,7 @@ export default { ...@@ -62,6 +69,7 @@ export default {
this.dataList = [] this.dataList = []
const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear }) const _data = await this.api.solar.getAllPurchaseTrend({ year: this.$store.state.app.solarYear })
const _dataList = _data.data.dataList const _dataList = _data.data.dataList
if (!_dataList.length) this.isEmpty = true
_dataList.forEach(item => { _dataList.forEach(item => {
this.dataList.push({ this.dataList.push({
month: item.statDate, month: item.statDate,
...@@ -75,7 +83,7 @@ export default { ...@@ -75,7 +83,7 @@ export default {
} }
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.purchase-box { .purchase-box {
position: relative; position: relative;
margin: 1.78vh 0; margin: 1.78vh 0;
...@@ -114,21 +122,26 @@ export default { ...@@ -114,21 +122,26 @@ export default {
} }
} }
} }
.empty {
height: 30.23vh;
display: flex;
align-items: center;
}
} }
.shop { .shop {
.legend-even { .legend-even {
background-image: linear-gradient(180deg, #2AD190 1%, #00B7DF 100%); background-image: linear-gradient(180deg, #2ad190 1%, #00b7df 100%);
} }
.legend-odd { .legend-odd {
background-image: linear-gradient(180deg, #22D8FF 0%, #5C56FF 100%); background-image: linear-gradient(180deg, #22d8ff 0%, #5c56ff 100%);
} }
} }
.self { .self {
.legend-even { .legend-even {
background-image: linear-gradient(180deg, #145F4E 1%, #035972 100%); background-image: linear-gradient(180deg, #145f4e 1%, #035972 100%);
} }
.legend-odd { .legend-odd {
background-image: linear-gradient(180deg, #11627A 0%, #282F7A 100%); background-image: linear-gradient(180deg, #11627a 0%, #282f7a 100%);
} }
} }
</style> </style>
<template>
<div class="propotion-box flex">
<div class="propotion-box-left">
<box-title title="商城采购商品占比"></box-title>
<RightViewContent
v-if="shopmallData.length"
class="content-box"
:chart="shopmallChart"
:listData="shopmallData"
:legentList="shopmallLegend"
:legendColors="shopmallChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
<div class="propotion-box-right">
<box-title title="自采商品占比"></box-title>
<RightViewContent
v-if="selfPickData.length"
class="content-box"
:chart="selfPickChart"
:listData="selfPickData"
:legentList="selfPickLegend"
:legendColors="selfPickChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</div>
</template>
<script>
import RightViewContent from '../home/solar/RightViewContent.vue'
export default {
name: 'MerchantsPropotion',
components: {
RightViewContent
},
props: {
shopmallData: {
type: Array,
default: () => []
},
selfPickData: {
type: Array,
default: () => []
}
},
data() {
return {
// 商城采购饼图结构
shopmallChart: {
id: 'shopmall',
keys: ['goodsname', 'purchaseamount'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
shopmallLegend: [
{
name: 'goodsname'
},
{
name: 'rate',
type: 'decimal'
},
{
name: 'purchaseamount',
hasIcon: '¥',
type: 'number'
},
{
name: 'averprice',
hasIcon: '均价¥',
type: 'number'
}
],
// 自采饼图结构
selfPickChart: {
id: 'selfPick',
keys: ['goodsname', 'purchaseamount'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
selfPickLegend: [
{
name: 'goodsname'
},
{
name: 'rate',
type: 'decimal'
},
{
name: 'purchaseamount',
hasIcon: '¥',
type: 'number'
},
{
name: 'averprice',
hasIcon: '均价¥',
type: 'number'
}
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.propotion-box {
justify-content: space-between;
margin-top: 1.78vh;
&-left,
&-right {
width: 47.78vw;
height: 25.33vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
}
.content-box {
padding: 1.78vh 6.18vw 4.44vh 0;
}
.empty {
height: 22vh;
display: flex;
align-items: center;
}
}
</style>
<template>
<div class="tendency-box">
<box-title title="近一年采购额趋势"></box-title>
<div v-if="!isEmpty">
<div class="legend">
<div class="legend-item shop">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
<span>商城</span>
</div>
<div class="legend-item self">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
自采
</div>
<div class="legend-item">
<img class="icon-line" src="@/assets/images/icon-line.png" alt="" />
商城采购占比
</div>
</div>
<BarLineChart ref="purchaseTrend" height="36.45vh" domId="purchaseTrend" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
export default {
name: 'MerchantsPurchaseTrends',
props: {
dataList: {
type: Array,
default: () => []
},
isEmpty: {
type: Boolean,
default: false
}
},
data() {
return {
tooltipFormatterObj: [
{
label: '商城',
attrName: 'data1'
},
{
label: '自采',
attrName: 'data2'
},
{
label: '占比',
attrName: 'data3',
addSymbol: '%'
}
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="scss" scoped>
.tendency-box {
position: relative;
width: 96.67vw;
height: 39.78vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
margin-top: 1.78vh;
.legend {
display: flex;
position: absolute;
right: 1.39vw;
top: 2.22vh;
&-item {
display: flex;
align-items: center;
color: #fff;
margin-right: 1.67vw;
&:last-child {
margin-right: 0;
}
img {
width: 1.32vw;
height: 1vh;
margin-right: 0.28vw;
}
.icon-line {
width: 0.98vw;
height: 0.56vh;
}
.legend-even,
.legend-odd {
display: inline-block;
width: 0.83vw;
height: 1.33vh;
margin-right: 0.28vw;
font-size: 8px;
text-align: center;
}
}
}
.shop {
.legend-even {
background-image: linear-gradient(180deg, #2ad190 1%, #00b7df 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #22d8ff 0%, #5c56ff 100%);
}
}
.self {
.legend-even {
background-image: linear-gradient(180deg, #145f4e 1%, #035972 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #11627a 0%, #282f7a 100%);
}
}
}
.empty {
height: 36.45vh;
display: flex;
align-items: center;
}
</style>
...@@ -9,57 +9,9 @@ ...@@ -9,57 +9,9 @@
<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>
<!-- 采购趋势 --> <!-- 采购趋势 -->
<div class="tendency-box"> <MerchantsPurchaseTrends ref="merchantsTrends" :dataList="dataList" :isEmpty="isEmpty"></MerchantsPurchaseTrends>
<box-title title="近一年采购额趋势"></box-title>
<div class="legend">
<div class="legend-item shop">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
<span>商城</span>
</div>
<div class="legend-item self">
<span class="legend-even">双</span>
<span class="legend-odd">单</span>
自采
</div>
<div class="legend-item">
<img class="icon-line" src="@/assets/images/icon-line.png" alt="" />
商城采购占比
</div>
</div>
<BarLineChart ref="purchaseTrend" height="36.45vh" domId="purchaseTrend" :dataList.sync="dataList" :tooltipFormatterObj="tooltipFormatterObj"></BarLineChart>
</div>
<!-- 商品占比 --> <!-- 商品占比 -->
<div class="propotion-box flex"> <MerchantsPropotion :shopmallData="shopmallData" :selfPickData="selfPickData"></MerchantsPropotion>
<div class="propotion-box-left">
<box-title title="商城采购商品占比"></box-title>
<RightViewContent
v-if="shopmallData.length"
class="content-box"
:chart="shopmallChart"
:listData="shopmallData"
:legentList="shopmallLegend"
:legendColors="shopmallChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
<div class="propotion-box-right">
<box-title title="自采商品占比"></box-title>
<RightViewContent
v-if="selfPickData.length"
class="content-box"
:chart="selfPickChart"
:listData="selfPickData"
:legentList="selfPickLegend"
:legendColors="selfPickChart.colors"
></RightViewContent>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</div>
</div> </div>
</template> </template>
</view-container> </view-container>
...@@ -68,17 +20,21 @@ ...@@ -68,17 +20,21 @@
<script> <script>
import { changeMixin } from '@/mixins' import { changeMixin } from '@/mixins'
import RightViewContent from '../home/solar/RightViewContent.vue' import MerchantsPurchaseTrends from './MerchantsPurchaseTrends.vue'
import MerchantsPropotion from './MerchantsPropotion.vue'
export default { export default {
name: 'SolarDetail', name: 'SolarDetail',
mixins: [changeMixin], mixins: [changeMixin],
components: { components: {
RightViewContent MerchantsPropotion,
MerchantsPurchaseTrends
}, },
data() { data() {
return { return {
yearList: [], yearList: [],
defaultYear: '', defaultYear: '',
isEmpty: false,
dataList: [],
tooltipFormatterObj: [ tooltipFormatterObj: [
{ {
label: '商城', label: '商城',
...@@ -100,7 +56,6 @@ export default { ...@@ -100,7 +56,6 @@ export default {
valueName: 'merchantid' valueName: 'merchantid'
}, },
tabObject: {}, tabObject: {},
dataList: [],
solarDetailList: [ solarDetailList: [
{ {
name: '总采购额', name: '总采购额',
...@@ -130,58 +85,10 @@ export default { ...@@ -130,58 +85,10 @@ export default {
bottomType: 'money' bottomType: 'money'
} }
], ],
// 商城采购饼图结构
shopmallChart: {
id: 'shopmall',
keys: ['goodsname', 'purchaseamount'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
// 商城采购数据 // 商城采购数据
shopmallData: [], shopmallData: [],
shopmallLegend: [
{
name: 'goodsname'
},
{
name: 'rate',
type: 'decimal'
},
{
name: 'purchaseamount',
hasIcon: '¥'
},
{
name: 'averprice',
hasIcon: '均价¥'
}
],
// 自采饼图结构
selfPickChart: {
id: 'selfPick',
keys: ['goodsname', 'purchaseamount'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
// 自采采购数据 // 自采采购数据
selfPickData: [], selfPickData: [],
selfPickLegend: [
{
name: 'goodsname'
},
{
name: 'rate',
type: 'decimal'
},
{
name: 'purchaseamount',
hasIcon: '¥'
},
{
name: 'averprice',
hasIcon: '均价¥'
}
],
businessTime: '' businessTime: ''
} }
}, },
...@@ -218,7 +125,7 @@ export default { ...@@ -218,7 +125,7 @@ export default {
this.api.solar.getMerchantPurchase({ year: this.$store.state.app.solarYear, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchase({ year: this.$store.state.app.solarYear, 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]
...@@ -246,10 +153,10 @@ export default { ...@@ -246,10 +153,10 @@ export default {
data3: item.shopratio data3: item.shopratio
} }
}) })
console.log(this.dataList, 'p-0-0-0-') this.$refs.merchantsTrends.$refs.purchaseTrend.drawBarLine()
this.$refs.purchaseTrend.drawBarLine()
}) })
}, },
// 获取所有门店数据
getAllRanking(purchaseType) { getAllRanking(purchaseType) {
return new Promise(resolve => { return new Promise(resolve => {
let _merchantList let _merchantList
...@@ -284,79 +191,5 @@ export default { ...@@ -284,79 +191,5 @@ export default {
.statistic-box { .statistic-box {
margin-top: 1.78vh; margin-top: 1.78vh;
} }
.tendency-box {
position: relative;
width: 96.67vw;
height: 39.78vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
margin-top: 1.78vh;
}
.propotion-box {
justify-content: space-between;
margin-top: 1.78vh;
&-left,
&-right {
width: 47.78vw;
height: 25.33vh;
box-shadow: inset 0 0 20px 0 #3d57ff69;
}
.content-box {
padding: 1.78vh 6.18vw 4.44vh 0;
}
.empty {
height: 22vh;
display: flex;
align-items: center;
}
}
}
.legend {
display: flex;
position: absolute;
right: 1.39vw;
top: 2.22vh;
&-item {
display: flex;
align-items: center;
color: #fff;
margin-right: 1.67vw;
&:last-child {
margin-right: 0;
}
img {
width: 1.32vw;
height: 1vh;
margin-right: 0.28vw;
}
.icon-line {
width: 0.98vw;
height: 0.56vh;
}
.legend-even,
.legend-odd {
display: inline-block;
width: 0.83vw;
height: 1.33vh;
margin-right: 0.28vw;
font-size: 8px;
text-align: center;
}
}
}
.shop {
.legend-even {
background-image: linear-gradient(180deg, #2ad190 1%, #00b7df 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #22d8ff 0%, #5c56ff 100%);
}
}
.self {
.legend-even {
background-image: linear-gradient(180deg, #145f4e 1%, #035972 100%);
}
.legend-odd {
background-image: linear-gradient(180deg, #11627a 0%, #282f7a 100%);
}
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!