Commit a2f12f58 by 匡雅琴

详情页接口联调

1 parent f605a845
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
type: String type: String
}, },
defaultValue: { defaultValue: {
type: String type: String || Number
} }
}, },
directives: { directives: {
......
...@@ -18,7 +18,8 @@ const state = { ...@@ -18,7 +18,8 @@ const state = {
channel: { channel: {
label: '全部渠道', label: '全部渠道',
value: 'all' value: 'all'
} },
merchantId: ''
} }
} }
const mutations = { const mutations = {
...@@ -39,6 +40,9 @@ const mutations = { ...@@ -39,6 +40,9 @@ const mutations = {
}, },
SET_BOUTIQUE_CHANNEL(state, meta) { SET_BOUTIQUE_CHANNEL(state, meta) {
state.boutique.channel = meta state.boutique.channel = meta
},
SET_BOUTIQUE_MERCHANTID(state, meta) {
state.boutique.merchantId = meta
} }
} }
const actions = { const actions = {
...@@ -60,6 +64,9 @@ const actions = { ...@@ -60,6 +64,9 @@ const actions = {
}, },
setBoutiqueChannel({ commit }, channel) { setBoutiqueChannel({ commit }, channel) {
commit('SET_BOUTIQUE_CHANNEL', channel) commit('SET_BOUTIQUE_CHANNEL', channel)
},
setBoutiqueMerchantid({ commit }, id) {
commit('SET_BOUTIQUE_MERCHANTID', id)
} }
} }
......
...@@ -116,8 +116,7 @@ export default { ...@@ -116,8 +116,7 @@ export default {
name: 'boutiqueDetail', name: 'boutiqueDetail',
query: { query: {
merchantid: item.merchantid, merchantid: item.merchantid,
merchantName: item.merchantname, merchantName: item.merchantname
year: this.$store.state.app.boutique.year
} }
}) })
window.open(routeData.href, '_blank') window.open(routeData.href, '_blank')
......
<template> <template>
<div class="detail-left-box"> <div class="detail-left-box">
<StatisticsBox :list="boutiqueDetailList"></StatisticsBox> <StatisticsBox :list="boutiqueDetailList"></StatisticsBox>
<BusinessDetailTrends class="trends-charts" :year="year" :merchantid="merchantid"></BusinessDetailTrends> <BusinessDetailTrends ref="detailTrends" class="trends-charts" :merchantid="merchantid"></BusinessDetailTrends>
</div> </div>
</template> </template>
...@@ -77,23 +77,39 @@ export default { ...@@ -77,23 +77,39 @@ export default {
} }
}, },
computed: {
listenId() {
return this.$store.state.app.boutique.merchantId
}
},
watch: {
listenId(value) {
this.getMerchantOverview(value)
this.merchantid = value
this.$refs.detailTrends.getDataList(value)
}
},
created() { created() {
const { merchantid, year } = this.$route.query const { merchantid } = this.$route.query
this.merchantid = merchantid this.merchantid = merchantid
this.year = year this.getMerchantOverview(merchantid)
this.getMerchantOverview(merchantid, year) this.$bus.$on('changeMerchant', data => {
console.log(data);
})
}, },
methods: { methods: {
// 获取门店的总展业时间&最近订单时间、总产值&本月产值等 // 获取门店的总展业时间&最近订单时间、总产值&本月产值等
async getMerchantOverview(merchantid, year) { async getMerchantOverview(merchantid) {
const _data = await this.api.boutique.getMerchantOverview({ MerchantId: merchantid, year }) const _data = await this.api.boutique.getMerchantOverview({ MerchantId: merchantid, year: this.$store.state.app.boutique.year })
const _dataList = _data.data.dataList[0] const _dataList = _data.data.dataList[0] || {}
this.$bus.$emit('boutiqueDate', { this.$bus.$emit('boutiqueDate', {
startTime: _dataList.startTime, startTime: _dataList?.startTime,
affiliation: _dataList.affiliation, affiliation: _dataList?.affiliation,
isusedElec: _dataList.isusedElec, isusedElec: _dataList?.isusedElec,
supplyMode: _dataList.supplyMode supplyMode: _dataList?.supplyMode
}) })
if (_dataList) { if (_dataList) {
this.boutiqueDetailList.forEach(item => { this.boutiqueDetailList.forEach(item => {
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<template> <template>
<div class="detail-right-box"> <div class="detail-right-box">
<!-- 商品供应方占比 --> <!-- 商品供应方占比 -->
<GoodsSupplierPropertion :year="year" :merchantid="merchantid"></GoodsSupplierPropertion> <GoodsSupplierPropertion ref="supplyPropertion" :merchantid="merchantid"></GoodsSupplierPropertion>
<!-- 订单支付方式占比 --> <!-- 订单支付方式占比 -->
<GoodsPayPropertion :year="year" :merchantid="merchantid"></GoodsPayPropertion> <GoodsPayPropertion ref="payPropertion" :merchantid="merchantid"></GoodsPayPropertion>
<!-- 商品销售排行 --> <!-- 商品销售排行 -->
<GoodsRanking :year="year" :merchantid="merchantid"></GoodsRanking> <GoodsRanking ref="goodsRanking" :merchantid="merchantid"></GoodsRanking>
</div> </div>
</template> </template>
...@@ -29,15 +29,29 @@ export default { ...@@ -29,15 +29,29 @@ export default {
}, },
data() { data() {
return { return {
merchantid: '', merchantid: ''
year: '', }
},
computed: {
listenId() {
return this.$store.state.app.boutique.merchantId
}
},
watch: {
listenId(value) {
console.log(value, '-00000000000-');
this.merchantid = value
this.$refs.supplyPropertion.getMerchantSupply(value)
this.$refs.payPropertion.getMerchantPay(value)
this.$refs.goodsRanking.getMerchantGoodsRank(value)
} }
}, },
created() { created() {
const { merchantid, year } = this.$route.query const { merchantid } = this.$route.query
this.merchantid = merchantid this.merchantid = merchantid
this.year = year
}, },
methods: {} methods: {}
......
...@@ -41,8 +41,7 @@ export default { ...@@ -41,8 +41,7 @@ export default {
}, },
mixins: [boutiqueMixin], mixins: [boutiqueMixin],
props: { props: {
merchantid: String, merchantid: String
year: String
}, },
data() { data() {
return { return {
...@@ -68,11 +67,11 @@ export default { ...@@ -68,11 +67,11 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
init() { init() {
this.getDataList() this.getDataList(this.merchantid)
}, },
async getDataList() { async getDataList(merchantid) {
this.dataList = [] this.dataList = []
const _data = await this.api.boutique.getMerchantTrend({ year: this.year, MerchantId: this.merchantid }) const _data = await this.api.boutique.getMerchantTrend({ year: this.$store.state.app.boutique.year, MerchantId: merchantid })
const _dataList = _data.data.dataList const _dataList = _data.data.dataList
if (!_dataList.length) { if (!_dataList.length) {
this.isEmpty = true this.isEmpty = true
......
...@@ -25,8 +25,7 @@ export default { ...@@ -25,8 +25,7 @@ export default {
RightViewContent RightViewContent
}, },
props: { props: {
merchantid: String, merchantid: String
year: String
}, },
data() { data() {
return { return {
...@@ -62,12 +61,11 @@ export default { ...@@ -62,12 +61,11 @@ export default {
methods: { methods: {
init() { init() {
const _year = this.year this.getMerchantPay(this.merchantid)
this.getMerchantPay(_year)
}, },
// 获取门店支付方式占比 // 获取门店支付方式占比
async getMerchantPay(year) { async getMerchantPay(merchantid) {
const _data = await this.api.boutique.getMerchantPay({ year, MerchantId: this.merchantid }) const _data = await this.api.boutique.getMerchantPay({ year: this.$store.state.app.boutique.year, MerchantId: merchantid })
console.log(_data); console.log(_data);
this.goodsPayData = _data.data.dataList this.goodsPayData = _data.data.dataList
}, },
......
...@@ -23,8 +23,7 @@ export default { ...@@ -23,8 +23,7 @@ export default {
name: 'GoodsRanking', name: 'GoodsRanking',
mixins: [boutiqueMixin], mixins: [boutiqueMixin],
props: { props: {
merchantid: String, merchantid: String
year: String
}, },
data() { data() {
return { return {
...@@ -54,12 +53,11 @@ export default { ...@@ -54,12 +53,11 @@ export default {
methods: { methods: {
init() { init() {
const _year = this.year this.getMerchantGoodsRank(this.merchantid)
this.getMerchantGoodsRank(_year)
}, },
// 获取门店商品销售排行 // 获取门店商品销售排行
async getMerchantGoodsRank(year, MerchantId) { async getMerchantGoodsRank(merchantid) {
const _data = await this.api.boutique.getMerchantGoodsRank({ year, MerchantId: this.merchantid }) const _data = await this.api.boutique.getMerchantGoodsRank({ year: this.$store.state.app.boutique.year, MerchantId: merchantid })
console.log(_data); console.log(_data);
this.goodsRankingList = _data.data.dataList this.goodsRankingList = _data.data.dataList
} }
......
...@@ -32,8 +32,7 @@ export default { ...@@ -32,8 +32,7 @@ export default {
RightViewContent RightViewContent
}, },
props: { props: {
merchantid: String, merchantid: String
year: String
}, },
data() { data() {
return { return {
...@@ -69,12 +68,11 @@ export default { ...@@ -69,12 +68,11 @@ export default {
methods: { methods: {
init() { init() {
const _year = this.year this.getMerchantSupply(this.merchantid)
this.getMerchantSupply(_year)
}, },
// 获取门店商品供应方占比 // 获取门店商品供应方占比
async getMerchantSupply(year, MerchantId) { async getMerchantSupply(merchantid) {
const _data = await this.api.boutique.getMerchantSupply({ year, MerchantId: this.merchantid }) const _data = await this.api.boutique.getMerchantSupply({ year: this.$store.state.app.boutique.year, MerchantId: merchantid })
console.log(_data); console.log(_data);
this.propertionData = _data.data.dataList this.propertionData = _data.data.dataList
}, },
......
...@@ -22,6 +22,7 @@ import { boutiqueMixin } from '@/mixins' ...@@ -22,6 +22,7 @@ import { boutiqueMixin } from '@/mixins'
import BoutiqueDetailLeft from './BoutiqueDetailLeft.vue' import BoutiqueDetailLeft from './BoutiqueDetailLeft.vue'
import BoutiqueDetailRight from './BoutiqueDetailRight.vue' import BoutiqueDetailRight from './BoutiqueDetailRight.vue'
import BoutiqueDetailDate from './BoutiqueDetailDate.vue' import BoutiqueDetailDate from './BoutiqueDetailDate.vue'
import { mapActions } from 'vuex'
export default { export default {
name: 'BoutiqueDetail', name: 'BoutiqueDetail',
mixins: [boutiqueMixin], mixins: [boutiqueMixin],
...@@ -56,11 +57,10 @@ export default { ...@@ -56,11 +57,10 @@ export default {
path: '/boutiqueDetail', path: '/boutiqueDetail',
query: { query: {
merchantid: data.merchantid, merchantid: data.merchantid,
merchantname: data.merchantname, merchantname: data.merchantname
year: this.$store.state.app.solarYear
} }
}) })
this.init() this.setBoutiqueMerchantid(data.merchantid)
}) })
this.$bus.$on('boutiqueDate', data => { this.$bus.$on('boutiqueDate', data => {
console.log(data, '--==-=-='); console.log(data, '--==-=-=');
...@@ -69,6 +69,7 @@ export default { ...@@ -69,6 +69,7 @@ export default {
}, },
methods: { methods: {
...mapActions(['setBoutiqueMerchantid']),
async init() { async init() {
this.tabObject = this.$route.query this.tabObject = this.$route.query
const { merchantid, merchantName, year } = this.$route.query const { merchantid, merchantName, year } = this.$route.query
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!