From 199912c4da54f4e4d9b2b6690ee20813f5ef2ee0 Mon Sep 17 00:00:00 2001 From: lifizer <913626195@qq.com> Date: Thu, 24 Jul 2025 11:22:57 +0800 Subject: [PATCH] =?UTF-8?q?Feat(=E4=B8=93=E9=A2=98=E9=A1=B5):1=E3=80=81?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E5=BC=A0=E5=9B=BE=E7=89=87=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=9B2?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0=E8=BD=AC=E5=8F=91=E6=A0=87=E9=A2=98?= =?UTF-8?q?=E5=92=8C=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg_product/components/ThemePageTemplate1.vue | 1 + pkg_product/components/ThemePageTemplate2.vue | 1 + pkg_product/components/ThemePageTemplate3.vue | 1 + pkg_product/components/ThemePageTemplate4.vue | 1 + pkg_product/mixins/themeTemplateMixins.js | 19 +++++++ pkg_product/views/festival.vue | 57 +++++++++++++++++-- pkg_product/views/homestay.vue | 55 ++++++++++++++++-- 7 files changed, 127 insertions(+), 8 deletions(-) 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