Commit 555df628 by 胡悦

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

2 parents 86e88337 63cafc4c
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<!-- 采购选项下拉 --> <!-- 采购选项下拉 -->
<div class="purchase-plugin"> <div class="purchase-plugin">
<div class="purchase" @click.stop="switchPurchase"> <div class="purchase" @click.stop="switchPurchase">
{{ purchase }} {{ purchase.labelName }}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt="" /> <img class="arrow-down" src="@/assets/images/arrow-down.png" alt="" />
</div> </div>
<SelectBox :isShow="isShow" @clickOutside="clickOutside" isObject :dataList="purchaseList" :boxWidth="'28.61vw'" @selectVal="selectPurchase" :labelName="'labelName'"></SelectBox> <SelectBox :isShow="isShow" @clickOutside="clickOutside" isObject :dataList="purchaseList" :boxWidth="'28.61vw'" @selectVal="selectPurchase" :labelName="'labelName'"></SelectBox>
...@@ -51,7 +51,7 @@ export default { ...@@ -51,7 +51,7 @@ export default {
}], }],
rankingList: {}, rankingList: {},
// 采购额排名当前选中值 // 采购额排名当前选中值
purchase: '', purchase: {},
// 采购额排名门店数据 // 采购额排名门店数据
merchantsList: [], merchantsList: [],
merchantsDataObj: [ merchantsDataObj: [
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
}, },
mounted() { mounted() {
this.purchase = this.purchaseList[0].labelName this.purchase = this.purchaseList[0]
}, },
methods: { methods: {
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
// 排名下拉选中 // 排名下拉选中
selectPurchase(item) { selectPurchase(item) {
console.log(item) console.log(item)
this.purchase = item.labelName this.purchase = item
const purchaseIndex = this.purchaseList.findIndex(itm => itm.value === item.value) const purchaseIndex = this.purchaseList.findIndex(itm => itm.value === item.value)
// 只获取排名前五的数据 // 只获取排名前五的数据
this.merchantsList = this.rankingList[this.purchaseList[purchaseIndex].value].slice(0, 5) this.merchantsList = this.rankingList[this.purchaseList[purchaseIndex].value].slice(0, 5)
...@@ -105,7 +105,7 @@ export default { ...@@ -105,7 +105,7 @@ export default {
// 跳转太阳膜详情页 // 跳转太阳膜详情页
goDetailPage(item) { goDetailPage(item) {
console.log(item) console.log(item)
this.$router.push({ path: `solarDetail?merchantid=${item.merchantid}&merchantname=${item.merchantname}` }) this.$router.push({ path: `solarDetail?merchantid=${item.merchantid}&merchantname=${item.merchantname}&purchaseType=${this.purchase.value}` })
}, },
// 点击外部控制排名下拉隐藏 // 点击外部控制排名下拉隐藏
clickOutside() { clickOutside() {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="layout"> <div class="layout">
<view-container> <view-container>
<template #title> <template #title>
<DetailTitle :dataList="merchantList" :dataListObj="merchantListObj" :tabName="tabName"></DetailTitle> <DetailTitle :dataList="merchantList" :dataListObj="merchantListObj" :tabObject="tabObject"></DetailTitle>
</template> </template>
<template #content> <template #content>
<div class="solar-detail-content"> <div class="solar-detail-content">
...@@ -98,7 +98,7 @@ export default { ...@@ -98,7 +98,7 @@ export default {
labelName: 'merchantname', labelName: 'merchantname',
valueName: 'merchantid' valueName: 'merchantid'
}, },
tabName: '', tabObject: {},
dataList: [], dataList: [],
solarDetailList: [ solarDetailList: [
{ {
...@@ -185,14 +185,28 @@ export default { ...@@ -185,14 +185,28 @@ export default {
created() {}, created() {},
methods: { methods: {
...mapActions(['setSolarYear']), ...mapActions(['setSolarYear']),
init() { async init() {
console.log(this.$route.query, '999') console.log(this.$route.query, '999')
this.merchantList = this.$store.state.app.merchantRankingList
console.log(this.merchantList, 'this.merchantList')
this.businessTime = this.$store.state.app.solarTime this.businessTime = this.$store.state.app.solarTime
this.businessYear = this.$store.state.app.solarYear this.businessYear = this.$store.state.app.solarYear
const { merchantid, merchantname } = this.$route.query const { merchantid, purchaseType } = this.$route.query
this.tabName = merchantname let _merchantList = this.$store.state.app.merchantRankingList
// 页面刷新导致门店数据置空,重新请求数据
// if (!_merchantList.length) {
// this.api.solar.getAllRanking({ year: 2023 }).then(res => {
// console.log(res, '000')
// if (!res.code === '0') {
// this.openMessage('获取商品采购额排名失败')
// return
// }
// const _data = res.data.dataList[0]
// _merchantList = _data[purchaseType]
// })
// }
if (!_merchantList.length) _merchantList = await this.getAllRanking(purchaseType)
this.merchantList = _merchantList
console.log(this.merchantList, 'this.merchantList')
this.tabObject = this.$route.query
this.getMerchantGoodsRatio(this.businessYear, merchantid) this.getMerchantGoodsRatio(this.businessYear, merchantid)
this.getMerchantPurchase(this.businessYear, merchantid) this.getMerchantPurchase(this.businessYear, merchantid)
this.getMerchantPurchaseTrend(this.businessYear, merchantid) this.getMerchantPurchaseTrend(this.businessYear, merchantid)
...@@ -247,6 +261,21 @@ export default { ...@@ -247,6 +261,21 @@ export default {
// 切换年份 // 切换年份
yearValue(val) { yearValue(val) {
this.setSolarYear(val) this.setSolarYear(val)
},
getAllRanking(purchaseType) {
return new Promise(resolve => {
let _merchantList
this.api.solar.getAllRanking({ year: 2023 }).then(res => {
console.log(res, '000')
if (!res.code === '0') {
this.openMessage('获取商品采购额排名失败')
return
}
const _data = res.data.dataList[0]
_merchantList = _data[purchaseType]
resolve(_merchantList)
})
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!