diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index a80028fa0..f503ec720 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -13,6 +13,7 @@ <result property="endNumDay" column="end_num_day"/> <result property="recipesId" column="recipes_id"/> <result property="sendFlag" column="send_flag"/> + <result property="subscribed" column="subscribed"/> <result property="sendTime" column="send_time"/> <result property="pauseDate" column="pause_date"/> <result property="createTime" column="create_time"/> @@ -22,7 +23,6 @@ <result property="delFlag" column="del_flag"/> <result property="cusId" column="cus_id"/> <result property="outId" column="out_id"/> - <result property="subscribed" column="subscribed"/> <result property="subSend" column="sub_send"/> <result property="smsSend" column="sms_send"/> <!-- 非持久化字段 --> @@ -181,7 +181,8 @@ <select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult"> SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone, su_nutritionist.nick_name AS nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis, - srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status + srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status, + srp.subscribed FROM sys_recipes_plan srp LEFT JOIN sys_order sr ON sr.order_id = srp.order_id LEFT JOIN sys_customer sc ON sc.id = srp.cus_id diff --git a/stdiet-ui/src/views/custom/recipesPlan/index.vue b/stdiet-ui/src/views/custom/recipesPlan/index.vue index fda3aab3f..0e8e94dcd 100644 --- a/stdiet-ui/src/views/custom/recipesPlan/index.vue +++ b/stdiet-ui/src/views/custom/recipesPlan/index.vue @@ -140,6 +140,21 @@ prop="nutritionistAssis" width="180" /> + <el-table-column label="订阅情况" align="center"> + <template slot-scope="scope"> + <el-tag :type="scope.row.subscribed ? 'success' : 'danger'"> + {{ scope.row.subscribed ? "已订阅" : "未订阅" }} + </el-tag> + </template> + </el-table-column> + <el-table-column label="发送" align="center" width="80"> + <template slot-scope="scope"> + <el-switch + v-model="!!scope.row.sendFlag" + @change="(val) => handleOnSendChange(val, scope.row)" + /> + </template> + </el-table-column> <el-table-column label="操作" align="center" @@ -172,7 +187,11 @@ </template> <script> -import { exportRecipesPlan, listRecipesPlan } from "@/api/custom/recipesPlan"; +import { + exportRecipesPlan, + listRecipesPlan, + updateRecipesPlan, +} from "@/api/custom/recipesPlan"; import dayjs from "dayjs"; import store from "@/store"; import { mapState } from "vuex"; @@ -307,6 +326,25 @@ export default { cancel() { this.reset(); }, + handleOnSendChange(val, data) { + const { id } = data; + if (data.reviewStatus === 2) { + updateRecipesPlan({ + id, + sendFlag: val ? 1 : 0, + }).then((res) => { + if (res.code === 200) { + this.$message.success(res.msg); + const tarPlan = this.recipesPlanList.find((obj) => obj.id === id); + if (tarPlan) { + tarPlan.sendFlag = val ? 1 : 0; + } + } + }); + } else { + this.$message.error("未审核的食谱不能发送"); + } + }, // 表单重置 reset() { this.form = {