Commit f4377110 by 匡雅琴

时间、地区切换接口联调

1 parent 703db180
......@@ -18,7 +18,6 @@ export default {
methods: {
selectDate(e) {
console.log(e, 'eeeee')
this.$emit('customerSelect', e)
}
}
......
......@@ -28,7 +28,8 @@ export default {
methods: {
changeTab(val) {
console.log(val);
this.$bus.$emit('whosaleTabChange', val === 0 ? 'gh' : 'gl')
}
}
}
......
......@@ -77,10 +77,32 @@ export default {
bottomType: 'slot'
}
],
dataList: []
dataList: [],
area: '',
month: ''
}
},
watch: {
area: {
handler(newVal) {
this.getRetailOverview()
this.getRetailTrend()
}
},
month: {
handler(newVal) {
this.getRetailOverview()
this.getRetailTrend()
}
}
},
created() {
this.$bus.$on('selectAreaChange', val => {
this.area = val
})
this.$bus.$on('selectMonthChange', val => {
this.month = val
})
this.getRetailOverview()
this.getRetailTrend()
},
......@@ -89,7 +111,10 @@ export default {
methods: {
async getRetailOverview() {
const params = {}
const params = {
province: this.area,
statMonth: this.month
}
const _result = await this.api.equity.getRetailOverview(params)
const _data = _result.data.dataList[0]
this.equitylList.forEach(item => {
......@@ -100,7 +125,10 @@ export default {
})
},
async getRetailTrend() {
const params = {}
const params = {
province: this.area,
statMonth: this.month
}
const _result = await this.api.equity.getRetailTrend(params)
this.dataList = _result.data.dataList
this.$nextTick(() => {
......
......@@ -4,7 +4,7 @@
<div class="rank-box">
<box-title title="门店产值排名"></box-title>
<div class="rank-content" v-if="storeOutputList.length">
<Ranking :id="'storeOutput'" :rankingsList="storeOutputList" :rankingDataObj="rankingDataObj" @goDetailPage="goDetailPage"></Ranking>
<Ranking :id="'storeOutput'" :rankingsList="storeOutputList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
......@@ -14,7 +14,7 @@
<div class="rank-box">
<box-title title="门店转化率排行"></box-title>
<div class="rank-content" v-if="storePercentList.length">
<Ranking :id="'storePercent'" :rankingsList="storePercentList" :rankingDataObj="rankPercentObj" @goDetailPage="goDetailPage"></Ranking>
<Ranking :id="'storePercent'" :rankingsList="storePercentList" :rankingDataObj="rankPercentObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
......@@ -24,7 +24,7 @@
<div class="rank-box">
<box-title title="门店客单价排行"></box-title>
<div class="rank-content" v-if="storePriceList.length">
<Ranking :id="'storePrice'" :rankingsList="storePriceList" :rankingDataObj="rankingDataObj" @goDetailPage="goDetailPage"></Ranking>
<Ranking :id="'storePrice'" :rankingsList="storePriceList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
<div v-else class="empty">
<Empty></Empty>
......@@ -68,11 +68,31 @@ export default {
width: '3vw',
type: 'decimal'
}
]
],
area: '',
month: ''
}
},
watch: {
area: {
handler(newVal) {
this.getRetailRank()
}
},
month: {
handler(newVal) {
this.getRetailRank()
}
}
},
created() {
this.$bus.$on('selectAreaChange', val => {
this.area = val
})
this.$bus.$on('selectMonthChange', val => {
this.month = val
})
this.getRetailRank()
},
......@@ -80,7 +100,10 @@ export default {
methods: {
async getRetailRank() {
const params = {}
const params = {
province: this.area,
statMonth: this.month
}
const _result = await this.api.equity.getRetailRank(params)
const { outputvalueRank, perCusTransRank, conversionRateRank } = _result.data.dataList[0]
this.storeOutputList = outputvalueRank.slice(0,5)
......
<template>
<div class="pie-box">
<TotalBill :totalBillData="numProportion"></TotalBill>
<TotalMerchant :totalMerchantData="merProportion"></TotalMerchant>
<TotalBill :totalBillData="numProportion" :totalNum="totalNum"></TotalBill>
<TotalMerchant :totalMerchantData="merProportion" :totalMerchant="totalMerchant"></TotalMerchant>
</div>
</template>
......@@ -16,12 +16,19 @@ export default {
},
data() {
return {
totalNum: 0,
totalMerchant: 0,
merProportion: [],
numProportion: []
numProportion: [],
month: ''
}
},
created() {
this.$bus.$on('selectMonthChange', val => {
this.month = val
this.getWholesaleNum()
})
this.getWholesaleNum()
},
......@@ -29,11 +36,15 @@ export default {
methods: {
async getWholesaleNum() {
const params = {}
const params = {
statMonth: this.month
}
const _result = await this.api.equity.getWholesaleNum(params)
const { merProportion, numProportion } = _result.data.dataList[0]
const { merProportion, numProportion, totalNum, totalMerchant } = _result.data.dataList[0]
this.merProportion = merProportion
this.numProportion = numProportion
this.totalNum = totalNum
this.totalMerchant = totalMerchant
}
}
}
......
......@@ -73,6 +73,7 @@ export default {
return _html
},
drawBar() {
console.log(this.tooltipFormatterObj);
this.barOptions.xAxis.data = this.dataList.map(item => item.statDate)
this.barOptions.series[0].data = this.dataList.map(item => item[this.tooltipFormatterObj.attrName])
this[this.domId].setOption(this.barOptions)
......
......@@ -51,10 +51,17 @@ export default {
watch: {
tabActive: {
handler(val) {
console.log(val)
if (val === 0) {
this.area = ''
this.month = ''
this.defaultArea = ''
this.defaultMonth = ''
this.getRetailYearsArea()
} else {
this.area = ''
this.month = ''
this.defaultArea = ''
this.defaultMonth = ''
this.getWholesaleYears()
}
}
......@@ -88,7 +95,9 @@ export default {
this.isShowArea = false
},
selectAreaVal(val) {
this.area = val.name
this.area = val
this.$bus.$emit('selectAreaChange', val)
this.switchArea()
},
switchMonth() {
this.isShowMonth = !this.isShowMonth
......@@ -97,7 +106,9 @@ export default {
this.isShowMonth = false
},
selectMonthVal(val) {
this.month = val.statemonth
this.month = val
this.$bus.$emit('selectMonthChange', val)
this.switchMonth()
}
}
}
......
......@@ -18,7 +18,7 @@
></SelectBox>
</div>
<DateTab :dateList="dateList" @changeDate="changeDate"></DateTab>
<Calendar v-show="showCalendar" @customerSelect="customerSelect"></Calendar>
<Calendar ref="calender" v-show="showCalendar" @customerSelect="customerSelect"></Calendar>
</div>
</template>
......@@ -34,11 +34,11 @@ export default {
selectList: [
{
name: '提单量趋势',
val: 0
val: 'num'
},
{
name: '提单门店量趋势',
val: 1
val: 'merNum'
}
],
selectType: ''
......@@ -53,25 +53,26 @@ export default {
this.showCalendar = true
return
} else {
this.$refs.calender.dateValue = ''
this.showCalendar = false
}
const date = val === 0 ? 'thisMonth' : 'thisYear'
this.$bus.$emit('dateTabChange', date)
},
switchType() {
console.log(2222)
this.isShow = !this.isShow
},
clickOutside() {
this.isShow = false
},
selectVal(val) {
console.log(val);
this.selectType = val.name
this.switchType()
this.selectType = val.name
this.$bus.$emit('equityTypeChange', val.val)
this.switchType()
},
// 自定义日期选择
customerSelect(val) {
this.start = val[0]
this.end = val[1]
this.$bus.$emit('dateCustomerChange', val)
}
}
}
......
......@@ -5,7 +5,7 @@
<div v-if="totalBillData.length" class="content-box">
<div class="text-box">
<div class="text">提单总数</div>
<div class="number-text">2,280,708</div>
<div class="number-text">{{ numAddSymbol(totalNum) }}</div>
</div>
<RightViewContent :chart="totalBillChart" :listData="totalBillData" :legentList="totalBillLegend" :legendColors="totalBillChart.colors"></RightViewContent>
</div>
......@@ -27,7 +27,8 @@ export default {
totalBillData: {
type: Array,
default: () => []
}
},
totalNum: Number
},
data() {
return {
......
......@@ -5,7 +5,7 @@
<div v-if="totalMerchantData.length" class="content-box">
<div class="text-box">
<div class="text">提单门店数</div>
<div class="number-text">2,280,708</div>
<div class="number-text">{{ numAddSymbol(totalMerchant) }}</div>
</div>
<RightViewContent
:chart="totalMerchantChart"
......@@ -32,7 +32,8 @@ export default {
totalMerchantData: {
type: Array,
default: () => []
}
},
totalMerchant: Number
},
data() {
return {
......
......@@ -39,10 +39,45 @@ export default {
colorList: [
['#2AD191', '#00A89E', '#061422'],
['#22D8FF', '#223FA9', '#061422']
]
],
queryType: 'gh',
queryItem: 'thisYear',
endDate: '',
startDate: ''
}
},
watch: {
queryType: {
handler() {
this.getWholesaleTrend()
}
},
queryItem: {
handler() {
this.getWholesaleTrend()
}
}
},
created() {
this.$bus.$on('whosaleTabChange', data => {
this.queryType = data
})
this.$bus.$on('dateTabChange', data => {
this.queryItem = data
this.startDate = ''
this.endDate = ''
})
this.$bus.$on('dateCustomerChange', data => {
this.startDate = data[0]
this.endDate = data[1]
this.queryItem = 'selfDefined'
})
this.$bus.$on('equityTypeChange', data => {
this.tooltips.amountTooltip.attrName = data
this.$nextTick(() => {
this.$refs.orderTrendChartRef.drawBar()
})
})
this.getWholesaleTrend()
},
......@@ -51,8 +86,10 @@ export default {
methods: {
async getWholesaleTrend() {
const params = {
queryItem: 'thisYear',
queryType: 'gh'
queryItem: this.queryItem,
queryType: this.queryType,
startDate: this.startDate,
endDate: this.endDate
}
const _result = await this.api.equity.getWholesaleTrend(params)
this.dataList = _result.data.dataList
......@@ -68,6 +105,6 @@ export default {
.trend-left {
width: 60.84vw;
padding-right: 5.9vw;
border-right: 1px solid #1E3372;
border-right: 1px solid #1e3372;
}
</style>
<template>
<div class="trend-right">
<div class="title">广汇门店提单量排名</div>
<div class="title">{{ title }}</div>
<div class="rank-content" v-if="merchantRankList.length">
<Ranking class="rank-box" :rankingsList="merchantRankList" :rankingDataObj="rankingDataObj"></Ranking>
</div>
......@@ -16,6 +16,7 @@ export default {
data() {
return {
title: '广汇门店提单量排名',
merchantRankList: [],
rankingDataObj: [
{
......@@ -27,10 +28,43 @@ export default {
width: '5vw',
type: 'number'
}
]
],
queryType: 'gh',
queryItem: 'thisYear',
endDate: '',
startDate: ''
}
},
watch: {
queryType: {
handler() {
this.getWholesaleRank()
}
},
queryItem: {
handler() {
this.getWholesaleRank()
}
}
},
created() {
this.$bus.$on('whosaleTabChange', data => {
this.queryType = data
this.title = data === 'gh' ? '广汇门店提单量排名' : '非广汇门店提单量排名'
})
this.$bus.$on('dateTabChange', data => {
this.queryItem = data
this.startDate = ''
this.endDate = ''
})
this.$bus.$on('dateCustomerChange', data => {
this.startDate = data[0]
this.endDate = data[1]
this.queryItem = 'selfDefined'
})
this.$bus.$on('equityTypeChange', data => {
this.tooltips.amountTooltip.attrName = data
})
this.getWholesaleRank()
},
......@@ -39,8 +73,10 @@ export default {
methods: {
async getWholesaleRank() {
const params = {
queryItem: 'thisYear',
queryType: 'gh'
queryItem: this.queryItem,
queryType: this.queryType,
startDate: this.startDate,
endDate: this.endDate
}
const _result = await this.api.equity.getWholesaleRank(params)
this.merchantRankList = _result.data.dataList
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!