Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
X
xzf_uniapp-wechat-web
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李智书
xzf_uniapp-wechat-web
Commits
17f3f6ba
Commit
17f3f6ba
authored
Dec 27, 2021
by
aifen@azjy1.onexmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
学生消费报告
parent
389a02a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
14 deletions
+88
-14
src/pages/ConsumptionReport/ConsumptionReport.vue
src/pages/ConsumptionReport/ConsumptionReport.vue
+88
-14
No files found.
src/pages/ConsumptionReport/ConsumptionReport.vue
View file @
17f3f6ba
...
...
@@ -103,11 +103,11 @@
<view
class=
"average-daily-consumption"
>
<view
class=
"average-daily-consumption-item"
>
<text>
¥
</text>
<text
class=
"average-daily-consumption-item-num"
>
150.20
</text>
<text
class=
"average-daily-consumption-item-num"
>
{{
dayConsumerTrend
.
userWeekAvgAmount
}}
</text>
</view>
<view
class=
"average-daily-consumption-item average-daily-consumption-item-orange"
>
<text>
¥
</text>
<text
class=
"average-daily-consumption-item-num"
>
185.25
</text>
<text
class=
"average-daily-consumption-item-num"
>
{{
dayConsumerTrend
.
classWeekAvgAmount
}}
</text>
</view>
</view>
<view
class=
"average-daily-consumption-contrast"
>
...
...
@@ -449,22 +449,38 @@
</
template
>
<
script
>
var
gHost
=
"
http://
"
+
window
.
location
.
host
;
var
gHost
=
"
http
s
://
"
+
window
.
location
.
host
;
if
(
window
.
location
.
protocol
!=
"
https:
"
)
{
gHost
=
"
http://dev-az-order-api.xiaopay.net
"
;
}
//获取参数
function
getQueryParams
(
params
)
{
let
href
=
window
.
location
.
href
let
query
=
href
.
substring
(
href
.
indexOf
(
'
?
'
)
+
1
);
let
vars
=
query
.
split
(
"
&
"
);
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
let
pair
=
vars
[
i
].
split
(
"
=
"
);
if
(
pair
[
0
]
==
params
)
{
return
pair
[
1
];
}
}
return
(
false
);
}
export
default
{
name
:
'
ConsumptionReport
'
,
data
()
{
return
{
consumerNameIndex
:
0
,
dataRangeIndex
:
0
,
consumerNameArr
:
[
'
宁哲桂
'
],
// 学生姓名列表
consumerNameArr
:
[],
// 学生姓名列表
consumerInfo
:[],
//家长关联的学生信息
specifiedConsumerInfo
:{},
//选择学生的信息
dayConsumerTrend
:{},
//日消费趋势数据
// 日期范围列表
dataRangeArr
:
[
'
12月06日~12月12日
'
,
'
11月29日~12月05日
'
,
'
11月22日~11月28日
'
],
// 日消费趋势图表数据
dailyConsumptionData
:
[
83.67
,
220.89
,
66.02
,
108.12
,
70.30
,
83.50
,
315.45
],
dailyConsumptionDate
:
[
'
12/06
'
,
'
12/07
'
,
'
12/08
'
,
'
12/09
'
,
'
12/10
'
,
'
12/11
'
,
'
12/12
'
],
dailyConsumptionData
:
[],
dailyConsumptionDate
:
[],
// 消费偏好数据
consumptionPreferencesData
:
[
372.81
,
145.05
,
108.34
],
}
...
...
@@ -487,17 +503,42 @@
}
},
mounted
()
{
this
.
queryPatriarchByStudent
()
this
.
queryPatriarchByStudent
().
then
(()
=>
{
this
.
queryDayConsumerTrend
()
})
this
.
getDataRangeArr
()
},
methods
:
{
consumerChange
(
e
)
{
this
.
consumerNameIndex
=
e
.
target
.
value
this
.
specifiedConsumerInfo
=
this
.
consumerInfo
[
this
.
consumerNameIndex
]
this
.
queryDayConsumerTrend
()
},
dataRangeChange
(
e
)
{
this
.
dataRangeIndex
=
e
.
target
.
value
},
// 获取当前日期
getNowFormatDate
(){
var
date
=
new
Date
()
var
seperator
=
'
-
'
var
year
=
date
.
getFullYear
()
var
month
=
date
.
getMonth
()
+
1
var
day
=
date
.
getDate
()
if
(
month
>=
1
&&
month
<=
9
){
month
=
'
0
'
+
month
}
if
(
day
>=
1
&&
day
<=
9
){
day
=
'
0
'
+
day
}
var
currentdate
=
year
+
seperator
+
month
+
seperator
+
day
return
currentdate
},
// 获取日期范围列表
getDataRangeArr
(){
console
.
log
(
this
.
getNowFormatDate
())
},
// 查询家长关联的学生
async
queryPatriarchByStudent
()
{
queryPatriarchByStudent
()
{
let
this_
=
this
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
...
...
@@ -506,20 +547,53 @@
dataType
:
'
json
'
,
contentType
:
'
application/x-www-form-urlencoded
'
,
data
:
{
phone
:
'
18942508364
'
phone
:
getQueryParams
(
'
phone
'
)
},
success
:
function
(
res
)
{
if
(
res
.
code
==
200
){
console
.
log
(
res
)
// this_.consumerNameArr=res.obj.name
this_
.
consumerNameArr
=
res
.
obj
.
map
(
element
=>
element
.
name
)
this_
.
consumerInfo
=
res
.
obj
this_
.
specifiedConsumerInfo
=
this_
.
consumerInfo
[
this_
.
consumerNameIndex
]
}
resolve
()
},
error
:
function
(
error
)
{
reject
(
error
)
}
})
}).
catch
(
e
=>
{})
}
})
},
// 查询周要点,消费金额
// 日消费趋势
queryDayConsumerTrend
(){
let
this_
=
this
return
new
Promise
((
resolve
,
reject
)
=>
{
$
.
ajax
({
url
:
gHost
+
'
/report-push/student-consumer-report/queryDayConsumerTrend
'
,
type
:
'
get
'
,
dataType
:
'
json
'
,
contentType
:
'
application/x-www-form-urlencoded
'
,
data
:
{
userId
:
this_
.
specifiedConsumerInfo
.
id
,
schoolId
:
this_
.
specifiedConsumerInfo
.
schoolid
,
startDate
:
'
2021-12-06
'
,
endDate
:
'
2021-12-12
'
},
success
:
function
(
res
)
{
if
(
res
.
code
==
200
){
this_
.
dayConsumerTrend
=
res
.
obj
this_
.
dailyConsumptionData
=
Object
.
values
(
this_
.
dayConsumerTrend
.
dayConsumerMap
).
reverse
()
this_
.
dailyConsumptionDate
=
Object
.
keys
(
this_
.
dayConsumerTrend
.
dayConsumerMap
).
map
(
element
=>
element
.
substr
(
5
).
replace
(
'
-
'
,
'
/
'
)).
reverse
()
}
resolve
()
},
error
:
function
(
error
)
{
reject
(
error
)
}
})
})
},
}
}
</
script
>
...
...
@@ -531,7 +605,7 @@
}
.consumption-report-container
{
width
:
750rpx
;
width
:
100%
;
height
:
2616rpx
;
background
:
#F6F6F6
;
position
:
relative
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment