Commit 95c2ae58 by 匡雅琴

接口联调

1 parent 6b5e9b21
......@@ -13,10 +13,10 @@
</div>
<div class="tab">
<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="">
</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">
<input type="text" class="search-input" v-model="search" @input="handleInput">
<img class="icon-search" src="@/assets/images/icon-search.png" @click="searchMerchant" alt="">
......@@ -36,26 +36,40 @@
import utils from '@/utils/util'
export default {
name: 'DetailTitle',
props: {
dataList: {
type: Array,
default: () => []
},
dataListObj: {
type: Object,
default: () => {}
},
tabName: {
type: String,
default: ''
}
},
data() {
return {
isShow: false,
dataList: [],
firstTab: '', // 存储第一个tab下的子菜单对象
// dataList: [],
firstTab: this.tabName, // 存储第一个tab下的子菜单对象
now: new Date().format('yyyy-MM-dd hh:mm:ss'),
currentMenu: 'home', // 标记当前是哪个tab菜单
search: ''
}
},
created() {
const _obj = {
label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX',
value: '1'
}
this.dataList.push(_obj)
// const _obj = {
// label: '广东省深圳市宝安区XXXXXXXXX广东省深圳市宝安区XXXXXXXXX',
// value: '1'
// }
// this.dataList.push(_obj)
},
mounted() {
this.timer()
this.firstTab = this.dataList[0]
console.log(this.tabName);
},
methods: {
timer() {
......
......@@ -11,5 +11,13 @@ export default {
watchReportParams() {
return this.$store.state.app.reportParams
}
},
method: {
openMessage(msg) {
this.$message({
message: msg,
type: 'warning'
})
}
}
}
<template>
<div class="purchase-progress-box">
<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>
</template>
......@@ -21,7 +21,6 @@ export default {
id: 'progress',
keys: ['isDelivery', 'price'],
height: '15.34vh',
// colors: ['#34AFFF', '#FFC200', '#16E193']
colors: ['#4FA0FF', '#7CFFB2', '#FDF006']
},
// 采购进度数据
......@@ -54,14 +53,17 @@ export default {
hasIcon: '¥',
type: 'number'
}
],
progressLegendColors: ['#34AFFF', '#FFC200', '#16E193']
]
}
},
mounted() {},
methods: {}
methods: {
init() {
}
}
}
</script>
......
......@@ -9,7 +9,7 @@
{{ purchase }}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt="" />
</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 class="purchase-item" :class="purchase == item ? 'active' : ''" v-for="(item, index) in purchaseList" :key="index" @click.s="selectPurchase(item)">{{ item }}</div>
</div> -->
......@@ -23,75 +23,87 @@
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'PurchaseRank',
mixins: [changeMixin],
data() {
return {
// 采购额排名下拉框显示
isShow: false,
// 采购额排名下拉框数据
purchaseList: ['商城采购', '商城采购商城采购商城采购商城采购商城采购城采购商', '自采', '商城采购商城采购商城采购商城'],
purchaseList: [{
labelName: '总采购额排行-商城采购',
value: 'shopranking'
},
{
labelName: '近三月采购额排行-商城采购',
value: 'shoprankingnear3'
},
{
labelName: '总采购额排行-自采',
value: 'selfranking'
},
{
labelName: '近三月采购额排行-自采',
value: 'selfrankingnear3'
}],
rankingList: {},
// 采购额排名当前选中值
purchase: '商城采购',
purchase: '',
// 采购额排名门店数据
merchantsList: [
{
name: '公转一号店公转一号店公转一号店公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
},
{
name: '公转一号店',
// merchant: '云南宏胜瑞达汽车销售',
value: '345489'
}
],
merchantsList: [],
merchantsDataObj: [
{
name: 'name'
},
{
name: 'merchant'
name: 'merchantname'
},
{
name: 'value',
name: 'num',
type: 'number'
}
]
}
},
mounted() {},
mounted() {
this.purchase = this.purchaseList[0].labelName
},
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() {
this.isShow = !this.isShow
},
// 排名下拉选中
selectPurchase(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()
},
// 跳转太阳膜详情页
goDetailPage(item) {
console.log(item)
this.$router.push({ name: 'solarDetail', params: item })
this.$router.push({ name: 'solarDetail', params: { currentMerchant: item, merchantList: this.merchantsList }})
},
// 点击外部控制排名下拉隐藏
clickOutside() {
this.isShow = false
}
......
......@@ -2,7 +2,7 @@
<div class="layout">
<view-container>
<template #title>
<DetailTitle></DetailTitle>
<DetailTitle :dataList="merchantList" :dataListObj="merchantListObj" :tabName="tabName"></DetailTitle>
</template>
<template #content>
<div class="solar-detail-content">
......@@ -32,11 +32,11 @@
<div class="propotion-box flex">
<div class="propotion-box-left">
<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 class="propotion-box-right">
<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>
......@@ -71,6 +71,12 @@ export default {
addSymbol: '%'
}
],
merchantList: [],
merchantListObj: {
labelName: 'merchantname',
valueName: 'merchantid'
},
tabName: '',
dataList: [],
solarDetailList: [
{
......@@ -107,133 +113,63 @@ export default {
// 商城采购饼图结构
shopmallChart: {
id: 'shopmall',
keys: ['goodsName', 'per'],
keys: ['goodsname', 'per'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
// 商城采购数据
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
}
],
shopmallData: [],
shopmallLegend: [
{
name: 'goodsName'
name: 'goodsname'
},
{
name: 'per'
},
{
name: 'price',
name: 'purchaseamount',
hasIcon: '¥'
},
{
name: 'averagePrice',
name: 'averprice',
hasIcon: '均价¥'
}
],
shopmallLegendColors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001'],
// 自采饼图结构
selfPickChart: {
id: 'selfPick',
keys: ['goodsName', 'per'],
keys: ['goodsname', 'per'],
height: '16vh',
colors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
},
// 自采采购数据
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
}
],
selfPickData: [],
selfPickLegend: [
{
name: 'goodsName'
name: 'goodsname'
},
{
name: 'per'
},
{
name: 'price',
name: 'purchaseamount',
hasIcon: '¥'
},
{
name: 'averagePrice',
name: 'averprice',
hasIcon: '均价¥'
}
],
selfPickLegendColors: ['#16E193', '#747DFF', '#E588FF', '#34AFFF', '#FFC200', '#EB6001']
}
},
mounted() {
console.log(this.$route.params, '000');
created() {
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: {
init() {
......@@ -251,6 +187,40 @@ export default {
p.then(() => {
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!