优化楼层装修

master
paulGao 2022-04-18 09:49:09 +08:00
parent 4156d51d78
commit 744567e8de
1 changed files with 81 additions and 29 deletions

View File

@ -15,7 +15,7 @@
> >
<li <li
v-for="(model, index) in modelData" v-for="(model, index) in modelData"
v-if="!model.drawer" v-if="!model.drawer && !model.drawerPromotions"
:key="index" :key="index"
class="model-item" class="model-item"
> >
@ -77,7 +77,8 @@ import templates from "./template/index";
import Draggable from "vuedraggable"; import Draggable from "vuedraggable";
import { modelData } from "./config"; import { modelData } from "./config";
import decorate from "./decorate"; import decorate from "./decorate";
import * as API_Other from '@/api/other' import * as API_Other from "@/api/other";
import * as API_Promotions from "@/api/promotion";
export default { export default {
components: { components: {
Draggable, Draggable,
@ -89,10 +90,12 @@ export default {
modelData, // modelData, //
qrcode: "", // qrcode: "", //
selected: 0, // selected: 0, //
contentData: { // contentData: {
//
list: [], list: [],
}, },
decorateData: "", // decorateData: "", //
decoratePromotionsData: "", //
}; };
}, },
watch: { watch: {
@ -108,21 +111,14 @@ export default {
}, },
methods: { methods: {
enableBindGoodsShow(){
},
// //
init() { init() {
if (!this.$route.query.id) return false; if (!this.$route.query.id) return false;
API_Other.getHomeData(this.$route.query.id).then(res=>{ API_Other.getHomeData(this.$route.query.id).then((res) => {
this.contentData = JSON.parse(res.result.pageData) this.contentData = JSON.parse(res.result.pageData);
this.handleComponent(this.contentData.list[0], 0);
this.handleComponent( this.contentData.list[0], 0) });
})
}, },
// //
@ -136,7 +132,6 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.decorateData = ""; this.decorateData = "";
console.log(this.contentData.list.length);
// //
if (this.contentData.list.length > 1) { if (this.contentData.list.length > 1) {
// //
@ -156,15 +151,70 @@ export default {
// //
handleComponent(val, index) { handleComponent(val, index) {
console.warn(val)
this.selected = index; this.selected = index;
this.$set(this, "decorateData", val); this.$set(this, "decorateData", val);
}, },
// //
handleDrawer(val) { handleDrawer(val) {
let newIndex = this.selected; let newIndex = this.selected;
if (val.promotionsType) {
if (this.contentData.list[newIndex].options.list.length >= 2) {
this.$Message.error("最多只能展示两个活动");
return;
}
if (val.promotionsType === "LIVE") {
API_Promotions.getLiveList({
status: "START",
pageSize: 1,
}).then((res) => {
if (res.success && res.result.size > 0) {
API_Promotions.getLiveInfo(res.result.records[0].id).then(
(res) => {
if (res.success) {
this.contentData.list[newIndex].options.list.push({
type: val.promotionsType,
title: val.name,
title1: val.subName,
color1: val.subColor,
bk_color: val.subBkColor,
data: res.result.commodityList
? res.result.commodityList
: [],
});
}
}
);
}
});
} else {
API_Promotions.getAllPromotion().then((res) => {
let exist = this.contentData.list[newIndex].options.list.find(
(i) => i.type === val.promotionsType
);
if (res.success && !exist) {
this.contentData.list[newIndex].options.list.push({
data: res.result[val.promotionsType]
? res.result[val.promotionsType]
: [],
type: val.promotionsType,
title1: val.subName,
color1: val.subColor,
bk_color: val.subBkColor,
title: val.name,
});
}
});
}
this.$set(this.contentData.list, newIndex, {
...val,
options: {
...this.contentData.list[newIndex].options,
},
//
model: val.type,
});
} else {
this.decorateData = ""; this.decorateData = "";
this.$set(this.contentData.list, newIndex, { this.$set(this.contentData.list, newIndex, {
@ -176,9 +226,11 @@ export default {
// //
model: val.type, model: val.type,
}); });
this.contentData.list = JSON.parse(JSON.stringify(this.contentData.list)); this.contentData.list = JSON.parse(
JSON.stringify(this.contentData.list)
);
this.$set(this, "decorateData", this.contentData.list[newIndex]); this.$set(this, "decorateData", this.contentData.list[newIndex]);
}
}, },
// //