diff --git a/src/ground/pages/home/index.ts b/src/ground/pages/home/index.ts index b58f693..429c0de 100644 --- a/src/ground/pages/home/index.ts +++ b/src/ground/pages/home/index.ts @@ -229,11 +229,13 @@ Page({ // 获取日/月度邀约患者统计数据(按日期筛选) getPatientStatistics() { + // 根据统计类型选择日期格式 + const statDate = this.data.statType === 'month' ? this.data.startMonth : this.data.startDate wx.ajax({ method: 'GET', url: '/app/promoter/promoter/patient-statistics', data: { - statDate: this.data.startDate, + statDate, type: this.data.statType, }, }).then((res: any) => { @@ -248,13 +250,16 @@ Page({ // 获取邀约患者统计图表(使用 chart1 的日期) getPatientChart() { + // 根据统计类型选择日期格式 + const startDate = this.data.statType === 'month' ? this.data.chart1StartMonth : this.data.chart1StartDate + const endDate = this.data.statType === 'month' ? this.data.chart1EndMonth : this.data.chart1EndDate wx.ajax({ method: 'GET', url: '/app/promoter/promoter/patient-chart', data: { type: this.data.statType, - startDate: this.data.chart1StartDate, - endDate: this.data.chart1EndDate, + startDate, + endDate, }, }).then((list: any) => { // 新接口返回的数据格式包含 invitePatientCount, jumpPatientCount, enrollPatientCount, indicationStats @@ -274,10 +279,13 @@ Page({ // 获取邀约药师统计图表(使用 chart2 的日期) getPharmacistChart() { + // 根据统计类型选择日期格式 + const startDate = this.data.statType === 'month' ? this.data.chart2StartMonth : this.data.chart2StartDate + const endDate = this.data.statType === 'month' ? this.data.chart2EndMonth : this.data.chart2EndDate const data: any = { type: this.data.statType, - startDate: this.data.chart2StartDate, - endDate: this.data.chart2EndDate, + startDate, + endDate, } if (this.data.currentProjectId) { data.projectId = this.data.currentProjectId @@ -296,10 +304,13 @@ Page({ // 获取邀约药店统计图表(使用 chart3 的日期) getPharmacyChart() { + // 根据统计类型选择日期格式 + const startDate = this.data.statType === 'month' ? this.data.chart3StartMonth : this.data.chart3StartDate + const endDate = this.data.statType === 'month' ? this.data.chart3EndMonth : this.data.chart3EndDate const data: any = { type: this.data.statType, - startDate: this.data.chart3StartDate, - endDate: this.data.chart3EndDate, + startDate, + endDate, } if (this.data.currentProjectId) { data.projectId = this.data.currentProjectId