diff --git a/stdiet-ui/src/components/HealthyView/index.vue b/stdiet-ui/src/components/HealthyView/index.vue index 8d90762df..85cf0e5ce 100644 --- a/stdiet-ui/src/components/HealthyView/index.vue +++ b/stdiet-ui/src/components/HealthyView/index.vue @@ -39,6 +39,7 @@
{{ con.title }}: obj[0] === "早餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "早加餐", + data.calories2, + ]); } if (data.calories4) { - source.push(["午加餐", data.calories4]); + const tarIdx = source.findIndex((obj) => obj[0] === "午餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "午加餐", + data.calories4, + ]); } if (data.calories6) { - source.push(["晚加餐", data.calories6]); + const tarIdx = source.findIndex((obj) => obj[0] === "晚餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "晚加餐", + data.calories6, + ]); } return source; }, @@ -83,13 +94,25 @@ export default { ["晚餐", data.weight5], ]; if (data.weight2) { - source.push(["早加餐", data.weight2]); + const tarIdx = source.findIndex((obj) => obj[0] === "早餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "早加餐", + data.weight2, + ]); } if (data.weight4) { - source.push(["午加餐", data.weight4]); + const tarIdx = source.findIndex((obj) => obj[0] === "午餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "午加餐", + data.weight4, + ]); } if (data.weight6) { - source.push(["晚加餐", data.weight6]); + const tarIdx = source.findIndex((obj) => obj[0] === "晚餐"); + source.splice(tarIdx > -1 ? tarIdx + 1 : source.length, 0, [ + "晚加餐", + data.weight6, + ]); } return source; }, diff --git a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue index f887bb45f..66d252993 100644 --- a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue @@ -63,6 +63,7 @@ export default { data() { return { visible: false, + label: '', loading: false, title: "", logo: require("@/assets/logo/st_logo.png"), @@ -96,7 +97,7 @@ export default { } }, processShoppingCart(num, data = []) { - console.log(data); + // console.log(data); this.shoppingCart = data.reduce((obj, cur, idx) => { if ( num < 0 || // 全部计算 @@ -141,7 +142,7 @@ export default { } return obj; }, {}); - console.log(this.shoppingCart); + // console.log(this.shoppingCart); }, handleOnBackClick() { this.visible = false;