Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
hmd
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 b4ab48ca
authored
Aug 21, 2023
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
权益附近优惠需求开发
1 parent
7bd32fc2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
56 deletions
app.js
pages/tab/equity/index.js
app.js
View file @
b4ab48c
...
...
@@ -32,5 +32,12 @@ App({
onHide
()
{},
globalData
:
{
ROUTE_QUERY
:
{},
goodsPageParam
:
{
appearance
:
1
,
pageSize
:
0
,
pageCount
:
3
},
goodsLoaded
:
false
,
goodsCommodityList
:
[]
},
});
pages/tab/equity/index.js
View file @
b4ab48c
const
app
=
getApp
()
import
mapApi
from
'../../../utils/mapapi/mapapi'
Page
({
options
:
{
...
...
@@ -99,21 +100,12 @@ Page({
onPullDownRefresh
()
{
this
.
getShopPackage
()
this
.
toCheckMember
()
this
.
setData
({
'pageParam.pageSize'
:
0
,
loadingMore
:
false
},
()
=>
{
let
{
currentAddress
}
=
this
.
data
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
)
}
)
app
.
globalData
.
goodsCommodityList
=
[]
app
.
globalData
.
goodsPageParam
.
pageSize
=
0
app
.
globalData
.
goodsLoaded
=
false
let
{
currentAddress
}
=
this
.
data
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
,
false
,
1
)
},
onReachBottom
()
{
if
(
this
.
data
.
unauthorized
)
{
...
...
@@ -123,25 +115,13 @@ Page({
return
}
let
{
pageParam
currentAddress
}
=
this
.
data
pageParam
.
pageSize
++
this
.
setData
({
pageParam
,
loadingMore
:
true
},
()
=>
{
let
{
currentAddress
}
=
this
.
data
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
)
}
)
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
)
},
// 新版
openMorePack
(
e
)
{
...
...
@@ -188,31 +168,24 @@ Page({
},
// 获取附近优惠数据
toGetCommodity
(
lat
,
lng
,
page
)
{
let
{
pageParam
,
loadingMore
,
commodityList
,
loadOver
}
=
this
.
data
toGetCommodity
(
lat
,
lng
,
firstLoad
)
{
let
para
=
{
lat
,
lng
,
...
pageParam
}
if
(
loadOver
)
{
return
...
app
.
globalData
.
goodsPageParam
}
if
(
page
)
{
para
.
pageSize
=
0
}
wx
.
p
.
api
.
equityApi
.
lasteCommodity
(
para
).
then
(
res
=>
{
if
(
!
res
)
{
if
(
app
.
globalData
.
goodsLoaded
||
(
firstLoad
&&
app
.
globalData
.
goodsPageParam
?.
length
))
{
this
.
setData
({
loadOver
:
true
commodityList
:
app
.
globalData
.
goodsCommodityList
,
})
return
}
wx
.
p
.
api
.
equityApi
.
lasteCommodity
(
para
).
then
(
res
=>
{
if
(
!
res
?.
length
)
{
app
.
globalData
.
goodsLoaded
=
true
return
}
app
.
globalData
.
goodsPageParam
.
pageSize
+=
1
let
tempArr
=
[]
if
(
res
)
{
res
.
forEach
(
item
=>
{
...
...
@@ -221,13 +194,10 @@ Page({
}
})
}
if
(
loadingMore
)
{
commodityList
=
commodityList
.
concat
(
tempArr
)
}
app
.
globalData
.
goodsCommodityList
=
app
.
globalData
.
goodsCommodityList
.
concat
(
tempArr
)
app
.
globalData
.
goodsLoaded
=
false
this
.
setData
({
commodityList
:
loadingMore
?
commodityList
:
tempArr
,
loadingMore
:
false
,
loadOver
:
false
commodityList
:
app
.
globalData
.
goodsCommodityList
,
})
})
},
...
...
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