wjj 16 ساعت پیش
والد
کامیت
065d27047a
2فایلهای تغییر یافته به همراه98 افزوده شده و 0 حذف شده
  1. 10 0
      src/api/course/courseCouponUser.js
  2. 88 0
      src/views/course/courseWatchLog/index.vue

+ 10 - 0
src/api/course/courseCouponUser.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+// 查询答题日志列表
+export function getRecordList(query) {
+  return request({
+    url: '/course/courseCouponUser/getRecordList',
+    method: 'get',
+    params: query
+  })
+}

+ 88 - 0
src/views/course/courseWatchLog/index.vue

@@ -460,6 +460,7 @@
         <template slot-scope="scope">
           <el-button @click="openAnswerLogFun(scope.row)" type="text" size="small">答题记录</el-button>
           <el-button @click="openRedLogFun(scope.row)" type="text" size="small">红包记录</el-button>
+          <el-button @click="openCouponLogFun(scope.row)" type="text" size="small">优惠券记录</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -577,6 +578,50 @@
       />
     </el-drawer>
 
+        <!-- 优惠券记录 Drawer -->
+    <el-drawer title="优惠券记录" :visible.sync="openCouponLog" size="70%" append-to-body>
+      <el-table border v-loading="loadingCouponLog" :data="couponLogsList">
+         <!-- 新增:展示当前行数据的列 -->
+        <el-table-column label="用户昵称" align="center" width="120">
+          <template slot-scope="scope">
+            <!-- 这里其实每一行都显示同一个用户,因为是根据用户查询的 -->
+            {{ currentRow ? currentRow.fsNickName : '-' }}
+          </template>
+        </el-table-column>
+        
+        <el-table-column label="课程名称" align="center" min-width="150">
+          <template slot-scope="scope">
+             {{ currentRow ? currentRow.courseName : '-' }}
+          </template>
+        </el-table-column>
+
+        <el-table-column label="小节名称" align="center" min-width="150">
+          <template slot-scope="scope">
+             {{ currentRow ? currentRow.videoName : '-' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="优惠券名称" align="center" prop="couponName" />
+        <el-table-column label="状态" align="center" prop="status">
+             <template slot-scope="scope">
+                <!-- 根据实际后端返回的状态值调整显示逻辑 -->
+                <el-tag :type="scope.row.status === 1 ? 'success' : 'info'">
+                   {{ scope.row.status === 1 ? '已使用' : '未使用' }}
+                </el-tag>
+             </template>
+        </el-table-column>
+        <el-table-column label="领取时间" align="center" prop="createTime" />
+        <el-table-column label="使用时间" align="center" prop="updateTime" />
+      </el-table>
+
+      <pagination
+        v-show="couponLogTotal>0"
+        :total="couponLogTotal"
+        :page.sync="couponLogQueryParams.pageNum"
+        :limit.sync="couponLogQueryParams.pageSize"
+        @pagination="getCouponLogList"
+      />
+    </el-drawer>
+
     <el-dialog title="批量添加标签" :visible.sync="tagOpen" width="800px" append-to-body>
       <div>搜索标签:
         <el-input v-model="tagChange.tagName" placeholder="请输入标签名称" clearable size="small" style="width: 200px;margin-right: 10px" />
@@ -723,6 +768,7 @@ import {treeselect} from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {getCourseConfigByRewardType} from "../../../api/system/config";
+import {getRecordList} from "@/api/course/courseCouponUser";
 
 Vue.use(Calendar)
 
@@ -864,6 +910,18 @@ export default {
         pageSize: 10,
       },
 
+      // 优惠券记录
+      openCouponLog: false,
+      loadingCouponLog: false,
+      couponLogsList: [],
+      couponLogTotal: 0,
+      couponLogQueryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        logId: null, // 关联的看课记录ID
+      },
+      currentRow : null,
+
       isVipList: [
         { dictLabel: '是', dictValue: 1 },
         { dictLabel: '否', dictValue: 0 }
@@ -973,6 +1031,36 @@ export default {
     this.loading=false;
   },
   methods: {
+
+     // 打开优惠券记录弹窗
+    openCouponLogFun(row) {
+      // 确保传入的 row 不是 null 或 undefined
+      if (!row) {
+        this.$message.error('无法获取当前行数据');
+        return;
+      }
+      this.currentRow  = row;
+      this.openCouponLog = true;
+      // 重置分页参数
+      this.couponLogQueryParams.pageNum = 1;
+      this.couponLogQueryParams.logId = row.logId;
+      this.couponLogQueryParams.userId = row.userId; // 假设行数据中有userId
+      this.getCouponLogList();
+      
+    },
+
+    // 获取优惠券记录列表
+    getCouponLogList() {
+      this.loadingCouponLog = true;
+      getRecordList(this.couponLogQueryParams).then(response => {
+        // 根据实际接口返回结构调整,通常是 response.rows 和 response.total
+        this.couponLogsList = response.rows || [];
+        this.couponLogTotal = response.total || 0;
+        this.loadingCouponLog = false;
+      }).catch(() => {
+        this.loadingCouponLog = false;
+      });
+    },
     getCourseByRewardType(){
           getCourseConfigByRewardType().then(res=>{
               this.RewardType=res.rewardType;