Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
蒋秀川
/
miniProject
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 f6346fa8
authored
Jan 16, 2024
by
李君
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化
1 parent
f63b2fbd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
77 deletions
miniProject/app.json
miniProject/index/index.js
miniProject/index/index.wxml
miniProject/index/index.wxss
miniProject/pages/homes/index.js
miniProject/pages/homes/index.wxml
miniProject/utils/util.js
miniProject/app.json
View file @
f6346fa
...
...
@@ -4,7 +4,6 @@
"index/index2"
,
"index/me"
,
"pages/login/index"
,
"pages/homes/index"
,
"pages/editPwd/editPwd"
,
"pages/shopSelect/index"
],
...
...
miniProject/index/index.js
View file @
f6346fa
...
...
@@ -3,6 +3,7 @@ import {
getAccountTrafficTrend
,
getAccountMallRank
}
from
'../api/shop'
import
{
getTime
}
from
'../utils/util'
import
moment
from
'moment'
const
App
=
getApp
();
Component
({
...
...
@@ -41,6 +42,7 @@ Component({
// maxDate: new Date(2222, 0, 31).getTime(), //自定义时间的结束日期
rankData
:
[],
indexVal
:
'PassengerFlow'
,
rankType
:
'1'
,
indexList
:
[{
name
:
'进店客流'
,
val
:
'PassengerFlow'
...
...
@@ -199,6 +201,14 @@ Component({
},
500
)
})
},
changeMallRank
(
data
){
console
.
log
(
data
);
this
.
setData
({
rankType
:
data
.
target
.
dataset
.
name
},()
=>
{
this
.
getMallRank
()
})
},
// 获取门店排行
getMallRank
(){
let
startTime
=
this
.
data
.
currentTime
,
...
...
@@ -212,15 +222,25 @@ Component({
accountId
:
wx
.
getStorageSync
(
'accountId'
),
startDate
:
startTime
,
endDate
:
endTime
,
dataIndex
:
this
.
data
.
indexVal
dataIndex
:
this
.
data
.
indexVal
,
topN
:
this
.
data
.
rankType
==
1
?
'10'
:
99999
}).
then
(
res
=>
{
let
rankData
=
res
.
data
;
let
maxVal
=
Math
.
max
.
apply
(
Math
,
rankData
.
map
((
o
)
=>
{
return
o
.
value
return
o
.
value
||
0
}))
rankData
.
forEach
(
item
=>
{
item
.
value
=
this
.
toThousands
(
item
.
value
)
item
.
percentage
=
parseInt
(
item
.
value
*
100
/
maxVal
);
// 进店率和深逛率加%
if
(
this
.
data
.
indexVal
==
'IntoStoreRate'
||
this
.
data
.
indexVal
==
'DeepShoppingRate'
){
item
.
dealValue
=
item
.
value
?
item
.
value
+
'%'
:
'--'
}
else
if
(
this
.
data
.
indexVal
==
'AvgResidenceTime'
){
// 停留时间转换
item
.
dealValue
=
item
.
value
?
getTime
(
item
.
value
):
'--'
}
else
{
item
.
dealValue
=
item
.
value
?
this
.
toThousands
(
item
.
value
):
'--'
}
item
.
percentage
=
item
.
value
?
parseInt
(
item
.
value
*
100
/
maxVal
):
0
;
})
this
.
setData
({
rankData
...
...
miniProject/index/index.wxml
View file @
f6346fa
...
...
@@ -63,7 +63,13 @@
</view> -->
<!-- 门店排行 -->
<view class="keliuliang">
<text class="title_chart">门店排行</text>
<view class="alone_floor">
<text class="title_chart">门店排行</text>
<view class="alone_btn">
<van-button bindtap="changeMallRank" data-name="1" size="mini" plain type="{{rankType==1?'info':'default'}}">TOP10</van-button>
<van-button plain bindtap="changeMallRank" data-name="2" size="mini" type="{{rankType==2?'info':'default'}}">全部</van-button>
</view>
</view>
<view style="margin-top:20rpx"></view>
<van-grid class="indexList" column-num="4" gutter='{{5}}'>
<van-grid-item bindtap="clickIndex" data-val="{{item.val}}" custom-class="desc_info" content-class="{{indexVal==item.val?'desc_content_active':'desc_content'}}" text-class="{{indexVal==item.val?'desc_text_active':'desc_text'}}" text="{{item.name}}" wx:for="{{ indexList }}" wx:for-item="item" wx:key="{{item.val}}" />
...
...
@@ -75,7 +81,7 @@
<text class="idx color">{{index*1+1+','+item.name}}</text>
</view>
<view class="num color">
{{item.
v
alue}}
{{item.
dealV
alue}}
</view>
</view>
<view class="progress progressCustom">
...
...
miniProject/index/index.wxss
View file @
f6346fa
...
...
@@ -261,4 +261,10 @@
}
.boxPadding .title_chart{
padding-left: 20rpx;
}
.alone_floor{
display: flex;
}
.alone_btn{
margin-left: auto;
}
\ No newline at end of file
miniProject/pages/homes/index.js
deleted
100644 → 0
View file @
f63b2fb
// pages/homes/index.js
Page
({
/**
* 页面的初始数据
*/
data
:
{
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{
},
/**
* 生命周期函数--监听页面显示
*/
onShow
()
{
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
()
{
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
()
{
},
/**
* 用户点击右上角分享
*/
onShareAppMessage
()
{
}
})
\ No newline at end of file
miniProject/pages/homes/index.wxml
deleted
100644 → 0
View file @
f63b2fb
<!--pages/homes/index.wxml-->
<text>pages/homes/index.wxml</text>
miniProject/utils/util.js
View file @
f6346fa
...
...
@@ -98,12 +98,19 @@ function getNowWeek() {
// }
// return rom + ',' + to
}
function
numFormat
(
val
){
return
val
>
9
?
val
:(
"0"
+
val
)
}
function
getTime
(
seconds
){
if
(
isNaN
(
seconds
))
return
seconds
;
return
numFormat
(
parseInt
(
seconds
/
3600
))
+
':'
+
numFormat
(
parseInt
(
seconds
%
3600
/
60
))
+
':'
+
numFormat
(
parseInt
(
seconds
%
60
));
}
module
.
exports
=
{
formatTime
,
getMonthStartDate
,
getMonthEndDate
,
getLocalStorage
,
dealTimer
,
getNowWeek
getNowWeek
,
getTime
}
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