|
@@ -82,12 +82,8 @@
|
|
|
<copy-text>{{ scope.row.id }}</copy-text>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- align="center"
|
|
|
- prop="name"
|
|
|
- label="活动名称"
|
|
|
- >
|
|
|
- <template slot-scope="scope">
|
|
|
+ <el-table-column align="center" prop="name" label="活动名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
<copy-text>{{ scope.row.name }}</copy-text>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -425,12 +421,35 @@
|
|
|
>
|
|
|
<template slot="append">%</template>
|
|
|
</el-input>
|
|
|
- <el-input v-if="activeType=='DISCOUNT'"
|
|
|
- v-model.number="attribute3"
|
|
|
- type="number"
|
|
|
- style="margin-left: 10px;width:200px!important"
|
|
|
- placeholder="请输入课时数">
|
|
|
- </el-input>
|
|
|
+ <el-form
|
|
|
+ :model="courseNumForm"
|
|
|
+ :inline="true"
|
|
|
+ ref="form"
|
|
|
+ :rules="courseNumrules"
|
|
|
+ >
|
|
|
+ <el-form-item prop="minCourseNum">
|
|
|
+ <el-input
|
|
|
+ @change="handleMinChange"
|
|
|
+ v-if="activeType == 'DISCOUNT'"
|
|
|
+ v-model.number="courseNumForm.minCourseNum"
|
|
|
+ type="number"
|
|
|
+ style="margin-left: 10px; width: 120px !important"
|
|
|
+ placeholder="最小课时数"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item prop="maxCourseNum">
|
|
|
+ <el-input
|
|
|
+ @change="handleMaxChange"
|
|
|
+ v-if="activeType == 'DISCOUNT'"
|
|
|
+ v-model.number="courseNumForm.maxCourseNum"
|
|
|
+ type="number"
|
|
|
+ style="margin-left: 10px; width: 120px !important"
|
|
|
+ placeholder="最大课时数"
|
|
|
+ >
|
|
|
+ </el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div
|
|
@@ -470,6 +489,8 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+const MIN_NUMBER = 1;
|
|
|
+const MAX_NUMBER = 999;
|
|
|
import pagination from "@/components/Pagination/index";
|
|
|
import {
|
|
|
vipGroupActivity,
|
|
@@ -478,9 +499,9 @@ import {
|
|
|
resetVipActive,
|
|
|
removeVipActive,
|
|
|
} from "@/api/vipSeting";
|
|
|
-import qs from 'qs';
|
|
|
-import { Export } from '@/utils/downLoadFile'
|
|
|
-import cleanDeep from 'clean-deep'
|
|
|
+import qs from "qs";
|
|
|
+import { Export } from "@/utils/downLoadFile";
|
|
|
+import cleanDeep from "clean-deep";
|
|
|
export default {
|
|
|
name: "vipActiveList",
|
|
|
components: { pagination },
|
|
@@ -549,10 +570,25 @@ export default {
|
|
|
paymentReadonlyFlag: true,
|
|
|
attribute1: "",
|
|
|
attribute2: "",
|
|
|
- attribute3: "",
|
|
|
giveClassPaySalaryFlag: false,
|
|
|
activeId: "",
|
|
|
isReset: false,
|
|
|
+ courseNumForm: {
|
|
|
+ minCourseNum: "",
|
|
|
+ maxCourseNum: "",
|
|
|
+ },
|
|
|
+ courseNumrules: {
|
|
|
+ minCourseNum: [
|
|
|
+ { required: true, message: "请输入最小课时数", trigger: "blur" },
|
|
|
+ { validator: this.validateCom, trigger: "blur" },
|
|
|
+ { validator: this.validateMin, trigger: "blur" },
|
|
|
+ ],
|
|
|
+ maxCourseNum: [
|
|
|
+ { required: true, message: "请输入最大课时数", trigger: "blur" },
|
|
|
+ { validator: this.validateCom, trigger: "blur" },
|
|
|
+ { validator: this.validateMax, trigger: "blur" },
|
|
|
+ ],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
// created() {
|
|
@@ -687,19 +723,23 @@ export default {
|
|
|
this.getList();
|
|
|
},
|
|
|
// 导出
|
|
|
- async onExport () {
|
|
|
+ async onExport() {
|
|
|
const { ...rest } = this.searchForm;
|
|
|
- let obj = {
|
|
|
+ let obj = {
|
|
|
...rest,
|
|
|
page: this.rules.page,
|
|
|
rows: this.rules.limit,
|
|
|
};
|
|
|
- await Export(this, {
|
|
|
- url: '/api-web/export/vipGroupActivity',
|
|
|
- fileName: '活动列表.xlsx',
|
|
|
- method: 'post',
|
|
|
- params: qs.stringify(cleanDeep(obj))
|
|
|
- }, '您确定活动列表?')
|
|
|
+ await Export(
|
|
|
+ this,
|
|
|
+ {
|
|
|
+ url: "/api-web/export/vipGroupActivity",
|
|
|
+ fileName: "活动列表.xlsx",
|
|
|
+ method: "post",
|
|
|
+ params: qs.stringify(cleanDeep(obj)),
|
|
|
+ },
|
|
|
+ "您确定活动列表?"
|
|
|
+ );
|
|
|
},
|
|
|
loadNumber(event) {
|
|
|
var el = event.currentTarget;
|
|
@@ -872,134 +912,140 @@ export default {
|
|
|
this.activeType = row.type;
|
|
|
this.attribute1 = row.attribute1;
|
|
|
this.attribute2 = row.attribute2;
|
|
|
- this.attribute3 = row.attribute3;
|
|
|
- this.giveClassPaySalaryFlag =
|
|
|
- row.giveClassPaySalaryFlag == 1 ? true : false;
|
|
|
+ (this.courseNumForm.minCourseNum = row.minCourseNum),
|
|
|
+ (this.courseNumForm.maxCourseNum = row.maxCourseNum),
|
|
|
+ (this.giveClassPaySalaryFlag =
|
|
|
+ row.giveClassPaySalaryFlag == 1 ? true : false);
|
|
|
},
|
|
|
// 点击确认按钮发送修改请求
|
|
|
resetRow() {
|
|
|
- this.$refs["vipform"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- // 验证通过
|
|
|
- let coursesStartTime;
|
|
|
- let coursesEndTime;
|
|
|
- let startTime;
|
|
|
- let endTime;
|
|
|
- if (!this.resetForm.courseTime) {
|
|
|
- this.resetForm.courseTime = [];
|
|
|
- // coursesStartTime = null;
|
|
|
- // coursesEndTime = null;
|
|
|
- }
|
|
|
- if (!this.resetForm.activeTime) {
|
|
|
- this.resetForm.activeTime = [];
|
|
|
- // startTime = null;
|
|
|
- // endTime = null;
|
|
|
- }
|
|
|
- let id = this.activeId;
|
|
|
- coursesStartTime = this.resetForm.courseTime[0] || null;
|
|
|
- coursesEndTime = this.resetForm.courseTime[1] || null;
|
|
|
- startTime = this.resetForm.activeTime[0] || null;
|
|
|
- endTime = this.resetForm.activeTime[1] || null;
|
|
|
- let organId = this.resetForm.organ.join(",");
|
|
|
- let type = this.activeType;
|
|
|
- if(!type) {
|
|
|
- this.$message.error('请选择活动类型')
|
|
|
- return
|
|
|
- }
|
|
|
- if (type == "DISCOUNT") {
|
|
|
- if (!this.attribute1 || this.attribute1 < 0 ) {
|
|
|
- this.$message.error("折扣必须大于等于0");
|
|
|
- return;
|
|
|
- }
|
|
|
- } else if(type == 'GIVE_CLASS') {
|
|
|
- if(!this.attribute1) {
|
|
|
- this.$message.error("请输入多少节开始赠");
|
|
|
- return;
|
|
|
- }
|
|
|
- if(!this.attribute2) {
|
|
|
- this.$message.error("请输入赠送课时数");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- let vipGroupCategoryIdList = this.resetForm.stauts.join(",");
|
|
|
- let onlineSalarySettlement;
|
|
|
- let offlineSalarySettlement;
|
|
|
- if (this.online) {
|
|
|
- // 勾选线上
|
|
|
-
|
|
|
- // 判断勾选的是折扣还是现金
|
|
|
- if (this.onlineSalary == "RATIO_DISCOUNT") {
|
|
|
- if (this.onlineprice < 0 || this.onlineprice > 100) {
|
|
|
- this.$message.error("折扣比必须大于0且小于100");
|
|
|
- return;
|
|
|
+ this.$refs.form.validate((isok) => {
|
|
|
+ if (isok) {
|
|
|
+ this.$refs["vipform"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // 验证通过
|
|
|
+ let coursesStartTime;
|
|
|
+ let coursesEndTime;
|
|
|
+ let startTime;
|
|
|
+ let endTime;
|
|
|
+ if (!this.resetForm.courseTime) {
|
|
|
+ this.resetForm.courseTime = [];
|
|
|
+ // coursesStartTime = null;
|
|
|
+ // coursesEndTime = null;
|
|
|
}
|
|
|
- } else if (this.onlineSalary == "TEACHER_DEFAULT") {
|
|
|
- this.onlineprice = 0;
|
|
|
- }
|
|
|
- onlineSalarySettlement = {
|
|
|
- salarySettlementType: this.onlineSalary,
|
|
|
- settlementValue: this.onlineprice,
|
|
|
- };
|
|
|
- } else {
|
|
|
- onlineSalarySettlement = null;
|
|
|
- }
|
|
|
- if (this.unonline) {
|
|
|
- // 勾选线下
|
|
|
- if (this.unonlineSalary == "RATIO_DISCOUNT") {
|
|
|
- if (this.unonlineprice < 0 || this.unonlineprice > 100) {
|
|
|
- this.$message.error("折扣比必须大于0且小于100");
|
|
|
+ if (!this.resetForm.activeTime) {
|
|
|
+ this.resetForm.activeTime = [];
|
|
|
+ // startTime = null;
|
|
|
+ // endTime = null;
|
|
|
+ }
|
|
|
+ let id = this.activeId;
|
|
|
+ coursesStartTime = this.resetForm.courseTime[0] || null;
|
|
|
+ coursesEndTime = this.resetForm.courseTime[1] || null;
|
|
|
+ startTime = this.resetForm.activeTime[0] || null;
|
|
|
+ endTime = this.resetForm.activeTime[1] || null;
|
|
|
+ let organId = this.resetForm.organ.join(",");
|
|
|
+ let type = this.activeType;
|
|
|
+ if (!type) {
|
|
|
+ this.$message.error("请选择活动类型");
|
|
|
return;
|
|
|
}
|
|
|
- } else if (this.unonlineSalary == "TEACHER_DEFAULT") {
|
|
|
- this.unonlineprice = 0;
|
|
|
- }
|
|
|
- offlineSalarySettlement = {
|
|
|
- salarySettlementType: this.unonlineSalary,
|
|
|
- settlementValue: this.unonlineprice,
|
|
|
- };
|
|
|
- } else {
|
|
|
- offlineSalarySettlement = null;
|
|
|
- }
|
|
|
- let salaryReadonlyFlag = this.salaryReadonlyFlag * 1;
|
|
|
- let paymentReadonlyFlag = this.paymentReadonlyFlag * 1;
|
|
|
- // let giveClassPaySalaryFlag = this.giveClassPaySalaryFlag * 1;
|
|
|
- let vipGroupSalarySettlement = {
|
|
|
- onlineSalarySettlement,
|
|
|
- offlineSalarySettlement,
|
|
|
- };
|
|
|
+ if (type == "DISCOUNT") {
|
|
|
+ if (!this.attribute1 || this.attribute1 < 0) {
|
|
|
+ this.$message.error("折扣必须大于等于0");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (type == "GIVE_CLASS") {
|
|
|
+ if (!this.attribute1) {
|
|
|
+ this.$message.error("请输入多少节开始赠");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (!this.attribute2) {
|
|
|
+ this.$message.error("请输入赠送课时数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let vipGroupCategoryIdList = this.resetForm.stauts.join(",");
|
|
|
+ let onlineSalarySettlement;
|
|
|
+ let offlineSalarySettlement;
|
|
|
+ if (this.online) {
|
|
|
+ // 勾选线上
|
|
|
|
|
|
- // 发请求创建活动
|
|
|
- resetVipActive({
|
|
|
- paymentReadonlyFlag,
|
|
|
- id,
|
|
|
- coursesStartTime,
|
|
|
- coursesEndTime,
|
|
|
- startTime,
|
|
|
- endTime,
|
|
|
- name: this.resetForm.name,
|
|
|
- description: this.resetForm.desc,
|
|
|
- organId,
|
|
|
- type,
|
|
|
- vipGroupCategoryIdList,
|
|
|
- vipGroupSalarySettlement,
|
|
|
- salaryReadonlyFlag,
|
|
|
- giveClassPaySalaryFlag: 1,
|
|
|
- attribute1: this.attribute1,
|
|
|
- attribute2: this.attribute2,
|
|
|
- attribute3: this.attribute3,
|
|
|
- onlineClassJoinGradientRewards:
|
|
|
- this.onlineClassJoinGradientRewards * 1,
|
|
|
- offlineClassJoinGradientRewards:
|
|
|
- this.offlineClassJoinGradientRewards * 1,
|
|
|
- }).then((res) => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message.success("恭喜你,活动修改成功");
|
|
|
- this.dialogVisible = false;
|
|
|
- this.getList();
|
|
|
+ // 判断勾选的是折扣还是现金
|
|
|
+ if (this.onlineSalary == "RATIO_DISCOUNT") {
|
|
|
+ if (this.onlineprice < 0 || this.onlineprice > 100) {
|
|
|
+ this.$message.error("折扣比必须大于0且小于100");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (this.onlineSalary == "TEACHER_DEFAULT") {
|
|
|
+ this.onlineprice = 0;
|
|
|
+ }
|
|
|
+ onlineSalarySettlement = {
|
|
|
+ salarySettlementType: this.onlineSalary,
|
|
|
+ settlementValue: this.onlineprice,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ onlineSalarySettlement = null;
|
|
|
+ }
|
|
|
+ if (this.unonline) {
|
|
|
+ // 勾选线下
|
|
|
+ if (this.unonlineSalary == "RATIO_DISCOUNT") {
|
|
|
+ if (this.unonlineprice < 0 || this.unonlineprice > 100) {
|
|
|
+ this.$message.error("折扣比必须大于0且小于100");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else if (this.unonlineSalary == "TEACHER_DEFAULT") {
|
|
|
+ this.unonlineprice = 0;
|
|
|
+ }
|
|
|
+ offlineSalarySettlement = {
|
|
|
+ salarySettlementType: this.unonlineSalary,
|
|
|
+ settlementValue: this.unonlineprice,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ offlineSalarySettlement = null;
|
|
|
+ }
|
|
|
+ let salaryReadonlyFlag = this.salaryReadonlyFlag * 1;
|
|
|
+ let paymentReadonlyFlag = this.paymentReadonlyFlag * 1;
|
|
|
+ // let giveClassPaySalaryFlag = this.giveClassPaySalaryFlag * 1;
|
|
|
+ let vipGroupSalarySettlement = {
|
|
|
+ onlineSalarySettlement,
|
|
|
+ offlineSalarySettlement,
|
|
|
+ };
|
|
|
+
|
|
|
+ // 发请求创建活动
|
|
|
+ resetVipActive({
|
|
|
+ paymentReadonlyFlag,
|
|
|
+ id,
|
|
|
+ coursesStartTime,
|
|
|
+ coursesEndTime,
|
|
|
+ startTime,
|
|
|
+ endTime,
|
|
|
+ name: this.resetForm.name,
|
|
|
+ description: this.resetForm.desc,
|
|
|
+ organId,
|
|
|
+ type,
|
|
|
+ vipGroupCategoryIdList,
|
|
|
+ vipGroupSalarySettlement,
|
|
|
+ salaryReadonlyFlag,
|
|
|
+ giveClassPaySalaryFlag: 1,
|
|
|
+ attribute1: this.attribute1,
|
|
|
+ attribute2: this.attribute2,
|
|
|
+ minCourseNum: this.courseNumForm.minCourseNum,
|
|
|
+ maxCourseNum: this.courseNumForm.maxCourseNum,
|
|
|
+ onlineClassJoinGradientRewards:
|
|
|
+ this.onlineClassJoinGradientRewards * 1,
|
|
|
+ offlineClassJoinGradientRewards:
|
|
|
+ this.offlineClassJoinGradientRewards * 1,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("恭喜你,活动修改成功");
|
|
|
+ this.dialogVisible = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error("请填写必要参数");
|
|
|
}
|
|
|
});
|
|
|
- } else {
|
|
|
- this.$message.error("请填写必要参数");
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -1026,6 +1072,43 @@ export default {
|
|
|
this.$refs["vipform"].resetFields();
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
+ resetForm() {
|
|
|
+ this.$refs.form.resetFields();
|
|
|
+ },
|
|
|
+ handleMinChange() {
|
|
|
+ this.$refs.form.validateField("maxCourseNum");
|
|
|
+ },
|
|
|
+ handleMaxChange() {
|
|
|
+ this.$refs.form.validateField("minCourseNum");
|
|
|
+ },
|
|
|
+ validateCom(rule, value, callback) {
|
|
|
+ const one = Number(value);
|
|
|
+ if (Number.isInteger(one)) {
|
|
|
+ if (one < MIN_NUMBER) {
|
|
|
+ return callback(new Error("输入值必须大于0"));
|
|
|
+ } else if (one > MAX_NUMBER) {
|
|
|
+ return callback(new Error("输入值必须小于999"));
|
|
|
+ }
|
|
|
+ return callback();
|
|
|
+ }
|
|
|
+ return callback(new Error("输入值必须为正整数"));
|
|
|
+ },
|
|
|
+ validateMin(rule, value, callback) {
|
|
|
+ const one = Number(value);
|
|
|
+ const max = Number(this.courseNumForm.maxCourseNum);
|
|
|
+ if (!max || one < max) {
|
|
|
+ return callback();
|
|
|
+ }
|
|
|
+ return callback(new Error("输入值不得大于最大课时数"));
|
|
|
+ },
|
|
|
+ validateMax(rule, value, callback) {
|
|
|
+ const one = Number(value);
|
|
|
+ const min = Number(this.courseNumForm.minCourseNum);
|
|
|
+ if (!min || one > min) {
|
|
|
+ return callback();
|
|
|
+ }
|
|
|
+ return callback(new Error("输入值不得小于最小课时数"));
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|