Commit 80e0c3a3 by Jaxon

fix(performanceScheme): 修复价格区间起始值计算和商品品类组件选项传递

- 修复新增价格区间时起始值可能超出最大值的问题
- 修复商品品类级联组件选项传递问题,移除对Vuex状态的直接依赖
- 统一价格区间输入框属性绑定,使用assessmentFactorOptions.componentProps
1 parent 8fecf06c
<template> <template>
<div class=""> <div class="">
<el-cascader clearable <el-cascader clearable
:options="goodsCategory" :options="options"
placeholder="请选择商品品类" placeholder="请选择商品品类"
:props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }" :props="{ checkStrictly: true, label: 'categoryName', value: 'categoryType' }"
:show-all-levels="false" :show-all-levels="false"
...@@ -17,6 +17,10 @@ import { mapState } from "vuex"; ...@@ -17,6 +17,10 @@ import { mapState } from "vuex";
export default { export default {
name: "", name: "",
props: { props: {
options: {
type: Array,
default: () => [],
},
value: { value: {
type: Array, type: Array,
default: () => [], default: () => [],
...@@ -28,7 +32,7 @@ export default { ...@@ -28,7 +32,7 @@ export default {
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList", "commissionTypesOptions", "goodsCategory"]), ...mapState("PerformanceFormStore", ["formData", "goodsCategory"]),
}, },
mounted() { mounted() {
......
...@@ -111,11 +111,11 @@ export default { ...@@ -111,11 +111,11 @@ export default {
return; return;
} }
} }
const componentsPropsMax = this.curParamsConfig.assessmentFactorOptions.componentProps.max;
const lastPriceRange = last(this.curParamsConfig[templateType])?.priceRange || [0, 0]; const lastPriceRange = last(this.curParamsConfig[templateType])?.priceRange || [0, 0];
const nPriceRange = [undefined, undefined]; const nPriceRange = [undefined, undefined];
if (lastPriceRange && lastPriceRange[1]) { if (lastPriceRange && lastPriceRange[1]) {
nPriceRange[0] = lastPriceRange[1] + 0.01; nPriceRange[0] = lastPriceRange[1] >= componentsPropsMax ? undefined : lastPriceRange[1] + 0.01;
nPriceRange[1] = undefined; nPriceRange[1] = undefined;
} }
this.curParamsConfig[templateType].push({ this.curParamsConfig[templateType].push({
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
:controls="false" :controls="false"
:disabled="$index === 0" :disabled="$index === 0"
type="number" type="number"
v-bind="curParamsConfig.priceRangeProps" v-bind="curParamsConfig.assessmentFactorOptions.componentProps"
@change="handlePriceRangeChange($index, 0)"> @change="handlePriceRangeChange($index, 0)">
</EditableText> </EditableText>
<div class="tag"> <div class="tag">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<EditableText v-model="curParamsConfig.ParamsType1[$index].priceRange[1]" <EditableText v-model="curParamsConfig.ParamsType1[$index].priceRange[1]"
:controls="false" :controls="false"
type="number" type="number"
v-bind="curParamsConfig.priceRangeProps" v-bind="curParamsConfig.assessmentFactorOptions.componentProps"
@change="handlePriceRangeChange($index, 1)"> @change="handlePriceRangeChange($index, 1)">
</EditableText> </EditableText>
</div> </div>
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
</el-button> --> </el-button> -->
<GoodsCategoryCascader v-if="goodsCategory === 0" <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="curParamsConfig.ParamsType1Products[index].productLabel" v-model="curParamsConfig.ParamsType1Products[index].productLabel"
:options="goodsCategoryOptions"
@change="handleProductChange" /> @change="handleProductChange" />
<el-cascader v-else <el-cascader v-else
...@@ -140,7 +141,11 @@ export default { ...@@ -140,7 +141,11 @@ export default {
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "commissionTypesOptions"]), ...mapState("PerformanceFormStore", {
formData: "formData",
commissionTypesOptions: "commissionTypesOptions",
goodsCategoryOptions: "goodsCategory",
}),
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]), ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
productDefineListOptions() { productDefineListOptions() {
if (this.goodsCategory === 1) { if (this.goodsCategory === 1) {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
:controls="false" :controls="false"
:disabled="$index === 0" :disabled="$index === 0"
type="number" type="number"
v-bind="curParamsConfig.priceRangeProps"> v-bind="curParamsConfig.assessmentFactorOptions.componentProps">
</EditableText> </EditableText>
<div class="tag"> <div class="tag">
- -
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<EditableText v-model="curParamsConfig.ParamsType2[$index].priceRange[1]" <EditableText v-model="curParamsConfig.ParamsType2[$index].priceRange[1]"
:controls="false" :controls="false"
type="number" type="number"
v-bind="curParamsConfig.priceRangeProps"> v-bind="curParamsConfig.assessmentFactorOptions.componentProps">
</EditableText> </EditableText>
</div> </div>
</template> </template>
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<!-- 品类cascader --> <!-- 品类cascader -->
<GoodsCategoryCascader v-if="goodsCategory === 0" <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="curParamsConfig.ParamsType2[$index].productLabel" v-model="curParamsConfig.ParamsType2[$index].productLabel"
:options="goodsCategoryOptions"
@change="handleProductChange" /> @change="handleProductChange" />
<!-- 圈定套餐/商品 cascader --> <!-- 圈定套餐/商品 cascader -->
<el-cascader v-else <el-cascader v-else
...@@ -137,7 +138,12 @@ export default { ...@@ -137,7 +138,12 @@ export default {
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList", "commissionTypesOptions"]), ...mapState("PerformanceFormStore", {
formData: "formData",
productDefineList: "productDefineList",
commissionTypesOptions: "commissionTypesOptions",
goodsCategoryOptions: "goodsCategory",
}),
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]), ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
goodsCategory: { goodsCategory: {
get() { get() {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
<GoodsCategoryCascader v-if="goodsCategory === 0" <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="productValue" v-model="productValue"
clearable clearable
:options="goodsCategoryOptions"
@change="handleProductChange" /> @change="handleProductChange" />
<el-cascader v-else <el-cascader v-else
...@@ -60,6 +61,8 @@ ...@@ -60,6 +61,8 @@
<span style="margin:0 6px">2. </span> <span style="margin:0 6px">2. </span>
<GoodsCategoryCascader v-if="goodsCategory === 0" <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="productValue1" v-model="productValue1"
clearable
:options="goodsCategoryOptions"
@change="handleProductChange" /> @change="handleProductChange" />
<el-cascader v-else <el-cascader v-else
...@@ -128,7 +131,11 @@ export default { ...@@ -128,7 +131,11 @@ export default {
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]), ...mapState("PerformanceFormStore", {
formData: "formData",
productDefineList: "productDefineList",
goodsCategoryOptions: "goodsCategory",
}),
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]), ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
goodsCategory: { goodsCategory: {
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
<!-- 品类cascader --> <!-- 品类cascader -->
<GoodsCategoryCascader v-if="goodsCategory === 0" <GoodsCategoryCascader v-if="goodsCategory === 0"
v-model="productValue" v-model="productValue"
clearable
:options="goodsCategoryOptions"
@change="handleProductChange" /> @change="handleProductChange" />
<!-- 圈定套餐/商品 cascader --> <!-- 圈定套餐/商品 cascader -->
<el-cascader v-else <el-cascader v-else
...@@ -57,7 +59,11 @@ export default { ...@@ -57,7 +59,11 @@ export default {
}; };
}, },
computed: { computed: {
...mapState("PerformanceFormStore", ["formData", "productDefineList"]), ...mapState("PerformanceFormStore", {
formData: "formData",
productDefineList: "productDefineList",
goodsCategoryOptions: "goodsCategory",
}),
...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]), ...mapGetters("PerformanceFormStore", ["getProductDefineListOptions"]),
// 路径太长 简化 // 路径太长 简化
paramsType2CommissionTypes() { paramsType2CommissionTypes() {
......
...@@ -192,7 +192,6 @@ export const paramConfigListTemplate = { ...@@ -192,7 +192,6 @@ export const paramConfigListTemplate = {
// 对应下面两个大数组 // 对应下面两个大数组
templateType: "ParamsType1", templateType: "ParamsType1",
// sort:在添加的时候输入 // sort:在添加的时候输入
// priceRangeProps 在新增时动态插入
// 只有paramsType1 需要. 这里不是paramsType1Table的行数据 // 只有paramsType1 需要. 这里不是paramsType1Table的行数据
// 每一个item 代表 一列 // 每一个item 代表 一列
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!