修复食谱计划获取id错误

This commit is contained in:
huangdeliang
2021-03-08 18:51:40 +08:00
parent 9ccd7ab17c
commit bddc3c7f85
8 changed files with 135 additions and 24 deletions

View File

@ -112,8 +112,9 @@
<template slot-scope="scope">
<span
v-if="
scope.row.nameSpan.colspan === 1 &&
scope.row.nameSpan.rowspan === 1
(scope.row.nameSpan.colspan === 1 &&
scope.row.nameSpan.rowspan === 1) ||
(scope.row.igdType !== '15' && scope.row.igdType !== '14')
"
>
{{ scope.row.igdName }}
@ -357,7 +358,6 @@ export default {
}
// console.log(cur);
arr.push({
id: cur.id,
dishesId: cur.dishesId,
@ -368,6 +368,7 @@ export default {
methods: cur.methods,
remark: cur.remark,
igdId: igd.id,
igdType: igd.type,
igdName: igd.name,
proteinRatio: igd.proteinRatio,
fatRatio: igd.fatRatio,
@ -400,7 +401,7 @@ export default {
}
return arr;
}, []);
// console.log(mData);
console.log(mData);
return mData;
},
@ -548,7 +549,7 @@ export default {
this.$refs.remarkDialogRef.showDialog(data);
},
handleOnRemarkConfirm(data) {
console.log(data);
// console.log(data);
const { id, remark } = data;
this.updateDishes({
num: this.num,

View File

@ -84,4 +84,9 @@ export default {
.el-dialog__body {
padding: 12px 18px;
}
.dishes_detail_dialog_wrapper {
.el-dialog:not(.is-fullscreen) {
margin-top: 20vh !important;
}
}
</style>

View File

@ -56,7 +56,7 @@ export default {
},
watch: {
value(val) {
console.log({ val });
// console.log({ val });
if (!val || !val.length) {
return;
}

View File

@ -0,0 +1,67 @@
<template>
<el-dialog
:visible.sync="visible"
width="80%"
center
title="选择时间段"
append-to-body
class="plan_time_wrapper"
>
<div class="full_day">
<el-button style="width: 100%" @click="handleOnTimeClick(7)">
7天计划
</el-button>
</div>
<div class="seperate_day">
<el-button @click="handleOnTimeClick(3)">前3天计划</el-button>
<el-button @click="handleOnTimeClick(4)">后四天计划</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
name: "PlanTimeDialog",
data() {
return {
visible: false,
recipesId: "",
};
},
methods: {
showDialog(recipesId) {
this.visible = true;
this.recipesId = recipesId;
},
handleOnTimeClick(num) {
this.visible = false;
this.$emit("onConfirm", {
num,
recipesId: this.recipesId,
});
},
},
};
</script>
<style lang="scss" scoped>
.plan_time_wrapper {
& > div {
margin-top: 30vh;
}
.seperate_day {
margin-top: 10px;
display: flex;
& > button {
flex: 1;
}
}
}
</style>
<style lang="scss">
.plan_time_wrapper {
.el-dialog:not(.is-fullscreen) {
margin-top: 20vh !important;
}
}
</style>

View File

@ -14,10 +14,18 @@
<el-collapse-item
v-for="plan in data"
:key="plan.id"
:title="plan.label"
:name="plan.id"
:class="plan.id === hitPlanId ? 'collapse_item_hit' : ''"
>
<template slot="title">
<div class="title_style">
<span>{{ plan.label }}</span>
<em
class="el-icon-shopping-cart-full icon_style"
@click="(e) => handleOnShoppingPlanClick(e, plan)"
/>
</div>
</template>
<div
v-for="menu in plan.menus"
:class="`item ${menu.id === curMenuId ? 'sel_item' : ''}`"
@ -32,9 +40,12 @@
</el-collapse-item>
</el-collapse>
</div>
<plan-time-dialog ref="planRef" @onConfirm="handleOnTimeConfirm" />
</el-drawer>
</template>
<script>
import PlanTimeDialog from "./PlanTimeDialog";
export default {
name: "planDrawer",
data() {
@ -45,6 +56,9 @@ export default {
hitPlanId: 0,
};
},
components: {
PlanTimeDialog,
},
props: ["data", "planId", "menuId"],
methods: {
showDrawer() {
@ -59,9 +73,16 @@ export default {
this.$emit("plan-change", menu);
},
handleOnShoppingPlanClick(e, data) {
e.stopPropagation();
this.$refs.planRef.showDialog(data.id);
this.visible = false;
},
handleOnTimeConfirm(val) {
console.log(val);
},
},
computed: {
},
computed: {},
watch: {
planId(val) {
this.curPlanId = val;
@ -106,6 +127,19 @@ export default {
background: #409eff;
color: white;
}
.title_style {
display: flex;
width: 100%;
align-items: center;
justify-content: space-between;
.icon_style {
margin-right: 16px;
font-size: 16px;
padding: 4px 8px;
}
}
}
}
</style>