优化楼层装修

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
v-for="(model, index) in modelData"
v-if="!model.drawer"
v-if="!model.drawer && !model.drawerPromotions"
:key="index"
class="model-item"
>
@ -77,7 +77,8 @@ import templates from "./template/index";
import Draggable from "vuedraggable";
import { modelData } from "./config";
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 {
components: {
Draggable,
@ -89,10 +90,12 @@ export default {
modelData, //
qrcode: "", //
selected: 0, //
contentData: { //
contentData: {
//
list: [],
},
decorateData: "", //
decoratePromotionsData: "", //
};
},
watch: {
@ -108,21 +111,14 @@ export default {
},
methods: {
enableBindGoodsShow(){
},
//
init() {
if (!this.$route.query.id) return false;
API_Other.getHomeData(this.$route.query.id).then(res=>{
this.contentData = JSON.parse(res.result.pageData)
API_Other.getHomeData(this.$route.query.id).then((res) => {
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.decorateData = "";
console.log(this.contentData.list.length);
//
if (this.contentData.list.length > 1) {
//
@ -156,29 +151,86 @@ export default {
//
handleComponent(val, index) {
console.warn(val)
this.selected = index;
this.$set(this, "decorateData", val);
},
//
handleDrawer(val) {
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
);
this.decorateData = "";
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.$set(this.contentData.list, newIndex, {
...val,
options: {
...val.options,
},
this.$set(this.contentData.list, newIndex, {
...val,
options: {
...val.options,
},
//
model: val.type,
});
this.contentData.list = JSON.parse(JSON.stringify(this.contentData.list));
this.$set(this, "decorateData", this.contentData.list[newIndex]);
//
model: val.type,
});
this.contentData.list = JSON.parse(
JSON.stringify(this.contentData.list)
);
this.$set(this, "decorateData", this.contentData.list[newIndex]);
}
},
//