|
|
@@ -28,7 +28,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="活动类型" prop="activityType">
|
|
|
- <DictSelect v-model="form.activityType.toString()" :dictOptions="activityTypeOption" placeholder="请选择" :disabled="type === 'view'" @change="handleActivityTypeChange"/>
|
|
|
+ <DictSelect v-model="form.activityType" :dictOptions="activityTypeOption" placeholder="请选择" :disabled="type === 'view'" @change="handleActivityTypeChange"/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -37,8 +37,8 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="活动时间" prop="isPermanent">
|
|
|
<el-radio-group v-model="form.isPermanent" :disabled="type === 'view'">
|
|
|
- <el-radio :label="1">长期有效</el-radio>
|
|
|
- <el-radio :label="0">指定时间</el-radio>
|
|
|
+ <el-radio label="1">长期有效</el-radio>
|
|
|
+ <el-radio label="0">指定时间</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -116,13 +116,8 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="断签规则">
|
|
|
- <el-radio-group v-model="form.breakRule.toString()" :disabled="type === 'view'">
|
|
|
- <el-radio label="0">
|
|
|
- 断签重置
|
|
|
- </el-radio>
|
|
|
- <el-radio label="1">
|
|
|
- 保留进度
|
|
|
- </el-radio>
|
|
|
+ <el-radio-group v-model="form.breakRule" :disabled="type === 'view'">
|
|
|
+ <el-radio :label="item.value" v-for="(item,index) in signRule" :key="index">{{ item.label }}</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
@@ -177,12 +172,7 @@
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="type === 'view'">{{ scope.row.frequencyLimitValue }}</span>
|
|
|
<template v-else>
|
|
|
- <el-select v-if="scope.row.status == 0" v-model="scope.row.frequencyLimitValue" placeholder="请选择">
|
|
|
- <el-option label="无限制" value="无限制"></el-option>
|
|
|
- <el-option label="每日1次" value="每日1次"></el-option>
|
|
|
- <el-option label="每周1次" value="每周1次"></el-option>
|
|
|
- <el-option label="每月1次" value="每月1次"></el-option>
|
|
|
- </el-select>
|
|
|
+ <DictSelect v-if="scope.row.status == 0" v-model="scope.row.frequencyLimitValue" :dictOptions="taskLimitTimes" placeholder="请选择"/>
|
|
|
<span v-else>--</span>
|
|
|
</template>
|
|
|
</template>
|
|
|
@@ -202,8 +192,8 @@
|
|
|
|
|
|
<div class="button-container" v-if="type !== 'view'">
|
|
|
<el-button @click="handleClose" class="cancel-btn">取消</el-button>
|
|
|
- <el-button @click="handleSaveDraft" class="cancel-btn">保存草稿</el-button>
|
|
|
- <el-button type="primary" @click="handlePublish" class="confirm-btn">发布</el-button>
|
|
|
+ <el-button @click="handleSave('3')" class="cancel-btn">保存草稿</el-button>
|
|
|
+ <el-button type="primary" @click="handleSave('4')" class="confirm-btn">发布</el-button>
|
|
|
</div>
|
|
|
<div class="button-container" v-else>
|
|
|
<el-button type="primary" @click="handleClose" class="confirm-btn">关闭</el-button>
|
|
|
@@ -212,10 +202,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getActivityById } from "@/api/points/rules_api";
|
|
|
+import { getActivityById,submitActivity,addActivity } from "@/api/points/rules_api";
|
|
|
export default {
|
|
|
name: "Activity_editBox",
|
|
|
- props: ['activityTypeOption', 'cityOptions'],
|
|
|
+ props: ['activityTypeOption', 'cityOptions','taskLimitTimes','signRule'],
|
|
|
data() {
|
|
|
return {
|
|
|
pointsActivity: false,
|
|
|
@@ -291,7 +281,7 @@ export default {
|
|
|
|
|
|
for (let i = 0; i < value.length; i++) {
|
|
|
const bonus = value[i];
|
|
|
- if (!bonus.period || Number(bonus.continueDays) <= 0) {
|
|
|
+ if (!bonus.continueDays || Number(bonus.continueDays) <= 0) {
|
|
|
callback(new Error('连续签到周期必须大于0'));
|
|
|
return;
|
|
|
}
|
|
|
@@ -352,11 +342,11 @@ export default {
|
|
|
},
|
|
|
getDefaultTasks() {
|
|
|
return [
|
|
|
- { taskName: '完成订单', triggerValue: '', rewardPoints: '', frequencyLimitValue: '无限制', status: '1' },
|
|
|
- { taskName: '充值任务', triggerValue: '', rewardPoints: '', frequencyLimitValue: '无限制', status: '1' },
|
|
|
- { taskName: '分享服务号', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '无限制', status: '1' },
|
|
|
- { taskName: '浏览动态', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '无限制', status: '1' },
|
|
|
- { taskName: '浏览商户', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '无限制', status: '1' }
|
|
|
+ { taskName: '完成订单', triggerValue: '', rewardPoints: '', frequencyLimitValue: '0', status: '1' },
|
|
|
+ { taskName: '充值任务', triggerValue: '', rewardPoints: '', frequencyLimitValue: '0', status: '1' },
|
|
|
+ { taskName: '分享服务号', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '0', status: '1' },
|
|
|
+ { taskName: '浏览动态', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '0', status: '1' },
|
|
|
+ { taskName: '浏览商户', triggerValue: '点击', rewardPoints: '', frequencyLimitValue: '0', status: '1' }
|
|
|
];
|
|
|
},
|
|
|
getTotalDays() {
|
|
|
@@ -373,7 +363,14 @@ export default {
|
|
|
this.resetForm();
|
|
|
if (type !== 'add') {
|
|
|
const data = await this.getActivityInfo(row);
|
|
|
- this.form = type === 'copy' ? {...data, id: ''} : {...data};
|
|
|
+ if (type === 'copy') {
|
|
|
+ const { id, ...copyData } = data;
|
|
|
+ this.form = copyData;
|
|
|
+ } else {
|
|
|
+ this.form = { ...data };
|
|
|
+ }
|
|
|
+ this.form.isPermanent = this.form.isPermanent?.toString();
|
|
|
+ this.form.breakRule = this.form.breakRule?.toString();
|
|
|
this.form.dateRange = [this.form.startTime, this.form.endTime];
|
|
|
}
|
|
|
this.pointsActivity = true;
|
|
|
@@ -415,6 +412,7 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
this.form.signRewardList.splice(index, 1);
|
|
|
+ this.updatePeriod();
|
|
|
},
|
|
|
handleActivityTypeChange() {
|
|
|
// 重置相关内容
|
|
|
@@ -446,7 +444,7 @@ export default {
|
|
|
rewardPoints: ''
|
|
|
});
|
|
|
},
|
|
|
- updatePeriod(index, value) {
|
|
|
+ updatePeriod() {
|
|
|
// 触发表单验证
|
|
|
this.$refs.formRef.validateField('signRewardList');
|
|
|
},
|
|
|
@@ -475,19 +473,20 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- handleSaveDraft() {
|
|
|
+ handleSave(type) {
|
|
|
+ //3:草稿 4:发布
|
|
|
this.validateForm(() => {
|
|
|
- console.log('Form内容:', this.form);
|
|
|
- this.$message.success('草稿已保存');
|
|
|
- this.pointsActivity = false;
|
|
|
+ this.form = this.DateRange(this.form,this.form.dateRange || [],['startTime','endTime'])
|
|
|
+ let paramsUrl = ['add','copy'].includes(this.type) ? addActivity : submitActivity;
|
|
|
+ paramsUrl({
|
|
|
+ ...this.form,
|
|
|
+ status:type
|
|
|
+ }).then(response => {
|
|
|
+ this.$message.success('草稿已保存');
|
|
|
+ this.pointsActivity = false;
|
|
|
+ })
|
|
|
});
|
|
|
},
|
|
|
- handlePublish() {
|
|
|
- this.validateForm(() => {
|
|
|
- this.$message.success('活动已发布');
|
|
|
- this.pointsActivity = false;
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|