diff --git a/src/components/popup/index.scss b/src/components/popup/index.scss index 64058a6..54685e7 100644 --- a/src/components/popup/index.scss +++ b/src/components/popup/index.scss @@ -45,6 +45,21 @@ } } } + .upload-preview { + margin-top: 16rpx; + position: relative; + .preview-img { + width: 100%; + height: 300rpx; + border-radius: 12rpx; + } + .reupload { + margin-top: 16rpx; + font-size: 28rpx; + color: #ff8a4c; + text-align: center; + } + } .btn { margin-top: 32rpx; font-size: 36rpx; @@ -54,6 +69,9 @@ line-height: 92rpx; background: linear-gradient(90deg, #fece55 0%, #ff8a4c 100%); border-radius: 72rpx 72rpx 72rpx 72rpx; + &.disabled { + opacity: 0.5; + } } } diff --git a/src/components/popup/index.ts b/src/components/popup/index.ts index 54d038b..0bdb671 100644 --- a/src/components/popup/index.ts +++ b/src/components/popup/index.ts @@ -36,6 +36,13 @@ Component({ if (this.data.type === 'publicCard') { this.getCodeImg() } + if (this.data.type === 'uploadMaterial') { + // 重置上传状态 + this.setData({ + materialImageUrl: '', + materialUploading: false, + }) + } } }, }, @@ -53,6 +60,10 @@ Component({ codeImg: '', + // 上传材料相关 + materialImageUrl: '', + materialUploading: false, + imageUrl: app.globalData.imageUrl, Timestamp: app.globalData.Timestamp, }, @@ -120,8 +131,7 @@ Component({ url, }) }, - handlePopup1Check1() { - }, + handlePopup1Check1() {}, handleSelectStatus(e) { const { status } = e.currentTarget.dataset this.triggerEvent('ok', { type: 'selectStatusComplete', status }) @@ -158,5 +168,67 @@ Component({ }) }) }, + // 选择图片 + handleChooseImage() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + sizeType: ['compressed'], + sourceType: ['camera', 'album'], + success: (res) => { + const tempFilePath = res.tempFiles[0].tempFilePath + this.uploadImage(tempFilePath) + }, + }) + }, + // 上传图片 + uploadImage(filePath: string) { + this.setData({ materialUploading: true }) + wx.uploadFile({ + url: `${app.globalData.url}/app/common/common/upload`, + filePath, + name: 'file', + success: (res) => { + const data = JSON.parse(res.data) + if (data.code === 0) { + // 更新头像 + this.setData({ + materialImageUrl: data.data.url, + }) + } else { + wx.showToast({ + title: data.msg || '上传失败', + icon: 'none', + }) + } + }, + fail: () => { + wx.showToast({ + title: '上传失败', + icon: 'none', + }) + }, + complete: () => { + this.setData({ materialUploading: false }) + }, + }) + }, + // 提交材料 + handleSubmitMaterial() { + const { materialImageUrl, params } = this.data + if (!materialImageUrl) { + wx.showToast({ + title: '请先上传证明材料', + icon: 'none', + }) + return + } + this.triggerEvent('ok', { + type: 'uploadMaterialComplete', + patientId: params.patientId, + auditType: params.auditType, + imageUrl: materialImageUrl, + }) + }, }, }) diff --git a/src/components/popup/index.wxml b/src/components/popup/index.wxml index c13cdc9..16153fa 100644 --- a/src/components/popup/index.wxml +++ b/src/components/popup/index.wxml @@ -9,33 +9,38 @@ safe-area-inset-bottom="{{false}}" root-portal > - - 新患者注册通知 + + + {{params.title || '上传证明材料'}} 患者姓名 - 钱多多 + {{params.patientName}} 手机号 - 13800138000 + {{params.phone}} 项目 - 特诺雅®项目 + {{params.projectName}}®项目 适应症 - IBD + {{params.indicationName}} - - + + 拍照/从相册选择 - - 确定并提交审核 + + + 点击重新选择 + + + 确定并提交审核 { - const newLikeCount = isLiked ? (articleDetail.likeCount || 0) - 1 : (articleDetail.likeCount || 0) + 1 - this.setData({ - isLiked: !isLiked, articleDetail: { ...articleDetail, - likeCount: newLikeCount, + likeCount: (articleDetail.likeCount || 0) + 1, }, + isLiked: true, }) wx.showToast({ - title: isLiked ? '取消点赞' : '点赞成功', + title: '点赞成功', icon: 'none', }) }) .catch(() => { wx.showToast({ - title: '操作失败', + title: '点赞失败', icon: 'none', }) }) diff --git a/src/doctor/pages/articleList/index.scss b/src/doctor/pages/articleList/index.scss index 4bfd5c8..fbd3ae2 100644 --- a/src/doctor/pages/articleList/index.scss +++ b/src/doctor/pages/articleList/index.scss @@ -71,6 +71,9 @@ page { .wrap { flex: 1; overflow: hidden; + display: flex; + flex-direction: column; + justify-content: space-between; .title { font-size: 32rpx; color: #342317; diff --git a/src/doctor/pages/articleList/index.ts b/src/doctor/pages/articleList/index.ts index aa37c2f..b3962a1 100644 --- a/src/doctor/pages/articleList/index.ts +++ b/src/doctor/pages/articleList/index.ts @@ -80,12 +80,13 @@ Page({ .then((res: any) => { const list = (res.list || []).map((item: any) => ({ ...item, + isLiked: item.isLiked || false, })) const total = res.total || 0 const currentPage = this.data.page this.setData({ - articleList: [...this.data.articleList, ...list], + articleList: this.data.page === 1 ? list : [...this.data.articleList, ...list], page: currentPage + 1, hasMore: list.length >= this.data.pageSize, loading: false, @@ -126,6 +127,38 @@ Page({ url: `/doctor/pages/article/index?id=${id}`, }) }, + // 点赞(多次点赞只增加点赞数) + handleLike(e: WechatMiniprogram.CustomEvent) { + const { id, index } = e.currentTarget.dataset + const article = this.data.articleList[index] + + wx.ajax({ + method: 'POST', + url: '/app/pharmacist/pharmacist/edu-article-like', + data: { + articleId: id, + }, + }) + .then(() => { + // 更新本地数据 + const likedKey = `articleList[${index}].isLiked` + const countKey = `articleList[${index}].likeCount` + this.setData({ + [likedKey]: true, + [countKey]: article.likeCount + 1, + }) + wx.showToast({ + title: '点赞成功', + icon: 'none', + }) + }) + .catch(() => { + wx.showToast({ + title: '点赞失败', + icon: 'none', + }) + }) + }, }) export {} diff --git a/src/doctor/pages/articleList/index.wxml b/src/doctor/pages/articleList/index.wxml index e924763..e759b9f 100644 --- a/src/doctor/pages/articleList/index.wxml +++ b/src/doctor/pages/articleList/index.wxml @@ -31,9 +31,9 @@ {{item.viewCount || 0}} - - - {{item.likeCount || 0}} + + + {{item.likeCount || 0}} diff --git a/src/doctor/pages/home/index.ts b/src/doctor/pages/home/index.ts index 081286e..2aad9ae 100644 --- a/src/doctor/pages/home/index.ts +++ b/src/doctor/pages/home/index.ts @@ -213,11 +213,11 @@ Page({ // 根据统计类型格式化日期 const startDate = this.data.statType === 'month' - ? this.data.chartStartDate.substring(0, 7) // YYYY-MM + ? this.data.chartStartMonth // YYYY-MM : this.data.chartStartDate // YYYY-MM-DD const endDate = this.data.statType === 'month' - ? this.data.chartEndDate.substring(0, 7) // YYYY-MM + ? this.data.chartEndMonth // YYYY-MM : this.data.chartEndDate // YYYY-MM-DD wx.ajax({ @@ -229,7 +229,7 @@ Page({ endDate, }, }).then((res: any) => { - const list = res.list || [] + const list = res || [] // 转换为图表需要的格式 const chartData = list.map((item: any) => ({ date: item.statDate || item.date, @@ -241,28 +241,6 @@ Page({ this.initChartBar(chartData) }) }, - // 生成模拟图表数据 - generateMockChartData() { - const list: any[] = [] - const days = this.data.statType === 'day' ? 30 : 12 - for (let i = 0; i < days; i++) { - const date = new Date() - if (this.data.statType === 'day') { - date.setDate(date.getDate() - (days - 1 - i)) - list.push({ - date: this.formatDate(date), - count: Math.floor(Math.random() * 30) + 5, - }) - } else { - date.setMonth(date.getMonth() - (days - 1 - i)) - list.push({ - date: `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`, - count: Math.floor(Math.random() * 300) + 50, - }) - } - } - return list - }, // 切换统计类型 switchStatType(e: WechatMiniprogram.CustomEvent) { diff --git a/src/doctor/pages/invite/index.wxml b/src/doctor/pages/invite/index.wxml index c3c7325..c5f802e 100644 --- a/src/doctor/pages/invite/index.wxml +++ b/src/doctor/pages/invite/index.wxml @@ -23,7 +23,7 @@ 邀请您加入健康管理项目 - 特诺雅 + {{projectName || '特诺雅'}} ® diff --git a/src/doctor/pages/my/index.ts b/src/doctor/pages/my/index.ts index b91def0..247f6b9 100644 --- a/src/doctor/pages/my/index.ts +++ b/src/doctor/pages/my/index.ts @@ -81,9 +81,6 @@ Page({ url: `${app.globalData.url}/app/common/common/upload`, filePath, name: 'file', - header: { - loginState: app.globalData.loginState || '', - }, success: (res) => { wx.hideLoading() const data = JSON.parse(res.data) @@ -156,7 +153,7 @@ Page({ wx.ajax({ method: 'POST', url: '/app/pharmacist/pharmacist/logout', - }).finally(() => { + }).then(() => { app.startLogin(() => { wx.reLaunch({ url: '/pages/work/index', diff --git a/src/doctor/pages/patientList/index.scss b/src/doctor/pages/patientList/index.scss index 82f14ba..db0c343 100644 --- a/src/doctor/pages/patientList/index.scss +++ b/src/doctor/pages/patientList/index.scss @@ -163,6 +163,7 @@ page { } .container { margin-top: 32rpx; + padding-top: 12rpx; padding-bottom: 32rpx; border-radius: 12rpx; background-color: rgba(247, 247, 247, 0.6); @@ -215,18 +216,18 @@ page { .wrap { flex: 1; margin: 0 16rpx; - padding-top: 24rpx; padding-bottom: 32rpx; border-bottom: 1px solid #efefef; .none { color: #b7b7b7; } .date { + padding-top: 24rpx; font-size: 32rpx; color: #342317; } .status { - margin-top: 28rpx; + margin-top: 18rpx; display: flex; align-items: center; gap: 32rpx; @@ -259,6 +260,11 @@ page { color: #e86854; } } + .none { + padding: 20rpx 0 0 16rpx; + font-size: 32rpx; + color: rgba(183, 183, 183, 0.8); + } &.active { .aside { .line-top, @@ -285,9 +291,9 @@ page { } } &:last-of-type { - .aside{ - .line-bottom{ - border: none; + .aside { + .line-bottom { + // border: none; } } .wrap { diff --git a/src/doctor/pages/patientList/index.ts b/src/doctor/pages/patientList/index.ts index 11d38ac..fabf3a3 100644 --- a/src/doctor/pages/patientList/index.ts +++ b/src/doctor/pages/patientList/index.ts @@ -1,41 +1,43 @@ +import dayjs from 'dayjs' const app = getApp() Page({ data: { + // 项目列表 + projectList: [] as Array<{ projectId: number; projectName: string; projectDescription: string }>, + currentProjectId: 0, + currentProjectName: '特诺雅', + projectIndex: 0, + // 搜索关键词 keyword: '', // 筛选条件 - jumpStatus: 0, // 0-全部,1-已跳转 - enrollStatus: 0, // 0-全部,1-已入组 + jumpStatus: '', // ''-全部,0-未跳转,1-已跳转 + jumpStatusIndex: 0, // picker 选中索引 + jumpStatusLabel: '全部', + jumpStatusOptions: [ + { value: '', label: '全部' }, + { value: 0, label: '未跳转' }, + { value: 1, label: '已跳转' }, + ] as Array<{ value: string | number; label: string }>, + enrollStatus: '', // ''-全部,0-未入组,1-已入组 + enrollStatusIndex: 0, // picker 选中索引 + enrollStatusLabel: '全部', + enrollStatusOptions: [ + { value: '', label: '全部' }, + { value: 0, label: '未入组' }, + { value: 1, label: '已入组' }, + ] as Array<{ value: string | number; label: string }>, timeType: 0, // 0-跳转时间,1-入组时间 jumpStartTime: '', jumpEndTime: '', enrollStartTime: '', enrollEndTime: '', - // 患者列表(模拟数据,接口上线后删除) - patientList: [ - { - id: 100, - patientId: 10, - patientName: '患者A', - patientAvatar: '', - phone: '138****8888', - indicationName: '银屑病', - pharmacyName: '国大药房(XX店)', - bindTime: 1700000000, - bindTimeFormatted: '2023/11/14 22:13:20', - jumpStatus: 1, - jumpTime: 1700000100, - jumpTimeFormatted: '2023/11/14 22:15:00', - enrollStatus: 1, - enrollTime: 1700000200, - enrollTimeFormatted: '2023/11/14 22:16:40', - materialStatus: 2, - }, - ] as any[], - totalCount: 1, + // 患者列表 + patientList: [] as any[], + totalCount: 0, // 分页 page: 1, @@ -43,9 +45,9 @@ Page({ loading: false, hasMore: true, pagination: { - count: 1, - page: 1, - pages: 1, + count: 0, + page: 0, + pages: 0, }, // 弹窗 @@ -56,10 +58,69 @@ Page({ onLoad() { // 药店端患者列表页面,仅允许药店人员访问 app.waitLogin({ types: [4] }).then(() => { - // TODO: 接口上线后取消注释 - // this.getPatientList() + this.getProjectList() }) }, + // 获取项目列表 + getProjectList() { + wx.ajax({ + method: 'GET', + url: '/app/pharmacist/pharmacist/project-list', + }) + .then((res: any) => { + const list = res.list || [] + const currentProjectId = res.currentProjectId || (list.length > 0 ? list[0].projectId : 0) + const currentProject = list.find((p: any) => p.projectId === currentProjectId) + + this.setData({ + projectList: list, + currentProjectId, + currentProjectName: currentProject?.projectName || '特诺雅', + projectIndex: list.findIndex((p: any) => p.projectId === currentProjectId), + }) + + // 获取患者列表 + this.getPatientList() + }) + .catch(() => { + // 接口失败,使用默认数据 + this.getPatientList() + }) + }, + // 切换项目 + onProjectChange(e: WechatMiniprogram.CustomEvent) { + const index = e.detail.value + const project = this.data.projectList[index] + if (!project || project.projectId === this.data.currentProjectId) return + + // 调用切换项目接口 + wx.ajax({ + method: 'POST', + url: '/app/pharmacist/pharmacist/switch-project', + data: { + projectId: project.projectId, + }, + }) + .then(() => { + this.setData({ + currentProjectId: project.projectId, + currentProjectName: project.projectName, + projectIndex: index, + // 重置患者列表 + patientList: [], + page: 1, + hasMore: true, + }) + // 刷新患者列表 + this.getPatientList() + }) + .catch(() => { + wx.showToast({ + title: '切换项目失败', + icon: 'none', + }) + }) + }, // 获取患者列表 getPatientList() { if (this.data.loading || !this.data.hasMore) return @@ -67,15 +128,23 @@ Page({ this.setData({ loading: true }) // 根据时间类型判断传递哪个时间参数 - const { timeType, jumpStartTime, jumpEndTime, enrollStartTime, enrollEndTime } = this.data + const { timeType, jumpStartTime, jumpEndTime, enrollStartTime, enrollEndTime, jumpStatus, enrollStatus } = this.data const params: any = { keyword: this.data.keyword, - jumpStatus: this.data.jumpStatus, - enrollStatus: this.data.enrollStatus, page: this.data.page, pageSize: this.data.pageSize, } + // 跳转状态:空字符串表示全部,不传递参数 + if (jumpStatus !== '') { + params.jumpStatus = jumpStatus + } + + // 入组状态:空字符串表示全部,不传递参数 + if (enrollStatus !== '') { + params.enrollStatus = enrollStatus + } + // 时间类型:0-跳转时间,1-入组时间 if (timeType === 0) { // 跳转时间 @@ -91,31 +160,45 @@ Page({ method: 'GET', url: '/app/pharmacist/pharmacist/patient-list', data: params, - }).then((res: any) => { - const list = (res.list || []).map((item: any) => ({ - ...item, - bindTimeFormatted: item.bindTime ? this.formatDate(item.bindTime) : '-', - jumpTimeFormatted: item.jumpTime ? this.formatDate(item.jumpTime) : '', - enrollTimeFormatted: item.enrollTime ? this.formatDate(item.enrollTime) : '', - })) - const total = res.total || 0 - const currentPage = this.data.page + }) + .then((res: any) => { + const list = (res.list || []).map((item: any) => ({ + ...item, + bindTimeFormatted: item.bindTime || '-', + jumpTimeFormatted: item.jumpMaterial.updateTime + ? dayjs(item.jumpMaterial.updateTime).format('YYYY-MM-DD HH:mm') + : '', + enrollTimeFormatted: item.enrollMaterial.updateTime + ? dayjs(item.enrollMaterial.updateTime).format('YYYY-MM-DD HH:mm') + : '', + // 跳转材料审核状态 + jumpAuditStatus: item.jumpMaterial?.auditStatus ?? -1, + jumpAuditStatusText: item.jumpMaterial?.auditStatusText || '', + jumpRejectReason: item.jumpMaterial?.rejectReason || '', + // 入组材料审核状态 + enrollAuditStatus: item.enrollMaterial?.auditStatus ?? -1, + enrollAuditStatusText: item.enrollMaterial?.auditStatusText || '', + enrollRejectReason: item.enrollMaterial?.rejectReason || '', + })) + const total = res.total || 0 + const currentPage = this.data.page - this.setData({ - patientList: [...this.data.patientList, ...list], - totalCount: total, - page: currentPage + 1, - hasMore: list.length >= this.data.pageSize, - loading: false, - pagination: { - count: total, - page: currentPage, - pages: Math.ceil(total / this.data.pageSize) || 1, - }, + this.setData({ + patientList: this.data.page === 1 ? list : [...this.data.patientList, ...list], + totalCount: total, + page: currentPage + 1, + hasMore: list.length >= this.data.pageSize, + loading: false, + pagination: { + count: total, + page: currentPage, + pages: Math.ceil(total / this.data.pageSize) || 1, + }, + }) + }) + .catch(() => { + this.setData({ loading: false }) }) - }).catch(() => { - this.setData({ loading: false }) - }) }, // 格式化日期 formatDate(timestamp: number): string { @@ -140,9 +223,12 @@ Page({ }, // 跳转状态筛选 handleJumpStatusChange(e: WechatMiniprogram.CustomEvent) { - const jumpStatus = e.detail.value === '1' ? 1 : 0 + const index = e.detail.value + const option = this.data.jumpStatusOptions[index] this.setData({ - jumpStatus, + jumpStatus: option.value, + jumpStatusIndex: index, + jumpStatusLabel: option.label, page: 1, patientList: [], hasMore: true, @@ -151,9 +237,12 @@ Page({ }, // 入组状态筛选 handleEnrollStatusChange(e: WechatMiniprogram.CustomEvent) { - const enrollStatus = e.detail.value === '1' ? 1 : 0 + const index = e.detail.value + const option = this.data.enrollStatusOptions[index] this.setData({ - enrollStatus, + enrollStatus: option.value, + enrollStatusIndex: index, + enrollStatusLabel: option.label, page: 1, patientList: [], hasMore: true, @@ -250,24 +339,93 @@ Page({ } this.getPatientList() }, - // 查看详情 - handleInfo(e: WechatMiniprogram.CustomEvent) { - const { id } = e.currentTarget.dataset - wx.navigateTo({ - url: `/doctor/pages/stat/index?id=${id}`, + // 预览提交的材料图片 + handlePreviewMaterial(e: WechatMiniprogram.CustomEvent) { + const { url } = e.currentTarget.dataset + if (!url) { + wx.showToast({ + title: '暂无图片', + icon: 'none', + }) + return + } + wx.previewImage({ + urls: [url], + current: url, }) }, // 上传材料 handleUpload(e: WechatMiniprogram.CustomEvent) { const { id } = e.currentTarget.dataset + // 查找患者信息 + const patient = this.data.patientList.find((p: any) => p.id === id) + if (!patient) return + + // 判断是跳转材料还是入组材料 + const isJumpMaterial = patient.jumpAuditStatus === 0 || patient.jumpAuditStatus === 3 + const auditType = isJumpMaterial ? 1 : 2 + const title = isJumpMaterial ? '上传跳转证明材料' : '上传入组证明材料' + this.setData({ popupShow: true, - popupType: 'upload', - popupParams: { patientId: id }, + popupType: 'uploadMaterial', + popupParams: { + patientId: patient.patientId, + patientName: patient.patientName, + phone: patient.phone, + projectName: this.data.currentProjectName, + indicationName: patient.indicationName, + auditType, + title, + }, }) }, // 弹窗确认 - handlePopupOk() { + handlePopupOk(e: WechatMiniprogram.CustomEvent) { + const { detail } = e + + // 处理上传材料完成 + if (detail && detail.type === 'uploadMaterialComplete') { + const { patientId, auditType, imageUrl } = detail + + wx.showLoading({ title: '提交中...' }) + wx.ajax({ + method: 'POST', + url: '/app/pharmacist/pharmacist/submit-material', + data: { + patientId, + imageUrl, + auditType, + }, + }) + .then(() => { + wx.hideLoading() + wx.showToast({ + title: '提交成功', + icon: 'success', + }) + this.setData({ + popupShow: false, + }) + // 刷新列表 + this.setData({ + page: 1, + patientList: [], + hasMore: true, + }) + this.getPatientList() + }) + .catch(() => { + wx.hideLoading() + wx.showToast({ + title: '提交失败', + icon: 'none', + }) + }) + return + } + + // 其他弹窗类型处理 this.setData({ popupShow: false, }) diff --git a/src/doctor/pages/patientList/index.wxml b/src/doctor/pages/patientList/index.wxml index a113d0f..dac32a3 100644 --- a/src/doctor/pages/patientList/index.wxml +++ b/src/doctor/pages/patientList/index.wxml @@ -1,9 +1,17 @@ - - 特诺雅 - ® - - + + + {{currentProjectName}} + ® + + + @@ -20,17 +28,17 @@ /> - + 跳转: - {{jumpStatus === 0 ? '全部' : '已跳转'}} + {{jumpStatusLabel}} - + 入组: - {{enrollStatus === 0 ? '全部' : '已入组'}} + {{enrollStatusLabel}} @@ -71,13 +79,9 @@ - + - + {{item.patientName}} @@ -99,23 +103,36 @@ - {{item.jumpTimeFormatted}} - - - {{item.materialStatus === 0 ? '未提交' : (item.materialStatus === 1 ? '审核中' : (item.materialStatus - === 2 ? '已通过' : '已驳回'))}} + {{item.jumpTimeFormatted}} + + + + {{item.jumpAuditStatusText}} + + + {{item.jumpAuditStatusText}} + + + 提交 + + - {{item.materialStatus === 3 ? '重新提交' : '查看提交材料'}} + 查看提交材料 + + + + 重新提交 - 材料信息不全 + + {{item.jumpRejectReason}} + @@ -128,13 +145,39 @@ - - {{item.enrollTimeFormatted}} - - 审核通过 - 查看提交材料 + + {{item.enrollTimeFormatted}} + + + + {{item.enrollAuditStatusText}} + + + {{item.enrollAuditStatusText}} + + + + 提交 + + + + 查看提交材料 + + + + 重新提交 + + + + {{item.enrollRejectReason}} + --- diff --git a/src/doctor/pages/stat/index.json b/src/doctor/pages/stat/index.json index e3ceeb9..5120472 100644 --- a/src/doctor/pages/stat/index.json +++ b/src/doctor/pages/stat/index.json @@ -2,6 +2,7 @@ "navigationStyle": "custom", "usingComponents": { "popup": "/components/popup/index", - "navbar": "/components/navbar/index" + "navbar": "/components/navbar/index", + "pagination": "/components/pagination/index" } } diff --git a/src/doctor/pages/stat/index.ts b/src/doctor/pages/stat/index.ts index 4982ee7..743d2c4 100644 --- a/src/doctor/pages/stat/index.ts +++ b/src/doctor/pages/stat/index.ts @@ -29,13 +29,18 @@ Page({ total: 0, loading: false, hasMore: true, + // 分页组件数据 + pagination: { + count: 0, + page: 0, + pages: 0, + }, }, onLoad() { // 药店端统计页面,仅允许药店人员访问 app.waitLogin({ types: [4] }).then(() => { this.initDate() - this.getStatisticsList() }) }, @@ -49,6 +54,7 @@ Page({ endDate: today, today, }) + this.getStatisticsList() }, // 格式化日期 @@ -75,25 +81,35 @@ Page({ page: this.data.page, pageSize: this.data.pageSize, }, - }).then((res: any) => { - const list = res.list || [] - const summary = res.summary || { - invitePatientCount: 0, - jumpPatientCount: 0, - enrollPatientCount: 0, - } - - this.setData({ - summary, - statList: this.data.page === 1 ? list : [...this.data.statList, ...list], - total: res.total || 0, - page: this.data.page + 1, - hasMore: list.length >= this.data.pageSize, - loading: false, - }) - }).catch(() => { - this.setData({ loading: false }) }) + .then((res: any) => { + const list = res.list || [] + const summary = res.summary || { + invitePatientCount: 0, + jumpPatientCount: 0, + enrollPatientCount: 0, + } + + const total = res.total || 0 + const pages = Math.ceil(total / this.data.pageSize) + + this.setData({ + summary, + statList: this.data.page === 1 ? list : [...this.data.statList, ...list], + total, + page: this.data.page + 1, + hasMore: list.length >= this.data.pageSize, + loading: false, + pagination: { + count: total, + page: this.data.page, + pages, + }, + }) + }) + .catch(() => { + this.setData({ loading: false }) + }) }, // 切换统计类型 diff --git a/src/doctor/pages/stat/index.wxml b/src/doctor/pages/stat/index.wxml index 7f7dd3c..0186e97 100644 --- a/src/doctor/pages/stat/index.wxml +++ b/src/doctor/pages/stat/index.wxml @@ -26,100 +26,55 @@ - 1893 + {{summary.invitePatientCount}} 邀约患者总数 - 1893 + {{summary.jumpPatientCount}} 跳转患者数 - 1893 + {{summary.enrollPatientCount}} - 跳转患者数 + 入组患者数 - + - 2025/02/26 + {{item.statDate}} 邀约患者数 - 750 + {{item.invitePatientCount}} 跳转患者数 - 750 + {{item.jumpPatientCount}} 入组患者数 - 750 - - - - - 入组患者数 - 300 - - - - 斑块状银屑病 - 280 - - - 斑块状银屑病 - 280 - - - - - - 溃疡性结肠炎 - 300 - - - - 溃疡性结肠炎 - 280 - - - 溃疡性结肠炎 - 280 - - - - - - 克罗恩病 - 300 - - - 克罗恩病 - 280 - - - 克罗恩病 - 280 + {{item.enrollPatientCount}} + diff --git a/src/ground/pages/invite/index.wxml b/src/ground/pages/invite/index.wxml index 1537dbf..ecb73ff 100644 --- a/src/ground/pages/invite/index.wxml +++ b/src/ground/pages/invite/index.wxml @@ -27,7 +27,7 @@ 邀请您加入健康管理项目 - 特诺雅 + {{projectName || '特诺雅'}} ® diff --git a/src/ground/pages/my/index.ts b/src/ground/pages/my/index.ts index dedbaea..b526e83 100644 --- a/src/ground/pages/my/index.ts +++ b/src/ground/pages/my/index.ts @@ -129,7 +129,7 @@ Page({ wx.ajax({ method: 'POST', url: '/app/promoter/promoter/logout', - }).finally(() => { + }).then(() => { app.startLogin(() => { wx.reLaunch({ url: '/pages/work/index', diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 2fd7273..ddaa6bf 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -121,15 +121,25 @@ Page({ }) .then((res: any) => { if (res && res.projectId) { - // 已有项目,显示已参加项目状态 - this.setData({ - isLogin: 1, - isPatient: 1, - projectId: res.projectId, - projectName: res.projectName, - hasProject: true, - selectedIndicationName: res.indicationName, - }) + // 检查扫码的项目是否与当前项目一致 + const scanProjectId = this.data.projectId + if (scanProjectId && String(scanProjectId) !== String(res.projectId)) { + // 扫码的是新项目,进入选择流程 + this.setData({ + hasProject: false, + }) + this.getProjectInfo() + } else { + // 已有项目且与扫码项目一致,显示已参加项目状态 + this.setData({ + isLogin: 1, + isPatient: 1, + projectId: res.projectId, + projectName: res.projectName, + hasProject: true, + selectedIndicationName: res.indicationName, + }) + } } else { // 没有项目,获取项目列表供选择 this.setData({ diff --git a/src/pages/start/index.ts b/src/pages/start/index.ts index 24c36fa..5bb15c8 100644 --- a/src/pages/start/index.ts +++ b/src/pages/start/index.ts @@ -71,6 +71,13 @@ Page({ return } + if (loginIdentity === 4 && isRegister === 0) { + wx.reLaunch({ + url: '/doctor/pages/login/index', + }) + return + } + // 已注册,根据身份跳转到对应首页 const homePageUrl = { 2: '/pages/index/index', diff --git a/src/pages/tourists/index.ts b/src/pages/tourists/index.ts index ad202bf..2bfe5b3 100644 --- a/src/pages/tourists/index.ts +++ b/src/pages/tourists/index.ts @@ -3,27 +3,7 @@ const app = getApp() Page({ data: {}, onLoad() { - app.waitLogin().then(() => { - // 检查用户是否已有绑定的项目 - this.checkProjectStatus() - }) - }, - // 检查用户项目状态 - checkProjectStatus() { - wx.ajax({ - method: 'GET', - url: '/app/patient/patient/recent-project', - }).then((res: any) => { - if (res && res.projectId) { - // 已有绑定的项目,跳转到患者首页 - wx.reLaunch({ - url: '/pages/index/index', - }) - } - // 没有项目,停留在当前页面 - }).catch(() => { - // 接口失败,停留在当前页面 - }) + app.waitLogin().then(() => {}) }, // 跳转到药店工作人员登录页 goToPharmacist() {