-
+
-
-
-
-
-
复制链接
+
-
扫描二维码或复制链接分享给用户
+
扫描二维码参与活动
@@ -673,43 +669,32 @@ export default defineComponent({
})
const qrCodeModalVisible = ref(false)
- const activityLink = ref('')
- const linkLoading = ref(false)
+ const qrCodeUrl = ref('')
+ const qrCodeLoading = ref(false)
- // 获取活动链接
- const handleGetLink = async (record) => {
+ // 获取活动二维码
+ const handleGetQrCode = async (record) => {
// 先显示模态框
qrCodeModalVisible.value = true
- linkLoading.value = true
+ qrCodeLoading.value = true
try {
const res = await request.get(`/api/coupon-activities/${record.id}/get_url_link`)
if (res.code === 200) {
- activityLink.value = res.data
+ qrCodeUrl.value = res.data
} else {
- message.error('获取活动链接失败')
+ message.error('获取活动二维码失败')
qrCodeModalVisible.value = false
}
} catch (error) {
- console.error('获取活动链接失败:', error)
- message.error('获取活动链接失败')
+ console.error('获取活动二维码失败:', error)
+ message.error('获取活动二维码失败')
qrCodeModalVisible.value = false
} finally {
- linkLoading.value = false
+ qrCodeLoading.value = false
}
}
- // 复制链接
- const copyLink = () => {
- const input = document.createElement('input')
- input.value = activityLink.value
- document.body.appendChild(input)
- input.select()
- document.execCommand('copy')
- document.body.removeChild(input)
- message.success('链接已复制到剪贴板')
- }
-
// 取消二维码模态框
const handleQrCodeModalCancel = () => {
qrCodeModalVisible.value = false
@@ -743,10 +728,9 @@ export default defineComponent({
isSelectedCoupon,
handleCouponSelect,
qrCodeModalVisible,
- activityLink,
- linkLoading,
- handleGetLink,
- copyLink,
+ qrCodeUrl,
+ qrCodeLoading,
+ handleGetQrCode,
handleQrCodeModalCancel
}
}
@@ -895,18 +879,6 @@ export default defineComponent({
margin-bottom: 16px;
}
-.link-container {
- display: flex;
- align-items: center;
- margin-bottom: 16px;
- width: 100%;
- gap: 8px;
-}
-
-.link-container .ant-input {
- flex: 1;
-}
-
.qrcode-tip {
text-align: center;
color: rgba(0, 0, 0, 0.65);