104 lines
2.7 KiB
JavaScript
104 lines
2.7 KiB
JavaScript
import { getCouponReceive } from '@/api/user'
|
|
export const themeMixins = {
|
|
data() {
|
|
return {
|
|
isLoad: false,
|
|
pageData: {},
|
|
topImage: '',
|
|
contents: [],
|
|
pageKeyId: '',
|
|
templateKey: '',
|
|
// 模板数据
|
|
templateProperties: {}
|
|
}
|
|
},
|
|
onShareAppMessage() {
|
|
uni.updateShareMenu({
|
|
isPrivateMessage: false,
|
|
withShareTicket: false
|
|
})
|
|
if (this.pageData.forwardTitle && this.pageData.forwardImage) {
|
|
return {
|
|
title: this.pageData.forwardTitle,
|
|
path: this.pageKeyId.indexOf('appContentHomestay') > -1 ? `/pkg_product/views/homestay?id=${this.pageData.id}` : `/pkg_product/views/festival?id=${this.pageData.id}&theme=${this.theme || ''}`,
|
|
imageUrl: this.pageData.forwardImage
|
|
}
|
|
} else {
|
|
return {
|
|
title: this.share.title,
|
|
path: this.share.path,
|
|
imageUrl: this.share.imageUrl,
|
|
desc: this.share.desc,
|
|
content: this.share.content,
|
|
success(res){
|
|
uni.showToast({
|
|
title:'分享成功'
|
|
})
|
|
},
|
|
fail(res){
|
|
uni.showToast({
|
|
title:'分享失败',
|
|
icon:'none'
|
|
})
|
|
}
|
|
}
|
|
}
|
|
},
|
|
onShareTimeline() {
|
|
uni.updateShareMenu({
|
|
isPrivateMessage: false,
|
|
withShareTicket: false
|
|
})
|
|
const title = this.pageData.forwardTitle || this.share.title
|
|
return {
|
|
title,
|
|
query: `id=${this.pageData.id}`,
|
|
imageUrl: this.pageData.forwardImage || this.share.imageUrl
|
|
}
|
|
},
|
|
methods: {
|
|
topImageClick() {
|
|
if (this.templateProperties.page1CouponEnable === 1 && this.templateProperties.page1CouponId) {
|
|
getCouponReceive(this.templateProperties.page1CouponId).then(res => {
|
|
if (res.status === 200) {
|
|
uni.showToast({
|
|
title: '领取成功',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
}).catch((err) => {
|
|
uni.showToast({
|
|
title: err.msg + '',
|
|
icon: 'none',
|
|
duration: 3000
|
|
})
|
|
})
|
|
}
|
|
},
|
|
goGoodsOrShop(item) {
|
|
const id = item.linkId || ''
|
|
if (!id) return
|
|
const type = item.type || 1
|
|
if (type === 1) {
|
|
uni.navigateTo({
|
|
url: `/pages/shop/GoodsCon/index?id=${id}&from=festival`
|
|
})
|
|
}
|
|
if (type === 2) {
|
|
uni.navigateTo({
|
|
url: `/pagesInn/inn/innHome?id=${id}&from=festival`
|
|
})
|
|
}
|
|
if (type === 3) {
|
|
uni.navigateTo({
|
|
url: `/pages/town/index?id=${id}&from=festival`
|
|
})
|
|
}
|
|
if (type === 4) {
|
|
uni.navigateTo({
|
|
url: `/pkg_product/views/famousQianxianShop?id=${id}&from=festival`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
} |