|
@@ -14,10 +14,18 @@
|
|
|
></el-form>
|
|
|
<div style="text-align: center">
|
|
|
<el-button @click="close">取消</el-button>
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')" v-if="status !== 'info'"
|
|
|
+ <el-button
|
|
|
+ v-loading="loading"
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('ruleForm')"
|
|
|
+ v-if="status !== 'info'"
|
|
|
>保存</el-button
|
|
|
>
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm', true)" v-if="status !== 'info'"
|
|
|
+ <el-button
|
|
|
+ v-loading="loading"
|
|
|
+ type="primary"
|
|
|
+ @click="submitForm('ruleForm', true)"
|
|
|
+ v-if="status !== 'info'"
|
|
|
>发布</el-button
|
|
|
>
|
|
|
</div>
|
|
@@ -32,6 +40,7 @@ export default {
|
|
|
components: { First, Second, Three },
|
|
|
data() {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
ruleForm: {
|
|
|
publishStatus: 0,
|
|
|
goodsList: [], //商品列表
|
|
@@ -50,23 +59,23 @@ export default {
|
|
|
],
|
|
|
},
|
|
|
id: "",
|
|
|
- status:""
|
|
|
+ status: "",
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.id = this.$route.query.id;
|
|
|
- this.status = this.$route.query.status
|
|
|
+ this.status = this.$route.query.status;
|
|
|
if (this.id) {
|
|
|
this.getInit();
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
close() {
|
|
|
- this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
|
|
|
- this.$router.push({
|
|
|
- path: "activityList",
|
|
|
- });
|
|
|
+ this.$store.dispatch("tagsView/exitView", this.$route).then((res) => {
|
|
|
+ this.$router.push({
|
|
|
+ path: "activityList",
|
|
|
});
|
|
|
+ });
|
|
|
},
|
|
|
getInit() {
|
|
|
this.$api.distributiontempdata(this.id).then((res) => {
|
|
@@ -74,8 +83,8 @@ export default {
|
|
|
parseInt(res.data.startTime * 1000),
|
|
|
parseInt(res.data.endTime * 1000),
|
|
|
];
|
|
|
- res.data.goodsList = res.data.goodsList || []
|
|
|
- res.data.tenantList = res.data.tenantList || []
|
|
|
+ res.data.goodsList = res.data.goodsList || [];
|
|
|
+ res.data.tenantList = res.data.tenantList || [];
|
|
|
this.$nextTick(() => {
|
|
|
this.ruleForm = res.data;
|
|
|
});
|
|
@@ -87,6 +96,7 @@ export default {
|
|
|
if (valid) {
|
|
|
this.checkGoodsFunc()
|
|
|
.then(() => {
|
|
|
+ this.loading = true;
|
|
|
var data = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
data.startTime = data.timeList[0] / 1000;
|
|
|
data.endTime = data.timeList[1] / 1000;
|
|
@@ -95,18 +105,22 @@ export default {
|
|
|
}
|
|
|
this.$api[
|
|
|
data.id ? "editdistributiontemp" : "distributiontempsave"
|
|
|
- ](data).then((res) => {
|
|
|
- this.$message.success("成功");
|
|
|
- setTimeout(() => {
|
|
|
- this.$store
|
|
|
- .dispatch("tagsView/exitView", this.$route)
|
|
|
- .then((res) => {
|
|
|
- this.$router.push({
|
|
|
- path: "activityList",
|
|
|
+ ](data)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.success("成功");
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$store
|
|
|
+ .dispatch("tagsView/exitView", this.$route)
|
|
|
+ .then((res) => {
|
|
|
+ this.$router.push({
|
|
|
+ path: "activityList",
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- }, 300);
|
|
|
- });
|
|
|
+ }, 300);
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
this.$message.error(err);
|
|
@@ -124,13 +138,13 @@ export default {
|
|
|
if (this.ruleForm.goodsList[i].profitType === 1) {
|
|
|
//百分比处理
|
|
|
if (this.ruleForm.goodsList[i].profitMax > 100) {
|
|
|
- return reject(`请检查第${i + 1}个商品的数组设置`);
|
|
|
+ return reject(`请检查第${i + 1}个商品的数值设置`);
|
|
|
} else {
|
|
|
let countNum =
|
|
|
parseFloat(this.ruleForm.goodsList[i].profitOne) +
|
|
|
parseFloat(this.ruleForm.goodsList[i].profitTwo) +
|
|
|
parseFloat(this.ruleForm.goodsList[i].profitThree);
|
|
|
- if (countNum > this.ruleForm.goodsList[i].profitMax) {
|
|
|
+ if (countNum > 100) {
|
|
|
return reject(
|
|
|
`请检查第${
|
|
|
i + 1
|