|
@@ -196,7 +196,7 @@
|
|
<el-form-item label="营期名称" prop="periodName">
|
|
<el-form-item label="营期名称" prop="periodName">
|
|
<el-input v-model="form.periodName" placeholder="请输入营期名称" />
|
|
<el-input v-model="form.periodName" placeholder="请输入营期名称" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="公司id" prop="companyId">
|
|
|
|
|
|
+ <el-form-item label="公司" prop="companyId">
|
|
<el-select v-model="form.companyId" placeholder="请选择公司" multiple>
|
|
<el-select v-model="form.companyId" placeholder="请选择公司" multiple>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in companyOptions"
|
|
v-for="item in companyOptions"
|
|
@@ -284,7 +284,7 @@
|
|
</el-drawer>
|
|
</el-drawer>
|
|
|
|
|
|
<!-- 添加或修改会员营期对话框-->
|
|
<!-- 添加或修改会员营期对话框-->
|
|
- <el-dialog title="课程管理" :visible.sync="course.open" width="90%" top="10px" append-to-body style="padding-bottom: 10px">
|
|
|
|
|
|
+ <el-dialog title="课程管理" :visible.sync="course.open" width="75%" top="10px" append-to-body style="padding-bottom: 10px">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
<el-button
|
|
@@ -298,47 +298,24 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-table v-loading="course.loading" :data="course.list">
|
|
<el-table v-loading="course.loading" :data="course.list">
|
|
- <el-table-column label="课程" align="center" prop="courseName" />
|
|
|
|
|
|
+ <el-table-column label="课程" align="center" prop="courseName" width="180" />
|
|
<el-table-column label="小节" align="center" prop="videoName" />
|
|
<el-table-column label="小节" align="center" prop="videoName" />
|
|
- <el-table-column label="营期时间" align="center" prop="dayDate" />
|
|
|
|
- <el-table-column v-if="course.row.redPacketGrantMethod == 2" label="红包金额" align="center" prop="money">
|
|
|
|
|
|
+ <el-table-column label="营期时间" align="center" prop="dayDate" width="150" />
|
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createTime" width="150" />
|
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="120">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
- <el-input v-model="scope.row.money">
|
|
|
|
- <template slot="append">元</template>
|
|
|
|
- </el-input>
|
|
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="text"
|
|
|
|
+ icon="el-icon-money"
|
|
|
|
+ @click="handleSetRedPacket(scope.row)"
|
|
|
|
+ >设置红包</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
-<!-- <el-table-column label="有效时间" align="center" prop="periodStartingTime" width="180" />-->
|
|
|
|
- <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
|
|
|
|
-<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
|
|
|
|
-<!-- <template slot-scope="scope">-->
|
|
|
|
-<!-- <el-button-->
|
|
|
|
-<!-- size="mini"-->
|
|
|
|
-<!-- type="text"-->
|
|
|
|
-<!-- icon="el-icon-edit"-->
|
|
|
|
-<!-- @click="handleUpdate(scope.row)"-->
|
|
|
|
-<!-- v-hasPermi="['course:period:edit']"-->
|
|
|
|
-<!-- >修改</el-button>-->
|
|
|
|
-<!-- <el-button-->
|
|
|
|
-<!-- size="mini"-->
|
|
|
|
-<!-- type="text"-->
|
|
|
|
-<!-- icon="el-icon-edit"-->
|
|
|
|
-<!-- @click="handleCourse(scope.row)"-->
|
|
|
|
-<!-- v-hasPermi="['course:period:edit']"-->
|
|
|
|
-<!-- >课程管理</el-button>-->
|
|
|
|
-<!-- <el-button-->
|
|
|
|
-<!-- size="mini"-->
|
|
|
|
-<!-- type="text"-->
|
|
|
|
-<!-- icon="el-icon-delete"-->
|
|
|
|
-<!-- @click="handleDelete(scope.row)"-->
|
|
|
|
-<!-- v-hasPermi="['course:period:remove']"-->
|
|
|
|
-<!-- >删除</el-button>-->
|
|
|
|
-<!-- </template>-->
|
|
|
|
-<!-- </el-table-column>-->
|
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
- <el-button type="primary" @click="saveCourseData">保存</el-button>
|
|
|
|
|
|
+<!-- <el-button type="primary" @click="saveCourseData">保存</el-button>-->
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
@@ -346,7 +323,7 @@
|
|
<el-dialog title="添加课程" :visible.sync="course.addOpen" width="500px" append-to-body>
|
|
<el-dialog title="添加课程" :visible.sync="course.addOpen" width="500px" append-to-body>
|
|
<el-form ref="courseAddForm" :model="course.form" label-width="100px">
|
|
<el-form ref="courseAddForm" :model="course.form" label-width="100px">
|
|
<el-form-item label="课程" prop="courseId">
|
|
<el-form-item label="课程" prop="courseId">
|
|
- <el-select filterable v-model="course.form.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(course.form.courseId)" style="width: 100%">
|
|
|
|
|
|
+ <el-select filterable v-model="course.form.courseId" placeholder="请选择课程" clearable size="small" @change="courseChange(course.form.courseId)" style="width: 100%" :value-key="'dictValue'">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in courseList"
|
|
v-for="dict in courseList"
|
|
:key="dict.dictValue"
|
|
:key="dict.dictValue"
|
|
@@ -356,7 +333,7 @@
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="小节" prop="videoId">
|
|
<el-form-item label="小节" prop="videoId">
|
|
- <el-select filterable v-model="course.form.videoIds" placeholder="请选择小节" :multiple-limit="getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total" multiple clearable size="small" style="width: 100%">
|
|
|
|
|
|
+ <el-select filterable v-model="course.form.videoIds" placeholder="请选择小节" :multiple-limit="getDiff(course.row.periodStartingTime, course.row.periodEndTime) - course.total" multiple clearable size="small" style="width: 100%" :value-key="'dictValue'">
|
|
<el-option
|
|
<el-option
|
|
v-for="dict in videoList"
|
|
v-for="dict in videoList"
|
|
:key="dict.dictValue"
|
|
:key="dict.dictValue"
|
|
@@ -372,13 +349,47 @@
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
-
|
|
|
|
|
|
+ <!-- 设置红包对话框 -->
|
|
|
|
+ <el-dialog title="设置红包" :visible.sync="redPacketOpen" width="800px" append-to-body>
|
|
|
|
+ <el-table :data="redPacketTableData" border>
|
|
|
|
+ <el-table-column type="index" label="序号" width="60" align="center" />
|
|
|
|
+ <el-table-column label="公司名称" prop="companyName" align="center" />
|
|
|
|
+ <el-table-column label="红包金额" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input-number
|
|
|
|
+ v-model="scope.row.amount"
|
|
|
|
+ :min="0"
|
|
|
|
+ :precision="2"
|
|
|
|
+ :step="0.01"
|
|
|
|
+ size="small"
|
|
|
|
+ style="width: 150px"
|
|
|
|
+ >
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
+ </el-input-number>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center" width="100">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button
|
|
|
|
+ size="mini"
|
|
|
|
+ type="primary"
|
|
|
|
+ @click="saveRedPacket(scope.row)"
|
|
|
|
+ >保存</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
+ <el-button @click="cancelRedPacket">关 闭</el-button>
|
|
|
|
+ <el-button type="primary" @click="batchSaveRedPacket">批量保存</el-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-dialog>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import {addPeriod, delPeriod, exportPeriod, getPeriod, pagePeriod, updatePeriod, getDays, addCourse, updateListCourseData} from "@/api/course/userCoursePeriod";
|
|
|
|
|
|
+import {addPeriod, delPeriod, exportPeriod, getPeriod, pagePeriod, updatePeriod, getDays, addCourse, updateListCourseData, getPeriodCompanyList,
|
|
|
|
+ batchSaveRedPacket} from "@/api/course/userCoursePeriod";
|
|
import {getCompanyList} from "@/api/company/company";
|
|
import {getCompanyList} from "@/api/company/company";
|
|
import { listCamp, addCamp, editCamp, delCamp, copyCamp } from "@/api/course/userCourseCamp";
|
|
import { listCamp, addCamp, editCamp, delCamp, copyCamp } from "@/api/course/userCourseCamp";
|
|
import { courseList,videoList } from '@/api/course/courseRedPacketLog'
|
|
import { courseList,videoList } from '@/api/course/courseRedPacketLog'
|
|
@@ -472,6 +483,12 @@ export default {
|
|
scrollThrottle: false,
|
|
scrollThrottle: false,
|
|
// 加载更多状态
|
|
// 加载更多状态
|
|
loadingMore: false,
|
|
loadingMore: false,
|
|
|
|
+ // 设置红包对话框
|
|
|
|
+ redPacketOpen: false,
|
|
|
|
+ // 红包表格数据
|
|
|
|
+ redPacketTableData: [],
|
|
|
|
+ // 营期公司列表
|
|
|
|
+ periodCompanyList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -962,17 +979,32 @@ export default {
|
|
this.course.loading = false;
|
|
this.course.loading = false;
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- handleAddCourse(){
|
|
|
|
|
|
+ handleAddCourse() {
|
|
this.course.addOpen = true;
|
|
this.course.addOpen = true;
|
|
this.course.form = {
|
|
this.course.form = {
|
|
periodId: this.course.row.periodId,
|
|
periodId: this.course.row.periodId,
|
|
|
|
+ courseId: null,
|
|
|
|
+ videoIds: []
|
|
};
|
|
};
|
|
|
|
+ // 重置表单
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
+ if (this.$refs.courseAddForm) {
|
|
|
|
+ this.$refs.courseAddForm.resetFields();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- closeAddCourse(){
|
|
|
|
|
|
+ closeAddCourse() {
|
|
this.course.addOpen = false;
|
|
this.course.addOpen = false;
|
|
|
|
+ this.course.form = {
|
|
|
|
+ periodId: null,
|
|
|
|
+ courseId: null,
|
|
|
|
+ videoIds: []
|
|
|
|
+ };
|
|
|
|
+ // 重置表单
|
|
|
|
+ if (this.$refs.courseAddForm) {
|
|
|
|
+ this.$refs.courseAddForm.resetFields();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
-
|
|
|
|
- //查询小节
|
|
|
|
courseChange(row){
|
|
courseChange(row){
|
|
this.course.form.videoIds = [];
|
|
this.course.form.videoIds = [];
|
|
videoList(row).then(response => {
|
|
videoList(row).then(response => {
|
|
@@ -998,6 +1030,88 @@ export default {
|
|
this.getCourseList();
|
|
this.getCourseList();
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ /** 设置红包按钮操作 */
|
|
|
|
+ handleSetRedPacket(row) {
|
|
|
|
+ this.redPacketOpen = true;
|
|
|
|
+ // 获取营期公司金额列表
|
|
|
|
+ getPeriodCompanyList({ periodId: this.course.row.periodId, videoId: row.videoId }).then(response => {
|
|
|
|
+ this.periodCompanyList = response.data || [];
|
|
|
|
+ // 初始化表格数据
|
|
|
|
+ this.redPacketTableData = this.periodCompanyList.map(company => ({
|
|
|
|
+ companyId: company.companyId,
|
|
|
|
+ companyName: company.companyName,
|
|
|
|
+ amount: company.amount,
|
|
|
|
+ videoId: row.videoId,
|
|
|
|
+ periodId: this.course.row.periodId
|
|
|
|
+ }));
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 取消设置红包 */
|
|
|
|
+ cancelRedPacket() {
|
|
|
|
+ this.redPacketOpen = false;
|
|
|
|
+ this.redPacketTableData = [];
|
|
|
|
+ this.periodCompanyList = [];
|
|
|
|
+ },
|
|
|
|
+ /** 保存单个红包设置 */
|
|
|
|
+ saveRedPacket(row) {
|
|
|
|
+ if (row.amount <= 0) {
|
|
|
|
+ this.$message.warning('请输入红包金额');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const saveData = [{
|
|
|
|
+ companyId: row.companyId,
|
|
|
|
+ redPacketMoney: row.amount,
|
|
|
|
+ videoId: row.videoId,
|
|
|
|
+ periodId: row.periodId,
|
|
|
|
+ dataType: 2
|
|
|
|
+ }];
|
|
|
|
+
|
|
|
|
+ // 调用保存接口
|
|
|
|
+ batchSaveRedPacket(saveData).then(response => {
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
+ this.$message.success('保存成功');
|
|
|
|
+ // 刷新课程列表
|
|
|
|
+ this.getCourseList();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(response.msg || "保存失败");
|
|
|
|
+ }
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ this.$message.error("保存失败:" + error.message);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ /** 批量保存红包设置 */
|
|
|
|
+ batchSaveRedPacket() {
|
|
|
|
+ // 过滤出有设置金额的数据,并转换数据结构
|
|
|
|
+ const saveData = this.redPacketTableData
|
|
|
|
+ .filter(item => item.amount > 0)
|
|
|
|
+ .map(item => ({
|
|
|
|
+ companyId: item.companyId,
|
|
|
|
+ redPacketMoney: item.amount,
|
|
|
|
+ videoId: item.videoId,
|
|
|
|
+ periodId: item.periodId,
|
|
|
|
+ dataType: 2
|
|
|
|
+ }));
|
|
|
|
+
|
|
|
|
+ if (saveData.length === 0) {
|
|
|
|
+ this.$message.warning('请至少设置一个红包金额');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 调用批量保存接口
|
|
|
|
+ batchSaveRedPacket(saveData).then(response => {
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
+ this.$message.success('批量保存成功');
|
|
|
|
+ this.redPacketOpen = false;
|
|
|
|
+ // 刷新课程列表
|
|
|
|
+ this.getCourseList();
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.error(response.msg || "保存失败");
|
|
|
|
+ }
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ this.$message.error("保存失败:" + error.message);
|
|
|
|
+ });
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|