Commit b4c9bfff by 胡悦

跳转详情添加年份查询

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