Commit e774e4e3 by 黑潮

fix: 商品选择器

parent c06449a8
......@@ -7,11 +7,18 @@
*/
// 商品选择器方法
const mapFilter = {
union: '或者',
intersect: '并且',
diff: '剔除'
};
export default {
data() {
return {
// ----线下适用商品开始----
xxSysp: {
filterLogicalOperator: [],
max: 5,
isExpand: false,
visible: false, // 适用商品选择器dialog
......@@ -27,6 +34,10 @@ export default {
},
methods: {
// ------线下适用商品开始-------
getXxSysFilterText(i) {
console.log(this.xxSysp.filterLogicalOperator);
return mapFilter[this.xxSysp.filterLogicalOperator[i] || 'union'];
},
// 清空线下适用商品 ,重置商品选择器
handleXxSyspReset() {
this.$refs.selector.conditions = this.$refs.selector.conditions.slice(0, 1);
......@@ -36,6 +47,7 @@ export default {
this.xxSysp.filterAbbrInfo = [];
this.xxSysp.conditionList = null;
this.xxSysp.goodsFilterId = null;
this.xxSysp.filterLogicalOperator = [];
},
// 编辑查看btn点击
handleXxSyspClick(visible = true) {
......@@ -84,6 +96,7 @@ export default {
this.xxSysp.goodsFilterId = res.id; // 保存id
this.xxSysp.conditionList = res.conditionList; // 保存回显list
this.xxSysp.filterAbbrInfo = this.xxSyspLabel(res.filterAbbrInfo);
this.xxSysp.filterLogicalOperator = res.filterLogicalOperator || [];
this.handleXxSyspClick(false); // 强制展开
this.xxSysp.visible = false;
}
......
......@@ -631,6 +631,7 @@ export default {
this.xxSysp.conditionList = this.xxSysp.conditionList_copy = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList || {}); // 备份数据
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
if (card.gicCouponType == 3 || card.gicCouponType == 4) {
const filterAbbrInfo = (goodsSearchDetail.filterAbbrInfo || []).map(el => {
return el.map((item, index) => {
......@@ -638,20 +639,17 @@ export default {
item.optName = null;
}
// intersect 或者,union 并且,diff 剔除
// switch (item.optName) {
// case 'intersect':
// item.optName = '或者';
// break;
// case 'union':
// item.optName = '并且';
// break;
// case 'diff':
// item.optName = '剔除';
// break;
// default:
// item.optName = null;
// break;
// }
switch (item.optName) {
case 'union':
item.optName = '或者';
break;
case 'intersect':
item.optName = '并且';
break;
case 'diff':
item.optName = '剔除';
break;
}
return item;
});
});
......
......@@ -115,7 +115,7 @@
<div class="sysp__content clearfix inline-block">
<div class="fl" v-if="xxSysp.filterAbbrInfo.length">
<div v-for="(item, idx) in xxSysp.filterAbbrInfo" :key="idx">
<div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">或者</div>
<div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">{{ getXxSysFilterText(idx - 1) }}</div>
<template v-for="(el, i) in item">
<span :key="i" v-show="idx < xxSysp.max || xxSysp.isExpand">
{{ el.optName }}
......
......@@ -370,6 +370,7 @@ export default {
this.xxSysp.conditionList = goodsSearchDetail.conditionList; // ref selector此时放在modal里并没有渲染,之后赋值
this.xxSysp.conditionList_copy = deepClone(goodsSearchDetail.conditionList); // 备份数据
this.xxSysp.filterAbbrInfo = goodsSearchDetail.filterAbbrInfo || [];
this.xxSysp.filterLogicalOperator = goodsSearchDetail.filterLogicalOperator || [];
}
}
......
......@@ -123,7 +123,7 @@
</div> -->
<div class="fl" v-if="xxSysp.filterAbbrInfo.length">
<div v-for="(item, idx) in xxSysp.filterAbbrInfo" :key="idx">
<div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">或者</div>
<div class="complex-and" v-if="idx > 0 && (idx < xxSysp.max || xxSysp.isExpand)">{{ getXxSysFilterText(idx - 1) }}</div>
<template v-for="(el, i) in item">
<span :key="i" v-show="idx < xxSysp.max || xxSysp.isExpand">
{{ el.optName }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment