移除前端中的会员卡和支付相关,新增微信一键登录

This commit is contained in:
2026-07-14 18:50:35 +08:00
parent 13b99428de
commit 6cc72ae0f7
26 changed files with 331 additions and 9159 deletions
+50 -39
View File
@@ -1,4 +1,4 @@
<template>
<template>
<view class="checkin-page">
<!-- 顶部导航栏固定顶部 -->
<view class="header">
@@ -97,7 +97,8 @@ import { ref } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app'
// 引入状态组件(路径与你保持一致)
import QrStatus from '@/components/QRCode/StatusCard.vue'
import { getQRCode, getMyMemberCards } from '@/api/main.js'
import { getQRCode, checkIn as apiCheckIn } from '@/api/main.js'
import { qrSignInGroupCourse } from '@/api/groupCourse.js'
import { getMemberId } from '@/utils/request.js'
let image = ref("")
@@ -220,40 +221,6 @@ import { getMemberId } from '@/utils/request.js'
throw new Error('未获取到会员ID')
}
const cardRes = await getMyMemberCards(memberId)
console.log('[签到页面] 查询会员卡结果:', JSON.stringify(cardRes, null, 2))
const hasCard = cardRes && cardRes.data && cardRes.data.length > 0
console.log('[签到页面] 查询会员卡 - hasCard:', hasCard)
if (!hasCard) {
isHaveCard.value = false
uni.hideLoading()
uni.showModal({
title: '提示',
content: '您还没有会员卡,无法进行签到。是否去购买会员卡?',
confirmText: '去购买',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
uni.redirectTo({
url: '/pages/memberInfo/purchaseCard'
})
} else {
uni.switchTab({
url: '/pages/index/index'
})
}
},
fail: () => {
uni.switchTab({
url: '/pages/index/index'
})
}
})
return
}
isHaveCard.value = true
uni.showLoading({
title: '生成签到二维码...',
@@ -388,9 +355,53 @@ import { getMemberId } from '@/utils/request.js'
})
}
// 手动签到接口
const checkIn = (qrContent) => {
console.log(qrContent)
// 手动签到接口(兼容到店签到和团课签到两种二维码)
const checkIn = async (qrContent) => {
console.log('扫码结果:', qrContent)
// 尝试解析为 JSON,判断是否为团课二维码(包含 id/courseName 字段)
let parsedQr = null
try {
parsedQr = JSON.parse(qrContent)
} catch (_) {
// 非 JSON,按到店签到处理
}
if (parsedQr && parsedQr.id && parsedQr.courseName) {
// 团课签到:使用团课签到接口
const memberId = getMemberId()
if (!memberId) {
uni.showToast({ title: '请先登录', icon: 'none' })
return
}
const courseId = Number(parsedQr.id)
uni.showLoading({ title: '团课签到中...' })
try {
const result = await qrSignInGroupCourse(courseId, memberId)
uni.hideLoading()
if (result.success) {
status.value = 'scanned'
errorText.value = ''
QRStatus.value = '团课签到成功'
isCheckIn.value = true
setCacheData("checkInTime", QRStatus.value)
setCacheData("isCheckIn", isCheckIn.value)
uni.showToast({ title: '团课签到成功', icon: 'success' })
} else {
status.value = 'error'
errorText.value = result.message || '团课签到失败'
uni.showToast({ title: result.message || '签到失败', icon: 'none' })
}
} catch (err) {
uni.hideLoading()
status.value = 'error'
errorText.value = err.message || '团课签到失败'
uni.showToast({ title: err.message || '签到失败', icon: 'none' })
}
return
}
// 到店签到:使用原有签到接口
apiCheckIn({ qrContent }).then(res => {
closeWebSocket()
console.log(res)