管理端,商品回显修改

This commit is contained in:
mabo
2021-05-25 14:26:48 +08:00
parent a36946de1a
commit 7e668cc6d5
5 changed files with 84 additions and 91 deletions

View File

@@ -45,8 +45,6 @@ export default {
type: "multiple", //单选或者多选 single multiple
skuList: [], // 商品sku列表
selectedWay: [], //选中商品集合
total: "", // 商品总数
goodsParams: { // 商品请求参数
pageNumber: 1,
@@ -64,7 +62,12 @@ export default {
loading: false, // 加载状态
};
},
props: ["clearFlag"],
props: {
selectedWay: {
type: Array,
default: new Array()
}
},
watch: {
category(val) {
this.goodsParams.categoryPath = val[0];
@@ -74,6 +77,7 @@ export default {
this.$emit("selected", this.selectedWay);
},
deep: true,
immediate: true
},
"goodsParams.categoryPath": {
@@ -110,6 +114,11 @@ export default {
res.result.records.forEach((item) => {
item.selected = false;
item.___type = "goods"; //设置为goods让pc wap知道标识
this.selectedWay.forEach(e => {
if (e.id === item.id) {
item.selected = true
}
})
});
/**
* 解决数据请求中,滚动栏会一直上下跳动
@@ -117,7 +126,6 @@ export default {
this.total = res.result.total;
this.goodsData.push(...res.result.records);
// console.log(this.goodsData);
} else {
this.empty = true;
}
@@ -193,9 +201,13 @@ export default {
this.selectedWay.push(val);
} else {
val.selected = false;
this.selectedWay.splice(index, 1);
for (let i = 0; i<this.selectedWay.length; i++ ) {
if (this.selectedWay[i].id===val.id) {
this.selectedWay.splice(i,1)
break;
}
}
}
// console.log(this.selectedWay);
},
},
};

View File

@@ -1,10 +1,7 @@
<template>
<Modal :styles="{ top: '120px' }" width="1160" @on-cancel="clickClose" @on-ok="clickOK" v-model="flag" :mask-closable="false" scrollable>
<goodsDialog @selected="
(val) => {
goodsData = val;
}
" v-if="goodsFlag" ref="goodsDialog" />
<goodsDialog @selected="(val) => {goodsData = val;}"
v-if="goodsFlag" ref="goodsDialog" :selectedWay='goodsData'/>
<linkDialog @selectedLink="
(val) => {
linkData = val;
@@ -23,7 +20,7 @@ export default {
data() {
return {
goodsFlag: false, // 是否商品选择器
goodsData: "", //选择的商品
goodsData: [], //选择的商品
linkData: "", //选择的链接
flag: false, // modal显隐
};