Commit 440cf518 by 曾经

异常规则配置提交校验

parent 81e9aaf1
import { doFetch,doFetchGet } from "@/components/axios/api";
import { doFetch, doFetchGet } from "@/components/axios/api";
import url from "@/components/axios/url";
import {
checkFalse
} from "../../../../../static/js/checkStatus";
import { checkFalse } from "../../../../../static/js/checkStatus";
import AbnormalNumberInput from "./components/number-input.vue";
......@@ -200,9 +198,9 @@ export default {
{
configType: 5,
name: "按“有效消费次数”配置:",
list:[
list: [
{
name: '单日',
name: "单日",
key: "dayCount",
checked: false,
value: 1,
......@@ -212,7 +210,7 @@ export default {
precision: 0
},
{
name: '单周',
name: "单周",
key: "weekCount",
checked: false,
value: 1,
......@@ -222,7 +220,7 @@ export default {
precision: 0
},
{
name: '单月',
name: "单月",
key: "monthCount",
checked: false,
value: 1,
......@@ -232,7 +230,7 @@ export default {
precision: 0
},
{
name: '最近一年',
name: "最近一年",
key: "yearCount",
checked: false,
value: 5,
......@@ -241,7 +239,7 @@ export default {
step: 1,
precision: 0
}
],
]
},
{
......@@ -249,7 +247,7 @@ export default {
name: "按“订单金额”配置:",
list: [
{
name: '单日',
name: "单日",
key: "dayAmount",
checked: false,
value: 100,
......@@ -259,7 +257,7 @@ export default {
precision: 2
},
{
name: '单周',
name: "单周",
key: "weekAmount",
checked: false,
value: 500,
......@@ -269,7 +267,7 @@ export default {
precision: 2
},
{
name: '单月',
name: "单月",
key: "monthAmount",
checked: false,
value: 1000,
......@@ -279,7 +277,7 @@ export default {
precision: 2
},
{
name: '最近一年',
name: "最近一年",
key: "yearAmount",
checked: false,
value: 2000,
......@@ -288,7 +286,7 @@ export default {
step: 0.01,
precision: 2
}
],
]
}
]
},
......@@ -370,13 +368,12 @@ export default {
case 5:
case 6:
item.list.forEach((item1)=>{
configsItem[item1.key] = item1.checked ? item1.value : '';
if(configsItem[item1.key]){
item.list.forEach(item1 => {
configsItem[item1.key] = item1.checked ? item1.value : "";
if (configsItem[item1.key]) {
canSave = true;
}
})
});
break;
default:
......@@ -402,15 +399,15 @@ export default {
},
init() {
doFetchGet(url.getAbnormalSetting).then(res => {
console.log("res--->",res);
console.log("res--->", res);
let { errorCode, result, message } = res.data || {};
if (errorCode != 0) {
checkFalse(message);
return;
}
if(result){
if (result) {
this.isFirstSave = false;
}else{
} else {
this.isFirstSave = true;
}
this.updateData(result);
......@@ -425,7 +422,7 @@ export default {
let configsItem = (configs || []).find(item1 => {
return item.configType == item1.configType;
});
if(!configsItem){
if (!configsItem) {
return;
}
switch (+item.configType) {
......@@ -477,13 +474,13 @@ export default {
case 5:
case 6:
item.list.forEach((item1)=>{
if(configsItem[item1.key]){
item.list.forEach(item1 => {
if (configsItem[item1.key]) {
item1.checked = true;
item1.value = configsItem[item1.key];
canSave = true;
}
})
});
break;
default:
break;
......@@ -492,31 +489,39 @@ export default {
this.canSave = canSave;
this.formData = formData;
},
submit(){
doFetch(url.saveAbnormalSetting, this.submitData)
.then(res => {
let { errorCode, message } = res.data || {};
if (errorCode != 0) {
checkFalse(message);
return;
}else{
this.$router.go(-1);
}
})
submit() {
doFetch(url.saveAbnormalSetting, this.submitData).then(res => {
let { errorCode, message } = res.data || {};
if (errorCode != 0) {
checkFalse(message);
return;
} else {
this.$router.go(-1);
}
});
},
save() {
if(this.isFirstSave){
this.submit();
}else{
this.$confirm(`修改“异常规则”后,次日【异常会员】列表将全量更新,系统会根据最新的异常规则来判断“异常会员”并展示在列表中`,
"确定修改异常会员规则配置", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.submit();
});
}
this.$refs.submitForm.validate(valid => {
if (valid) {
if (this.isFirstSave) {
this.submit();
} else {
this.$confirm(
`修改“异常规则”后,次日【异常会员】列表将全量更新,系统会根据最新的异常规则来判断“异常会员”并展示在列表中`,
"确定修改异常会员规则配置",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.submit();
});
}
} else {
return false;
}
});
},
cancel() {
this.$router.go(-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment