From d266eabe8bfcae703b0eeb72a58283fd7ec03bc9 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Sat, 6 Mar 2021 14:14:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A3=9F=E8=B0=B1?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/custom/SysRecipesPlanMapper.xml | 5 +- .../MenuDetail/NutriComputeCom/index.vue | 1 + .../custom/recipesShow/MenuDetail/index.vue | 18 ++++++- .../src/views/custom/recipesShow/index.vue | 51 +++++++++++-------- .../src/views/custom/recipesShow/utils.js | 30 +++++------ 5 files changed, 67 insertions(+), 38 deletions(-) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index 7dab14631..4c2d153a3 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -239,7 +239,7 @@ <!-- 通过outId查询食谱计划简要--> <select id="selectRecipesPlanListInfo" resultMap="SysRecipesPlanListInfoResult"> - select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 + select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 and review_status = 2 </select> <resultMap type="SysRecipesDaily" id="SysRecipesResult"> @@ -248,9 +248,10 @@ </resultMap> <select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult"> - select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} and del_flag = 0 order by num_day asc + select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc </select> + <!-- 批量修改食谱计划 --> <update id="updateMuchRecipesPlanDate" parameterType="SysRecipesPlan"> <!--<foreach collection="list" item="item" separator=";" open="" close=""> diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue index cff52f37c..beedb4c82 100644 --- a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue @@ -56,6 +56,7 @@ export default { }, watch: { value(val) { + console.log({ val }); if (!val || !val.length) { return; } diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue index 5f3b87964..e9571bbdb 100644 --- a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue @@ -5,7 +5,10 @@ <!-- 食谱详细 --> <el-card v-for="obj in menus" :key="obj.type" style="margin-top: 12px"> <div slot="header"> - <span>{{ obj.typeName }}</span> + <div class="header_style"> + <span>{{ obj.typeName }}</span> + <span class="time">{{ menuTypeTimeDict[obj.type] }}</span> + </div> </div> <div v-for="mObj in obj.values" :key="mObj.id"> <div class="dishes_item"> @@ -60,6 +63,10 @@ export default { }, data() { return { + menuTypeTimeDict: { + 2: "10:00 - 10:30", + 4: "15:00 - 15:30", + }, menuTypeDict: {}, curUnitDict: {}, cusWeightDict: {}, @@ -107,6 +114,15 @@ export default { .menu_detail_wrapper { padding: 0 12px 12px 12px; + .header_style { + display: flex; + justify-content: space-between; + + .time { + color: #8c8c8c; + } + } + .dishes_item { height: 38px; padding: 0 8px; diff --git a/stdiet-ui/src/views/custom/recipesShow/index.vue b/stdiet-ui/src/views/custom/recipesShow/index.vue index 59d32f770..d9fc95131 100644 --- a/stdiet-ui/src/views/custom/recipesShow/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/index.vue @@ -15,8 +15,10 @@ @click="handleUserInfoClick" /> </div> - <div class="content" v-loading="loading"> - <MenuDetail :value="menuData" :date="curDate" /> + <div v-loading="loading"> + <div class="content"> + <MenuDetail :value="menuData" :date="curDate" /> + </div> </div> <!-- 食谱计划 --> @@ -71,24 +73,29 @@ export default { if (response.code === 200) { let curPlanId, curMenuId, curDate; const toDay = dayjs().format("YYYY-MM-DD"); - this.planList = response.data.map((plan) => ({ - menus: plan.menus.map((menu, idx) => { - const date = dayjs(plan.startDate) - .add(idx, "day") - .format("YYYY-MM-DD"); - if (toDay === date) { - curPlanId = plan.id; - curMenuId = menu.id; - curDate = date; - } - return { - date, - id: menu.id, - }; - }), - label: `第${plan.startNumDay} 至 ${plan.endNumDay}天`, - id: plan.id, - })); + this.planList = response.data.reduce((arr, plan) => { + if (plan.menus) { + arr.push({ + menus: plan.menus.map((menu, idx) => { + const date = dayjs(plan.startDate) + .add(idx, "day") + .format("YYYY-MM-DD"); + if (toDay === date) { + curPlanId = plan.id; + curMenuId = menu.id; + curDate = date; + } + return { + date, + id: menu.id, + }; + }), + label: `第${plan.startNumDay} 至 ${plan.endNumDay}天`, + id: plan.id, + }); + } + return arr; + }, []); if (!curMenuId) { curMenuId = this.planList[0].menus[0].id; curPlanId = this.planList[0].id; @@ -98,6 +105,10 @@ export default { this.curPlanId = curPlanId; this.curDate = curDate; + // console.log({ + // planList: this.planList, + // }); + this.fetchRecipesInfo(this.curMenuId); } }); diff --git a/stdiet-ui/src/views/custom/recipesShow/utils.js b/stdiet-ui/src/views/custom/recipesShow/utils.js index 14c1e5943..d42cb8e73 100644 --- a/stdiet-ui/src/views/custom/recipesShow/utils.js +++ b/stdiet-ui/src/views/custom/recipesShow/utils.js @@ -17,21 +17,21 @@ export function getProcessMenuData(menuData) { igdList: cur.igdList.reduce((igdArr, igdData) => { if (igdData.id > 0) { const tarDetail = cur.detail.find(obj => obj.id === igdData.id); - igdArr.push({ - id: igdData.id, - name: igdData.name, - carbonRatio: igdData.carbonRatio, - fatRatio: igdData.fatRatio, - proteinRatio: igdData.proteinRatio, - cusUnit: tarDetail ? tarDetail.cus_unit : igdData.cusUnit, - cusWeight: tarDetail - ? parseFloat(tarDetail.cus_weight) - : igdData.cusWeight, - weight: tarDetail ? parseFloat(tarDetail.weight) : igdData.weight, - notRec: igdData.notRec, - rec: igdData.rec, - type: igdData.type - }); + if (tarDetail) { + igdArr.push({ + id: igdData.id, + name: igdData.name, + carbonRatio: igdData.carbonRatio, + fatRatio: igdData.fatRatio, + proteinRatio: igdData.proteinRatio, + cusUnit: tarDetail.cus_unit, + cusWeight: tarDetail.cus_weight, + weight: parseFloat(tarDetail.weight), + notRec: igdData.notRec, + rec: igdData.rec, + type: igdData.type + }); + } } return igdArr; }, []) From f82e87fe554ae939cb0f825a544e18590db41e03 Mon Sep 17 00:00:00 2001 From: huangdeliang <huangdeliang@skieer.com> Date: Sat, 6 Mar 2021 14:18:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/RecipesPlanDrawer/index.vue | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue index db51810f0..48e224f95 100644 --- a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue +++ b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue @@ -19,7 +19,17 @@ @click="handleOnRecipesLinkClick" >客户食谱链接 </el-button> - + <el-popover placement="top" trigger="click" v-if="cusOutId" style="margin: 0 12px"> + <VueQr :text="copyValue" :logoSrc="logo" /> + <el-button + slot="reference" + size="mini" + icon="el-icon-picture-outline" + type="primary" + @click="handleCopy(scope.row.path)" + >二维码</el-button + > + </el-popover> <el-button icon="el-icon-view" size="mini" @click="handleInnerOpen" >查看暂停记录 </el-button> @@ -68,13 +78,17 @@ import Clipboard from "clipboard"; import { listRecipesPlanByCusId } from "@/api/custom/recipesPlan"; import PlanPauseDrawer from "./PlanPauseDrawer"; +import VueQr from "vue-qr"; +const logo = require("@/assets/logo/logo_b.png"); export default { name: "RecipesPlanDrawer", components: { PlanPauseDrawer, + VueQr, }, data() { return { + logo, visible: false, title: "", cusOutId: "", @@ -90,6 +104,7 @@ export default { if (!this.data) { return; } + this.visible = true; this.title = `「${this.data.name}」食谱计划`; this.planLoading = true; @@ -101,6 +116,10 @@ export default { } return str; }, ""); + this.copyValue = + window.location.origin.replace("manage", "sign") + + "/recipes/detail/" + + this.cusOutId; // console.log(this.planList); this.planLoading = false; }); @@ -115,10 +134,6 @@ export default { this.innerTitle = `「${this.data.name}」暂停记录`; }, handleOnRecipesLinkClick() { - this.copyValue = - window.location.origin.replace("manage", "sign") + - "/recipes/detail/" + - this.cusOutId; new Clipboard(".copyBtn"); this.$message({ message: "拷贝成功",