2021-05-13 10:56:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="layout">
|
|
|
|
|
<Form ref="formValidate" :label-width="150" label-position="right" :model="formValidate" :rules="ruleValidate">
|
|
|
|
|
|
|
|
|
|
<FormItem label="订单自动取消" prop="autoCancel">
|
|
|
|
|
<Input type='number' v-model="formValidate.autoCancel">
|
|
|
|
|
<span slot="append">分</span>
|
|
|
|
|
</Input>
|
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem label="订单自动收货" class="label-item" prop="autoReceive">
|
|
|
|
|
<Input type='number' v-model="formValidate.autoReceive">
|
|
|
|
|
<span slot="append">天</span>
|
|
|
|
|
</Input>
|
2021-07-09 15:04:02 +08:00
|
|
|
|
<span class="desc">收货后,订单完成</span>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<FormItem label="自动评价" prop="autoEvaluation">
|
|
|
|
|
<Input type='number' v-model="formValidate.autoEvaluation">
|
|
|
|
|
<span slot="append">天</span>
|
|
|
|
|
</Input>
|
|
|
|
|
|
|
|
|
|
</FormItem>
|
2021-07-09 15:04:02 +08:00
|
|
|
|
<FormItem label="已完成订单允许退单" prop="closeAfterSale">
|
|
|
|
|
<Input type='number' v-model="formValidate.closeAfterSale">
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<span slot="append">天</span>
|
|
|
|
|
</Input>
|
2021-07-09 15:04:02 +08:00
|
|
|
|
<span class="desc">如果天数为0,则不允许退单</span>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="已完成订单允许投诉" prop="closeComplaint">
|
|
|
|
|
<Input type='number' v-model="formValidate.closeComplaint">
|
|
|
|
|
<span slot="append">天</span>
|
|
|
|
|
</Input>
|
|
|
|
|
<span class="desc">如果天数为0,则不允许投诉</span>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</FormItem>
|
|
|
|
|
|
|
|
|
|
<div class="label-btns">
|
|
|
|
|
<Button type="primary" @click="submit('formValidate')">保存</Button>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { setSetting } from "@/api/index";
|
|
|
|
|
import { handleSubmit } from "./validate";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2021-05-14 12:01:24 +08:00
|
|
|
|
ruleValidate: {}, // 验证规则
|
|
|
|
|
formValidate: { // 表单数据
|
2021-05-13 10:56:04 +08:00
|
|
|
|
autoCancel: "",
|
|
|
|
|
autoEvaluation: "",
|
|
|
|
|
autoReceive: "",
|
2021-07-09 15:04:02 +08:00
|
|
|
|
closeAfterSale: "",
|
|
|
|
|
closeComplaint:""
|
2021-05-13 10:56:04 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
props: ["res", "type"],
|
|
|
|
|
created() {
|
|
|
|
|
this.init();
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
submit(name) {
|
|
|
|
|
let that = this;
|
|
|
|
|
if (handleSubmit(that, name)) {
|
|
|
|
|
this.setupSetting();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setupSetting() {
|
|
|
|
|
setSetting(this.type, this.formValidate).then((res) => {
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.$Message.success("保存成功!");
|
|
|
|
|
} else {
|
|
|
|
|
this.$Message.error("保存失败!");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 实例化数据
|
|
|
|
|
init() {
|
|
|
|
|
this.res = JSON.parse(this.res);
|
|
|
|
|
Object.keys(this.res).map((item) => {
|
|
|
|
|
this.res[item] += "";
|
|
|
|
|
});
|
|
|
|
|
this.$set(this, "formValidate", { ...this.res });
|
|
|
|
|
Object.keys(this.formValidate).forEach((item) => {
|
|
|
|
|
this.ruleValidate[item] = [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: "请填写必填项",
|
|
|
|
|
trigger: "blur",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (value < 0) {
|
|
|
|
|
callback(new Error("不能输入负数!"));
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
trigger: "change",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
@import "./style.scss";
|
|
|
|
|
.label-item {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.ivu-input-wrapper {
|
|
|
|
|
width: 100px;
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
}
|
|
|
|
|
/deep/ .ivu-input {
|
|
|
|
|
width: 100px !important;
|
|
|
|
|
}
|
2021-07-09 15:04:02 +08:00
|
|
|
|
.desc {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</style>
|