From 0c6ce0950614c9ebbcf025fecc5facfd8391f257 Mon Sep 17 00:00:00 2001 From: BAKEYi <16298417+bakeyi@user.noreply.gitee.com> Date: Tue, 26 May 2026 14:04:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=AB=E7=A0=81=E6=AD=A3=E7=A1=AE=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/home.vue | 63 ++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index ef95923..28f631d 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -182,7 +182,7 @@ export default { ], quickActions: [ - { name: '扫码验券', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/b128e423-e4b5-4ad6-bdf5-522de7a9bc68.png' , path: 'scan'}, + { name: '扫码验券', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/b128e423-e4b5-4ad6-bdf5-522de7a9bc68.png' , path: '/pages/shop/verify/verify-order'}, { name: '服务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/a90f02a2-9d39-440a-ad20-a4337bcd1b38.png' , path: '/pages/artisan/service-list'}, { name: '工位管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/4c503603-6c2f-4a7a-9329-5e54b8ca769e.png' , path: '/pages/shop/workSpace/list'}, { name: '财务管理', icon: 'https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/728c659e-e395-4473-b83e-7e04539f7ec6.png' , path: '/pages/wallet/wallet'} @@ -195,7 +195,11 @@ export default { }; }, computed: { - // 💡 状态管理核心判定 + // 营业状态:true(营业中) / false(休息中) + isOpenStore() { + return this.userInfo.order_taking === 1; + }, + // 状态管理判定 // 是否已入驻 (0: 未入驻, -1: 入驻第一步, >0: 已认证) 只要不等于0,说明已经开启了入驻流程 isSettled() { if (!this.isLogin || !this.userInfo) return false; @@ -238,7 +242,7 @@ export default { } }, onShow() { - // 继承 1.0 的登录判定逻辑 + // 登录判定逻辑 this.isLogin = uni.getStorageSync("accessToken") ? true : false; if (this.isLogin) { this.getUserInfo(); @@ -260,27 +264,15 @@ export default { // 处理金刚区点击事件 (包含扫码验券核心逻辑) handleQuickAction(item) { if (item.name === '扫码验券') { - uni.scanCode({ - success: (res) => { - const code = res.result; - if (code) { - uni.showLoading({ title: '查询订单中...' }); - request.post('/sj/poster/getOrderByCode', { server_code: code }).then(result => { - uni.hideLoading(); - if (result.code === 200 && result.data) { - // TODO: 这里扫码成功获取到订单数据(result.data),后续可弹窗或跳转到核销确认页 - // 预留核销接口调用逻辑: request.post('/sj/poster/useOrderServerCode', { id: result.data.order_id, order_type: result.data.order_type, server_code: code }) - uni.showToast({ title: '获取订单成功', icon: 'success' }); - } else { - uni.showToast({ title: result.msg || '未找到该订单', icon: 'none' }); - } - }).catch(() => { - uni.hideLoading(); - uni.showToast({ title: '网络异常', icon: 'none' }); - }); - } - } - }); + console.log('准备跳转到自定义扫码页...'); + + uni.navigateTo({ + url: '/pages/shop/verify/verify-order', + fail: (err) => { + console.error('跳转失败:', err); + } + }); + return; } // 2. 通用跳转逻辑 else if (item.path) { uni.navigateTo({ @@ -407,7 +399,7 @@ export default { }); }, - // 💡 跳转:通知详情页 + // 跳转:通知详情页 goToNotice(msg) { if(msg.id) { uni.navigateTo({ url: `/pages/notice/detail?id=${msg.id}` }); @@ -435,7 +427,7 @@ export default { } }, - // 💡 营业中 / 休息中 按钮逻辑判断 + // 营业中 / 休息中 按钮逻辑判断 toggleStatus() { // 校验逻辑保留你之前的认证状态检查 if (!this.isCertified) { @@ -447,15 +439,16 @@ export default { return; } - // 3、认证通过并配置时间,仅作为开关,不跳转页面 - if (this.isCertified && this.hasBusinessTime) { - this.isOpenStore = !this.isOpenStore; - // 同步给后端当前状态 - const newState = this.isOpenStore ? 1 : 0; - // request.post('/api/store/toggleStatus', { self_state: newState }).then(() => { - // uni.showToast({ title: this.isOpenStore ? '已开启营业' : '已休息', icon: 'none' }); - // }); - } + // 真正的请求逻辑 + let newStatus = this.userInfo.order_taking == 1 ? 2 : 1; + request.post("/sj/sjordertaking", { + order_taking: newStatus, + sjid: this.syrId // 使用你在 getUserInfo 存入的 sjId/syrId + }).then((res) => { + // 成功后重新拉取最新信息以更新 UI + this.getUserInfo(); + uni.showToast({ title: newStatus == 1 ? '已开启营业' : '已休息', icon: 'none' }); + }); }, animateScore() {