Commit 92df765e by 匡雅琴

提交

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