Commit a2f12f58 by 匡雅琴

详情页接口联调

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