|
|
|
@ -50,7 +50,7 @@ |
|
|
|
</el-table> |
|
|
|
</el-card> |
|
|
|
|
|
|
|
<el-dialog title="添加积分分类" |
|
|
|
<el-dialog :title="addLevel == '1' ? '添加积分分类' : addLevel == '2' ? '添加二级分类' : addLevel == '3' ? '添加积分规则' : addLevel == '4' ? '修改二级分类' : addLevel == '5' ? '修改积分规则' : ''" |
|
|
|
:visible.sync="dialogVisible" |
|
|
|
width="40%" |
|
|
|
append-to-body |
|
|
|
@ -66,8 +66,7 @@ |
|
|
|
v-model="form.pid" |
|
|
|
placeholder="请选择" |
|
|
|
size="small" |
|
|
|
style="width: 180px;" |
|
|
|
:disabled="addLevel == '2' || addLevel == '3' || addLevel == '4' ? true : false" |
|
|
|
:disabled="addLevel == '2' || addLevel == '3' || addLevel == '4' || addLevel == '5' ? true : false" |
|
|
|
clearable> |
|
|
|
<el-option v-for="item in typeList" |
|
|
|
:key="item.value" |
|
|
|
@ -100,7 +99,7 @@ |
|
|
|
<el-form-item v-if="addLevel == '3' || addLevel == '5'" |
|
|
|
label="居民端积分申请" |
|
|
|
prop="applyFlag" |
|
|
|
label-width="200px"> |
|
|
|
label-width="140px"> |
|
|
|
<el-radio v-model="form.applyFlag" label="0">允许申请</el-radio> |
|
|
|
<el-radio v-model="form.applyFlag" label="1">不允许申请</el-radio> |
|
|
|
</el-form-item> |
|
|
|
@ -151,6 +150,8 @@ export default { |
|
|
|
pointValue: '', // 加减积分 |
|
|
|
applyFlag: '0' // 允许申请0,不允许申请1 |
|
|
|
}, |
|
|
|
ruleform:{}, // 积分规则查询相关数据,由于只是修改名称/分值/是否申请 所以之前的数据不做改变只做展示用 全部放在form里面 |
|
|
|
typeform: {}, // 积分二级分类 |
|
|
|
rules: { |
|
|
|
pid: [{ required: true, message: '请选择分类', trigger: 'blur' }], |
|
|
|
categoryName: [{ required: true, message: '类别名称不能为空', trigger: 'blur' }], |
|
|
|
@ -199,11 +200,22 @@ export default { |
|
|
|
}, |
|
|
|
// 列表修改点击事件 |
|
|
|
async handleEdit (row, addType, level) { |
|
|
|
console.log(addType, level) |
|
|
|
let url = '' |
|
|
|
if (level === '4') { |
|
|
|
url = `/point/additiverule/categorydetail/${row.id}` |
|
|
|
} else if(level === '5') { |
|
|
|
url = `/point/additiverule/ruledetail/${row.id}` |
|
|
|
|
|
|
|
await this.$http.post(`/point/additiverule/categorydetail/${row.pid}`).then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
this.form.pid = res.data.pid // 分类 |
|
|
|
this.form.categoryName = res.data.categoryName // 类别名称 |
|
|
|
this.form.newPid = res.data.id // 类别 id |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
this.addLevel = level |
|
|
|
this.addType = addType |
|
|
|
@ -212,7 +224,18 @@ export default { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
this.form = { ...res.data } |
|
|
|
if (this.addLevel === '4' ) { |
|
|
|
this.form.pid = res.data.pid // 分类 |
|
|
|
this.form.categoryName = res.data.categoryName // 类别名称 |
|
|
|
this.form.newPid = res.data.id // 类别 id |
|
|
|
this.typeform = { ...res.data } |
|
|
|
} else { |
|
|
|
this.form.applyFlag = res.data.applyFlag // 积分规则 只有这三块内容可以修改 |
|
|
|
this.form.ruleName = res.data.ruleName |
|
|
|
this.form.pointValue = res.data.pointValue |
|
|
|
this.ruleform = { ...res.data } |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -276,21 +299,27 @@ export default { |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 修改提交 ---------------这里还没做 |
|
|
|
// 修改提交 |
|
|
|
async editCate () { |
|
|
|
const _form = { |
|
|
|
categoryName: this.form.categoryName, |
|
|
|
level: this.form.level, |
|
|
|
pointValue: this.form.pointValue |
|
|
|
if (this.addLevel === '4' ) { // 分类修改 |
|
|
|
this.typeform.categoryName = this.form.categoryName |
|
|
|
this.typeform.type = 'category' |
|
|
|
} else { |
|
|
|
this.ruleform.categoryName = this.form.categoryName |
|
|
|
this.ruleform.pointValue = this.form.pointValue |
|
|
|
this.ruleform.applyFlag = this.form.applyFlag |
|
|
|
this.ruleform.type = 'rule' |
|
|
|
} |
|
|
|
console.log(JSON.stringify(this.ruleform)) |
|
|
|
await this.$http |
|
|
|
.post('/heart/icresidemanddict/update', _form) |
|
|
|
.post('/point/additiverule/modify', this.addLevel==='4' ? this.typeform : this.ruleform) |
|
|
|
.then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
return this.$message.error(res.msg) |
|
|
|
} else { |
|
|
|
this.dialogVisible = false |
|
|
|
this.getTableData() |
|
|
|
this.$message.success('保存成功') |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
@ -327,6 +356,7 @@ export default { |
|
|
|
}, |
|
|
|
// 查询积分类别规则列表 |
|
|
|
async getTableData () { |
|
|
|
this.tableData = [] |
|
|
|
this.tableLoading = true |
|
|
|
let params = {} |
|
|
|
await this.$http.post('/point/additiverule/list4tree', params).then(({ data: res }) => { |
|
|
|
|