Commit 92df765e by 匡雅琴

提交

1 parent dcabb71f
...@@ -20,7 +20,6 @@ const pages = [ ...@@ -20,7 +20,6 @@ const pages = [
name: 'solarDetail', name: 'solarDetail',
meta: { meta: {
isTab: true, isTab: true,
keepAlive: true,
backgroundColor: '#F7F7F7' backgroundColor: '#F7F7F7'
} }
} }
......
...@@ -11,7 +11,8 @@ const state = { ...@@ -11,7 +11,8 @@ const state = {
reportType: 0 // 月表0,日表1 reportType: 0 // 月表0,日表1
}, },
solarYear: '2023', solarYear: '2023',
solarTime: '' solarTime: '',
merchantRankingList: []
} }
const mutations = { const mutations = {
SET_PAGE_META(state, meta) { SET_PAGE_META(state, meta) {
...@@ -22,6 +23,9 @@ const mutations = { ...@@ -22,6 +23,9 @@ const mutations = {
}, },
SET_SOLAR_TIME(state, meta) { SET_SOLAR_TIME(state, meta) {
state.solarTime = meta state.solarTime = meta
},
SET_MERCHANT_LIST(state, meta) {
state.merchantRankingList = meta
} }
} }
const actions = { const actions = {
...@@ -34,6 +38,10 @@ const actions = { ...@@ -34,6 +38,10 @@ const actions = {
}, },
setSolarTime({ commit }, time) { setSolarTime({ commit }, time) {
commit('SET_SOLAR_TIME', time) commit('SET_SOLAR_TIME', time)
},
setMerchantRankingList({ commit }, list) {
console.log(list, '-----');
commit('SET_MERCHANT_LIST', list)
} }
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<script> <script>
import { changeMixin } from '@/mixins' import { changeMixin } from '@/mixins'
import { mapActions } from 'vuex'
export default { export default {
name: 'PurchaseRank', name: 'PurchaseRank',
mixins: [changeMixin], mixins: [changeMixin],
...@@ -70,6 +71,7 @@ export default { ...@@ -70,6 +71,7 @@ export default {
}, },
methods: { methods: {
...mapActions(['setMerchantRankingList']),
init() { init() {
this.getAllRanking() this.getAllRanking()
}, },
...@@ -83,6 +85,7 @@ export default { ...@@ -83,6 +85,7 @@ export default {
} }
this.rankingList = res.data.dataList[0] this.rankingList = res.data.dataList[0]
this.merchantsList = this.rankingList[this.purchaseList[0].value].slice(0, 5) this.merchantsList = this.rankingList[this.purchaseList[0].value].slice(0, 5)
this.setMerchantRankingList(this.merchantsList)
}) })
}, },
// 排名下拉显示/隐藏 // 排名下拉显示/隐藏
...@@ -96,12 +99,13 @@ export default { ...@@ -96,12 +99,13 @@ export default {
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)
this.setMerchantRankingList(this.merchantsList)
this.switchPurchase() this.switchPurchase()
}, },
// 跳转太阳膜详情页 // 跳转太阳膜详情页
goDetailPage(item) { goDetailPage(item) {
console.log(item) console.log(item)
this.$router.push({ name: 'solarDetail', params: { currentMerchant: item, merchantList: this.merchantsList }}) this.$router.push({ path: `solarDetail?merchantid=${item.merchantid}&merchantname=${item.merchantname}` })
}, },
// 点击外部控制排名下拉隐藏 // 点击外部控制排名下拉隐藏
clickOutside() { clickOutside() {
......
...@@ -157,18 +157,20 @@ export default { ...@@ -157,18 +157,20 @@ export default {
methods: { methods: {
...mapActions(['setSolarYear']), ...mapActions(['setSolarYear']),
init() { init() {
console.log(this.$route.params, '999') console.log(this.$route.query, '999')
this.merchantList = this.$route.params.merchantList 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
const { merchantid, merchantname } = this.$route.params.currentMerchant this.businessYear = this.$store.state.app.solarYear
const { merchantid, merchantname } = this.$route.query
this.tabName = merchantname this.tabName = merchantname
this.getMerchantGoodsRatio(merchantid) this.getMerchantGoodsRatio(this.businessYear, merchantid)
this.getMerchantPurchase(merchantid) this.getMerchantPurchase(this.businessYear, merchantid)
this.getMerchantPurchaseTrend(merchantid) this.getMerchantPurchaseTrend(this.businessYear, merchantid)
}, },
// 获取门店的商品采购占比(商城、自采) // 获取门店的商品采购占比(商城、自采)
getMerchantGoodsRatio(merchantid) { getMerchantGoodsRatio(year, merchantid) {
this.api.solar.getMerchantGoodsRatio({ year: 2023, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantGoodsRatio({ year: year, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -179,8 +181,8 @@ export default { ...@@ -179,8 +181,8 @@ export default {
}) })
}, },
// 获取每个门店的 总采购额(总计、本月) 、商城采购额(总计、本月) 、自采采购额(总计、本月) // 获取每个门店的 总采购额(总计、本月) 、商城采购额(总计、本月) 、自采采购额(总计、本月)
getMerchantPurchase(merchantid) { getMerchantPurchase(year, merchantid) {
this.api.solar.getMerchantPurchase({ year: 2023, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchase({ year: year, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -189,8 +191,8 @@ export default { ...@@ -189,8 +191,8 @@ export default {
}) })
}, },
// 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势 // 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势
getMerchantPurchaseTrend(merchantid) { getMerchantPurchaseTrend(year, merchantid) {
this.api.solar.getMerchantPurchaseTrend({ year: 2023, MerchantId: merchantid }).then(res => { this.api.solar.getMerchantPurchaseTrend({ year: year, MerchantId: merchantid }).then(res => {
console.log(res) console.log(res)
if (!res.code === '0') { if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败') this.openMessage('获取门店商品采购占比失败')
...@@ -201,7 +203,8 @@ export default { ...@@ -201,7 +203,8 @@ export default {
this.dataList.push({ this.dataList.push({
month: item.statDate, month: item.statDate,
data1: item.shopamount, data1: item.shopamount,
data2: item.selfamount data2: item.selfamount,
data3: item.shopratio
}) })
}) })
console.log(this.dataList) console.log(this.dataList)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!