扫码正确逻辑

This commit is contained in:
BAKEYi 2026-05-26 14:04:05 +08:00
parent 8895bef4e1
commit 0c6ce09506
1 changed files with 28 additions and 35 deletions

View File

@ -182,7 +182,7 @@ export default {
], ],
quickActions: [ 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/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/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'} { 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: { computed: {
// 💡 // true() / false()
isOpenStore() {
return this.userInfo.order_taking === 1;
},
//
// (0: , -1: , >0: ) 0 // (0: , -1: , >0: ) 0
isSettled() { isSettled() {
if (!this.isLogin || !this.userInfo) return false; if (!this.isLogin || !this.userInfo) return false;
@ -238,7 +242,7 @@ export default {
} }
}, },
onShow() { onShow() {
// 1.0 //
this.isLogin = uni.getStorageSync("accessToken") ? true : false; this.isLogin = uni.getStorageSync("accessToken") ? true : false;
if (this.isLogin) { if (this.isLogin) {
this.getUserInfo(); this.getUserInfo();
@ -260,27 +264,15 @@ export default {
// () // ()
handleQuickAction(item) { handleQuickAction(item) {
if (item.name === '扫码验券') { if (item.name === '扫码验券') {
uni.scanCode({ console.log('准备跳转到自定义扫码页...');
success: (res) => {
const code = res.result; uni.navigateTo({
if (code) { url: '/pages/shop/verify/verify-order',
uni.showLoading({ title: '查询订单中...' }); fail: (err) => {
request.post('/sj/poster/getOrderByCode', { server_code: code }).then(result => { console.error('跳转失败:', err);
uni.hideLoading(); }
if (result.code === 200 && result.data) { });
// TODO: (result.data) return;
// : 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' });
});
}
}
});
} // 2. } // 2.
else if (item.path) { else if (item.path) {
uni.navigateTo({ uni.navigateTo({
@ -407,7 +399,7 @@ export default {
}); });
}, },
// 💡 //
goToNotice(msg) { goToNotice(msg) {
if(msg.id) { if(msg.id) {
uni.navigateTo({ url: `/pages/notice/detail?id=${msg.id}` }); uni.navigateTo({ url: `/pages/notice/detail?id=${msg.id}` });
@ -435,7 +427,7 @@ export default {
} }
}, },
// 💡 / // /
toggleStatus() { toggleStatus() {
// //
if (!this.isCertified) { if (!this.isCertified) {
@ -447,15 +439,16 @@ export default {
return; return;
} }
// 3 //
if (this.isCertified && this.hasBusinessTime) { let newStatus = this.userInfo.order_taking == 1 ? 2 : 1;
this.isOpenStore = !this.isOpenStore; request.post("/sj/sjordertaking", {
// order_taking: newStatus,
const newState = this.isOpenStore ? 1 : 0; sjid: this.syrId // 使 getUserInfo sjId/syrId
// request.post('/api/store/toggleStatus', { self_state: newState }).then(() => { }).then((res) => {
// uni.showToast({ title: this.isOpenStore ? '' : '', icon: 'none' }); // UI
// }); this.getUserInfo();
} uni.showToast({ title: newStatus == 1 ? '已开启营业' : '已休息', icon: 'none' });
});
}, },
animateScore() { animateScore() {