Commit 95c2ae58 by 匡雅琴

接口联调

1 parent 6b5e9b21
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
</div> </div>
<div class="tab"> <div class="tab">
<div class="tab-item first-tab active" @click.stop="openSelect"> <div class="tab-item first-tab active" @click.stop="openSelect">
<div class="merchant-name">{{ firstTab.label }}</div> <div class="merchant-name">{{ firstTab.label || firstTab }}</div>
<img class="arrow-down" src="@/assets/images/title-arrow.png" alt=""> <img class="arrow-down" src="@/assets/images/title-arrow.png" alt="">
</div> </div>
<SelectBox :isShow="isShow" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'23.33vw'" isObject @selectVal="selectVal"> <SelectBox :isShow="isShow" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'23.33vw'" isObject @selectVal="selectVal" :labelName="dataListObj.labelName" :valueName="dataListObj.valueName">
<div slot="search" class="search"> <div slot="search" class="search">
<input type="text" class="search-input" v-model="search" @input="handleInput"> <input type="text" class="search-input" v-model="search" @input="handleInput">
<img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt=""> <img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt="">
...@@ -36,26 +36,40 @@ ...@@ -36,26 +36,40 @@
import utils from '@/utils/util' import utils from '@/utils/util'
export default { export default {
name: 'DetailTitle', name: 'DetailTitle',
props: {
dataList: {
type: Array,
default: () => []
},
dataListObj: {
type: Object,
default: () => {}
},
tabName: {
type: String,
default: ''
}
},
data() { data() {
return { return {
isShow: false, isShow: false,
dataList: [], // dataList: [],
firstTab: '', // 存储第一个tab下的子菜单对象 firstTab: this.tabName, // 存储第一个tab下的子菜单对象
now: new Date().format('yyyy-MM-dd hh:mm:ss'), now: new Date().format('yyyy-MM-dd hh:mm:ss'),
currentMenu: 'home', // 标记当前是哪个tab菜单 currentMenu: 'home', // 标记当前是哪个tab菜单
search: '' search: ''
} }
}, },
created() { created() {
const _obj = { // const _obj = {
label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX', // label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX',
value: '1' // value: '1'
} // }
this.dataList.push(_obj) // this.dataList.push(_obj)
}, },
mounted() { mounted() {
this.timer() this.timer()
this.firstTab = this.dataList[0] console.log(this.tabName);
}, },
methods: { methods: {
timer() { timer() {
......
...@@ -11,5 +11,13 @@ export default { ...@@ -11,5 +11,13 @@ export default {
watchReportParams() { watchReportParams() {
return this.$store.state.app.reportParams return this.$store.state.app.reportParams
} }
},
method: {
openMessage(msg) {
this.$message({
message: msg,
type: 'warning'
})
}
} }
} }
<template> <template>
<div class="purchase-progress-box"> <div class="purchase-progress-box">
<box-title title="商城采购进度分析"></box-title> <box-title title="商城采购进度分析"></box-title>
<RightViewContent class="content-box" :chart="progressChart" :listData="progressData" :legentList="progressLegend" :legendColors="progressLegendColors"></RightViewContent> <RightViewContent class="content-box" :chart="progressChart" :listData="progressData" :legentList="progressLegend" :legendColors="progressChart.colors"></RightViewContent>
</div> </div>
</template> </template>
...@@ -21,7 +21,6 @@ export default { ...@@ -21,7 +21,6 @@ export default {
id: 'progress', id: 'progress',
keys: ['isDelivery', 'price'], keys: ['isDelivery', 'price'],
height: '15.34vh', height: '15.34vh',
// colors: ['#34AFFF', '#FFC200', '#16E193']
colors: ['#4FA0FF', '#7CFFB2', '#FDF006'] colors: ['#4FA0FF', '#7CFFB2', '#FDF006']
}, },
// 采购进度数据 // 采购进度数据
...@@ -54,14 +53,17 @@ export default { ...@@ -54,14 +53,17 @@ export default {
hasIcon: '¥', hasIcon: '¥',
type: 'number' type: 'number'
} }
], ]
progressLegendColors: ['#34AFFF', '#FFC200', '#16E193']
} }
}, },
mounted() {}, mounted() {},
methods: {} methods: {
init() {
}
}
} }
</script> </script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{{ purchase }} {{ purchase }}
<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" :dataList="purchaseList" :boxWidth="'28.61vw'" @selectVal="selectPurchase"></SelectBox> <SelectBox :isShow="isShow" @clickOutside="clickOutside" isObject :dataList="purchaseList" :boxWidth="'28.61vw'" @selectVal="selectPurchase" :labelName="'labelName'"></SelectBox>
<!-- <div v-show="isShow" class="select-purchase"> <!-- <div v-show="isShow" class="select-purchase">
<div class="purchase-item" :class="purchase == item ? 'active' : ''" v-for="(item, index) in purchaseList" :key="index" @click.s="selectPurchase(item)">{{ item }}</div> <div class="purchase-item" :class="purchase == item ? 'active' : ''" v-for="(item, index) in purchaseList" :key="index" @click.s="selectPurchase(item)">{{ item }}</div>
</div> --> </div> -->
...@@ -23,75 +23,87 @@ ...@@ -23,75 +23,87 @@
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'PurchaseRank', name: 'PurchaseRank',
mixins: [changeMixin],
data() { data() {
return { return {
// 采购额排名下拉框显示 // 采购额排名下拉框显示
isShow: false, isShow: false,
// 采购额排名下拉框数据 // 采购额排名下拉框数据
purchaseList: ['商城采购', '商城采购商城采购商城采购商城采购商城采购城采购商', '自采', '商城采购商城采购商城采购商城'], purchaseList: [{
labelName: '总采购额排行-商城采购',
value: 'shopranking'
},
{
labelName: '近三月采购额排行-商城采购',
value: 'shoprankingnear3'
},
{
labelName: '总采购额排行-自采',
value: 'selfranking'
},
{
labelName: '近三月采购额排行-自采',
value: 'selfrankingnear3'
}],
rankingList: {},
// 采购额排名当前选中值 // 采购额排名当前选中值
purchase: '商城采购', purchase: '',
// 采购额排名门店数据 // 采购额排名门店数据
merchantsList: [ merchantsList: [],
{
name: '公转一号店公转一号店公转一号店公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
}
],
merchantsDataObj: [ merchantsDataObj: [
{ {
name: 'name' name: 'merchantname'
},
{
name: 'merchant'
}, },
{ {
name: 'value', name: 'num',
type: 'number' type: 'number'
} }
] ]
} }
}, },
mounted() {}, mounted() {
this.purchase = this.purchaseList[0].labelName
},
methods: { methods: {
init() {
this.getAllRanking()
},
// 获取各类商品采购额排名
getAllRanking() {
this.api.solar.getAllRanking({ req: { year: 2023 }}).then(res => {
console.log(res, '000')
if (!res.code === '0') {
this.openMessage('获取商品采购额排名失败')
return
}
this.rankingList = res.data.dataList[0]
this.merchantsList = this.rankingList[this.purchaseList[0].value].slice(0, 5)
})
},
// 排名下拉显示/隐藏
switchPurchase() { switchPurchase() {
this.isShow = !this.isShow this.isShow = !this.isShow
}, },
// 排名下拉选中
selectPurchase(item) { selectPurchase(item) {
console.log(item) console.log(item)
this.purchase = item this.purchase = item.labelName
const purchaseIndex = this.purchaseList.findIndex(itm => itm.value === item.value)
// 只获取排名前五的数据
this.merchantsList = this.rankingList[this.purchaseList[purchaseIndex].value].slice(0, 5)
this.switchPurchase() this.switchPurchase()
}, },
// 跳转太阳膜详情页 // 跳转太阳膜详情页
goDetailPage(item) { goDetailPage(item) {
console.log(item) console.log(item)
this.$router.push({ name: 'solarDetail', params: item }) this.$router.push({ name: 'solarDetail', params: { currentMerchant: item, merchantList: this.merchantsList }})
}, },
// 点击外部控制排名下拉隐藏
clickOutside() { clickOutside() {
this.isShow = false this.isShow = false
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="layout"> <div class="layout">
<view-container> <view-container>
<template #title> <template #title>
<DetailTitle></DetailTitle> <DetailTitle :dataList="merchantList" :dataListObj="merchantListObj" :tabName="tabName"></DetailTitle>
</template> </template>
<template #content> <template #content>
<div class="solar-detail-content"> <div class="solar-detail-content">
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
<div class="propotion-box flex"> <div class="propotion-box flex">
<div class="propotion-box-left"> <div class="propotion-box-left">
<box-title title="商城采购商品占比"></box-title> <box-title title="商城采购商品占比"></box-title>
<RightViewContent class="content-box" :chart="shopmallChart" :listData="shopmallData" :legentList="shopmallLegend" :legendColors="shopmallLegendColors"></RightViewContent> <RightViewContent class="content-box" :chart="shopmallChart" :listData="shopmallData" :legentList="shopmallLegend" :legendColors="shopmallChart.color"></RightViewContent>
</div> </div>
<div class="propotion-box-right"> <div class="propotion-box-right">
<box-title title="自采商品占比"></box-title> <box-title title="自采商品占比"></box-title>
<RightViewContent class="content-box" :chart="selfPickChart" :listData="selfPickData" :legentList="selfPickLegend" :legendColors="selfPickLegendColors"></RightViewContent> <RightViewContent class="content-box" :chart="selfPickChart" :listData="selfPickData" :legentList="selfPickLegend" :legendColors="selfPickChart.color"></RightViewContent>
</div> </div>
</div> </div>
</div> </div>
...@@ -71,6 +71,12 @@ export default { ...@@ -71,6 +71,12 @@ export default {
addSymbol: '%' addSymbol: '%'
} }
], ],
merchantList: [],
merchantListObj: {
labelName: 'merchantname',
valueName: 'merchantid'
},
tabName: '',
dataList: [], dataList: [],
solarDetailList: [ solarDetailList: [
{ {
...@@ -107,133 +113,63 @@ export default { ...@@ -107,133 +113,63 @@ export default {
// 商城采购饼图结构 // 商城采购饼图结构
shopmallChart: { shopmallChart: {
id: 'shopmall', id: 'shopmall',
keys: ['goodsName', 'per'], keys: ['goodsname', 'per'],
height: '16vh', height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'] colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
}, },
// 商城采购数据 // 商城采购数据
shopmallData: [ shopmallData: [],
{
goodsName: '商品1',
per: 0.36,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品2',
per: 0.2,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品3',
per: 0.16,
price: 4568,
averagePrice: 668
},
{
goodsName: '品1发货',
per: 0.1,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品4',
per: 0.09,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品5',
per: 0.09,
price: 4568,
averagePrice: 668
}
],
shopmallLegend: [ shopmallLegend: [
{ {
name: 'goodsName' name: 'goodsname'
}, },
{ {
name: 'per' name: 'per'
}, },
{ {
name: 'price', name: 'purchaseamount',
hasIcon: '¥' hasIcon: '¥'
}, },
{ {
name: 'averagePrice', name: 'averprice',
hasIcon: '均价¥' hasIcon: '均价¥'
} }
], ],
shopmallLegendColors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
// 自采饼图结构 // 自采饼图结构
selfPickChart: { selfPickChart: {
id: 'selfPick', id: 'selfPick',
keys: ['goodsName', 'per'], keys: ['goodsname', 'per'],
height: '16vh', height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'] colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
}, },
// 自采采购数据 // 自采采购数据
selfPickData: [ selfPickData: [],
{
goodsName: '商品1',
per: 0.36,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品5',
per: 0.2,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品6',
per: 0.16,
price: 4568,
averagePrice: 668
},
{
goodsName: '品1发货',
per: 0.1,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品7',
per: 0.09,
price: 4568,
averagePrice: 668
},
{
goodsName: '商品8',
per: 0.09,
price: 4568,
averagePrice: 668
}
],
selfPickLegend: [ selfPickLegend: [
{ {
name: 'goodsName' name: 'goodsname'
}, },
{ {
name: 'per' name: 'per'
}, },
{ {
name: 'price', name: 'purchaseamount',
hasIcon: '¥' hasIcon: '¥'
}, },
{ {
name: 'averagePrice', name: 'averprice',
hasIcon: '均价¥' hasIcon: '均价¥'
} }
], ],
selfPickLegendColors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
} }
}, },
mounted() { created() {
console.log(this.$route.params, '000'); console.log(this.$route.params, '999')
this.merchantList = this.$route.params.merchantList
const { merchantid, merchantname } = this.$route.params.currentMerchant
this.tabName = merchantname
this.getMerchantGoodsRatio(merchantid)
this.getMerchantPurchase(merchantid)
// this.getMerchantPurchaseTrend(merchantid)
}, },
methods: { methods: {
init() { init() {
...@@ -251,6 +187,40 @@ export default { ...@@ -251,6 +187,40 @@ export default {
p.then(() => { p.then(() => {
this.$refs.purchaseTrend.drawBarLine() this.$refs.purchaseTrend.drawBarLine()
}) })
},
// 获取门店的商品采购占比(商城、自采)
getMerchantGoodsRatio(merchantid) {
this.api.solar.getMerchantGoodsRatio({ req: { year: 2023, MerchantId: merchantid }}).then(res => {
console.log(res);
if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败')
return
}
this.shopmallData = res.data.dataList[0].selfgoodsRatioList || []
this.selfPickData = res.data.dataList[0].shopgoodsRatioList || []
})
},
// 获取每个门店的 总采购额(总计、本月) 、商城采购额(总计、本月) 、自采采购额(总计、本月)
getMerchantPurchase(merchantid) {
this.api.solar.getMerchantPurchase({ req: { year: 2023, MerchantId: merchantid }}).then(res => {
console.log(res);
if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败')
return
}
})
},
// 获取每个门店的商城采购额(占比)、自采采购额(占比) 趋势
getMerchantPurchaseTrend(merchantid) {
this.api.solar.getMerchantPurchaseTrend({ req: { year: 2023, MerchantId: merchantid }}).then(res => {
console.log(res);
if (!res.code === '0') {
this.openMessage('获取门店商品采购占比失败')
return
}
this.dataList = res.data.dataList[0]
this.$refs.purchaseTrend.drawBarLine()
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!