Commit 122173dc authored by renjie's avatar renjie

修改相册首页进入逻辑

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