Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
zhwy
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 3e5278e9
authored
Sep 27, 2023
by
杨北旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
提交附近优惠
1 parent
a495eae1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
51 deletions
packagePlugin/pages/index/index.js
pages/tab/equity/index.js
pages/tab/equity/index.wxml
pages/tab/index/index.wxml
pages/tab/mall/index.wxml
pages/tab/mine/index.wxml
packagePlugin/pages/index/index.js
View file @
3e5278e
...
@@ -46,6 +46,7 @@ Page({
...
@@ -46,6 +46,7 @@ Page({
wx
.
navigateTo
({
wx
.
navigateTo
({
url
,
url
,
})
})
}
},
})
})
pages/tab/equity/index.js
View file @
3e5278e
import
{
env
}
from
'~/api/env/index'
import
{
env
}
from
'~/api/env/index'
import
mapApi
from
'~/utils/mapapi/mapapi'
const
app
=
getApp
()
Page
({
Page
({
data
:
{
data
:
{
...
@@ -24,9 +26,17 @@ Page({
...
@@ -24,9 +26,17 @@ Page({
onLoad
()
{
onLoad
()
{
this
.
getAllMerchantList
()
this
.
getAllMerchantList
()
let
freecard
=
wx
.
p
.
storage
.
get
(
'bindInfo'
)
if
(
freecard
)
{
let
bingInfo
=
JSON
.
parse
(
decodeURIComponent
(
freecard
))
const
sid
=
bingInfo
.
data
.
sessionId
wx
.
p
.
cache
.
storageApi
.
setSessionId
(
sid
)
this
.
handleFreeCard
(
bingInfo
)
}
},
},
onShow
()
{
onShow
()
{
let
authComponent
=
this
.
selectComponent
(
'#authorize'
)
if
(
authComponent
)
authComponent
.
check
()
},
},
goMorePage
()
{
goMorePage
()
{
...
@@ -49,7 +59,7 @@ Page({
...
@@ -49,7 +59,7 @@ Page({
// 定位
// 定位
async
getLocation
()
{
async
getLocation
()
{
try
{
try
{
const
res
=
await
wx
.
p
.
$Track
.
getAddressInfo
()
const
res
=
await
this
.
getAddressInfo
()
this
.
toGetCommodity
(
res
.
location
.
lat
,
res
.
location
.
lng
,
1
)
this
.
toGetCommodity
(
res
.
location
.
lat
,
res
.
location
.
lng
,
1
)
this
.
setData
({
this
.
setData
({
currentAddress
:
res
,
currentAddress
:
res
,
...
@@ -62,44 +72,33 @@ Page({
...
@@ -62,44 +72,33 @@ Page({
},
},
// 获取附近优惠数据
// 获取附近优惠数据
toGetCommodity
(
lat
,
lng
,
page
)
{
toGetCommodity
(
lat
,
lng
,
firstLoad
)
{
let
{
pageParam
,
loadingMore
,
commodityList
,
loadOver
}
=
this
.
data
let
para
=
{
let
para
=
{
lat
,
lat
,
lng
,
lng
,
...
p
ageParam
...
app
.
globalData
.
goodsP
ageParam
}
}
if
(
loadOver
)
{
if
(
app
.
globalData
.
goodsLoaded
||
(
firstLoad
&&
app
.
globalData
.
goodsPageParam
?.
length
))
{
this
.
setData
({
commodityList
:
app
.
globalData
.
goodsCommodityList
,
})
return
return
}
}
if
(
page
)
{
para
.
pageOffset
=
para
.
pageSize
para
.
pageSize
=
0
wx
.
p
.
api
.
equityApi
.
getLasteCommodity
(
para
).
then
(
res
=>
{
}
if
(
!
res
?.
data
?.
length
)
{
wx
.
p
.
api
.
equityApi
.
lasteCommodity
(
para
).
then
(
res
=>
{
app
.
globalData
.
goodsLoaded
=
true
if
(
!
res
)
{
this
.
setData
({
loadOver
:
true
})
return
return
}
}
app
.
globalData
.
goodsPageParam
.
pageSize
=
res
.
pageOffset
let
tempArr
=
[]
let
tempArr
=
[]
res
.
forEach
(
item
=>
{
res
.
data
.
forEach
(
item
=>
{
if
(
item
.
couponsGoodsList
)
{
tempArr
.
push
(
item
)
tempArr
.
push
(
item
)
}
})
})
if
(
loadingMore
)
{
app
.
globalData
.
goodsCommodityList
=
app
.
globalData
.
goodsCommodityList
.
concat
(
tempArr
)
commodityList
=
commodityList
.
concat
(
tempArr
)
app
.
globalData
.
goodsLoaded
=
false
}
this
.
setData
({
this
.
setData
({
commodityList
:
loadingMore
?
commodityList
:
tempArr
,
commodityList
:
app
.
globalData
.
goodsCommodityList
,
loadingMore
:
false
,
loadOver
:
false
})
})
})
})
},
},
...
@@ -110,7 +109,17 @@ Page({
...
@@ -110,7 +109,17 @@ Page({
showAuth
:
true
showAuth
:
true
})
})
},
},
onPullDownRefresh
()
{
this
.
getShopPackage
()
this
.
toCheckMember
()
app
.
globalData
.
goodsCommodityList
=
[]
app
.
globalData
.
goodsPageParam
.
pageSize
=
0
app
.
globalData
.
goodsLoaded
=
false
let
{
currentAddress
}
=
this
.
data
if
(
!
currentAddress
)
return
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
,
false
,
1
)
},
onReachBottom
()
{
onReachBottom
()
{
if
(
this
.
data
.
unauthorized
)
{
if
(
this
.
data
.
unauthorized
)
{
return
return
...
@@ -118,19 +127,15 @@ Page({
...
@@ -118,19 +127,15 @@ Page({
if
(
!
this
.
data
.
commodityList
.
length
)
{
if
(
!
this
.
data
.
commodityList
.
length
)
{
return
return
}
}
let
{
pageParam
}
=
this
.
data
let
{
pageParam
.
pageSize
++
currentAddress
this
.
setData
(
}
=
this
.
data
{
if
(
!
currentAddress
)
return
pageParam
,
const
{
loadingMore
:
true
lat
,
},
lng
()
=>
{
}
=
currentAddress
.
location
let
{
currentAddress
}
=
this
.
data
this
.
toGetCommodity
(
lat
,
lng
)
const
{
lat
,
lng
}
=
currentAddress
.
location
this
.
toGetCommodity
(
lat
,
lng
)
}
)
},
},
getAllMerchantList
()
{
getAllMerchantList
()
{
const
{
const
{
...
@@ -214,9 +219,9 @@ Page({
...
@@ -214,9 +219,9 @@ Page({
icon
:
item
.
equityIcon
,
icon
:
item
.
equityIcon
,
...
item
...
item
})
})
})
})
}
}
this
.
setData
({
this
.
setData
({
foodMenuList
,
foodMenuList
,
...
@@ -227,5 +232,70 @@ Page({
...
@@ -227,5 +232,70 @@ Page({
},
},
toPluginPage
()
{
toPluginPage
()
{
wx
.
p
.
router
.
go
(
'/packagePlugin/pages/index/index'
,
{
notIntercept
:
true
})
wx
.
p
.
router
.
go
(
'/packagePlugin/pages/index/index'
,
{
notIntercept
:
true
})
}
},
async
getAddressInfo
()
{
let
addressInfo
=
wx
.
p
.
storage
.
get
(
'address_info'
)
return
new
Promise
(
resolve
=>
{
if
(
addressInfo
&&
Date
.
now
()
-
addressInfo
.
createTime
<
2
*
60
*
1
e3
)
resolve
(
addressInfo
)
else
wx
.
getLocation
({
type
:
'gcj02'
}).
then
(({
latitude
,
longitude
})
=>
{
mapApi
.
detailedAdrress
([
latitude
,
longitude
]).
then
(
detail
=>
{
let
info
=
{
...
detail
,
createTime
:
Date
.
now
()
}
resolve
(
info
)
wx
.
p
.
storage
.
set
(
'address_info'
,
info
)
})
})
})
},
// 处理免费领取权益页面带来的参数---弹框显示
handleFreeCard
(
bindInfo
)
{
wx
.
p
.
storage
.
rm
(
'bindInfo'
)
const
{
code
,
errId
,
message
}
=
bindInfo
if
(
code
==
0
)
{
wx
.
showModal
({
title
:
'提示'
,
content
:
'领取成功'
,
confirmText
:
'确定'
,
showCancel
:
false
,
confirmColor
:
'#F13C3D'
})
}
else
if
(
code
==
-
1
&&
errId
==
20321
)
{
wx
.
showModal
({
title
:
'提示'
,
content
:
message
,
confirmText
:
'续费开通'
,
cancelText
:
'不用了'
,
confirmColor
:
'#F13C3D'
}).
then
(
res
=>
{
if
(
res
.
confirm
)
{
this
.
toBuyMember
()
}
})
}
else
if
(
errId
==
20320
||
errId
==
20322
)
{
wx
.
showModal
({
title
:
'提示'
,
content
:
message
,
confirmText
:
'确定'
,
showCancel
:
false
,
confirmColor
:
'#F13C3D'
})
}
},
toBuyMember
()
{
wx
.
p
.
router
.
go
(
'/packageSaveMoney/pages/open/open'
,
{
notIntercept
:
true
})
},
})
})
\ No newline at end of file
\ No newline at end of file
pages/tab/equity/index.wxml
View file @
3e5278e
...
@@ -39,4 +39,6 @@
...
@@ -39,4 +39,6 @@
<view style="height:400rpx"></view>
<view style="height:400rpx"></view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
\ No newline at end of file
</view>
<authorize id="authorize" scopeType="userLocation" isShowCheck="{{false}}" bindfail="authFail" bindsuccess="authSuccess" show="{{showAuth}}"></authorize>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file
\ No newline at end of file
pages/tab/index/index.wxml
View file @
3e5278e
...
@@ -57,4 +57,5 @@
...
@@ -57,4 +57,5 @@
<image class="max_cover" src="{{IMG_URL}}home/{{urlName}}.png" show-menu-by-longpress="{{true}}" />
<image class="max_cover" src="{{IMG_URL}}home/{{urlName}}.png" show-menu-by-longpress="{{true}}" />
<image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}home/close_modal.png" />
<image bind:tap="closeModal" class="close_icon" src="{{IMG_URL}}home/close_modal.png" />
</view>
</view>
</view>
\ No newline at end of file
\ No newline at end of file
</view>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file
\ No newline at end of file
pages/tab/mall/index.wxml
View file @
3e5278e
...
@@ -8,4 +8,5 @@
...
@@ -8,4 +8,5 @@
<glsx-image webp custom-class="bg" src="mall/bg.png"></glsx-image>
<glsx-image webp custom-class="bg" src="mall/bg.png"></glsx-image>
</view>
</view>
<carOwner id="currentChannel_6" bindshowShoppingCar="showShoppingCarFn" merchantid="{{merchantId}}" channelID="{{currentChannel.id}}"></carOwner>
<carOwner id="currentChannel_6" bindshowShoppingCar="showShoppingCarFn" merchantid="{{merchantId}}" channelID="{{currentChannel.id}}"></carOwner>
</view>
\ No newline at end of file
\ No newline at end of file
</view>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file
\ No newline at end of file
pages/tab/mine/index.wxml
View file @
3e5278e
...
@@ -139,4 +139,5 @@
...
@@ -139,4 +139,5 @@
</view>
</view>
</view>
</view>
</view>
</view>
</block>
\ No newline at end of file
\ No newline at end of file
</block>
<glsx-privacy appletName="车生活助手"></glsx-privacy>
\ No newline at end of file
\ No newline at end of file
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