30411
This commit is contained in:
@@ -240,10 +240,13 @@ export default {
|
||||
toEdit(row) {
|
||||
this.instance.post(`/app/apppartyintegralrule/queryDetailById?id=${row.id}`).then((res) => {
|
||||
if(res?.data) {
|
||||
// console.log(res);
|
||||
this.form = res.data
|
||||
this.form.ladderIntegral = JSON.parse(res.data.ladderRule)
|
||||
this.form.ruleType = res.data.ruleType
|
||||
this.form.integralArr = [ res.data.integralMin, res.data.integralMax ]
|
||||
if(res.data.ruleType == 1) {
|
||||
this.form.ladderIntegral = JSON.parse(res.data.ladderRule)
|
||||
}
|
||||
this.dialog = true
|
||||
}
|
||||
})
|
||||
@@ -307,24 +310,29 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
onConfirm() {
|
||||
if(this.ruleType == 2) {
|
||||
if(!this.form.integralArr) {
|
||||
if(this.form.ruleType == 2) {
|
||||
|
||||
this.form.integralMin = this.form.integralArr[0] || ''
|
||||
this.form.integralMax = this.form.integralArr[1] || ''
|
||||
|
||||
if(!this.form.integralArr[0] && !this.form.integralArr[1]) {
|
||||
return this.$message.error('请输入积分分值')
|
||||
}
|
||||
this.form.integralMin = this.form.integralArr?.[0] || ''
|
||||
this.form.integralMax = this.form.integralArr?.[1] || ''
|
||||
this.form.ladderRule = JSON.stringify(this.form.ladderIntegral)
|
||||
if(this.form.integralMin >= this.form.integralMax) {
|
||||
return this.$message.error('请输入正确的区间范围')
|
||||
return this.$message.error('请输入正确积分区间')
|
||||
}
|
||||
this.form.ladderRule = ''
|
||||
}
|
||||
}
|
||||
if(this.form.ruleType == 1) {
|
||||
this.form.ladderRule = JSON.stringify(this.form.ladderIntegral)
|
||||
}
|
||||
|
||||
this.$refs.DialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.instance.post(`/app/apppartyintegralrule/addOrUpdate`, {
|
||||
...this.form,
|
||||
id: this.form.id || ''
|
||||
id: this.form.id || '',
|
||||
integralMin: this.form.integralArr[0] || '',
|
||||
integralMax: this.form.integralArr[1] || '',
|
||||
}).then((res) => {
|
||||
if (res?.code == 0) {
|
||||
this.$message.success(`${this.isEdit ? '编辑成功' : '添加成功'}`)
|
||||
|
||||
Reference in New Issue
Block a user