|
@@ -1,11 +1,12 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<BaseDialog
|
|
|
- width="1200px"
|
|
|
+ width="1100px"
|
|
|
:isShow.sync="isShow"
|
|
|
:title="title"
|
|
|
@close="close"
|
|
|
@submit="submitForm"
|
|
|
+ @open="init"
|
|
|
>
|
|
|
<div class="bop-tip">
|
|
|
<div>
|
|
@@ -171,7 +172,7 @@ import {
|
|
|
addInstCost,
|
|
|
costInstDetail,
|
|
|
editInstCost,
|
|
|
- categoryList,
|
|
|
+ instCategoryList,
|
|
|
} from "@/api/financed/index";
|
|
|
export default {
|
|
|
name: "DislogSet",
|
|
@@ -246,43 +247,21 @@ export default {
|
|
|
methods: {
|
|
|
init() {
|
|
|
this.resetForm();
|
|
|
- if (this.type === 3) {
|
|
|
- this.getOrdercostInstDetail();
|
|
|
- } else if (this.type === 4) {
|
|
|
- } else {
|
|
|
- this.tpId && this.getcostInstDetail();
|
|
|
- }
|
|
|
+ this.tpId && this.getcostInstDetail();
|
|
|
this.getEduList();
|
|
|
this.getCategoryList();
|
|
|
},
|
|
|
getCategoryList() {
|
|
|
- categoryList().then((res) => {
|
|
|
+ instCategoryList().then((res) => {
|
|
|
this.categoryList = res.rows;
|
|
|
});
|
|
|
},
|
|
|
- getOrdercostInstDetail() {
|
|
|
- this.$api.systemtopordercost(this.tpId).then((res) => {
|
|
|
- Object.keys(this.form).map((key) => {
|
|
|
- this.form[key] = res.data[key];
|
|
|
- });
|
|
|
- this.form.itemList.forEach((ele) => {
|
|
|
- if (ele.maxValue == -1) {
|
|
|
- ele.maxValue = "*";
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
getcostInstDetail() {
|
|
|
costInstDetail(this.tpId).then((res) => {
|
|
|
if (this.type == 2) delete this.form["tpId"];
|
|
|
Object.keys(this.form).map((key) => {
|
|
|
this.form[key] = res.data[key];
|
|
|
});
|
|
|
- this.form.itemList.forEach((ele) => {
|
|
|
- if (ele.maxValue == -1) {
|
|
|
- ele.maxValue = "*";
|
|
|
- }
|
|
|
- });
|
|
|
});
|
|
|
},
|
|
|
getEduList() {
|
|
@@ -346,70 +325,20 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.type === 3 || this.type === 4) {
|
|
|
- this.$api
|
|
|
- .systemtoporderupdatecost({
|
|
|
- costTpVo: form,
|
|
|
- orderSnList:
|
|
|
- this.type === 3 ? [this.tpId] : this.tpId?.split(","),
|
|
|
- })
|
|
|
- .then(this.cb);
|
|
|
- } else if (this.type !== 1) {
|
|
|
+ if (this.type !== 1) {
|
|
|
addInstCost(this.form).then(this.cb);
|
|
|
} else {
|
|
|
- editInstCost(form).then(this.cb);
|
|
|
+ editInstCost(this.form).then(this.cb);
|
|
|
}
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- changeMaxValue(prop) {
|
|
|
- this.$refs.form.validateField(prop);
|
|
|
- },
|
|
|
- // 阶梯校验
|
|
|
- isHaveIntersect(list) {
|
|
|
- const isEmpty = list.some((e) => !e.minValue && !e.maxValue);
|
|
|
- if (isEmpty) {
|
|
|
- return "非阶梯计价只能存在一个";
|
|
|
- }
|
|
|
- let maxList = list.filter((e) => e.maxValue === "*");
|
|
|
- if (maxList.length > 1) {
|
|
|
- return "阶梯计价存在范围冲突";
|
|
|
- }
|
|
|
- list.sort((a, b) => {
|
|
|
- if (a.maxValue == "*") {
|
|
|
- return Number.MAX_VALUE;
|
|
|
- }
|
|
|
- if (b.maxValue == "*") {
|
|
|
- return -Number.MAX_VALUE;
|
|
|
- }
|
|
|
- return a.minValue - b.minValue;
|
|
|
- });
|
|
|
- for (let i = 0, len = list.length - 1; i < len; i++) {
|
|
|
- if (list[i].maxValue >= list[i + 1].minValue) {
|
|
|
- return "阶梯计价存在范围冲突";
|
|
|
- }
|
|
|
- }
|
|
|
- return;
|
|
|
- },
|
|
|
- regValue(data) {
|
|
|
- let { maxValue } = data;
|
|
|
- let val;
|
|
|
- if (maxValue.includes("*")) {
|
|
|
- val = "*";
|
|
|
- } else {
|
|
|
- val = maxValue.replace(/[^0-9]/g, "");
|
|
|
- }
|
|
|
- data.maxValue = val;
|
|
|
- },
|
|
|
},
|
|
|
computed: {
|
|
|
isShow: {
|
|
|
get() {
|
|
|
- if (this.dialogVisible) {
|
|
|
- this.init();
|
|
|
- }
|
|
|
return this.dialogVisible;
|
|
|
},
|
|
|
set(val) {
|
|
@@ -417,9 +346,7 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
title() {
|
|
|
- return ["新增", "修改", "复制", "订单成本设置", "批量成本设置"][
|
|
|
- this.type
|
|
|
- ];
|
|
|
+ return ["新增", "修改", "复制"][this.type];
|
|
|
},
|
|
|
itemList() {
|
|
|
return this.form.itemList;
|