From 4ff6564ffb507b7119895fa669e47baab62ef8b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Thu, 2 Jul 2026 14:11:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E7=89=B9=E8=89=B2=E6=96=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/HealthTeaCard/HealthTeaCard.vue | 0 pages.json | 15 + pages/Inquiries/Inquiries.vue | 69 +- pages/home/home.vue | 513 ++++++- request/api/api.js | 23 + request/api/register.js | 19 + request/api/request.js | 3 + request/api/specialPrescription.js | 92 ++ subPackages/doctor/doctor-userinfo.vue | 1312 ++++------------- .../components/RegisterConfirmStep.vue | 949 ++++++++++++ .../components/RegisterPatientStep.vue | 840 +++++++++++ .../register/components/RegisterStepBar.vue | 148 ++ subPackages/register/register-success.vue | 16 + subPackages/register/register.vue | 947 +----------- subPackages/special-prescription/detail.vue | 540 +++++++ subPackages/special-prescription/list.vue | 759 ++++++++++ 16 files changed, 4241 insertions(+), 2004 deletions(-) create mode 100644 components/HealthTeaCard/HealthTeaCard.vue create mode 100644 request/api/specialPrescription.js create mode 100644 subPackages/register/components/RegisterConfirmStep.vue create mode 100644 subPackages/register/components/RegisterPatientStep.vue create mode 100644 subPackages/register/components/RegisterStepBar.vue create mode 100644 subPackages/special-prescription/detail.vue create mode 100644 subPackages/special-prescription/list.vue diff --git a/components/HealthTeaCard/HealthTeaCard.vue b/components/HealthTeaCard/HealthTeaCard.vue new file mode 100644 index 0000000..e69de29 diff --git a/pages.json b/pages.json index 0e7d2e0..fa4ef8c 100644 --- a/pages.json +++ b/pages.json @@ -194,6 +194,21 @@ "navigationBarTitleText": "用药信息", "enablePullDownRefresh": false } + }, + { + "path": "special-prescription/list", + "style": { + "navigationBarTitleText": "特色药方", + "enablePullDownRefresh": false, + "disableScroll": true + } + }, + { + "path": "special-prescription/detail", + "style": { + "navigationBarTitleText": "药方详情", + "enablePullDownRefresh": false + } } ] }, diff --git a/pages/Inquiries/Inquiries.vue b/pages/Inquiries/Inquiries.vue index 2beda37..72869dc 100644 --- a/pages/Inquiries/Inquiries.vue +++ b/pages/Inquiries/Inquiries.vue @@ -43,10 +43,10 @@ 选择坐诊医生 - + - + @@ -61,10 +61,10 @@ - {{ typeMap[type] }} + {{ typeMap[type] }} - + 擅长:{{item.good_at}} @@ -129,7 +129,7 @@ import { dDropdown } from '@/components/d-dropdown/d-dropdown' - import { isGuestMode } from '@/common/utils/auth.js' + import { isGuestMode, isLoggedIn, saveRedirectInfo, buildUrlWithParams } from '@/common/utils/auth.js' export default { components: { dDropdown @@ -232,6 +232,11 @@ } }, methods: { + resolveRegisterType(pageType) { + const t = String(pageType ?? '0'); + if (['0', '1', '2', '3'].includes(t)) return t; + return '0'; + }, closeDropdown() { this.$refs.uDropdown.close(); this.getList() @@ -309,6 +314,60 @@ }) }, + async goRegister(item) { + if (!isLoggedIn()) { + const storeId = uni.getStorageSync('store_id') || '11001'; + saveRedirectInfo('/subPackages/doctor/doctor-userinfo', { + id: item.id, + r_type: this.resolveRegisterType(this.type), + store_id: storeId, + }); + uni.navigateTo({ + url: buildUrlWithParams('/pages/login/login', { + redirect: 'doctor-userinfo', + doctor_id: item.id, + store_id: storeId, + }) + }); + return; + } + + const rType = this.resolveRegisterType(this.type); + if (rType === '2') { + try { + const storeId = uni.getStorageSync('store_id') || '11001'; + const { getClinicOnlineConsultationInfoApi } = await import('@/request/api/product'); + const configRes = await getClinicOnlineConsultationInfoApi({ store_id: storeId }); + if (configRes.data?.code === 0 || configRes.data?.code === '0') { + const result = configRes.data?.result; + if (result?.can_use && result?.delegate_doctor_id) { + uni.navigateTo({ + url: `/subPackages/doctor/doctor-userinfo?id=${result.delegate_doctor_id}&r_type=2&delegate_store_id=${result.delegate_store_id || storeId}` + }); + return; + } + uni.showToast({ + title: result?.message || '该门店暂不支持在线问诊功能', + icon: 'none', + }); + return; + } + uni.showToast({ + title: configRes.data?.message || '获取在线问诊信息失败', + icon: 'none', + }); + } catch (error) { + console.error('获取在线问诊信息失败:', error); + uni.showToast({ title: '获取在线问诊信息失败', icon: 'none' }); + } + return; + } + + uni.navigateTo({ + url: `/subPackages/doctor/doctor-userinfo?id=${item.id}&r_type=${rType}`, + }); + }, + goProduct() { uni.navigateTo({ url: '/subPackages/product/product?id=' + id diff --git a/pages/home/home.vue b/pages/home/home.vue index ddb609d..99c5d9c 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -3,7 +3,7 @@ - + - + 到店挂号 预约专家 不排队 @@ -94,11 +94,107 @@ - + + + 您有 {{ unpaidRegisterCount }} 个待支付挂号订单,点击前往查看 + + + + + + 您有 {{ unpaidProductOrderCount }} 个待支付商品订单,点击前往查看 + + + + + + + + + + + + + + + + + + + + + + + + {{ specialPrescription.subtitle || '精选时令养生茶饮' }} + + + + + + + + + 特色方 + + + {{ tea.name }} + + {{ tag }} + + + ¥{{ tea.price_per_dose }} + + 暂无报价 + + + + + + + + 热卖养生茶 + 查看全部药方 + + + + + + + + 医生推荐 - 更多 + 更多 @@ -118,8 +214,8 @@ {{item.good_at}} - - + + @@ -209,10 +305,13 @@ import { getToken, storeChange, storeInfo, - storeList + storeList, + fetchUnpaidProductOrderListApi, } from '../../request/api/api' import { getPlatformQualificationsApi } from '../../request/api/platform' import { getStoreDrugListBySalespersonApi, getHomeTopProductsApi, getHomeZonesApi, checkOnlineConsultationConfigApi } from "@/request/api/product"; +import { getSpecialPrescriptionHomeApi } from '@/request/api/specialPrescription'; +import { fetchUnpaidRegisterListApi } from '@/request/api/register'; import request from "@/request/api/request"; import MessageNotification from "@/components/MessageNotification/MessageNotification.vue"; import ImageCompressPopup from '@/components/image-compress-popup/image-compress-popup.vue'; @@ -251,7 +350,22 @@ export default { isSticky: false, // 控制金刚区布局模式: 'scroll' (滑动) 或 'wrap' (换行) - zoneLayoutMode: 'scroll' + zoneLayoutMode: 'scroll', + + unpaidRegisterCount: 0, + unpaidRegisterList: [], + unpaidProductOrderCount: 0, + unpaidProductOrderList: [], + + // 特色药方(API) + specialPrescription: { + enabled: false, + doctor_id: 0, + title_image: '', + mascot_image: '', + subtitle: '', + items: [], + }, } }, computed: { @@ -265,7 +379,7 @@ export default { } }, onLoad() { - + this.isShow_envVersion = uni.getStorageSync('isShow_envVersion') if (this.isShow_envVersion === false) { this.getList(); @@ -318,6 +432,55 @@ export default { } }, methods: { + async fetchUnpaidCounts() { + if (!isLoggedIn()) { + this.unpaidRegisterCount = 0; + this.unpaidRegisterList = []; + this.unpaidProductOrderCount = 0; + this.unpaidProductOrderList = []; + return; + } + try { + const [registerList, productList] = await Promise.all([ + fetchUnpaidRegisterListApi(), + fetchUnpaidProductOrderListApi(), + ]); + this.unpaidRegisterList = registerList; + this.unpaidRegisterCount = registerList.length; + this.unpaidProductOrderList = productList; + this.unpaidProductOrderCount = productList.length; + } catch (e) { + console.error('fetchUnpaidCounts', e); + this.unpaidRegisterCount = 0; + this.unpaidRegisterList = []; + this.unpaidProductOrderCount = 0; + this.unpaidProductOrderList = []; + } + }, + onUnpaidRegisterBannerClick() { + if (this.unpaidRegisterCount === 1 && this.unpaidRegisterList[0]) { + const id = this.unpaidRegisterList[0].id; + uni.navigateTo({ + url: `/subPackages/doctor/doctor-userinfo?step=2®ister_id=${id}`, + }); + return; + } + uni.navigateTo({ + url: '/subPackages/my/myappiont', + }); + }, + onUnpaidProductOrderBannerClick() { + if (this.unpaidProductOrderCount === 1 && this.unpaidProductOrderList[0]) { + const id = this.unpaidProductOrderList[0].id; + uni.navigateTo({ + url: `/subPackages/my/my-drug/drug-info?id=${id}`, + }); + return; + } + uni.navigateTo({ + url: '/subPackages/my/my-drug/drug-list?index=1', + }); + }, // 处理购物车按钮点击 handleAddToCart(item) { if(item && item.drug) { @@ -331,10 +494,10 @@ export default { const storeId = uni.getStorageSync('store_id') || '11001'; const { getClinicOnlineConsultationInfoApi } = await import('@/request/api/product'); const configRes = await getClinicOnlineConsultationInfoApi({ store_id: storeId }); - + if (configRes.data?.code === 0 || configRes.data?.code === '0') { const result = configRes.data?.result; - + if (result?.can_use && result?.delegate_doctor_id) { // 直接跳转到就诊人选择页面,传递医生ID和挂号类型 uni.navigateTo({ @@ -367,21 +530,21 @@ export default { return; } } - + // 当 type === 3 (在线复诊) 时,需要先检查门店是否支持在线问诊功能 if (type === 3) { try { const storeId = uni.getStorageSync('store_id') || '11001'; - const configRes = await checkOnlineConsultationConfigApi({ + const configRes = await checkOnlineConsultationConfigApi({ store_id: storeId, guest: 1 // 使用 Guest 接口 }); - + // 直接使用新接口格式(code + result) if (configRes.data?.code === 0 || configRes.data?.code === '0') { // 获取结果数据,直接使用 result(返回格式:{ code: 0, result: { can_use: false, message: "..." } }) const result = configRes.data?.result; - + // 检查是否可以使用在线问诊功能 if (!result?.can_use) { // 显示后端返回的提示信息(使用 result 中的 message) @@ -411,7 +574,7 @@ export default { return; } } - + // 检查通过或非在线复诊类型,正常跳转 uni.navigateTo({ url: '/pages/Inquiries/Inquiries?type=' + type @@ -476,18 +639,18 @@ export default { const isGuest = isGuestMode(); const isNewFormat = isGuest && (res.data.code === 0 || res.data.code === '0'); const isOldFormat = !isGuest && (res.data.errcode === 0 || res.data.errcode === '0'); - + if (isNewFormat || isOldFormat) { // 新接口格式:从 result 取值 // 老接口格式:从 data 取值 const responseData = isGuest && res.data.result ? res.data.result : res.data.data; - + if (responseData && responseData.store) { this.storeType = responseData.store['type'] uni.setStorageSync('store_type', responseData.store['type']) // 存储门店类型 this.infoList = responseData this.headerTitle = responseData.store['name'] - this.getBannered(); + this.getBannered(); } } }) @@ -529,7 +692,7 @@ export default { const isGuest = isGuestMode(); const isNewFormat = isGuest && (res.data.code === 0 || res.data.code === '0'); const isOldFormat = !isGuest && (res.data.errcode === 0 || res.data.errcode === '0'); - + if (isNewFormat || isOldFormat) { // 新接口格式:从 result 取值 // 老接口格式:从 data 取值 @@ -555,12 +718,12 @@ export default { const isGuest = isGuestMode(); const isNewFormat = isGuest && (res.data.code === 0 || res.data.code === '0'); const isOldFormat = !isGuest && (res.data.errcode === 0 || res.data.errcode === '0'); - + if (isNewFormat || isOldFormat) { // 新接口格式:从 result 取值 // 老接口格式:从 data 取值 const responseData = isGuest && res.data.result ? res.data.result : res.data.data; - + if (responseData) { this.info = responseData this.urlInfo = responseData.nav || [] @@ -628,8 +791,8 @@ export default { previewQualification(item) { // 获取所有有图片的资质,支持滑动预览 const allImages = this.qualifications - .filter(q => q.image) - .map(q => q.image); + .filter(q => q.image) + .map(q => q.image); if (allImages.length > 0 && item.image) { uni.previewImage({ urls: allImages, @@ -650,6 +813,43 @@ export default { goPlatformInfo() { uni.navigateTo({ url: '/pages/index/platform-info' }); }, + // 跳转到全部药方 / 养生茶饮列表 + goTeaList() { + uni.navigateTo({ + url: '/subPackages/special-prescription/list', + }); + }, + goTeaDetail(tea) { + const id = Number(tea?.id); + if (!id) return; + uni.navigateTo({ + url: `/subPackages/special-prescription/detail?id=${id}`, + }); + }, + detailUrl(tea) { + const id = Number(tea?.id); + if (!id) return ''; + return `/subPackages/special-prescription/detail?id=${id}`; + }, + fetchSpecialPrescriptionHome() { + getSpecialPrescriptionHomeApi({ + store_id: uni.getStorageSync('store_id') || '11001', + }).then((res) => { + if (res.data?.code === 0 || res.data?.code === '0') { + const result = res.data.result || {}; + this.specialPrescription = { + enabled: !!result.enabled, + doctor_id: result.doctor_id || 0, + title_image: result.title_image || '', + mascot_image: result.mascot_image || '', + subtitle: result.subtitle || '', + items: result.items || [], + }; + } + }).catch(() => { + this.specialPrescription.enabled = false; + }); + }, async getDefaultDoctorId() { try { const storeId = uni.getStorageSync('store_id'); @@ -676,6 +876,8 @@ export default { this.getHomeZones(); this.getPlatformQualifications(); // 已补回 this.getDefaultDoctorId(); + this.fetchUnpaidCounts(); + this.fetchSpecialPrescriptionHome(); }, } @@ -789,12 +991,249 @@ $card-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.04); } } + .unpaid-banner { + display: flex; + align-items: center; + justify-content: space-between; + margin: 16rpx 32rpx 0; + padding: 24rpx 28rpx; + border-radius: 16rpx; + + &--register { + background: linear-gradient(90deg, rgba(65, 117, 238, 0.08) 0%, rgba(65, 117, 238, 0.04) 100%); + border: 1rpx solid rgba(65, 117, 238, 0.2); + + .unpaid-banner-text, + .unpaid-banner-arrow { + color: #4175EE; + } + } + + &--product { + background: linear-gradient(90deg, rgba(0, 181, 120, 0.08) 0%, rgba(0, 181, 120, 0.04) 100%); + border: 1rpx solid rgba(0, 181, 120, 0.25); + + .unpaid-banner-text, + .unpaid-banner-arrow { + color: #00B578; + } + } + + .unpaid-banner-text { + flex: 1; + font-size: 26rpx; + line-height: 1.5; + } + + .unpaid-banner-arrow { + font-size: 24rpx; + margin-left: 12rpx; + } + } + .section-header { padding: 0 32rpx; margin: 20rpx 0 32rpx; display: flex; justify-content: space-between; align-items: center; .section-title { font-size: 36rpx; font-weight: 800; color: #333; position: relative; padding-left: 24rpx; &::before { content: ''; position: absolute; left: 0; top: 8rpx; bottom: 8rpx; width: 8rpx; background: $primary-color; border-radius: 4rpx; } } .section-more { font-size: 26rpx; color: #999; display: flex; align-items: center; } } + /* --- 特色药方 / 养生茶饮异形卡片 --- */ + .tea-section { + padding: 57rpx 32rpx 12rpx; + + .irregular-card { + position: relative; + display: flex; + flex-direction: column; + align-items: flex-start; + } + + /* 左侧凸起 Tab */ + .card-tab { + width: 220rpx; + height: 40rpx; + background: #FFFFFF; + border-radius: 24rpx 24rpx 0 0; + position: relative; + z-index: 2; + margin-bottom: -1rpx; + } + + /* 凸起右侧的下坡过渡(凹角) */ + .card-tab-slope { + position: absolute; + right: -40rpx; + bottom: 0; + width: 40rpx; + height: 40rpx; + /* 使用径向渐变模拟内凹的下坡曲线 */ + background-image: radial-gradient(circle at 100% 0%, transparent 40rpx, #FFFFFF 40rpx); + } + + /* 悬浮艺术字标题:坐落在凸起与卡片衔接处 */ + .main-title { + position: absolute; + left: 8rpx; + top: -120rpx; + width: 210rpx; + height: 128rpx; + z-index: 6; + pointer-events: none; + } + + /* 主体区域 */ + .card-body { + background: #FFFFFF; + width: 100%; + padding: 24rpx 24rpx 24rpx; + border-radius: 0 24rpx 24rpx 24rpx; + position: relative; + z-index: 1; + box-sizing: border-box; + box-shadow: 0 12rpx 32rpx rgba(65, 117, 238, 0.16); + } + + /* 悬浮 IP 小熊 */ + .main-mascot { + position: absolute; + right: 12rpx; + top: -140rpx; + width: 217rpx; + height: 168rpx; + z-index: 10; + pointer-events: none; + } + + .tea-subtitle { + font-size: 28rpx; + color: #333; + font-weight: bold; + margin-bottom: 20rpx; + padding-right: 150rpx; + display: flex; + align-items: center; + .subtitle-icon { + width: 6rpx; + height: 26rpx; + background: #4175EE; + border-radius: 3rpx; + margin-right: 12rpx; + } + } + + /* 横向滑动列表 */ + .tea-scroll { + width: 100%; + white-space: nowrap; + margin: 0 -24rpx; + box-sizing: border-box; + position: relative; + z-index: 5; + } + .tea-list { + display: inline-flex; + padding: 4rpx 24rpx 12rpx; + position: relative; + z-index: 5; + } + + .tea-item { + display: inline-flex; + flex-direction: column; + width: 176rpx; + margin-right: 16rpx; + background: #FFFFFF; + border-radius: 16rpx; + overflow: hidden; + border: 1rpx solid #F0F0F0; + box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.05); + position: relative; + z-index: 5; + &:last-child { margin-right: 0; } + &:active, + &.tea-item--active { transform: scale(0.97); } + + .tea-image-wrap { + width: 100%; + height: 132rpx; + background: linear-gradient(135deg, #F5F7FA 0%, rgba(65, 117, 238, 0.08) 100%); + display: flex; + align-items: center; + justify-content: center; + .tea-image { width: 100%; height: 100%; } + .tea-image-placeholder { font-size: 22rpx; color: #4175EE; } + } + + .tea-info-wrap { + padding: 12rpx; + display: flex; + flex-direction: column; + } + .tea-name { + font-size: 24rpx; + color: #333; + font-weight: 600; + margin-bottom: 8rpx; + } + .tea-tags { + display: flex; + margin-bottom: 8rpx; + .tea-tag { + font-size: 18rpx; + color: #4175EE; + background: rgba(65, 117, 238, 0.1); + padding: 1rpx 8rpx; + border-radius: 4rpx; + margin-right: 6rpx; + } + } + .tea-price { + color: #FF5722; + font-size: 28rpx; + font-weight: 800; + .tea-price-symbol { font-size: 20rpx; margin-right: 2rpx; } + &--unavailable { + color: #999; + font-size: 22rpx; + font-weight: 500; + } + } + } + + /* 底部操作区 */ + .tea-bottom-area { + position: relative; + margin-top: 16rpx; + .days-left-tag { + position: absolute; + top: -20rpx; + right: 20rpx; + background: #FFC107; + color: #8C6A00; + font-size: 20rpx; + font-weight: bold; + padding: 6rpx 18rpx; + border-radius: 16rpx 16rpx 16rpx 0; + z-index: 2; + border: 2rpx solid #fff; + box-shadow: 0 4rpx 12rpx rgba(255, 193, 7, 0.3); + } + .tea-action-button { + width: 100%; + text-align: center; + padding: 20rpx 0; + border-radius: 40rpx; + background: linear-gradient(90deg, #4175EE 0%, #298DFF 100%); + color: #fff; + font-size: 28rpx; + font-weight: bold; + box-sizing: border-box; + box-shadow: 0 8rpx 24rpx rgba(65, 117, 238, 0.3); + &:active { transform: scale(0.98); } + } + } + } + .doctor-card { background: #fff; margin: 0 32rpx 32rpx; border-radius: $card-radius; box-shadow: $card-shadow; overflow: hidden; &:active { transform: scale(0.99); } @@ -876,23 +1315,23 @@ $card-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.04); .qualifications-section { padding: 40rpx 32rpx 40rpx; .qualifications-row { - display: flex; + display: flex; flex-wrap: wrap; gap: 20rpx; .qualification-card { - background: #fff; - padding: 24rpx; - border-radius: 16rpx; + background: #fff; + padding: 24rpx; + border-radius: 16rpx; width: calc((100% - 20rpx) / 2); /* 一行两个 */ - text-align: center; - box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03); - display: flex; - flex-direction: column; + text-align: center; + box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.03); + display: flex; + flex-direction: column; align-items: center; - .qual-icon { - width: 200rpx; - height: 140rpx; - margin-bottom: 16rpx; + .qual-icon { + width: 200rpx; + height: 140rpx; + margin-bottom: 16rpx; border-radius: 8rpx; background: #f8f8f8; } @@ -904,4 +1343,4 @@ $card-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.04); .u-line-1 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .bg- { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 999; display: flex; align-items: center; justify-content: center; } } - \ No newline at end of file + diff --git a/request/api/api.js b/request/api/api.js index 4a6fd3b..1f8ae79 100644 --- a/request/api/api.js +++ b/request/api/api.js @@ -375,6 +375,29 @@ export async function getOrdlist(params) { return normalizeXkApiResponse(data) } +/** + * 获取待支付商品订单列表(首页提醒用) + */ +export async function fetchUnpaidProductOrderListApi(params = {}) { + const storeId = params.store_id || uni.getStorageSync('store_id') || '11001'; + const res = await getOrdlist({ + method: 'post', + data: { + store_id: storeId, + type: 'unpaid', + page: 1, + ...params, + }, + }); + if (res.data?.errcode != 0) { + return []; + } + const list = res.data?.data?.list || []; + return list.filter( + (item) => item.status === 0 && item.is_pay === 0 && item.cancel_status === 0 + ); +} + // v1/product-order/list export async function getToken(params) { let data = await http('/oldApi/v1/user/login-platform', params) diff --git a/request/api/register.js b/request/api/register.js index b4a0603..979a120 100644 --- a/request/api/register.js +++ b/request/api/register.js @@ -8,3 +8,22 @@ import {post} from './http' export async function getRegisterListApi(params) { return await post('/register/list', params, 3) } + +/** + * 获取待支付挂号列表(首页提醒用) + * @param params + * @returns {Promise} + */ +export async function fetchUnpaidRegisterListApi(params = {}) { + const storeId = params.store_id || uni.getStorageSync('store_id') || '11001'; + const res = await post('/register/list?pageSize=100', { + store_id: storeId, + page: 1, + ...params, + }, 3); + if (res.data?.code !== 0 && res.data?.code !== '0') { + return []; + } + const list = res.data?.result?.list || []; + return list.filter((item) => item.status === 0 && item.is_cancel !== 1); +} diff --git a/request/api/request.js b/request/api/request.js index fcc9786..9a68926 100644 --- a/request/api/request.js +++ b/request/api/request.js @@ -147,6 +147,9 @@ function request(url, params, method = 0) { } else if (url.indexOf('/xkApi/store/list') !== -1) { url = url.replace('/xkApi/store/list', '/guest/guest-home/store-list'); baseURL = envUrls.xkApi; + } else if (url.indexOf('/xkApi/special-prescription/') !== -1) { + url = url.replace('/xkApi/special-prescription/', '/guest/guest-special-prescription/'); + baseURL = envUrls.xkApi; } } diff --git a/request/api/specialPrescription.js b/request/api/specialPrescription.js new file mode 100644 index 0000000..0a012aa --- /dev/null +++ b/request/api/specialPrescription.js @@ -0,0 +1,92 @@ +import { get, post } from './http' + +export const SPECIAL_PRESCRIPTION_STORAGE_KEY = 'special_prescription_register_context' + +/** + * 首页特色方配置 + * @param params {{ store_id?: number|string }} + */ +export async function getSpecialPrescriptionHomeApi(params) { + return await get('/special-prescription/home', params, 3) +} + +/** + * 特色方列表页配置 + * @param params {{ store_id?: number|string }} + */ +export async function getSpecialPrescriptionListPageApi(params) { + return await get('/special-prescription/list-page', params, 3) +} + +/** + * 特色方列表 + * @param params {{ store_id?: number|string, category_id?: number, name?: string, page?: number, pageSize?: number }} + */ +export async function getSpecialPrescriptionListApi(params) { + return await get('/special-prescription/list', params, 3) +} + +/** + * 特色方详情 + * @param params {{ id: number|string, store_id?: number|string }} + */ +export async function getSpecialPrescriptionDetailApi(params) { + return await get('/special-prescription/detail', params, 3) +} + +/** + * 特色方分类 + */ +export async function getSpecialPrescriptionCategoriesApi(params = {}) { + return await get('/special-prescription/categories', params, 3) +} + +/** + * 挂号成功后创建选方记录 + * @param params {{ register_id, special_prescription_id, dose_count, store_id, doctor_id }} + */ +export async function createSpecialPrescriptionPatientRecordApi(params) { + return await post('/special-prescription/create-patient-record', params, 3) +} + +export function saveSpecialPrescriptionRegisterContext(ctx) { + if (!ctx || !ctx.special_prescription_id) return + uni.setStorageSync(SPECIAL_PRESCRIPTION_STORAGE_KEY, { + special_prescription_id: ctx.special_prescription_id, + dose_count: ctx.dose_count || 1, + doctor_id: ctx.doctor_id || '', + }) +} + +export function getSpecialPrescriptionRegisterContext() { + return uni.getStorageSync(SPECIAL_PRESCRIPTION_STORAGE_KEY) || null +} + +export function clearSpecialPrescriptionRegisterContext() { + uni.removeStorageSync(SPECIAL_PRESCRIPTION_STORAGE_KEY) +} + +/** + * 挂号成功后绑定特色方选方记录(幂等,失败不阻断流程) + * @param registerId + */ +export async function tryCreateSpecialPrescriptionPatientRecord(registerId) { + if (!registerId) return + const ctx = getSpecialPrescriptionRegisterContext() + if (!ctx || !ctx.special_prescription_id) return + + try { + const res = await createSpecialPrescriptionPatientRecordApi({ + register_id: registerId, + special_prescription_id: ctx.special_prescription_id, + dose_count: ctx.dose_count || 1, + store_id: uni.getStorageSync('store_id') || '11001', + doctor_id: ctx.doctor_id, + }) + if (res.data?.code === 0 || res.data?.code === '0') { + clearSpecialPrescriptionRegisterContext() + } + } catch (e) { + console.error('tryCreateSpecialPrescriptionPatientRecord', e) + } +} diff --git a/subPackages/doctor/doctor-userinfo.vue b/subPackages/doctor/doctor-userinfo.vue index cd45e74..333a455 100644 --- a/subPackages/doctor/doctor-userinfo.vue +++ b/subPackages/doctor/doctor-userinfo.vue @@ -1,1075 +1,293 @@