Commit a22a61cc by 胡悦

修复数据重复问题

1 parent f605a845
......@@ -3,20 +3,36 @@
* @Author: huyue
* @Date: 2023-07-07 11:23:06
* @LastEditors: huyue
* @LastEditTime: 2023-07-27 14:53:39
* @LastEditTime: 2023-07-31 10:09:08
*/
export default {
data() {
return {
isFlag: false
}
},
watch: {
watchBoutiqueYear: {
immediate: true,
handler(newval) {
this.isFlag = true
this && this.init && this.init(newval)
}
},
watchBoutiqueChannel: {
immediate: true,
handler(newval) {
if (!this.isFlag) return
this && this.init && this.init(newval)
}
}
},
computed: {
watchBoutiqueYear() {
return this.$store.state.app.boutique.year || this.$store.state.app.boutique.channel.value
return this.$store.state.app.boutique.year
},
watchBoutiqueChannel() {
return this.$store.state.app.boutique.channel.value
}
},
method: {
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-05 10:35:43
* @LastEditors: huyue
* @LastEditTime: 2023-07-21 15:09:33
* @LastEditTime: 2023-07-28 18:05:28
-->
<template>
<div class="view-date">
......@@ -54,8 +54,8 @@ export default {
}
},
mounted() {
const { defaultYear } = this
if (defaultYear) this.setBoutiqueYear(defaultYear)
// const { defaultYear } = this
// if (defaultYear) this.setBoutiqueYear(defaultYear)
},
methods: {
...mapActions(['setBoutiqueYear', 'setBoutiqueChannel']),
......@@ -80,7 +80,6 @@ export default {
},
// 选择渠道触发事件
selectChannelVal(value) {
console.log(value)
this.setBoutiqueChannel(value)
this.$emit('selectChannel', value)
this.switchChannel()
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-04 13:55:35
* @LastEditors: huyue
* @LastEditTime: 2023-07-27 16:51:18
* @LastEditTime: 2023-07-31 10:32:01
-->
<template>
<div class="left">
......@@ -64,86 +64,87 @@ export default {
{
name: '总门店数',
valueName: 'totalMer',
value: '2708',
value: '0',
bottomLabel: '上月新增门店数:',
bottemName: 'incrMer',
bottomValue: '21'
bottomValue: '0'
},
{
name: '总产值',
valueName: 'outputvalue',
value: '1000000',
value: '0',
unit: '¥',
unitType: 'left',
bottomType: 'ratio',
ratioLeftLabel: '月环比',
ratioLeftValueName: 'outputvalueHB',
ratioLeftValue: '12',
ratioLeftValue: '0',
ratioRightLabel: '年同比',
ratioRightValueName: 'outputvalueTB',
ratioRightValue: '-7'
ratioRightValue: '-0'
},
{
name: '客单价',
valueName: 'perCusTrans',
value: '1003',
value: '0',
unit: '¥',
unitType: 'left',
bottomType: 'ratio',
ratioLeftLabel: '月环比',
ratioLeftValueName: 'perCusTransHB',
ratioLeftValue: '12',
ratioLeftValue: '0',
ratioRightLabel: '年同比',
ratioRightValueName: 'perCusTransTB',
ratioRightValue: '-7'
ratioRightValue: '0'
},
{
name: '总转化率',
valueName: 'conversionRate',
value: '58',
value: '0',
unit: '%',
unitType: 'right',
bottomType: 'ratio',
ratioLeftLabel: '月环比',
ratioLeftValueName: 'conversionRateHB',
ratioLeftValue: '12',
ratioLeftValue: '0',
ratioRightLabel: '年同比',
ratioRightValueName: 'conversionRateTB',
ratioRightValue: '-7'
ratioRightValue: '0'
},
{
name: '在营门店数',
valueName: 'openMer',
value: '233'
value: '0'
},
{
name: '发放电子券门店',
valueName: 'usedelecMer',
value: '233'
value: '0'
},
{
name: '嘀加供货门店',
valueName: 'djsupplyMer',
value: '233'
value: '0'
},
{
name: '停业门店',
valueName: 'closedMer',
value: '233'
value: '0'
}
],
tabList: ['业务趋势', '区域门店数据'],
activeName: 0
}
},
mounted() { },
mounted() {
this.getYears()
},
methods: {
changeTab(data) {
this.activeName = data
},
init() {
this.getAllOverview()
this.getYears()
},
async getAllOverview() {
const { boutique } = this.$store.state.app
......@@ -153,15 +154,17 @@ export default {
}
const _data = await this.api.boutique.getAllOverview(params)
const _dataList = _data.data.dataList[0]
this.businessTime = _dataList.startTime
this.boutiqueList.forEach(item => {
item.value = _dataList[item.valueName]
if (item.bottomValue) item.bottomValue = _dataList[item.bottemName]
if (item.bottomType === 'ratio') {
item.ratioLeftValue = _dataList[item.ratioLeftValueName]
item.ratioRightValue = _dataList[item.ratioRightValueName]
}
})
if (_dataList.length) {
this.businessTime = _dataList.startTime
this.boutiqueList.forEach(item => {
item.value = _dataList[item.valueName]
if (item.bottomValue) item.bottomValue = _dataList[item.bottemName]
if (item.bottomType === 'ratio') {
item.ratioLeftValue = _dataList[item.ratioLeftValueName]
item.ratioRightValue = _dataList[item.ratioRightValueName]
}
})
}
},
async getYears() {
this.yearList = [{
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-27 17:51:57
* @LastEditTime: 2023-07-31 10:07:45
-->
<template>
<div class="trends-box">
......@@ -60,7 +60,8 @@ export default {
}
],
dataList: [],
isEmpty: false
isEmpty: false,
isFlag: false
}
},
mounted() {
......@@ -69,29 +70,34 @@ export default {
init() {
this.getDataList()
},
async getDataList() {
getDataList() {
const { boutique } = this.$store.state.app
const params = {
year: boutique.year,
channelName: boutique.channel.value
}
this.dataList = []
const _data = await this.api.boutique.getSpringbudTrend(params)
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.deploy_num,
data2: item.open_num,
data3: item.dj_supply,
data4: item.close_num
this.isFlag = false
if (!this.isFlag) {
this.api.boutique.getSpringbudTrend(params).then(res => {
const _dataList = res.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.deploy_num,
data2: item.open_num,
data3: item.dj_supply,
data4: item.close_num
})
})
this.$refs.barTrendsRef.drawBar()
this.isFlag = true
})
})
this.$refs.barTrendsRef.drawBar()
}
}
}
}
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-27 10:40:19
* @LastEditTime: 2023-07-28 18:09:10
-->
<template>
<div class="trends-box">
......@@ -58,7 +58,8 @@ export default {
}
],
dataList: [],
isEmpty: false
isEmpty: false,
isFlag: true
}
},
mounted() {
......@@ -67,29 +68,49 @@ export default {
init() {
this.getDataList()
},
async getDataList() {
getDataList() {
const { boutique } = this.$store.state.app
const params = {
year: boutique.year,
channelName: boutique.channel.value
}
this.dataList = []
const _data = await this.api.boutique.getAllTrend(params)
console.log(_data)
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.outputvalue,
data2: item.perCusTrans,
data3: item.conversionRate
this.isFlag = false
if (!this.isFlag) {
this.api.boutique.getAllTrend(params).then(res => {
const _dataList = res.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.outputvalue,
data2: item.perCusTrans,
data3: item.conversionRate
})
})
this.$refs.purchaseRef.drawBarLine()
this.isFlag = true
})
})
this.$refs.purchaseRef.drawBarLine()
}
// this.api.boutique.getAllTrend(params)
// console.log(_data)
// const _dataList = _data.data.dataList
// if (!_dataList.length) {
// this.isEmpty = true
// return
// }
// _dataList.forEach(item => {
// this.dataList.push({
// month: item.statMonth,
// data1: item.outputvalue,
// data2: item.perCusTrans,
// data3: item.conversionRate
// })
// })
// this.$refs.purchaseRef.drawBarLine()
}
}
}
......
......@@ -3,18 +3,21 @@
* @Author: huyue
* @Date: 2023-07-19 17:18:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-27 17:47:18
* @LastEditTime: 2023-07-31 10:27:45
-->
<template>
<div>
<box-title title="区域门店数据"></box-title>
<div class="content">
<div v-if="!isEmpty" class="content">
<Map ref="map" :mapData="storeDistrictList"></Map>
<div class="content-right">
<div class="rank-title">区域门店排行</div>
<Ranking :id="'storeDistrict'" :rankingsList="storeDistrictList" :rankingDataObj="rankStoreObj"></Ranking>
</div>
</div>
<div v-else class="empty">
<Empty></Empty>
</div>
</div>
</template>
<script>
......@@ -82,26 +85,34 @@ export default {
{
name: 'num'
}
]
],
isEmpty: false
}
},
methods: {
init() {
this.getData()
},
async getData() {
getData() {
const { boutique } = this.$store.state.app
const params = {
year: boutique.year,
channelName: boutique.channel.value
}
const _data = await this.api.boutique.getRegionMerchant(params)
this.storeDistrictList = _data.data.dataList
const districtData = this.storeDistrictList.map(item => {
item.name = item.province
return item
this.api.boutique.getRegionMerchant(params).then(res => {
if (res.data.dataList.length === 0) {
this.isEmpty = true
return
}
this.storeDistrictList = 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
})
this.$refs.map.drawMap(districtData)
}
}
}
......
......@@ -62,7 +62,8 @@ export default {
addSymbol: '%'
}
],
dataList: []
dataList: [],
isFlag: true
}
},
mounted() {},
......@@ -70,23 +71,28 @@ export default {
init() {
this.getDataList()
},
async getDataList() {
getDataList() {
this.dataList = []
const _data = await this.api.boutique.getMerchantTrend({ year: this.year, MerchantId: this.merchantid })
const _dataList = _data.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.outputvalue,
data2: item.perCusTrans,
data3: item.conversionRate
this.isFlag = false
if (!this.isFlag) {
this.api.boutique.getMerchantTrend({ year: this.year, MerchantId: this.merchantid }).then(res => {
const _dataList = res.data.dataList
if (!_dataList.length) {
this.isEmpty = true
return
}
_dataList.forEach(item => {
this.dataList.push({
month: item.statMonth,
data1: item.outputvalue,
data2: item.perCusTrans,
data3: item.conversionRate
})
})
this.$refs.purchaseRef.drawBarLine()
this.isFlag = true
})
})
this.$refs.purchaseRef.drawBarLine()
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!