StoreMap.vue
2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!--
* @Description:
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-08-01 14:36:12
-->
<template>
<div>
<box-title title="区域门店数据"></box-title>
<div v-if="!isEmpty" class="content">
<Map ref="map" :mapData="storeDistrictList"></Map>
<div class="content-right">
<div class="rank-title">区域门店排行</div>
<Ranking class="store-map" :id="'storeDistrict'" :rankingsList="storeDistrictList" :rankingDataObj="rankStoreObj"></Ranking>
</div>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
import Map from '../Map.vue'
import { boutiqueMixin } from '@/mixins'
export default {
name: 'StoreMap',
components: {
Map
},
mixins: [boutiqueMixin],
data() {
return {
storeDistrictList: [
],
rankStoreObj: [
{
name: 'province',
width: '9.72vw'
},
{
name: 'num',
sufunit: '家'
}
],
isEmpty: false
}
},
methods: {
init() {
this.getData()
},
getData() {
const { boutique } = this.$store.state.app
const params = {
year: boutique.year,
channelName: boutique.channel.value
}
this.isEmpty = false
this.api.boutique.getRegionMerchant(params).then(res => {
if (res.data.dataList.length === 0) {
this.isEmpty = true
return
}
this.storeDistrictList = res.data.dataList.length > 10 ? res.data.dataList.slice(0, 10) : res.data.dataList
const districtData = this.storeDistrictList.map(item => {
item.name = item.province
return item
})
this.$refs.map.drawMap(districtData)
}).catch(_err => {
this.isEmpty = true
})
}
}
}
</script>
<style lang="scss" scoped>
.content {
display: flex;
&-right {
margin-left: 4.41vw;
height: 44.44vh;
overflow: hidden;
}
.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>
<style lang="scss">
.store-map {
.ranking-box-item {
height: 4vh;
}
}
</style>