From 810fbf8955b99c7e6e4a8551f7e1ffa95515f549 Mon Sep 17 00:00:00 2001 From: peng <peng.com> Date: 星期五, 12 九月 2025 19:16:37 +0800 Subject: [PATCH] 调整分享状态的改变 --- pages/order/cardPack.vue | 157 +++++++++++++++++++++++++++++---------------------- 1 files changed, 89 insertions(+), 68 deletions(-) diff --git a/pages/order/cardPack.vue b/pages/order/cardPack.vue index d2a402d..e8b61fe 100644 --- a/pages/order/cardPack.vue +++ b/pages/order/cardPack.vue @@ -24,7 +24,7 @@ 'coupon-used': item.claimStatus === 'CLAIMED', 'coupon-expired': item.status === 'EXPIRED' }" - @click="handleCouponClick(item)" + :data-item="JSON.stringify(item)" > <!-- 宸︿晶浼樻儬鍒镐富浣� --> <view class="left"> @@ -38,7 +38,7 @@ <view class="coupon-name">{{ item.skuName }}</view> <view class="coupon-no">鍒稿彿: {{ item.couponNo }}</view> <view class="order-id" v-if="item.orderId">璁㈠崟: {{ item.orderId }}</view> - + </view> <!-- 鍦嗗舰瑁呴グ --> @@ -52,7 +52,7 @@ <view class="status-tag" :class="{ 'unclaimed': item.claimStatus === 'NOT_CLAIM', - 'claimed': item.claimStatus === 'CLAIMED' + 'claimed': item.claimStatus === 'CLAIM' }"> {{ item.claimStatus === 'NOT_CLAIM' ? '鏈鍙�' : '宸查鍙�' }} </view> @@ -64,37 +64,41 @@ }"> {{ item.shareStatus === 'NOT_SHARE' ? '鏈垎浜�' : '宸插垎浜�' }} </view> - - <!-- 鎿嶄綔鎸夐挳 --> - <view class="action-btn" v-if="item.claimStatus === 'NOT_CLAIM'"> - 绔嬪嵆棰嗗彇 - </view> - <view class="action-btn shared" v-else-if="item.shareStatus === 'NOT_SHARE'"> - 鍒嗕韩濂藉弸 - </view> - <view class="action-btn disabled" v-else> - 宸蹭娇鐢� - </view> </view> </view> + + <!-- 鍒嗕韩鎸夐挳 --> + <view v-if="item.claimStatus !== 'CLAIM'" class="share-btn-container"> + <button class="action-btn shared" open-type="share" :data-item="JSON.stringify(item)"> + <uni-icons class="share-icon" type="redo" size="20" color="#FFFFFF"></uni-icons> + </button> + </view> </view> + </view> + + <!-- 鍔犺浇鏇村鎻愮ず --> + <view class="load-more" v-if="couponList.length > 0"> + <text v-if="loadStatus === 'more'">涓婃媺鍔犺浇鏇村</text> + <text v-else-if="loadStatus === 'loading'">鍔犺浇涓�...</text> + <text v-else>娌℃湁鏇村浜�</text> </view> </div> </div> </div> - - <!-- 鍔犺浇鏇村鎻愮ず --> - <view class="load-more" v-if="couponList.length > 0"> - <text v-if="loadStatus === 'more'">涓婃媺鍔犺浇鏇村</text> - <text v-else-if="loadStatus === 'loading'">鍔犺浇涓�...</text> - <text v-else>娌℃湁鏇村浜�</text> - </view> </view> </template> <script> - import {getPage} from '@/api/couponVirtual.js' + import configs from '@/config/config' + import {getPage,changShareStatus} from '@/api/couponVirtual.js' + import storage from "@/utils/storage.js"; + // 寮曞叆uni-icons缁勪欢 + import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue' export default { + // 娉ㄥ唽缁勪欢 + components: { + uniIcons + }, data() { return { loadStatus: "more", //涓嬫媺鐘舵�� @@ -107,8 +111,22 @@ }, storeId: "", //搴楅摵 id, couponData: "", - }; + }, + onShareAppMessage(e){ + const userInfo = storage.getUserInfo(); + if(!userInfo) { + console.log("鏈櫥褰曚笉鑳藉垎浜�"); + return + } + console.log('------------------------->',e) + const shareItem = e.target?.dataset?.item ? JSON.parse(e.target.dataset.item) : this.item;2 + changShareStatus(shareItem.id); + return { + title: shareItem.name, + path: `/pages/order/claim-coupon/claim-coupon?id=${shareItem.id}`, + imageUrl:shareItem.original + } }, onLoad(options) { // options 涓寘鍚� URL 浼犻�掔殑鎵�鏈夊弬鏁� @@ -161,22 +179,7 @@ this.loadStatus = "noMore"; } }, - handleCouponClick(item) { - // 澶勭悊浼樻儬鍒哥偣鍑讳簨浠� - if (item.claimStatus === 'NOT_CLAIM') { - // 棰嗗彇浼樻儬鍒搁�昏緫 - uni.showToast({ - title: '棰嗗彇鎴愬姛', - icon: 'success' - }) - } else if (item.shareStatus === 'NOT_SHARE') { - // 鍒嗕韩浼樻儬鍒搁�昏緫 - uni.showToast({ - title: '宸茬敓鎴愬垎浜浘', - icon: 'success' - }) - } - } + } } </script> @@ -230,7 +233,7 @@ .swiper-item { .scroll-v { height: calc(100vh - 100rpx); - padding: 30rpx 24rpx 100rpx; + padding: 30rpx 24rpx 30rpx; } } } @@ -384,6 +387,11 @@ opacity: 0.9; } + .order-id { + word-break: break-all; + white-space: normal; + } + .valid-date { margin-top: 16rpx; font-size: 22rpx; @@ -462,29 +470,47 @@ color: $gray; border: 1rpx solid rgba(158, 158, 158, 0.3); } - - // 鎿嶄綔鎸夐挳 - .action-btn { - background: linear-gradient(135deg, $primary, $primary-light); - color: $white; - padding: 14rpx 28rpx; - border-radius: 40rpx; - font-size: 26rpx; - text-align: center; - margin-top: 10rpx; - font-weight: 500; - box-shadow: 0 4rpx 12rpx rgba(255, 107, 59, 0.3); - - &.shared { - background: linear-gradient(135deg, $info, #42A5F5); - box-shadow: 0 4rpx 12rpx rgba(33, 150, 243, 0.3); - } - - &.disabled { - background: linear-gradient(135deg, #BDBDBD, #9E9E9E); - box-shadow: 0 4rpx 12rpx rgba(158, 158, 158, 0.3); - } - } + } + } + + // 鍒嗕韩鎸夐挳瀹瑰櫒 + .share-btn-container { + position: absolute; + top: 0rpx; + right: 0rpx; + z-index: 10; + } + + // 鎿嶄綔鎸夐挳 + .action-btn { + background: linear-gradient(135deg, $primary, $primary-light); + width: 50rpx; + height: 50rpx; + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + box-shadow: 0 4rpx 12rpx rgba(255, 107, 59, 0.3); + border: none; + padding: 0; + margin: 0; + + &.shared { + background: linear-gradient(135deg, $info, #42A5F5); + box-shadow: 0 4rpx 12rpx rgba(33, 150, 243, 0.3); + } + + &.disabled { + background: linear-gradient(135deg, #BDBDBD, #9E9E9E); + box-shadow: 0 4rpx 12rpx rgba(158, 158, 158, 0.3); + } + + .share-icon { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; } } @@ -495,11 +521,6 @@ color: $gray; font-size: 26rpx; background-color: $bg-color; - position: fixed; - bottom: 0; - left: 0; - right: 0; - z-index: 10; } } </style> \ No newline at end of file -- Gitblit v1.8.0