Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
h5
/
glsk-data-view-pd
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b1abaa7c
authored
Jul 14, 2023
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
接口调取
1 parent
392671b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
12 deletions
src/views/home/solar/PurchaseRank.vue
src/views/solarDetail/index.vue
src/views/home/solar/PurchaseRank.vue
View file @
b1abaa7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<!-- 采购选项下拉 -->
<!-- 采购选项下拉 -->
<div
class=
"purchase-plugin"
>
<div
class=
"purchase-plugin"
>
<div
class=
"purchase"
@
click
.
stop=
"switchPurchase"
>
<div
class=
"purchase"
@
click
.
stop=
"switchPurchase"
>
{{
purchase
}}
{{
purchase
.
labelName
}}
<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"
isObject
:dataList=
"purchaseList"
:boxWidth=
"'28.61vw'"
@
selectVal=
"selectPurchase"
:labelName=
"'labelName'"
></SelectBox>
<SelectBox
:isShow=
"isShow"
@
clickOutside=
"clickOutside"
isObject
:dataList=
"purchaseList"
:boxWidth=
"'28.61vw'"
@
selectVal=
"selectPurchase"
:labelName=
"'labelName'"
></SelectBox>
...
@@ -51,7 +51,7 @@ export default {
...
@@ -51,7 +51,7 @@ export default {
}],
}],
rankingList
:
{},
rankingList
:
{},
// 采购额排名当前选中值
// 采购额排名当前选中值
purchase
:
''
,
purchase
:
{}
,
// 采购额排名门店数据
// 采购额排名门店数据
merchantsList
:
[],
merchantsList
:
[],
merchantsDataObj
:
[
merchantsDataObj
:
[
...
@@ -67,7 +67,7 @@ export default {
...
@@ -67,7 +67,7 @@ export default {
},
},
mounted
()
{
mounted
()
{
this
.
purchase
=
this
.
purchaseList
[
0
]
.
labelName
this
.
purchase
=
this
.
purchaseList
[
0
]
},
},
methods
:
{
methods
:
{
...
@@ -95,7 +95,7 @@ export default {
...
@@ -95,7 +95,7 @@ export default {
// 排名下拉选中
// 排名下拉选中
selectPurchase
(
item
)
{
selectPurchase
(
item
)
{
console
.
log
(
item
)
console
.
log
(
item
)
this
.
purchase
=
item
.
labelName
this
.
purchase
=
item
const
purchaseIndex
=
this
.
purchaseList
.
findIndex
(
itm
=>
itm
.
value
===
item
.
value
)
const
purchaseIndex
=
this
.
purchaseList
.
findIndex
(
itm
=>
itm
.
value
===
item
.
value
)
// 只获取排名前五的数据
// 只获取排名前五的数据
this
.
merchantsList
=
this
.
rankingList
[
this
.
purchaseList
[
purchaseIndex
].
value
].
slice
(
0
,
5
)
this
.
merchantsList
=
this
.
rankingList
[
this
.
purchaseList
[
purchaseIndex
].
value
].
slice
(
0
,
5
)
...
@@ -105,7 +105,7 @@ export default {
...
@@ -105,7 +105,7 @@ export default {
// 跳转太阳膜详情页
// 跳转太阳膜详情页
goDetailPage
(
item
)
{
goDetailPage
(
item
)
{
console
.
log
(
item
)
console
.
log
(
item
)
this
.
$router
.
push
({
path
:
`solarDetail?merchantid=
${
item
.
merchantid
}
&merchantname=
${
item
.
merchantname
}
`
})
this
.
$router
.
push
({
path
:
`solarDetail?merchantid=
${
item
.
merchantid
}
&merchantname=
${
item
.
merchantname
}
&purchaseType=
${
this
.
purchase
.
value
}
`
})
},
},
// 点击外部控制排名下拉隐藏
// 点击外部控制排名下拉隐藏
clickOutside
()
{
clickOutside
()
{
...
...
src/views/solarDetail/index.vue
View file @
b1abaa7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<div
class=
"layout"
>
<div
class=
"layout"
>
<view-container>
<view-container>
<template
#
title
>
<template
#
title
>
<DetailTitle
:dataList=
"merchantList"
:dataListObj=
"merchantListObj"
:tab
Name=
"tabName
"
></DetailTitle>
<DetailTitle
:dataList=
"merchantList"
:dataListObj=
"merchantListObj"
:tab
Object=
"tabObject
"
></DetailTitle>
</
template
>
</
template
>
<
template
#
content
>
<
template
#
content
>
<div
class=
"solar-detail-content"
>
<div
class=
"solar-detail-content"
>
...
@@ -98,7 +98,7 @@ export default {
...
@@ -98,7 +98,7 @@ export default {
labelName
:
'merchantname'
,
labelName
:
'merchantname'
,
valueName
:
'merchantid'
valueName
:
'merchantid'
},
},
tab
Name
:
''
,
tab
Object
:
{}
,
dataList
:
[],
dataList
:
[],
solarDetailList
:
[
solarDetailList
:
[
{
{
...
@@ -185,14 +185,28 @@ export default {
...
@@ -185,14 +185,28 @@ export default {
created
()
{},
created
()
{},
methods
:
{
methods
:
{
...
mapActions
([
'setSolarYear'
]),
...
mapActions
([
'setSolarYear'
]),
init
()
{
async
init
()
{
console
.
log
(
this
.
$route
.
query
,
'999'
)
console
.
log
(
this
.
$route
.
query
,
'999'
)
this
.
merchantList
=
this
.
$store
.
state
.
app
.
merchantRankingList
console
.
log
(
this
.
merchantList
,
'this.merchantList'
)
this
.
businessTime
=
this
.
$store
.
state
.
app
.
solarTime
this
.
businessTime
=
this
.
$store
.
state
.
app
.
solarTime
this
.
businessYear
=
this
.
$store
.
state
.
app
.
solarYear
this
.
businessYear
=
this
.
$store
.
state
.
app
.
solarYear
const
{
merchantid
,
merchantname
}
=
this
.
$route
.
query
const
{
merchantid
,
purchaseType
}
=
this
.
$route
.
query
this
.
tabName
=
merchantname
let
_merchantList
=
this
.
$store
.
state
.
app
.
merchantRankingList
// 页面刷新导致门店数据置空,重新请求数据
// if (!_merchantList.length) {
// this.api.solar.getAllRanking({ year: 2023 }).then(res => {
// console.log(res, '000')
// if (!res.code === '0') {
// this.openMessage('获取商品采购额排名失败')
// return
// }
// const _data = res.data.dataList[0]
// _merchantList = _data[purchaseType]
// })
// }
if
(
!
_merchantList
.
length
)
_merchantList
=
await
this
.
getAllRanking
(
purchaseType
)
this
.
merchantList
=
_merchantList
console
.
log
(
this
.
merchantList
,
'this.merchantList'
)
this
.
tabObject
=
this
.
$route
.
query
this
.
getMerchantGoodsRatio
(
this
.
businessYear
,
merchantid
)
this
.
getMerchantGoodsRatio
(
this
.
businessYear
,
merchantid
)
this
.
getMerchantPurchase
(
this
.
businessYear
,
merchantid
)
this
.
getMerchantPurchase
(
this
.
businessYear
,
merchantid
)
this
.
getMerchantPurchaseTrend
(
this
.
businessYear
,
merchantid
)
this
.
getMerchantPurchaseTrend
(
this
.
businessYear
,
merchantid
)
...
@@ -247,6 +261,21 @@ export default {
...
@@ -247,6 +261,21 @@ export default {
// 切换年份
// 切换年份
yearValue
(
val
)
{
yearValue
(
val
)
{
this
.
setSolarYear
(
val
)
this
.
setSolarYear
(
val
)
},
getAllRanking
(
purchaseType
)
{
return
new
Promise
(
resolve
=>
{
let
_merchantList
this
.
api
.
solar
.
getAllRanking
({
year
:
2023
}).
then
(
res
=>
{
console
.
log
(
res
,
'000'
)
if
(
!
res
.
code
===
'0'
)
{
this
.
openMessage
(
'获取商品采购额排名失败'
)
return
}
const
_data
=
res
.
data
.
dataList
[
0
]
_merchantList
=
_data
[
purchaseType
]
resolve
(
_merchantList
)
})
})
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment