Commit b4c9bfff by 胡悦

跳转详情添加年份查询

1 parent 2d2fcc2e
/*
* @Description:
* @Description: 1.0 太阳膜接口
* @Author: huyue
* @Date: 2023-07-12 16:17:18
* @LastEditors: huyue
* @LastEditTime: 2023-07-13 14:07:44
* @LastEditTime: 2023-07-17 10:15:45
*/
// 总 - 商品采购占比
const getAllGoodsRatio = params => {
......@@ -55,6 +55,16 @@ const getBugProgress = params => {
return window.$HTTP.get('solarfilm/getBugProgress', params)
}
// 获取年份接口
const getYears = params => {
return window.$HTTP.get('solarfilm/getYears', params)
}
// 获取门店列表
const getMerchant = params => {
return window.$HTTP.get('solarfilm/getMerchant', params)
}
export default {
getAllGoodsRatio,
getAllOpenBuyTrend,
......@@ -65,5 +75,7 @@ export default {
getMerchantPurchase,
getMerchantPurchaseTrend,
getUsedWarehousing,
getBugProgress
getBugProgress,
getYears,
getMerchant
}
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2023-07-05 15:11:53
* @LastEditors: huyue
* @LastEditTime: 2023-07-14 18:02:44
* @LastEditTime: 2023-07-17 10:36:40
-->
<template>
<div v-click-outside="handleClickOutside" @mouseleave="handleMouseLeave" v-show="isShow" class="select-box" :style="{'width': boxWidth}">
......@@ -72,13 +72,6 @@ export default {
empty: '暂无数据'
}
},
watch: {
'defaultValue': {
handler(newVal) {
console.log(newVal)
}
}
},
mounted() {
const { valueName, isObject, dataList, defaultValue } = this
console.log(defaultValue)
......
......@@ -3,37 +3,42 @@
* @Author: huyue
* @Date: 2023-07-05 10:35:43
* @LastEditors: huyue
* @LastEditTime: 2023-07-14 18:11:23
* @LastEditTime: 2023-07-17 10:56:11
-->
<template>
<div class="view-date">统计年份:
<div class="year-plugin">
<div class="year" @click.stop="switchYear">
{{$store.state.app.solarYear}}
{{defaultYear || $store.state.app.solarYear}}
<img class="arrow-down" src="@/assets/images/arrow-down.png" alt="">
</div>
<SelectBox :isShow="isShow" :defaultValue="$store.state.app.solarYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
<SelectBox :isShow="isShow" :defaultValue="defaultYear" @clickOutside="clickOutside" :dataList="dataList" :boxWidth="'8.61vw'" @selectVal="selectVal"></SelectBox>
<!-- <div v-show="isShow" class="select-year">
<div class="year-item" :class="year == item ? 'active' : ''" v-for="(item,index) in dataList" :key="index" @click.s="selectYear(item)">{{item}}</div>
</div> -->
</div>
<span class="businessTime">
业务开始时间:{{new Date(businessTime).format('yyyy-MM-dd')}}
业务开始时间:{{businessTime ? new Date(businessTime).format('yyyy-MM-dd') : ''}}
</span>
</div>
</template>
<script type='text/ecmascript-6'>
import datas from '@/utils/data'
// import datas from '@/utils/data'
import { mapActions } from 'vuex'
export default {
name: 'ViewDate',
props: {
businessTime: String
businessTime: String,
dataList: {
type: Array,
default: () => []
},
defaultYear: String
},
data() {
return {
isShow: false,
dataList: datas.DefaultData.yearList,
// dataList: datas.DefaultData.yearList,
year: ''
}
},
......
......@@ -3,11 +3,11 @@
* @Author: huyue
* @Date: 2023-07-04 13:56:33
* @LastEditors: huyue
* @LastEditTime: 2023-07-14 17:08:05
* @LastEditTime: 2023-07-17 10:37:36
-->
<template>
<div class="view-content">
<ViewDate :businessTime="businessTime"></ViewDate>
<ViewDate :dataList="yearList" :businessTime="businessTime"></ViewDate>
<div class="content">
<ContentLeft></ContentLeft>
<ContentRight></ContentRight>
......@@ -29,15 +29,21 @@ export default {
},
data() {
return {
businessTime: ''
businessTime: '',
yearList: []
}
},
created() {
this.$bus.$on('businessstarttime', data => {
this.businessTime = data
})
this.getYears()
},
methods: {
async getYears() {
const _data = await this.api.solar.getYears({})
this.yearList = _data.data.dataList[0].year.reverse().map(item => item + '')
}
}
}
</script>
......
......@@ -104,14 +104,15 @@ export default {
},
// 跳转太阳膜详情页
goDetailPage(item) {
console.log(item)
console.log(this.$store.state.app.solarYear)
// this.$router.push({ path: `solarDetail?merchantid=${item.merchantid}&merchantname=${item.merchantname}&purchaseType=${this.purchase.value}` })
const routeData = this.$router.resolve({
name: 'solarDetail',
query: {
merchantid: item.merchantid,
merchantname: item.merchantname,
purchaseType: this.purchase.value
purchaseType: this.purchase.value,
year: this.$store.state.app.solarYear
}
})
window.open(routeData.href, '_blank')
......
......@@ -6,7 +6,7 @@
</template>
<template #content>
<div class="solar-detail-content">
<view-date :businessTime="businessTime"></view-date>
<view-date :defaultYear="defaultYear" :dataList="yearList" :businessTime="businessTime"></view-date>
<StatisticsBox class="statistic-box" :list="solarDetailList"></StatisticsBox>
<!-- 采购趋势 -->
<div class="tendency-box">
......@@ -77,6 +77,8 @@ export default {
},
data() {
return {
yearList: [],
defaultYear: '',
tooltipFormatterObj: [
{
label: '商城',
......@@ -185,17 +187,17 @@ export default {
},
methods: {
async init() {
console.log(this.$route.query, '999')
this.tabObject = this.$route.query
this.businessTime = this.$store.state.app.solarTime
this.businessYear = this.$store.state.app.solarYear
const { year } = this.$route.query
this.defaultYear = year
const { merchantid, purchaseType } = this.$route.query
const _merchantList = await this.getAllRanking(purchaseType)
this.merchantList = _merchantList
console.log(this.merchantList, 'this.merchantList')
this.getMerchantGoodsRatio(this.businessYear, merchantid)
this.getMerchantPurchase(this.businessYear, merchantid)
this.getMerchantPurchaseTrend(this.businessYear, merchantid)
this.getMerchantGoodsRatio(year, merchantid)
this.getMerchantPurchase(year, merchantid)
this.getMerchantPurchaseTrend(year, merchantid)
this.getYears(merchantid)
},
// 获取门店的商品采购占比(商城、自采)
getMerchantGoodsRatio(year, merchantid) {
......@@ -260,6 +262,11 @@ export default {
resolve(_merchantList)
})
})
},
// 获取年份数据参数门店id
async getYears(MerchantId) {
const _data = await this.api.solar.getYears({ MerchantId })
this.yearList = _data.data.dataList[0].year.reverse().map(item => item + '')
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!