|
@@ -145,26 +145,6 @@
|
|
|
></el-input>
|
|
|
</el-col>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <!-- <el-form-item
|
|
|
- label=""
|
|
|
- :prop="'itemList.' + index + '.minValue'"
|
|
|
- :rules="rules['minValue']"
|
|
|
- class="range"
|
|
|
- >
|
|
|
- <el-input placeholder="最低价" v-model="item.minValue"></el-input>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <div class="line">-</div>
|
|
|
- <el-form-item
|
|
|
- label=""
|
|
|
- :prop="'itemList.' + index + '.maxValue'"
|
|
|
- :rules="rules['maxValue']"
|
|
|
- class="range"
|
|
|
- >
|
|
|
- <el-input placeholder="最高价" v-model="item.maxValue"></el-input>
|
|
|
- </el-form-item> -->
|
|
|
-
|
|
|
<el-form-item
|
|
|
v-if="item.itemType"
|
|
|
class="ddd"
|
|
@@ -174,18 +154,26 @@
|
|
|
:rules="rules['typeValue']"
|
|
|
>
|
|
|
<el-input
|
|
|
- :placeholder="item.itemType == 1 ? '百分比成本' : '固定成本'"
|
|
|
+ v-if="item.itemType == 1"
|
|
|
+ placeholder="百分比成本"
|
|
|
+ v-model="item.typeValue"
|
|
|
+ key="2"
|
|
|
+ v-int="{ max: 100 }"
|
|
|
+ >
|
|
|
+ <template slot="append"> % </template>
|
|
|
+ </el-input>
|
|
|
+ <el-input
|
|
|
+ key="1"
|
|
|
+ v-else
|
|
|
+ placeholder="固定成本"
|
|
|
v-model="item.typeValue"
|
|
|
v-int
|
|
|
>
|
|
|
- <template slot="append">
|
|
|
- {{ item.itemType == 1 ? "%" : "元" }}
|
|
|
- </template>
|
|
|
+ <template slot="append"> 元 </template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label-width="0" label=" ">
|
|
|
<div class="btns">
|
|
|
- <!-- <el-button type="text">复制</el-button> -->
|
|
|
<i @click="add(index, item)" class="el-icon-connection"></i>
|
|
|
<i @click="add(index)" class="el-icon-circle-plus-outline"></i>
|
|
|
<i
|
|
@@ -233,19 +221,13 @@ export default {
|
|
|
callback(new Error("最低价不能小于最高价"));
|
|
|
}
|
|
|
}
|
|
|
- if (!businessId) {
|
|
|
- callback();
|
|
|
- }
|
|
|
- const levelList = this.itemList.filter(
|
|
|
- (e) => e.businessId == list.businessId
|
|
|
- );
|
|
|
- if (levelList.length > 1) {
|
|
|
- const isEmpty = levelList.some((e) => !e.minValue && !e.maxValue);
|
|
|
- if (isEmpty) {
|
|
|
- callback(new Error("同层级成本设置不是阶梯计价只能存在一个"));
|
|
|
- } else {
|
|
|
- this.isHaveIntersect(levelList) &&
|
|
|
- callback(new Error("阶梯计价存在范围冲突"));
|
|
|
+ if (businessId) {
|
|
|
+ const levelList = this.itemList.filter(
|
|
|
+ (e) => e.businessId == list.businessId
|
|
|
+ );
|
|
|
+ if (levelList.length > 1) {
|
|
|
+ const text = this.isHaveIntersect(levelList);
|
|
|
+ text && callback(new Error(text));
|
|
|
}
|
|
|
}
|
|
|
callback();
|
|
@@ -383,8 +365,6 @@ export default {
|
|
|
submitForm() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(valid, 666);
|
|
|
- return;
|
|
|
if (this.type !== 1) {
|
|
|
addCost(this.form).then(this.cb);
|
|
|
} else {
|
|
@@ -399,13 +379,17 @@ export default {
|
|
|
this.$refs.form.validateField(prop);
|
|
|
},
|
|
|
isHaveIntersect(list) {
|
|
|
+ const isEmpty = list.some((e) => !e.minValue && !e.maxValue);
|
|
|
+ if (isEmpty) {
|
|
|
+ return "非阶梯计价只能存在一个";
|
|
|
+ }
|
|
|
list = list.sort((a, b) => a.minValue - b.minValue);
|
|
|
for (let i = 0, len = list.length - 1; i < len; i++) {
|
|
|
if (list[i].maxValue >= list[i + 1].minValue) {
|
|
|
- return true;
|
|
|
+ return "阶梯计价存在范围冲突";
|
|
|
}
|
|
|
}
|
|
|
- return false;
|
|
|
+ return;
|
|
|
},
|
|
|
},
|
|
|
computed: {
|