Selaa lähdekoodia

看课 流量营期拆分app 和小程序

wangxy 1 viikko sitten
vanhempi
commit
f7a1350f9e

+ 2 - 1
src/views/course/courseTrafficLog/index.vue

@@ -165,7 +165,8 @@ export default {
         pageSize: 10,
         companyId: null,
         project: null,
-        courseId: null
+        courseId: null,
+        typeFlag:0
       }
     };
   },

+ 273 - 0
src/views/course/courseTrafficLog/indexApp.vue

@@ -0,0 +1,273 @@
+<template>
+  <div class="app-container">
+    <!-- Tab 切换 -->
+    <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+      <el-tab-pane label="项目" name="project"></el-tab-pane>
+      <el-tab-pane label="课程" name="course"></el-tab-pane>
+      <el-tab-pane label="公开课" name="common"></el-tab-pane>
+    </el-tabs>
+
+    <!-- 查询条件 -->
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <!-- 公司选择 -->
+      <el-form-item label="公司">
+        <el-select v-model="queryParams.companyId" placeholder="请选择公司" filterable clearable size="small">
+          <el-option v-for="(option, index) in companyList" :key="index" :value="option.dictValue" :label="option.dictLabel"></el-option>
+        </el-select>
+      </el-form-item>
+
+      <!-- 项目选择 -->
+      <el-form-item label="项目" v-if="activeTab === 'all' || activeTab === 'project'">
+        <el-select v-model="queryParams.project" placeholder="请选择项目" filterable clearable size="small">
+          <el-option v-for="dict in projectOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+
+      <!-- 课程选择 -->
+      <el-form-item label="课程" v-if="activeTab === 'all' || activeTab === 'course'">
+        <el-select v-model="queryParams.courseId" placeholder="请选择课程" filterable clearable size="small">
+          <el-option v-for="dict in courseLists" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="公开课" v-if="activeTab === 'all' || activeTab === 'common'">
+        <el-select v-model="queryParams.courseId" placeholder="请选择课程" filterable clearable size="small">
+          <el-option v-for="dict in courseLists" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
+        </el-select>
+      </el-form-item>
+
+      <!-- 时间选择 -->
+      <el-form-item label="年月">
+        <el-date-picker
+          v-model="timeRange"
+          type="daterange"
+          placeholder="选择年月"
+          :value-format="'yyyy-MM-dd'"
+          :picker-options="pickerOptions"
+          @change="handleDateData"
+        ></el-date-picker>
+      </el-form-item>
+
+
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+        <el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading" @click="handleExport" >导出</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+          v-hasPermi="['his:company:export']"
+        >导出
+        </el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <!-- 表格 -->
+    <el-table border v-loading="loading" :data="courseTrafficLogList" @selection-change="handleSelectionChange" show-summary :summary-method="getSummaries">
+      <el-table-column type="selection" width="55" align="center" />
+      <!-- 公司列 -->
+      <el-table-column label="公司" align="center" prop="companyName" />
+      <!-- 项目列 -->
+      <el-table-column label="项目" align="center" prop="projectName" v-if="activeTab === 'all' || activeTab === 'project'" />
+      <!-- 课程列 -->
+      <el-table-column label="课程" align="center" prop="courseName" v-if="activeTab === 'all' || activeTab === 'course'||activeTab === 'common'" />
+      <el-table-column label="日期" align="center" prop="month" />
+      <el-table-column label="使用流量" align="center">
+        <template slot-scope="scope">
+          <span>{{ formatTrafficData(scope.row.totalInternetTraffic) }}</span>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 分页 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import { listCourseTrafficLog, exportCourseTrafficLog } from "@/api/course/courseTrafficLog";
+import { courseList } from "@/api/course/courseRedPacketLog";
+import { allList } from "@/api/company/company";
+
+export default {
+  data() {
+    return {
+      activeTab: "project", // 默认 tab
+      timeRange: null, // 时间范围单独绑定
+      companyList: [],
+      projectOptions: [],
+      pickerOptions: {
+        shortcuts: [
+          {
+            text: '今日',
+            onClick(picker) {
+              const start = new Date();
+              const end = new Date();
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '昨日',
+            onClick(picker) {
+              const start = new Date();
+              start.setDate(start.getDate() - 1);
+              const end = new Date(start);
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '本周',
+            onClick(picker) {
+              const now = new Date();
+              const day = now.getDay() || 7;
+              const start = new Date(now);
+              start.setDate(now.getDate() - day + 1);
+              const end = new Date();
+              picker.$emit('pick', [start, end]);
+            }
+          },
+          {
+            text: '本月',
+            onClick(picker) {
+              const start = new Date(new Date().setDate(1));
+              const end = new Date();
+              picker.$emit('pick', [start, end]);
+            }
+          }
+        ]
+      },
+      courseLists: [],
+      loading: false,
+      exportLoading: false,
+      showSearch: true,
+      total: 0,
+      courseTrafficLogList: [],
+      queryParams: {
+        tabType: "", // 当前 tab 类型
+        startDate: null,
+        endDate: null,
+        pageNum: 1,
+        pageSize: 10,
+        companyId: null,
+        project: null,
+        courseId: null,
+        typeFlag:1
+      }
+    };
+  },
+  created() {
+    this.queryParams.tabType = "project";
+    courseList().then(res => this.courseLists = res.list);
+    this.getDicts("sys_course_project").then(res => this.projectOptions = res.data);
+    this.getAllCompany();
+    this.getList();
+  },
+  methods: {
+    getSummaries(param) {
+      const { columns, data } = param;
+      const sums = [];
+      columns.forEach((column, index) => {
+        if (index === 0) {
+          sums[index] = '合计';
+          return;
+        }
+        // 根据列的位置判断,假设流量列是最后一个列(第5列,索引为4)
+        // 或者根据列的数量判断,这里假设流量列始终是倒数第一列
+        if (index === columns.length - 1) {
+          if (data && data.length > 0) {
+            const values = data.map(item => Number(item.totalInternetTraffic) || 0);
+            const total = values.reduce((prev, curr) => prev + curr, 0);
+            sums[index] = this.formatTrafficData(total);
+          } else {
+            sums[index] = '0.0000 GB';
+          }
+        } else {
+          sums[index] = '';
+        }
+      });
+
+      return sums;
+    },
+    handleTabClick(tab) {
+      this.queryParams.tabType = tab.name;
+      this.queryParams.pageNum = 1;
+
+      // 清理互斥参数
+      if (tab.name !== "project") this.queryParams.project = null;
+      if (tab.name !== "course") this.queryParams.courseId = null;
+      this.getList();
+    },
+
+    handleDateData() {
+      if (this.timeRange) {
+        this.queryParams.startDate = this.timeRange[0];
+        this.queryParams.endDate = this.timeRange[1];
+      } else {
+        this.queryParams.startDate = null;
+        this.queryParams.endDate = null;
+      }
+    },
+    getAllCompany() {
+      allList().then(res => this.companyList = res.rows);
+    },
+    getList() {
+      this.loading = true;
+      listCourseTrafficLog(this.queryParams).then(res => {
+        this.courseTrafficLogList = res.rows;
+        console.log('列表',this.courseTrafficLogList)
+        this.total = res.total;
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    resetQuery() {
+      this.timeRange = null;
+      this.queryParams = {
+        ...this.queryParams,
+        startDate: null,
+        endDate: null,
+        companyId: null,
+        project: null,
+        courseId: null,
+        pageNum: 1,
+      };
+      this.getList();
+    },
+    formatTrafficData(traffic) {
+      return `${(traffic / (1024 ** 3)).toFixed(4)} GB`;
+    },
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.logId);
+    },
+    handleExport() {
+      this.$confirm("确认导出数据?", "提示").then(() => {
+        this.exportLoading = true;
+        return exportCourseTrafficLog(this.queryParams);
+      }).then(res => {
+        this.download(res.msg);
+      }).finally(() => {
+        this.exportLoading = false;
+      });
+    },
+  }
+};
+</script>

+ 16 - 1
src/views/course/userCoursePeriod/statistics.vue

@@ -2,6 +2,11 @@
   <div class="statistics-container">
     <!-- 营期课程选择 -->
     <div class="fixed-header">
+      <!-- Tab切换 -->
+      <el-tabs v-model="activeTab" @tab-click="handleTabClick">
+        <el-tab-pane label="APP" name="app"></el-tab-pane>
+        <el-tab-pane label="小程序" name="miniprogram"></el-tab-pane>
+      </el-tabs>
       <el-form :inline="true" :model="queryParams" class="demo-form-inline">
         <el-form-item label="营期课程">
           <el-select
@@ -157,6 +162,8 @@ export default {
       // 课程选项
       courseOptions: [],
       companyOptions: [],
+      // tab切换
+      activeTab: 'miniprogram',
       // 统计数据
       statistics: {
         courseCompleteNum: 0,
@@ -177,7 +184,8 @@ export default {
         pageSize: 100,
         videoIdList: [],
         // videoId: '',
-        periodId: ''
+        periodId: '',
+        typeFlag: 2
       },
       // 是否已初始化
       initialized: false
@@ -203,6 +211,13 @@ export default {
     }
   },
   methods: {
+    /** 处理tab切换 */
+    handleTabClick(tab) {
+      // 设置typeFlag参数 1:APP 2:小程序
+      this.queryParams.typeFlag = tab.name === 'app' ? 1 : 2;
+      // 重新查询数据
+      this.handleQuery();
+    },
     /** 初始化数据 */
     initializeData() {
       this.getCourseOptions();

+ 540 - 0
src/views/his/statistics/courseAppReport.vue

@@ -0,0 +1,540 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="85px">
+      <el-radio-group v-model="queryParams.dimension" @change="handleDimensionChange">
+        <el-radio-button label="company">销售公司</el-radio-button>
+        <el-radio-button label="camp">训练营</el-radio-button>
+      </el-radio-group>
+      <el-form-item label="公司名" prop="companyId">
+        <el-select filterable v-model="queryParams.companyId" placeholder="请选择公司名"
+                   clearable size="small">
+          <el-option
+            v-for="item in companys"
+            :key="item.companyId"
+            :label="item.companyName"
+            :value="item.companyId"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="训练营" prop="trainingCampId" v-if="queryParams.dimension === 'camp'">
+        <el-select filterable v-model="queryParams.trainingCampId" placeholder="请选择训练营"
+                   clearable size="small" @change="handleCampChange">
+          <el-option
+            v-for="item in camps"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <treeselect style="width: 220px" v-model="queryParams.periodId" :options="deptOptions"
+                    clearable :show-count="true" placeholder="请选择归属营期" value-consists-of="LEAF_PRIORITY"
+                    :normalizer="normalizer" v-if="queryParams.dimension === 'camp'" />
+      </el-form-item>
+      <el-form-item>
+        <el-form-item label="看课时间" prop="createTime">
+          <el-date-picker v-model="createTime" size="small" style="width: 220px" value-format="yyyy-MM-dd"
+                          type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
+                          @change="xdChange"></el-date-picker>
+        </el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          :loading="exportLoading"
+          @click="handleExport"
+        >导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+    <el-table height="500" v-loading="loading" border :data="packageOrderList">
+      <el-table-column label="销售公司" align="center" prop="companyName" width="120px"/>
+      <el-table-column label="训练营" align="center" prop="trainingCampName" v-if="showTrainingCampColumn"/>
+      <el-table-column label="营期" align="center" prop="periodName" v-if="showPeriodColumn"/>
+      <el-table-column label="进线人数" align="center" prop="accessCount"/>
+      <el-table-column label="待看课人数" align="center" prop="pendingCount"/>
+      <el-table-column label="看课中人数" align="center" prop="watchingCount"/>
+      <el-table-column label="看课率" align="center" prop="watchRate"/>
+      <el-table-column label="完课人数" align="center" prop="finishedCount"/>
+      <el-table-column label="看课中断" align="center" prop="interruptedCount"/>
+      <el-table-column label="完课率" align="center" prop="finishRate"/>
+      <el-table-column label="答题人数" align="center" prop="answerUserCount"/>
+      <el-table-column label="红包领取人数" align="center" prop="packetUserCount"/>
+      <el-table-column label="红包金额" align="center" prop="packetAmount"/>
+    </el-table>
+    <div class="total-summary">
+      <span class="total-title">总计:</span>
+      <span class="total-item">进线人数: {{ calculatedTotalData.accessCount }}</span>
+      <span class="total-item">待看课人数: {{ calculatedTotalData.pendingCount }}</span>
+      <span class="total-item">看课中人数: {{ calculatedTotalData.watchingCount }}</span>
+      <span class="total-item">看课率: {{ calculatedTotalData.watchRate}}</span>
+      <span class="total-item">完课人数: {{ calculatedTotalData.finishedCount }}</span>
+      <span class="total-item">看课中断: {{ calculatedTotalData.interruptedCount }}</span>
+      <span class="total-item">完课率: {{ calculatedTotalData.finishRate}}</span>
+      <span class="total-item">答题人数: {{ calculatedTotalData.answerUserCount }}</span>
+      <span class="total-item">红包领取人数: {{ calculatedTotalData.packetUserCount}}</span>
+      <span class="total-item">红包金额: {{ calculatedTotalData.packetAmount }}</span>
+    </div>
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+import {
+  listPackageOrder, getPackageOrder, delPackageOrder, addPackageOrder, updatePackageOrder, exportPackageOrder,
+  PackageOrderReport, orderReport, courseReport, exportOrderReport, exportCourseReport
+} from "@/api/his/packageOrder";
+import {getCompanyList} from "@/api/company/company";
+import packageOrderDetails from '../../components/his/packageOrderDetails.vue';
+import {treeselect} from "@/api/company/companyDept";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {getTask} from "@/api/common";
+import {getCampList, getPeriodList} from "@/api/course/userWatchCourseStatistics";
+
+export default {
+  name: "PackageOrder",
+  components: {packageOrderDetails, Treeselect},
+  data() {
+    return {
+      normalizer: function(node) {
+        return {
+          id: node.id || node.dictValue,
+          label: node.label || node.dictLabel,
+          children: node.children
+        }
+      },
+      // 添加用于存储计算总和的数据
+      calculatedTotalData: {
+        accessCount: 0,
+        pendingCount: 0,
+        watchingCount: 0,
+        watchRate: '0%',
+        finishedCount: 0,
+        interruptedCount: 0,
+        finishRate: '0%',
+        answerUserCount: 0,
+        packetUserCount: 0,
+        packetAmount: 0
+      },
+      showTrainingCampColumn: false,
+      showPeriodColumn: false,
+      totalData: {},
+      companys: [],
+      camps: [],
+      deptOptions: [],
+      companyId: undefined,
+      campId: undefined,
+      deptId: undefined,
+      show: {
+        open: false,
+      },
+      sourceOptions: [],
+      actName: "2",
+      // 遮罩层
+      loading: true,
+      startTime: null,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      createTime: null,
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      endTime: null,
+      // 总条数
+      total: 0,
+      // 套餐订单表格数据
+      packageOrderList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 是否支付字典
+      isPayOptions: [],
+      // 状态字典
+      statusOptions: [],
+      refundStatusOptions: [],
+      packageSubTypeOptions: [],
+      payTypeOptions: [],
+      deliveryPayStatusOptions: [],
+      deliveryStatusOptions: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        orderSn: null,
+        userId: null,
+        doctorId: null,
+        doctorName: null,
+        phone: null,
+        phoneMk: null,
+        packageId: null,
+        packageName: null,
+        payMoney: null,
+        isPay: null,
+        days: null,
+        status: null,
+        startTime: null,
+        startDate: null,
+        endDate:null,
+        finishTime: null,
+        sTime: null,
+        eTime: null,
+        stTime: null,
+        endTime: null,
+        endStartTime: null,
+        endEndTime: null,
+        companyUserName: null,
+        companyName: null,
+        deptId: null,
+        source: null,
+        trainingCampId: null,
+        periodId: null,
+        dimension: 'camp',
+        watchType: 1
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {}
+    };
+  },
+  created() {
+    // 设置默认时间为前一天
+    const yesterday = new Date();
+    yesterday.setDate(yesterday.getDate() - 1);
+    const formatDate = (date) => {
+      const year = date.getFullYear();
+      const month = String(date.getMonth() + 1).padStart(2, '0');
+      const day = String(date.getDate()).padStart(2, '0');
+      return `${year}-${month}-${day}`;
+    };
+    this.createTime = [formatDate(yesterday), formatDate(yesterday)];
+    this.queryParams.sTime = this.createTime[0];
+    this.queryParams.eTime = this.createTime[1];
+    getCampList().then(response => {
+      this.camps = response.data.list
+      if (this.camps != null && this.camps.length > 0) {
+        this.companyId = this.camps[0].dictValue;
+      }
+      this.camps.push({companyId: "-1", companyName: "无"})
+    });
+    getCompanyList().then(response => {
+      this.companys = response.data;
+      if (this.companys != null && this.companys.length > 0) {
+        this.companyId = this.companys[0].companyId;
+      }
+      this.companys.push({companyId: "-1", companyName: "无"})
+    });
+    this.getList();
+    this.getDicts("sys_company_or").then(response => {
+      this.isPayOptions = response.data;
+    });
+    this.getDicts("sys_package_order_status").then(response => {
+      this.statusOptions = response.data;
+    });
+    this.getDicts("sys_refund_status").then(response => {
+      this.refundStatusOptions = response.data;
+    });
+    this.getDicts("sys_order_source").then(response => {
+      this.sourceOptions = response.data;
+    });
+    this.getDicts("sys_package_pay_type").then(response => {
+      this.payTypeOptions = response.data;
+    });
+    this.getDicts("sys_store_delivery_pay_status").then(response => {
+      this.deliveryPayStatusOptions = response.data;
+    });
+    this.getDicts("sys_store_order_delivery_status").then(response => {
+      this.deliveryStatusOptions = response.data;
+    });
+    this.getDicts("sys_package_sub_type").then(response => {
+      this.packageSubTypeOptions = response.data;
+    });
+  },
+  methods: {
+    handleDimensionChange: function(val) {
+      console.log('维度切换到:', val);
+      // 重置分页
+      this.queryParams.pageNum = 1;
+      // 重新获取数据
+      this.getList();
+    },
+    /** 查询套餐订单列表 */
+    getList() {
+      this.loading = true;
+      courseReport(this.queryParams).then(response => {
+        this.packageOrderList = response.rows;
+        this.total = response.total;
+        // 判断是否需要显示训练营和营期列
+        this.showTrainingCampColumn = this.packageOrderList &&
+          this.packageOrderList.some(item => item.trainingCampName);
+        this.showPeriodColumn = this.packageOrderList &&
+          this.packageOrderList.some(item => item.periodName);
+        this.calculateTotals();
+        this.loading = false;
+        // 延迟强制更新以确保DOM完全渲染
+        setTimeout(() => {
+          this.$forceUpdate();
+        }, 100);
+      });
+    },
+    calculateTotals() {
+      // 重置总计数据
+      this.calculatedTotalData = {
+        accessCount: 0,
+        pendingCount: 0,
+        watchingCount: 0,
+        watchRate: 0,
+        finishedCount: 0,
+        interruptedCount: 0,
+        finishRate: 0,
+        answerUserCount: 0,
+        packetUserCount: 0,
+        packetAmount: 0
+      };
+
+      // 遍历当前页数据计算总和
+      this.packageOrderList.forEach(item => {
+        this.calculatedTotalData.accessCount += Number(item.accessCount) || 0;
+        this.calculatedTotalData.pendingCount += Number(item.pendingCount) || 0;
+        this.calculatedTotalData.watchingCount += Number(item.watchingCount) || 0;
+        this.calculatedTotalData.finishedCount += Number(item.finishedCount) || 0;
+        this.calculatedTotalData.interruptedCount += Number(item.interruptedCount) || 0;
+        this.calculatedTotalData.answerUserCount += Number(item.answerUserCount) || 0;
+        this.calculatedTotalData.packetUserCount += Number(item.packetUserCount) || 0;
+        this.calculatedTotalData.packetAmount += Number(item.packetAmount) || 0;
+      });
+
+      if (this.calculatedTotalData.accessCount > 0) {
+        // 看课率 = 看课中人数 / 进线人数
+        this.calculatedTotalData.watchRate = ((this.calculatedTotalData.watchingCount / this.calculatedTotalData.accessCount) * 100).toFixed(2) + '%';
+        // 完课率 = 完课人数 / 进线人数
+        this.calculatedTotalData.finishRate = ((this.calculatedTotalData.finishedCount / this.calculatedTotalData.accessCount) * 100).toFixed(2) + '%';
+      } else {
+        this.calculatedTotalData.watchRate = '0.00%';
+        this.calculatedTotalData.finishRate = '0.00%';
+      }
+
+      // 金额格式化
+      this.calculatedTotalData.packetAmount = this.calculatedTotalData.packetAmount.toFixed(2);
+    },
+    /** 训练营变更处理 */
+    handleCampChange(val) {
+      this.queryParams.trainingCampId = val;
+      this.queryParams.periodId = null; // 清空已选择的营期
+
+      if (val) {
+        // 获取对应的营期数据
+        this.getPeriodByCamp(val);
+      } else {
+        // 如果清空训练营,也清空营期选项
+        this.deptOptions = [];
+      }
+      // 移除了自动搜索的逻辑,只在点击搜索按钮时触发
+    },
+
+    /** 根据训练营获取营期数据 */
+    getPeriodByCamp(campId) {
+      const param = {campId: campId};
+      getPeriodList(param).then((response) => {
+        console.log('接口返回数据:', response);
+        console.log('营期列表数据:', response.data);
+        this.deptOptions = response.data || [];
+        console.log('deptOptions 已赋值:', this.deptOptions);
+      }).catch(error => {
+        console.error('获取营期数据失败:', error);
+        this.deptOptions = [];
+      });
+    },
+    hasDeptNameField() {
+      return this.packageOrderList &&
+        this.packageOrderList.some(item => item.deptName !== undefined && item.deptName !== null && item.deptName !== '');
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        orderId: null,
+        orderSn: null,
+        userId: null,
+        doctorId: null,
+        packageId: null,
+        packageName: null,
+        payMoney: null,
+        isPay: null,
+        days: null,
+        status: 0,
+        startTime: null,
+        finishTime: null,
+        createTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      // 清空所有时间相关变量
+      this.createTime = null;
+      this.startTime = null;
+      this.endTime = null;
+
+      // 重置所有查询参数
+      this.queryParams = {
+        pageNum: null,
+        pageSize: null,
+        orderSn: null,
+        userId: null,
+        doctorId: null,
+        doctorName: null,
+        phone: null,
+        phoneMk: null,
+        packageId: null,
+        packageName: null,
+        payMoney: null,
+        isPay: null,
+        days: null,
+        status: null,
+        startTime: null,
+        finishTime: null,
+        sTime: null,
+        eTime: null,
+        stTime: null,
+        endTime: null,
+        endStartTime: null,
+        endEndTime: null,
+        companyUserName: null,
+        companyName: null,
+        companyId: null,
+        deptId: null,
+        source: null,
+      };
+
+      // 立即执行查询
+      this.handleQuery();
+    },
+    xdChange() {
+      if (this.createTime != null) {
+        this.queryParams.sTime = this.createTime[0];
+        this.queryParams.eTime = this.createTime[1];
+      } else {
+        this.queryParams.sTime = null;
+        this.queryParams.eTime = null;
+      }
+    },
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出会员看课报表', "警告", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        this.exportLoading = true;
+        return exportCourseReport(queryParams);
+      }).then(response => {
+        this.download(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+      });
+    },
+    endChange() {
+      if (this.endTime != null) {
+        this.queryParams.endStartTime = this.endTime[0];
+        this.queryParams.endEndTime = this.endTime[1];
+      } else {
+        this.queryParams.endStartTime = null;
+        this.queryParams.endEndTime = null;
+      }
+    }
+  }
+};
+</script>
+
+<style scoped>
+.total-summary {
+  margin-top: 15px;
+  padding: 15px 20px;
+  background: linear-gradient(135deg, #f5f7fa 0%, #e4e7f4 100%);
+  border: 1px solid #dcdfe6;
+  border-radius: 4px;
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
+  display: flex;
+  flex-wrap: wrap;
+  align-items: center;
+}
+
+.total-title {
+  font-weight: bold;
+  font-size: 16px;
+  color: #303133;
+  margin-right: 20px;
+  flex-shrink: 0;
+}
+
+.total-item {
+  margin-right: 25px;
+  padding: 5px 10px;
+  background: white;
+  border-radius: 3px;
+  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
+  display: inline-block;
+  margin-bottom: 5px;
+  font-size: 13px;
+  color: #606266;
+}
+
+.total-item::before {
+  content: "";
+  display: inline-block;
+  width: 3px;
+  height: 3px;
+  background: #409eff;
+  border-radius: 50%;
+  margin-right: 5px;
+  vertical-align: middle;
+}
+
+/* 响应式处理 */
+@media (max-width: 768px) {
+  .total-summary {
+    flex-direction: column;
+    align-items: flex-start;
+  }
+
+  .total-title {
+    margin-bottom: 10px;
+  }
+
+  .total-item {
+    margin-right: 10px;
+    margin-bottom: 8px;
+  }
+}
+</style>

+ 2 - 1
src/views/his/statistics/courseReport.vue

@@ -209,7 +209,8 @@ export default {
         source: null,
         trainingCampId: null,
         periodId: null,
-        dimension: 'camp'
+        dimension: 'camp',
+        watchType: 2
       },
       // 表单参数
       form: {},