Commit a22a61cc by 胡悦

修复数据重复问题

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