diff --git a/pkg_product/components/ThemePageTemplate1.vue b/pkg_product/components/ThemePageTemplate1.vue index 1896239..a987f8e 100644 --- a/pkg_product/components/ThemePageTemplate1.vue +++ b/pkg_product/components/ThemePageTemplate1.vue @@ -4,6 +4,7 @@ :src="topImage" class="top-img" mode="widthFix" + @click="topImageClick" /> diff --git a/pkg_product/components/ThemePageTemplate2.vue b/pkg_product/components/ThemePageTemplate2.vue index 4d537d4..4b86e19 100644 --- a/pkg_product/components/ThemePageTemplate2.vue +++ b/pkg_product/components/ThemePageTemplate2.vue @@ -4,6 +4,7 @@ :src="topImage" class="top-img" mode="widthFix" + @click="topImageClick" /> diff --git a/pkg_product/components/ThemePageTemplate3.vue b/pkg_product/components/ThemePageTemplate3.vue index 95e9bd4..a8a469f 100644 --- a/pkg_product/components/ThemePageTemplate3.vue +++ b/pkg_product/components/ThemePageTemplate3.vue @@ -4,6 +4,7 @@ :src="topImage" class="top-img" mode="widthFix" + @click="topImageClick" /> diff --git a/pkg_product/components/ThemePageTemplate4.vue b/pkg_product/components/ThemePageTemplate4.vue index 1d429d3..3e893e7 100644 --- a/pkg_product/components/ThemePageTemplate4.vue +++ b/pkg_product/components/ThemePageTemplate4.vue @@ -4,6 +4,7 @@ :src="topImage" class="top-img" mode="widthFix" + @click="topImageClick" /> diff --git a/pkg_product/mixins/themeTemplateMixins.js b/pkg_product/mixins/themeTemplateMixins.js index 71ac980..b96c586 100644 --- a/pkg_product/mixins/themeTemplateMixins.js +++ b/pkg_product/mixins/themeTemplateMixins.js @@ -1,3 +1,4 @@ +import { getCouponReceive } from '@/api/user' export const themeTemplateMixins = { props: { topImage: { @@ -12,6 +13,24 @@ export const themeTemplateMixins = { } }, 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.data.msg + '', + icon: 'none', + duration: 3000 + }) + }) + } + }, itemClick(item) { if (!item.available) return this.$emit('view', item) diff --git a/pkg_product/views/festival.vue b/pkg_product/views/festival.vue index 226bc7a..978e10a 100644 --- a/pkg_product/views/festival.vue +++ b/pkg_product/views/festival.vue @@ -15,6 +15,7 @@ :src="topImage" class="top-img" mode="widthFix" + @click="topImageClick" /> { + if (res.status === 200) { + uni.showToast({ + title: '领取成功', + icon: 'none' + }) + } + }).catch((err) => { + uni.showToast({ + title: err.data.msg + '', + icon: 'none', + duration: 3000 + }) + }) + } + }, goGoodsOrShop(item) { const id = item.linkId const type = item.type || 1 diff --git a/pkg_product/views/homestay.vue b/pkg_product/views/homestay.vue index 4f68c9b..8d46801 100644 --- a/pkg_product/views/homestay.vue +++ b/pkg_product/views/homestay.vue @@ -15,6 +15,7 @@ :src="topImage" mode="widthFix" class="top-img" + @click="topImageClick" /> // 民宿专题 import { getHomestayV2 } from '@/api/product' +import { getCouponReceive } from '@/api/user' import { pageListenMixins } from '@/mixins/pageListenMixins' import ThemePageTemplate1 from '../components/ThemePageTemplate1.vue' import ThemePageTemplate2 from '../components/ThemePageTemplate2.vue' @@ -93,6 +95,7 @@ export default { data() { return { isLoad: false, + pageData: {}, topImage: '', contents: [], pageKeyId: '', @@ -106,6 +109,34 @@ export default { this.pageKeyId = `appContentHomestay_id_${id}` this.getHomestayReq(id) }, + onShareAppMessage() { + if (this.pageData.forwardTitle && this.pageData.forwardImage) { + return { + title: this.pageData.forwardTitle, + path: `/pkg_product/views/homestay?id=${this.pageData.id}`, + 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' + }) + } + } + } + }, methods: { getHomestayReq(id) { /*旧接口 @@ -120,6 +151,7 @@ export default { }) }, renderTemplateData(data) { + this.pageData = data const contents = [] if (data.templateProperties) { const templateKey = data.templateKey @@ -144,15 +176,30 @@ export default { list: temp.page4Links }) } - // 模板1 - if (['template_1', 'template_2', 'template_3', 'template_4'].includes(templateKey)) { - this.templateProperties = temp - } } + this.templateProperties = data.templateProperties || {} this.templateKey = data.templateKey this.contents = contents this.isLoad = true }, + 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.data.msg + '', + icon: 'none', + duration: 3000 + }) + }) + } + }, goGoodsOrShop(item) { const id = item.linkId const type = item.type || 1