From bbb78c77ffa2282014ae8626389cc6159d43f450 Mon Sep 17 00:00:00 2001 From: lq Date: Thu, 25 Dec 2025 11:19:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=82=A3=E8=80=85?= =?UTF-8?q?=E5=B0=B1=E8=AF=8A=E5=8E=86=E5=8F=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/home.vue | 35 +++++++++++++++++++++++++++++--- subPackages/product/symptoms.vue | 29 ++++++++++++++++++++------ 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/pages/home/home.vue b/pages/home/home.vue index 9413851..3252a10 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -320,6 +320,15 @@ export default { }, golist(type) { if (type === 3) { + // 检查是否配置了在线复诊负责人 + if (!this.defaultDoctorId) { + uni.showToast({ + title: '该门店暂不支持在线复诊', + icon: 'none', + duration: 2000 + }); + return; + } return uni.navigateTo({ url: '/subPackages/product/product?doctor_id=' + this.defaultDoctorId + '®ister_type=3' }) @@ -584,6 +593,15 @@ export default { }, // 直接购买 buyProduct(item) { + // 检查是否配置了在线复诊负责人 + if (!this.defaultDoctorId) { + uni.showToast({ + title: '该门店暂不支持在线复诊', + icon: 'none', + duration: 2000 + }); + return; + } uni.navigateTo({ url: `/subPackages/product/product?doctor_id=${this.defaultDoctorId}®ister_type=3` }); @@ -603,18 +621,29 @@ export default { url: '/pages/index/platform-info' }); }, - // 获取默认医生ID + // 获取默认医生ID(根据门店配置) async getDefaultDoctorId() { try { + const storeId = uni.getStorageSync('store_id'); + if (!storeId) { + console.warn('未找到store_id,无法获取默认医生'); + this.defaultDoctorId = null; + return; + } const res = await request('/xkApi/online-consultation/get-default-doctor-id', { - method: 'GET' + method: 'GET', + data: { store_id: storeId } }, 0); if (res.data && res.data.result && res.data.result.doctor_id) { this.defaultDoctorId = res.data.result.doctor_id; + } else { + // 门店未配置在线复诊负责人 + this.defaultDoctorId = null; + console.warn('该门店未配置在线复诊负责人:', res.data?.result?.message); } } catch (error) { console.error('获取默认医生ID失败:', error); - // 如果接口失败,保持默认值39 + this.defaultDoctorId = null; } } }, diff --git a/subPackages/product/symptoms.vue b/subPackages/product/symptoms.vue index a3387b2..5c8a1de 100644 --- a/subPackages/product/symptoms.vue +++ b/subPackages/product/symptoms.vue @@ -528,9 +528,20 @@ export default { this.closePrescriptionFormPopup(); try { - // 1. 获取默认医生ID=39 + // 1. 获取默认医生ID(根据门店配置) const doctorRes = await this.getDefaultDoctorId(); - const doctorId = doctorRes.data.result?.doctor_id || '39'; + const doctorId = doctorRes.data.result?.doctor_id; + + // 检查是否配置了在线复诊负责人 + if (!doctorId) { + uni.showToast({ + title: '该门店暂不支持在线复诊', + icon: 'none', + duration: 2000 + }); + this.submitted = false; + return; + } // 2. 先调用后端API保存就诊信息,获取info_id const createRes = await request('/xkApi/order/create-register-info', { @@ -578,17 +589,23 @@ export default { } }, - // 获取默认医生ID + // 获取默认医生ID(根据门店配置) async getDefaultDoctorId() { try { + const storeId = uni.getStorageSync('store_id'); + if (!storeId) { + console.warn('未找到store_id,无法获取默认医生'); + return { data: { result: { doctor_id: null, message: '未找到门店信息' } } }; + } const res = await request('/xkApi/online-consultation/get-default-doctor-id', { - method: 'GET' + method: 'GET', + data: { store_id: storeId } }, 0); return res; } catch (error) { console.error('获取默认医生ID失败:', error); - // 如果接口失败,返回默认值39 - return { data: { result: { doctor_id: '39' } } }; + // 如果接口失败,返回空值 + return { data: { result: { doctor_id: null, message: '获取失败' } } }; } }, goToCart() {