Commit 78ed0493 authored by qipeng's avatar qipeng

Merge branch 'develop' of http://git.tbd.yanzuoguang.com/panyongping/uni-pdtravel into develop

parents 92663815 021af6d3
...@@ -248,55 +248,58 @@ export default { ...@@ -248,55 +248,58 @@ export default {
}) })
}, },
async handleWhetherToVotePage() { //---判断是否跳转投票页面 async handleWhetherToVotePage() { //---判断是否跳转投票页面
// 1.获取调查列表id try{
const surveyQueryData = { // 1.获取调查列表id
pageCode: 'albumIndex', //默认前端写死 const surveyQueryData = {
channelId: this.options.channelId //游客扫码携带的channelId pageCode: 'albumIndex', //默认前端写死
} 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 = []
if (surveyList.length) { if (surveyList.length) {
surveyIds = surveyList.map(item => item.surveyId) surveyIds = surveyList.map(item => item.surveyId)
surveyResult = await this.judgeWhether('scenic/albumConfig/getSurveyConfig', { surveyResult = await this.judgeWhether('scenic/albumConfig/getSurveyConfig', {
surveyIds surveyIds
}) })
}else {// 调查模板为空则直接展示首页 }else {// 调查模板为空则直接展示首页
this.show = true this.show = true
this.getCoupon() this.couponIsUse()
this.couponIsUse() return
return }
}
// 3.判断用户是否已经投过票 // 3.判断用户是否已经投过票
let voteObj = {} // 用户投票信息 let voteObj = {} // 用户投票信息
if (surveyResult.length) { if (surveyResult.length) {
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)
}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.判断是否跳转投票页面 // 4.判断是否跳转投票页面
if (voteObj.alreadySurvey === 0) { // 未投过票 if (voteObj.alreadySurvey === 0) { // 未投过票
uni.navigateTo({ uni.navigateTo({
url: `./chooseFavorite?surveyConfig=${JSON.stringify(surveyResult)}` url: `./chooseFavorite?surveyConfig=${JSON.stringify(surveyResult)}`
}) })
} else if (voteObj.alreadySurvey === 1) { // 已投票 } else if (voteObj.alreadySurvey === 1) { // 已投票
this.show = true
this.couponIsUse()
}
}catch(e){
this.show = true this.show = true
this.getCoupon() this.couponIsUse()
this.couponIsUse() console.log(e)
} }
}, },
getCoupon() { //---获取优惠券 getCoupon() { //---获取优惠券
...@@ -308,17 +311,17 @@ export default { ...@@ -308,17 +311,17 @@ 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') {
if(res.data.length) { if(res.data.length) {
this.couponTip = true this.couponTip = true
} }
} else if(res.code === '04') { } else if(res.code === '04') {
this.isHaveCoupon = false this.isHaveCoupon = false
}else { }else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
icon: 'none' icon: 'none'
}) })
} }
}) })
}, },
couponIsUse() { //---判断是否有劵 couponIsUse() { //---判断是否有劵
...@@ -326,18 +329,18 @@ export default { ...@@ -326,18 +329,18 @@ export default {
openid: this.openid openid: this.openid
}).then(res => { }).then(res => {
if (res.code === '00') { 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.isHaveCoupon = true
this.couponPrice = firstItem.deductPrice this.couponPrice = firstItem.deductPrice
// 处理使用规则数据结构 // 处理使用规则数据结构
this.handleDataStructure(firstItem.couponRule, '规则说明') this.handleDataStructure(firstItem.couponRule, '规则说明')
this.handleDataStructure(firstItem.couponRuleRemind, '补充说明') this.handleDataStructure(firstItem.couponRuleRemind, '补充说明')
} else { } else {
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -351,18 +354,18 @@ export default { ...@@ -351,18 +354,18 @@ export default {
}) })
}) })
}, },
handleDataStructure(str, title) { //---处理使用规则数据结构 handleDataStructure(str, title) { //---处理使用规则数据结构
let ruleContents = str ? str.split(';') : [] let ruleContents = str ? str.split(';') : []
ruleContents = ruleContents.map(value => { ruleContents = ruleContents.map(value => {
return { return {
value value
} }
}) })
this.rules.push({ this.rules.push({
ruleName: title, ruleName: title,
contents: ruleContents contents: ruleContents
}) })
}, },
recordDeviceInfo() { //---记录设备信息 recordDeviceInfo() { //---记录设备信息
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight // 状态栏高度 this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight // 状态栏高度
this.capsule = uni.getMenuButtonBoundingClientRect() // 胶囊大小、位置数据 this.capsule = uni.getMenuButtonBoundingClientRect() // 胶囊大小、位置数据
...@@ -377,13 +380,13 @@ export default { ...@@ -377,13 +380,13 @@ export default {
this.options = options this.options = options
if (this.options.template === 'true') { // 从模板选择页进入 if (this.options.template === 'true') { // 从模板选择页进入
this.show = true this.show = true
this.getCoupon() this.getCoupon()
this.couponIsUse() 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() this.couponIsUse()
} }
if (uni.getStorageSync('location')) return if (uni.getStorageSync('location')) return
...@@ -394,7 +397,7 @@ export default { ...@@ -394,7 +397,7 @@ export default {
uni.setStorageSync('location', JSON.stringify(res)) uni.setStorageSync('location', JSON.stringify(res))
}, },
fail() { fail() {
console.log('获取经纬度失败') console.log('获取经纬度失败')
} }
}) })
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</view> </view>
<view class="img-box"> <view class="img-box">
<view class="item" v-for="(item, index) in imgArr" :key="item.templateId" @click="imageChange(item)"> <view class="item" v-for="(item, index) in imgArr" :key="item.templateId" @click="imageChange(item)">
<image class="img" :src="item.templateUrl" mode="aspectFill"></image> <image class="img" :src="item.templateUrl" mode="widthFix"></image>
<checkbox class="checkbox blue round" :checked="item.value" :value="item.templateId" shape="circle"></checkbox> <checkbox class="checkbox blue round" :checked="item.value" :value="item.templateId" shape="circle"></checkbox>
</view> </view>
</view> </view>
...@@ -173,6 +173,7 @@ export default { ...@@ -173,6 +173,7 @@ export default {
.img { .img {
width: 100%; width: 100%;
heigit: 100%; heigit: 100%;
border-radius: 16rpx;
} }
.checkbox { .checkbox {
position: absolute; position: absolute;
......
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