Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
U
uni-pdtravel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
panyongping
uni-pdtravel
Commits
b61e9e81
Commit
b61e9e81
authored
Sep 15, 2023
by
renjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改相册首页逻辑
parent
32794fac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
69 deletions
+72
-69
albumIndex.vue
pages/album/albumIndex.vue
+72
-69
No files found.
pages/album/albumIndex.vue
View file @
b61e9e81
...
...
@@ -248,55 +248,58 @@ export default {
})
},
async
handleWhetherToVotePage
()
{
//---判断是否跳转投票页面
// 1.获取调查列表id
const
surveyQueryData
=
{
pageCode
:
'albumIndex'
,
//默认前端写死
channelId
:
this
.
options
.
channelId
//游客扫码携带的channelId
}
const
surveyList
=
await
this
.
judgeWhether
(
'scenic/market/findPageMarket'
,
surveyQueryData
)
// 2.判断商店是否在做投票活动,获取模板
let
surveyIds
let
surveyResult
=
[]
if
(
surveyList
.
length
)
{
surveyIds
=
surveyList
.
map
(
item
=>
item
.
surveyId
)
surveyResult
=
await
this
.
judgeWhether
(
'scenic/albumConfig/getSurveyConfig'
,
{
surveyIds
})
}
else
{
// 调查模板为空则直接展示首页
this
.
show
=
true
this
.
getCoupon
()
this
.
couponIsUse
()
return
}
try
{
// 1.获取调查列表id
const
surveyQueryData
=
{
pageCode
:
'albumIndex'
,
//默认前端写死
channelId
:
this
.
options
.
channelId
//游客扫码携带的channelId
}
const
surveyList
=
await
this
.
judgeWhether
(
'scenic/market/findPageMarket'
,
surveyQueryData
)
// 2.判断商店是否在做投票活动,获取模板
let
surveyIds
let
surveyResult
=
[]
if
(
surveyList
.
length
)
{
surveyIds
=
surveyList
.
map
(
item
=>
item
.
surveyId
)
surveyResult
=
await
this
.
judgeWhether
(
'scenic/albumConfig/getSurveyConfig'
,
{
surveyIds
})
}
else
{
// 调查模板为空则直接展示首页
this
.
show
=
true
this
.
couponIsUse
()
return
}
// 3.判断用户是否已经投过票
let
voteObj
=
{}
// 用户投票信息
// 3.判断用户是否已经投过票
let
voteObj
=
{}
// 用户投票信息
if
(
surveyResult
.
length
)
{
const
votedQueryData
=
{
merchantId
:
surveyResult
[
0
].
merchantId
,
openid
:
uni
.
getStorageSync
(
'openid'
)
if
(
surveyResult
.
length
)
{
const
votedQueryData
=
{
merchantId
:
surveyResult
[
0
].
merchantId
,
openid
:
uni
.
getStorageSync
(
'openid'
)
}
voteObj
=
await
this
.
judgeWhether
(
'wechatUser/pdAlbum/checkVisitorSurvey'
,
votedQueryData
)
}
else
{
this
.
show
=
true
this
.
couponIsUse
()
return
}
voteObj
=
await
this
.
judgeWhether
(
'wechatUser/pdAlbum/checkVisitorSurvey'
,
votedQueryData
)
}
else
{
this
.
show
=
true
this
.
getCoupon
()
this
.
couponIsUse
()
return
}
// 4.判断是否跳转投票页面
if
(
voteObj
.
alreadySurvey
===
0
)
{
// 未投过票
uni
.
navigateTo
({
url
:
`./chooseFavorite?surveyConfig=
${
JSON
.
stringify
(
surveyResult
)}
`
})
}
else
if
(
voteObj
.
alreadySurvey
===
1
)
{
// 已投票
// 4.判断是否跳转投票页面
if
(
voteObj
.
alreadySurvey
===
0
)
{
// 未投过票
uni
.
navigateTo
({
url
:
`./chooseFavorite?surveyConfig=
${
JSON
.
stringify
(
surveyResult
)}
`
})
}
else
if
(
voteObj
.
alreadySurvey
===
1
)
{
// 已投票
this
.
show
=
true
this
.
couponIsUse
()
}
}
catch
(
e
){
this
.
show
=
true
this
.
getCoupon
()
this
.
couponIsUse
(
)
this
.
couponIsUse
()
console
.
log
(
e
)
}
},
getCoupon
()
{
//---获取优惠券
...
...
@@ -308,17 +311,17 @@ export default {
}
this
.
$request
(
'scenic/market/findPageMarket'
,
data
).
then
((
res
)
=>
{
if
(
res
.
code
===
'00'
)
{
if
(
res
.
data
.
length
)
{
this
.
couponTip
=
true
}
if
(
res
.
data
.
length
)
{
this
.
couponTip
=
true
}
}
else
if
(
res
.
code
===
'04'
)
{
this
.
isHaveCoupon
=
false
}
else
{
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
message
,
icon
:
'none'
})
}
})
}
})
},
couponIsUse
()
{
//---判断是否有劵
...
...
@@ -326,18 +329,18 @@ export default {
openid
:
this
.
openid
}).
then
(
res
=>
{
if
(
res
.
code
===
'00'
)
{
const
albumCoupon
=
res
.
data
.
filter
(
item
=>
item
.
useRange
===
11
&&
item
.
couponStatus
===
1
)
// 过滤 相册的劵
const
albumCoupon
=
res
.
data
.
filter
(
item
=>
item
.
useRange
===
11
&&
item
.
couponStatus
===
1
)
// 过滤 相册的劵
if
(
!
albumCoupon
.
length
)
return
if
(
!
albumCoupon
.
length
)
return
const
firstItem
=
albumCoupon
[
0
]
const
firstItem
=
albumCoupon
[
0
]
this
.
isHaveCoupon
=
true
this
.
couponPrice
=
firstItem
.
deductPrice
this
.
isHaveCoupon
=
true
this
.
couponPrice
=
firstItem
.
deductPrice
// 处理使用规则数据结构
this
.
handleDataStructure
(
firstItem
.
couponRule
,
'规则说明'
)
this
.
handleDataStructure
(
firstItem
.
couponRuleRemind
,
'补充说明'
)
// 处理使用规则数据结构
this
.
handleDataStructure
(
firstItem
.
couponRule
,
'规则说明'
)
this
.
handleDataStructure
(
firstItem
.
couponRuleRemind
,
'补充说明'
)
}
else
{
uni
.
showToast
({
title
:
res
.
message
,
...
...
@@ -351,18 +354,18 @@ export default {
})
})
},
handleDataStructure
(
str
,
title
)
{
//---处理使用规则数据结构
let
ruleContents
=
str
?
str
.
split
(
';'
)
:
[]
ruleContents
=
ruleContents
.
map
(
value
=>
{
handleDataStructure
(
str
,
title
)
{
//---处理使用规则数据结构
let
ruleContents
=
str
?
str
.
split
(
';'
)
:
[]
ruleContents
=
ruleContents
.
map
(
value
=>
{
return
{
value
}
})
this
.
rules
.
push
({
})
this
.
rules
.
push
({
ruleName
:
title
,
contents
:
ruleContents
})
},
})
},
recordDeviceInfo
()
{
//---记录设备信息
this
.
statusBarHeight
=
uni
.
getSystemInfoSync
().
statusBarHeight
// 状态栏高度
this
.
capsule
=
uni
.
getMenuButtonBoundingClientRect
()
// 胶囊大小、位置数据
...
...
@@ -377,13 +380,13 @@ export default {
this
.
options
=
options
if
(
this
.
options
.
template
===
'true'
)
{
// 从模板选择页进入
this
.
show
=
true
this
.
getCoupon
()
this
.
couponIsUse
()
this
.
getCoupon
()
this
.
couponIsUse
()
}
else
if
(
this
.
options
.
channelId
)
{
// 扫码进入本页
this
.
handleWhetherToVotePage
()
}
else
if
(
this
.
options
.
index
==
1
)
{
// 从vlog首页进入
this
.
show
=
true
this
.
couponIsUse
()
this
.
couponIsUse
()
}
if
(
uni
.
getStorageSync
(
'location'
))
return
...
...
@@ -394,7 +397,7 @@ export default {
uni
.
setStorageSync
(
'location'
,
JSON
.
stringify
(
res
))
},
fail
()
{
console
.
log
(
'获取经纬度失败'
)
console
.
log
(
'获取经纬度失败'
)
}
})
}
...
...
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