|
@@ -1,5 +1,6 @@
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
import { computed, ref } from 'vue'
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
+import ShortLinkModal from '@/components/ShortLinkModal.vue'
|
|
|
import { useScroll } from '@/hooks/useScroll'
|
|
import { useScroll } from '@/hooks/useScroll'
|
|
|
import { useShare } from '@/hooks/useShare'
|
|
import { useShare } from '@/hooks/useShare'
|
|
|
import { safeAreaInsets } from '@/utils'
|
|
import { safeAreaInsets } from '@/utils'
|
|
@@ -37,28 +38,28 @@ const {
|
|
|
pageSize: 7,
|
|
pageSize: 7,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const { getShareConfig: getShareCouponConfig } = useShare({
|
|
|
|
|
- shareType: 'COUPON',
|
|
|
|
|
- imageSource: 'REMOTE',
|
|
|
|
|
- path: '/pages/receiveCoupon/index',
|
|
|
|
|
- pathParamKey: 'couponShareRecordId',
|
|
|
|
|
-})
|
|
|
|
|
|
|
+// const { getShareConfig: getShareCouponConfig } = useShare({
|
|
|
|
|
+// shareType: 'COUPON',
|
|
|
|
|
+// imageSource: 'REMOTE',
|
|
|
|
|
+// path: '/pages/receiveCoupon/index',
|
|
|
|
|
+// pathParamKey: 'couponShareRecordId',
|
|
|
|
|
+// })
|
|
|
|
|
|
|
|
// #ifdef MP-WEIXIN
|
|
// #ifdef MP-WEIXIN
|
|
|
// 分享功能实现
|
|
// 分享功能实现
|
|
|
// 分享生命周期函数
|
|
// 分享生命周期函数
|
|
|
-onShareAppMessage(async (options) => {
|
|
|
|
|
- if (options.from === 'button' && options.target.dataset.shareType === 'coupon') {
|
|
|
|
|
- const couponId = options.target.dataset.couponId
|
|
|
|
|
- const couponinfo = await getCouponDetail({ templateId: couponId })
|
|
|
|
|
- return await getShareCouponConfig({
|
|
|
|
|
- imageUrl: couponinfo?.imageUrl,
|
|
|
|
|
- }, {
|
|
|
|
|
- shareContentId: couponId,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- return null
|
|
|
|
|
-})
|
|
|
|
|
|
|
+// onShareAppMessage(async (options) => {
|
|
|
|
|
+// if (options.from === 'button' && options.target.dataset.shareType === 'coupon') {
|
|
|
|
|
+// const couponId = options.target.dataset.couponId
|
|
|
|
|
+// const couponinfo = await getCouponDetail({ templateId: couponId })
|
|
|
|
|
+// return await getShareCouponConfig({
|
|
|
|
|
+// imageUrl: couponinfo?.imageUrl,
|
|
|
|
|
+// }, {
|
|
|
|
|
+// shareContentId: couponId,
|
|
|
|
|
+// })
|
|
|
|
|
+// }
|
|
|
|
|
+// return null
|
|
|
|
|
+// })
|
|
|
// #endif
|
|
// #endif
|
|
|
|
|
|
|
|
// 计算底部安全区高度
|
|
// 计算底部安全区高度
|
|
@@ -68,6 +69,9 @@ const safeBottomHeight = computed(() => {
|
|
|
|
|
|
|
|
const topSafeAreaHeight = safeAreaInsets?.top || 0
|
|
const topSafeAreaHeight = safeAreaInsets?.top || 0
|
|
|
|
|
|
|
|
|
|
+const couponShareLink = ref('')
|
|
|
|
|
+const showShareModal = ref(false)
|
|
|
|
|
+
|
|
|
// 页面加载时获取数据
|
|
// 页面加载时获取数据
|
|
|
onLoad((options) => {
|
|
onLoad((options) => {
|
|
|
if (options.type) {
|
|
if (options.type) {
|
|
@@ -75,6 +79,11 @@ onLoad((options) => {
|
|
|
onRefresh()
|
|
onRefresh()
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+function handleShareClick(shareLink) {
|
|
|
|
|
+ couponShareLink.value = shareLink
|
|
|
|
|
+ showShareModal.value = true
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -82,11 +91,13 @@ onLoad((options) => {
|
|
|
<view class="safe-top" :style="{ height: `${topSafeAreaHeight}px` }" />
|
|
<view class="safe-top" :style="{ height: `${topSafeAreaHeight}px` }" />
|
|
|
<up-navbar title="满减券" :auto-back="true" />
|
|
<up-navbar title="满减券" :auto-back="true" />
|
|
|
<!-- <up-status-bar /> -->
|
|
<!-- <up-status-bar /> -->
|
|
|
- <scroll-view :style="{ paddingTop: `${topSafeAreaHeight}px` }" class="discount-coupon-list" scroll-y
|
|
|
|
|
- refresher-enabled :refresher-triggered="loading" @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
|
|
|
|
|
|
+ <scroll-view id="spendAndSaveCouponScrollView" :style="{ paddingTop: `${topSafeAreaHeight}px` }"
|
|
|
|
|
+ class="discount-coupon-list" scroll-y refresher-enabled :refresher-triggered="loading"
|
|
|
|
|
+ @refresherrefresh="onRefresh" @scrolltolower="onLoadMore">
|
|
|
<view class="list-content">
|
|
<view class="list-content">
|
|
|
<view v-for="item in data" :key="item.templateId" class="discount-coupon-item">
|
|
<view v-for="item in data" :key="item.templateId" class="discount-coupon-item">
|
|
|
- <SpendAndSaveCoupon :coupon="item" />
|
|
|
|
|
|
|
+ <SpendAndSaveCoupon :coupon="item" scroll-view-id="spendAndSaveCouponScrollView"
|
|
|
|
|
+ :enable-custom-share="true" @share-click="handleShareClick" />
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 加载状态提示 -->
|
|
<!-- 加载状态提示 -->
|
|
@@ -99,6 +110,7 @@ onLoad((options) => {
|
|
|
</view>
|
|
</view>
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
|
|
|
|
|
|
|
|
+ <ShortLinkModal v-model:show-modal="showShareModal" :share-link="couponShareLink" />
|
|
|
<!-- 安全区底部占位 -->
|
|
<!-- 安全区底部占位 -->
|
|
|
<view class="safe-bottom" :style="{ height: `${safeBottomHeight}px` }" />
|
|
<view class="safe-bottom" :style="{ height: `${safeBottomHeight}px` }" />
|
|
|
</view>
|
|
</view>
|