|
@@ -266,7 +266,6 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="开营日期" prop="periodStartingTime">
|
|
|
<el-date-picker
|
|
|
- :disabled = "isDisabledDateRange"
|
|
|
:style="{display: form.periodType == 1 ? '' : 'none !important'}"
|
|
|
v-model="form.dateRange"
|
|
|
@change="timeChange(1)"
|
|
@@ -917,10 +916,10 @@ export default {
|
|
|
this.form.timeRange = [this.form.viewStartTime, this.form.viewEndTime];
|
|
|
}
|
|
|
if(this.form.periodType == 1){
|
|
|
- this.form.dateRange = [this.form.periodStartingTime, this.form.periodEndTime];
|
|
|
+ this.$set(this.form,'dateRange',[this.form.periodStartingTime, this.form.periodEndTime])
|
|
|
}
|
|
|
if(this.form.periodType == 2){
|
|
|
- this.form.date = this.form.periodStartingTime;
|
|
|
+ this.$set(this.form,'date',this.form.periodStartingTime)
|
|
|
}
|
|
|
this.open = true;
|
|
|
this.title = "修改会员营期";
|
|
@@ -960,24 +959,27 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- //添加删除判断,只能删除未开始的营期
|
|
|
- console.log(row.periodStatus)
|
|
|
- if(row.periodStatus !== 1){
|
|
|
- this.$message.error('营期处于进行中或者结束,不能删除');
|
|
|
- return;
|
|
|
- }
|
|
|
+ async handleDelete(row) {
|
|
|
const periodIds = row.periodId || this.ids;
|
|
|
- this.$confirm('是否确认删除该营期?', "提示", {
|
|
|
+
|
|
|
+ try {
|
|
|
+ await this.$confirm('是否确认删除该营期?', "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
- }).then(function() {
|
|
|
- return delPeriod(periodIds);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.msgSuccess("删除成功");
|
|
|
- }).catch(function() {});
|
|
|
+ });
|
|
|
+
|
|
|
+ const res = await delPeriod(periodIds);
|
|
|
+
|
|
|
+ if (res && res.code === 200) {
|
|
|
+ this.getList(); // 刷新列表
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+
|
|
|
+ }
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -1294,19 +1296,23 @@ export default {
|
|
|
this.loadingMore = false;
|
|
|
});
|
|
|
},
|
|
|
- timeChange(type){
|
|
|
- if(type == 1){
|
|
|
+ timeChange(type) {
|
|
|
+ if (type == 1) {
|
|
|
this.form.periodStartingTime = this.form.dateRange[0];
|
|
|
this.form.periodEndTime = this.form.dateRange[1];
|
|
|
- // 转换为天数
|
|
|
+ if (!Array.isArray(this.form.days)) {
|
|
|
+ this.form.days = [];
|
|
|
+ }
|
|
|
+ this.form.days = [];
|
|
|
let days = this.getDiff(this.form.periodStartingTime, this.form.periodEndTime);
|
|
|
for (let i = 0; i < days; i++) {
|
|
|
- this.form.days.push({lesson: i + 1});
|
|
|
+ this.form.days.push({ lesson: i + 1 });
|
|
|
}
|
|
|
}
|
|
|
- if(type == 2){
|
|
|
+ if (type == 2) {
|
|
|
this.form.periodStartingTime = this.form.date;
|
|
|
this.form.periodEndTime = this.form.date;
|
|
|
+ this.form.days = [];
|
|
|
}
|
|
|
},
|
|
|
getDiff(start, end) {
|