Commit 122173dc authored by renjie's avatar renjie

修改相册首页进入逻辑

parent f318a2cf
...@@ -70,28 +70,18 @@ ...@@ -70,28 +70,18 @@
</view> </view>
</view> </view>
<view class="coupon" @click="couponTip = true"> <view class="coupon" @click="showUseRule = true" v-if="isHaveCoupon">
<image class="coupon-img" src="@/static/img/my/coupon.png" mode="aspectFit" v-if="isHaveCoupon"> <image class="coupon-img" src="@/static/img/my/coupon.png" mode="aspectFit"></image>
</image>
<text class="coupon-price"> <text class="coupon-price">
<text class="r-symbol"></text> <text class="r-symbol"></text>
{{couponPrice}} {{couponPrice}}
</text> </text>
</view> </view>
<u-mask :show="postCartTip || couponTip || showUseRule"> <u-mask :show="couponTip || showUseRule">
<view class="mask"> <view class="mask">
<view class="img-box"> <view class="img-box">
<image class="bg" src="@/static/img/my/backgroundIcon01.png" mode="aspectFit"></image> <image class="bg" src="@/static/img/my/backgroundIcon01.png" mode="aspectFit"></image>
<view class="post-card" v-if="postCartTip">
<view class="thank">- 感谢您的参与 -</view>
<view class="tip-content">
<text>免费领取</text>
<text>纪念小照片1张</text>
</view>
<image class="my-card" src="./static/album/myCard.png" mode="aspectFit"></image>
<view class="address">(领取地址:南站观景台旁)</view>
</view>
<view class="coupon-box" v-if="couponTip"> <view class="coupon-box" v-if="couponTip">
<view class="congra">恭喜您!</view> <view class="congra">恭喜您!</view>
<view class="get-coupon"> <view class="get-coupon">
...@@ -139,7 +129,6 @@ export default { ...@@ -139,7 +129,6 @@ export default {
}, },
data() { data() {
return { return {
postCartTip: false, //明信片领取提示
couponTip: false, //券领取提示 couponTip: false, //券领取提示
showUseRule: false, //使用规则提示 showUseRule: false, //使用规则提示
statusBarHeight: 0, statusBarHeight: 0,
...@@ -198,7 +187,6 @@ export default { ...@@ -198,7 +187,6 @@ export default {
}) })
}, },
closeMask() { //---关闭遮罩 closeMask() { //---关闭遮罩
this.postCartTip = false
this.couponTip = false this.couponTip = false
this.showUseRule = false this.showUseRule = false
}, },
...@@ -260,15 +248,15 @@ export default { ...@@ -260,15 +248,15 @@ export default {
}) })
}, },
async handleWhetherToVotePage() { //---判断是否跳转投票页面 async handleWhetherToVotePage() { //---判断是否跳转投票页面
// 1.获取调查列表 // 1.获取调查列表id
const surveyQueryData = { const surveyQueryData = {
pageCode: 'albumIndex', //默认前端写死 pageCode: 'albumIndex', //默认前端写死
channelId: this.options.channelId //游客扫码携带的channelId或者是胖丁登录时的公司id channelId: this.options.channelId //游客扫码携带的channelId
} }
const surveyList = await this.judgeWhether('scenic/market/findPageMarket', surveyQueryData) const surveyList = await this.judgeWhether('scenic/market/findPageMarket', surveyQueryData)
// 2.判断商店是否在做投票活动 // 2.判断商店是否在做投票活动,获取模板
let surveyIds let surveyIds
let surveyResult = [] let surveyResult = []
...@@ -279,21 +267,26 @@ export default { ...@@ -279,21 +267,26 @@ export default {
}) })
}else {// 调查模板为空则直接展示首页 }else {// 调查模板为空则直接展示首页
this.show = true this.show = true
this.getCoupon()
this.couponIsUse()
return
} }
// 3.判断用户是否已经投过票 // 3.判断用户是否已经投过票
let voteObj = {} // 用户投票信息 let voteObj = {} // 用户投票信息
if (surveyResult.length) { if (surveyResult.length) {
// 默认保存第一个商店id
// this.options.merchantId = surveyResult[0].merchantId
const votedQueryData = { const votedQueryData = {
merchantId: surveyResult[0].merchantId, merchantId: surveyResult[0].merchantId,
openid: uni.getStorageSync('openid') openid: uni.getStorageSync('openid')
} }
voteObj = await this.judgeWhether('wechatUser/pdAlbum/checkVisitorSurvey', votedQueryData) voteObj = await this.judgeWhether('wechatUser/pdAlbum/checkVisitorSurvey', votedQueryData)
} }else {
this.show = true
this.getCoupon()
this.couponIsUse()
return
}
// 4.判断是否跳转投票页面 // 4.判断是否跳转投票页面
if (voteObj.alreadySurvey === 0) { // 未投过票 if (voteObj.alreadySurvey === 0) { // 未投过票
...@@ -302,9 +295,11 @@ export default { ...@@ -302,9 +295,11 @@ export default {
}) })
} else if (voteObj.alreadySurvey === 1) { // 已投票 } else if (voteObj.alreadySurvey === 1) { // 已投票
this.show = true this.show = true
this.getCoupon()
this.couponIsUse()
} }
}, },
findPageMarketFun() { //---获取优惠券 getCoupon() { //---获取优惠券
var data = { var data = {
pageCode: 'albumIndex', pageCode: 'albumIndex',
marketingStatus: 1, marketingStatus: 1,
...@@ -313,7 +308,9 @@ export default { ...@@ -313,7 +308,9 @@ export default {
} }
this.$request('scenic/market/findPageMarket', data).then((res) => { this.$request('scenic/market/findPageMarket', data).then((res) => {
if (res.code === '00') { if (res.code === '00') {
this.couponIsUse() if(res.data.length) {
this.couponTip = true
}
} else if(res.code === '04') { } else if(res.code === '04') {
this.isHaveCoupon = false this.isHaveCoupon = false
}else { }else {
...@@ -329,36 +326,18 @@ export default { ...@@ -329,36 +326,18 @@ export default {
openid: this.openid openid: this.openid
}).then(res => { }).then(res => {
if (res.code === '00') { if (res.code === '00') {
res.data.forEach(item => { const albumCoupon = res.data.filter(item => item.useRange === 11 && item.couponStatus === 1) // 过滤 相册的劵
if (item.useRange === 11 && item.couponStatus === 1) {
this.isHaveCoupon = true if(!albumCoupon.length) return
this.couponPrice = item.deductPrice
const firstItem = albumCoupon[0]
// 处理使用规则数据结构
let ruleContents = item.couponRule ? item.couponRule.split(';') : [] this.isHaveCoupon = true
ruleContents = ruleContents.map(value => { this.couponPrice = firstItem.deductPrice
return {
value // 处理使用规则数据结构
} this.handleDataStructure(firstItem.couponRule, '规则说明')
}) this.handleDataStructure(firstItem.couponRuleRemind, '补充说明')
this.rules.push({
ruleName: '规则说明',
contents: ruleContents
})
let elseContents = item.couponRuleRemind ? item.couponRuleRemind.split(
';') : []
elseContents = elseContents.map(value => {
return {
value
}
})
this.rules.push({
ruleName: '补充说明',
contents: elseContents
})
}
})
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -372,6 +351,18 @@ export default { ...@@ -372,6 +351,18 @@ export default {
}) })
}) })
}, },
handleDataStructure(str, title) { //---处理使用规则数据结构
let ruleContents = str ? str.split(';') : []
ruleContents = ruleContents.map(value => {
return {
value
}
})
this.rules.push({
ruleName: title,
contents: ruleContents
})
},
recordDeviceInfo() { //---记录设备信息 recordDeviceInfo() { //---记录设备信息
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight // 状态栏高度 this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight // 状态栏高度
this.capsule = uni.getMenuButtonBoundingClientRect() // 胶囊大小、位置数据 this.capsule = uni.getMenuButtonBoundingClientRect() // 胶囊大小、位置数据
...@@ -382,16 +373,17 @@ export default { ...@@ -382,16 +373,17 @@ export default {
this.$commonjs.getCompanyId(options) this.$commonjs.getCompanyId(options)
this.openid = uni.getStorageSync('openid') this.openid = uni.getStorageSync('openid')
this.userId = uni.getStorageSync('userId') this.userId = uni.getStorageSync('userId')
this.findPageMarketFun()
this.recordDeviceInfo() this.recordDeviceInfo()
this.options = options this.options = options
if (this.options.tip === 'true') { // 从模板选择页进入 if (this.options.template === 'true') { // 从模板选择页进入
this.show = true this.show = true
this.postCartTip = true this.getCoupon()
this.couponIsUse()
}else if (this.options.channelId) { // 扫码进入本页 }else if (this.options.channelId) { // 扫码进入本页
this.handleWhetherToVotePage() this.handleWhetherToVotePage()
} else if (this.options.index == 1) { // 从vlog首页进入 } else if (this.options.index == 1) { // 从vlog首页进入
this.show = true this.show = true
this.couponIsUse()
} }
if (uni.getStorageSync('location')) return if (uni.getStorageSync('location')) return
...@@ -402,10 +394,7 @@ export default { ...@@ -402,10 +394,7 @@ export default {
uni.setStorageSync('location', JSON.stringify(res)) uni.setStorageSync('location', JSON.stringify(res))
}, },
fail() { fail() {
uni.showToast({ console.log('获取经纬度失败')
title: '获取经纬度失败',
icon: 'none'
})
} }
}) })
} }
...@@ -635,7 +624,6 @@ export default { ...@@ -635,7 +624,6 @@ export default {
} }
} }
.post-card,
.coupon-box, .coupon-box,
.rules { .rules {
display: flex; display: flex;
...@@ -646,27 +634,6 @@ export default { ...@@ -646,27 +634,6 @@ export default {
overflow-y: auto; overflow-y: auto;
} }
.post-card {
justify-content: space-between;
font-size: 36rpx;
.thank {
font-size: 28rpx;
color: #999;
}
.tip-content {
display: flex;
flex-direction: column;
align-items: center;
}
.address {
font-size: 24rpx;
font-weight: 700;
}
}
.coupon-box { .coupon-box {
justify-content: space-between; justify-content: space-between;
font-size: 36rpx; font-size: 36rpx;
......
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
icon: 'success' icon: 'success'
}) })
uni.navigateTo({ uni.navigateTo({
url: `./albumIndex?tip=true&merchantId=${data.merchantId}` url: `./albumIndex?template=true&merchantId=${data.merchantId}`
}) })
}else{ }else{
uni.showToast({ uni.showToast({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment