| | |
| | | 'coupon-used': item.claimStatus === 'CLAIMED', |
| | | 'coupon-expired': item.status === 'EXPIRED' |
| | | }" |
| | | @click="handleCouponClick(item)" |
| | | > |
| | | <!-- 左侧优惠券主体 --> |
| | | <view class="left"> |
| | |
| | | <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> |
| | | |
| | | <!-- 圆形装饰 --> |
| | |
| | | {{ item.shareStatus === 'NOT_SHARE' ? '未分享' : '已分享' }} |
| | | </view> |
| | | |
| | | <!-- 操作按钮 --> |
| | | <view class="action-btn" v-if="item.claimStatus === 'NOT_CLAIM'"> |
| | | 立即领取 |
| | | |
| | | <view v-if="item.claimStatus === 'CLAIMED'"> |
| | | <button class="action-btn shared" open-type="share" :data-item="JSON.stringify(item)"> |
| | | 分享好友 |
| | | </button> |
| | | </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> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import configs from '@/config/config' |
| | | import {getPage} from '@/api/couponVirtual.js' |
| | | import storage from "@/utils/storage.js"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | storeId: "", //店铺 id, |
| | | couponData: "", |
| | | |
| | | }; |
| | | }, |
| | | onShareAppMessage(e){ |
| | | const userInfo = storage.getUserInfo(); |
| | | if(!userInfo) { |
| | | console.log("未登录不能分享"); |
| | | return |
| | | } |
| | | const shareItem = e.target?.dataset?.item ? JSON.parse(e.target.dataset.item) : this.item; |
| | | return { |
| | | title: '分享优惠卷', |
| | | path: `/pages/order/claim-coupon/claim-coupon?id=${shareItem.id}`, |
| | | imageUrl: '' |
| | | } |
| | | }, |
| | | onLoad(options) { |
| | | // options 中包含 URL 传递的所有参数 |
| | |
| | | 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> |