我的预约0.2

This commit is contained in:
WindowBird 2025-08-15 16:43:24 +08:00
parent 80af8f718b
commit 85c5296cef
2 changed files with 25 additions and 10 deletions

View File

@ -43,6 +43,20 @@ export function getAppointmentQRCode(id) {
}) })
} }
/**
* 核销验证码
* @param {string} subscribeId - 预约ID
* @returns {Promise} 返回核销结果
*/
export function verifyAppointmentCode(subscribeId) {
return get('/app/subscribe/verifiedCode', {
subscribeId: subscribeId
}, {
timeout: 10000,
showLoading: true,
})
}
/** /**
* 获取用户信息 * 获取用户信息
* @returns {Promise} 返回用户信息 * @returns {Promise} 返回用户信息

View File

@ -68,7 +68,7 @@
mode="aspectFit" mode="aspectFit"
src="https://api.ccttiot.com/image-1755237410755.png" src="https://api.ccttiot.com/image-1755237410755.png"
/> />
<text class="btn-text">出示码券</text> <text class="btn-text">核销验证码</text>
</view> </view>
<!-- 只有待核销状态才显示取消预约按钮 --> <!-- 只有待核销状态才显示取消预约按钮 -->
<view <view
@ -128,6 +128,7 @@ import {
cancelAppointment, cancelAppointment,
getAppointmentList, getAppointmentList,
getAppointmentQRCode, getAppointmentQRCode,
verifyAppointmentCode,
} from "@/api/personalCenter/index.js"; } from "@/api/personalCenter/index.js";
export default { export default {
@ -268,28 +269,28 @@ export default {
return classMap[state] || "status-default"; return classMap[state] || "status-default";
}, },
// //
async showQRCode(item) { async showQRCode(item) {
try { try {
const response = await getAppointmentQRCode(item.subscribeId || item.id); const response = await verifyAppointmentCode(item.subscribeId || item.id);
if (response.code === 200) { if (response.code === 200) {
// TODO:
console.log("二维码数据:", response.data);
uni.showToast({ uni.showToast({
title: "二维码功能开发中", title: "核销成功",
icon: "none", icon: "success",
}); });
//
this.refreshList();
} else { } else {
uni.showToast({ uni.showToast({
title: response.msg || "获取二维码失败", title: response.msg || "核销失败",
icon: "none", icon: "none",
}); });
} }
} catch (error) { } catch (error) {
console.error("获取二维码失败:", error); console.error("核销失败:", error);
uni.showToast({ uni.showToast({
title: "获取二维码失败,请重试", title: "核销失败,请重试",
icon: "none", icon: "none",
}); });
} }