Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gh
/
data-view
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 a4a9fc41
authored
Jun 30, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
转化趋势
1 parent
14a1ec47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
65 deletions
src/views/salesData/trend.vue
src/views/salesData/trend.vue
View file @
a4a9fc4
...
@@ -3,16 +3,18 @@
...
@@ -3,16 +3,18 @@
* @Author: huyue
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 1
4:38:18
* @LastEditTime: 2022-06-30 1
7:04:25
-->
-->
<
template
>
<
template
>
<div>
<div>
<div
class=
"title"
>
转化趋势
</div>
<div
class=
"title"
>
转化趋势
{{
hasData
}}
</div>
<!--
<div
class=
"empty"
>
<div
v-if=
"hasData"
style=
"width: 100%"
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
-->
<div
id=
"lineTrend"
:style=
"
{ height: height - 4.1 + 'vh' }">
</div>
<div
id=
"lineTrend"
:style=
"
{ height: height - 4.1 + 'vh' }">
</div>
</div>
</div>
<div
v-else
class=
"empty"
>
<img
src=
"../../assets/images/empty.png"
alt=
""
/>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
...
@@ -27,7 +29,9 @@ export default {
...
@@ -27,7 +29,9 @@ export default {
echartsTrend
:
{},
echartsTrend
:
{},
option
:
{},
option
:
{},
dataList
:
[],
dataList
:
[],
paramsData
:
[]
paramsData
:
[],
list
:
[
'enter'
,
'stayfile'
,
'test'
,
'placeorder'
,
'success'
],
hasData
:
true
}
}
},
},
mounted
()
{
mounted
()
{
...
@@ -41,7 +45,7 @@ export default {
...
@@ -41,7 +45,7 @@ export default {
var
params
=
{
var
params
=
{
req
:
{
req
:
{
corporateGroupName
:
'集团1'
,
corporateGroupName
:
'集团1'
,
queryItem
:
'enter'
,
//
queryItem: 'enter',
querystartTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
30
)
:
this
.
getNMonth
(
-
12
),
querystartTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
30
)
:
this
.
getNMonth
(
-
12
),
queryendTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
1
)
:
this
.
getNMonth
(
-
1
),
queryendTime
:
+
val
.
reportType
===
1
?
this
.
getNDate
(
-
1
)
:
this
.
getNMonth
(
-
1
),
queryType
:
val
.
reportType
||
0
queryType
:
val
.
reportType
||
0
...
@@ -52,37 +56,49 @@ export default {
...
@@ -52,37 +56,49 @@ export default {
if
(
brandName
)
{
if
(
brandName
)
{
params
.
req
.
brandName
=
brandName
params
.
req
.
brandName
=
brandName
}
}
this
.
api
.
sales
[
brandName
?
'storeTransTrend'
:
'saleTransTrend'
](
params
).
then
(
res
=>
{
const
api
=
brandName
?
'storeTransTrend'
:
'saleTransTrend'
var
{
code
,
data
}
=
res
const
p
=
[]
console
.
log
(
res
)
this
.
list
.
forEach
((
i
,
idx
)
=>
{
switch
(
+
code
)
{
p
[
idx
]
=
new
Promise
((
resolve
,
reject
)
=>
{
case
0
:
params
.
req
.
queryItem
=
i
this
.
dataList
=
[]
this
.
api
.
sales
[
api
](
params
).
then
(
res
=>
{
if
(
!
data
.
dataList
.
map
(
item
=>
item
.
num
).
every
(
item
=>
item
===
0
))
{
resolve
(
res
.
data
.
dataList
)
this
.
dealList
(
data
.
dataList
)
this
.
$nextTick
(()
=>
{
this
.
draw
()
})
})
})
})
Promise
.
all
([
p
[
0
],
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
]]).
then
(
results
=>
{
console
.
log
(
results
)
this
.
dataList
=
results
const
flag
=
results
.
map
(
item
=>
{
if
(
item
.
length
)
{
return
item
.
map
(
i
=>
i
.
num
).
some
(
j
=>
j
!=
0
)
}
else
{
return
false
}
}
break
})
}
console
.
log
(
flag
,
flag
.
every
(
i
=>
!
i
)
)
// this.hasData = !flag.every(i => !i)
this
.
$set
(
this
,
'hasData'
,
!
flag
.
every
(
i
=>
!
i
))
this
.
draw
()
})
})
},
},
draw
()
{
draw
()
{
this
.
option
=
{
this
.
option
=
{
tooltip
:
{
tooltip
:
{
trigger
:
'axis'
,
trigger
:
'axis'
,
show
:
true
,
borderWidth
:
0
,
borderWidth
:
0
,
backgroundColor
:
'rgba(68,68,68,0.80)'
,
backgroundColor
:
'rgba(68,68,68,0.80)'
,
position
:
[
20
,
20
],
//
position: [20, 20],
textStyle
:
{
textStyle
:
{
color
:
'#FFFFFF'
,
color
:
'#FFFFFF'
,
fontSize
:
8
fontSize
:
8
},
},
extraCssText
:
'width: 60px;'
,
extraCssText
:
'width: 80px;'
,
// formatter: this.tooltipFormatter
formatter
:
e
=>
{
formatter
:
e
=>
{
console
.
log
(
e
)
var
txt
=
''
var
txt
=
''
e
.
forEach
(
item
=>
{
e
.
forEach
(
item
=>
{
if
(
txt
)
{
if
(
txt
)
{
...
@@ -110,83 +126,61 @@ export default {
...
@@ -110,83 +126,61 @@ export default {
data
:
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
data
:
[
'Mon'
,
'Tue'
,
'Wed'
,
'Thu'
,
'Fri'
,
'Sat'
,
'Sun'
]
},
},
yAxis
:
{
yAxis
:
{
type
:
'value'
,
type
:
'value'
splitLine
:
{
lineStyle
:
{
color
:
'#606266'
}
}
},
},
series
:
[
series
:
[
{
{
name
:
'客流'
,
name
:
'客流'
,
type
:
'line'
,
type
:
'line'
,
symbol
:
'
non
e'
,
symbol
:
'
circl
e'
,
smooth
:
true
,
smooth
:
true
,
showSymbol
:
false
,
stack
:
'Total'
,
stack
:
'Total'
,
data
:
[
120
,
132
,
101
,
134
,
90
,
230
,
210
]
data
:
[]
},
},
{
{
name
:
'留档'
,
name
:
'留档'
,
type
:
'line'
,
type
:
'line'
,
symbol
:
'circle'
,
smooth
:
true
,
smooth
:
true
,
s
ymbol
:
'none'
,
s
howSymbol
:
false
,
stack
:
'Total'
,
stack
:
'Total'
,
data
:
[
220
,
182
,
191
,
234
,
290
,
330
,
310
]
data
:
[]
},
},
{
{
name
:
'试驾'
,
name
:
'试驾'
,
type
:
'line'
,
type
:
'line'
,
symbol
:
'
non
e'
,
symbol
:
'
circl
e'
,
smooth
:
true
,
smooth
:
true
,
showSymbol
:
false
,
stack
:
'Total'
,
stack
:
'Total'
,
data
:
[
150
,
232
,
201
,
154
,
190
,
330
,
410
]
data
:
[]
},
},
{
{
name
:
'订单'
,
name
:
'订单'
,
type
:
'line'
,
type
:
'line'
,
symbol
:
'none'
,
symbol
:
'circle'
,
showSymbol
:
false
,
smooth
:
true
,
smooth
:
true
,
stack
:
'Total'
,
stack
:
'Total'
,
data
:
[
320
,
332
,
301
,
334
,
390
,
330
,
320
]
data
:
[]
},
},
{
{
name
:
'成交'
,
name
:
'成交'
,
type
:
'line'
,
type
:
'line'
,
symbol
:
'none'
,
symbol
:
'circle'
,
showSymbol
:
false
,
smooth
:
true
,
smooth
:
true
,
stack
:
'Total'
,
stack
:
'Total'
,
data
:
[
820
,
932
,
901
,
934
,
1290
,
1330
,
1320
]
data
:
[]
}
}
// {
// type: 'line',
// itemStyle: {
// color: '#F5AA01'
// },
// // 节点,平滑曲线
// symbol: 'none',
// smooth: true,
// // 折线背景色
// data: []
// }
]
]
}
}
this
.
option
.
xAxis
.
data
=
this
.
dataList
.
map
(
item
=>
item
.
statDate
)
this
.
option
.
xAxis
.
data
=
this
.
dataList
[
0
].
map
(
item
=>
item
.
statDate
)
this
.
list
.
forEach
((
i
,
index
)
=>
{
this
.
option
.
series
[
0
].
data
=
this
.
dataList
.
map
(
item
=>
item
.
num
)
this
.
option
.
series
[
index
].
data
=
this
.
dataList
[
index
].
map
(
item
=>
item
.
num
)
console
.
log
(
this
.
option
)
this
.
echartsTrend
.
setOption
(
this
.
option
)
},
dealList
(
list
)
{
list
.
forEach
(
item
=>
{
this
.
dataList
.
push
({
num
:
item
.
num
||
0
,
hrate
:
item
.
hrate
||
0
,
trate
:
item
.
trate
||
0
,
statDate
:
item
.
statDate
})
})
})
this
.
echartsTrend
.
setOption
(
this
.
option
)
}
}
}
}
}
}
...
...
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