!181 处理暂停日期

Merge pull request !181 from 德仔/develop
This commit is contained in:
德仔 2021-03-29 19:43:17 +08:00 committed by Gitee
commit 57c5470a23
10 changed files with 216 additions and 129 deletions

View File

@ -2,6 +2,8 @@ package com.stdiet.web.controller.custom;
import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysOrderPause;
import com.stdiet.custom.service.ISysOrderPauseService;
import com.stdiet.custom.service.ISysRecipesService; import com.stdiet.custom.service.ISysRecipesService;
import com.stdiet.custom.service.ISysWapServices; import com.stdiet.custom.service.ISysWapServices;
import com.stdiet.system.service.ISysDictTypeService; import com.stdiet.system.service.ISysDictTypeService;
@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import java.util.List;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@RestController @RestController
@RequestMapping("/wap") @RequestMapping("/wap")
@ -27,6 +27,9 @@ public class SysWapController extends BaseController {
@Autowired @Autowired
ISysDictTypeService iSysDictTypeService; ISysDictTypeService iSysDictTypeService;
@Autowired
ISysOrderPauseService iSysOrderPauseService;
/** /**
* 客户食谱详情 * 客户食谱详情
* *
@ -38,6 +41,17 @@ public class SysWapController extends BaseController {
return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId)); return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId));
} }
@GetMapping(value = "/recipes/plan/pause/{outId}")
public AjaxResult planPauses(@PathVariable String outId) {
SysOrderPause sysOrderPause = new SysOrderPause();
sysOrderPause.setOutId(outId);
List<SysOrderPause> list = iSysOrderPauseService.selectSysOrderPauseList(sysOrderPause);
for (SysOrderPause pause : list) {
pause.setCusId(null);
}
return AjaxResult.success(list);
}
/** /**
* 获取用户信息 * 获取用户信息
* *

View File

@ -1,6 +1,7 @@
package com.stdiet.custom.domain; package com.stdiet.custom.domain;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stdiet.common.annotation.Excel; import com.stdiet.common.annotation.Excel;
import lombok.Data; import lombok.Data;
@ -224,6 +225,7 @@ public class SysCustomerPhysicalSigns {
private JSONArray avoidFood; private JSONArray avoidFood;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date createTime; private Date createTime;
private Date updateTime; private Date updateTime;

View File

@ -29,6 +29,8 @@ public class SysOrderPause {
private Long cusId; private Long cusId;
private String outId;
/** /**
* 服务暂停开始时间 * 服务暂停开始时间
*/ */

View File

@ -8,6 +8,7 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="orderId" column="order_id"/> <result property="orderId" column="order_id"/>
<result property="cusId" column="cus_id"/> <result property="cusId" column="cus_id"/>
<result property="outId" column="out_id"/>
<result property="pauseStartDate" column="pause_start_date"/> <result property="pauseStartDate" column="pause_start_date"/>
<result property="pauseEndDate" column="pause_end_date"/> <result property="pauseEndDate" column="pause_end_date"/>
<result property="reason" column="reason"/> <result property="reason" column="reason"/>
@ -24,7 +25,7 @@
</sql> </sql>
<sql id="selectSysOrderPauseVo"> <sql id="selectSysOrderPauseVo">
select id, order_id, cus_id, pause_start_date, pause_end_date, reason, remarks, create_time, create_by, update_time, update_by, del_flag from sys_recipes_pause sop select id, order_id, cus_id, out_id, pause_start_date, pause_end_date, reason, remarks, create_time, create_by, update_time, update_by, del_flag from sys_recipes_pause sop
</sql> </sql>
<select id="selectSysOrderPauseList" parameterType="SysOrderPause" resultMap="SysOrderPauseResult"> <select id="selectSysOrderPauseList" parameterType="SysOrderPause" resultMap="SysOrderPauseResult">
@ -36,6 +37,7 @@
where sop.del_flag = 0 where sop.del_flag = 0
<if test="orderId != null ">and sop.order_id = #{orderId}</if> <if test="orderId != null ">and sop.order_id = #{orderId}</if>
<if test="cusId != null ">and sop.cus_id = #{cusId}</if> <if test="cusId != null ">and sop.cus_id = #{cusId}</if>
<if test="outId != null ">and sop.out_id = #{outId}</if>
<if test="pauseStartDate != null ">and sop.pause_start_date = #{pauseStartDate}</if> <if test="pauseStartDate != null ">and sop.pause_start_date = #{pauseStartDate}</if>
<if test="pauseEndDate != null ">and sop.pause_end_date = #{pauseEndDate}</if> <if test="pauseEndDate != null ">and sop.pause_end_date = #{pauseEndDate}</if>
<if test="reason != null and reason != ''">and sop.reason = #{reason}</if> <if test="reason != null and reason != ''">and sop.reason = #{reason}</if>
@ -52,6 +54,7 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if> <if test="orderId != null">order_id,</if>
<if test="cusId != null">cus_id,</if> <if test="cusId != null">cus_id,</if>
<if test="cusId != null">out_id,</if>
<if test="pauseStartDate != null">pause_start_date,</if> <if test="pauseStartDate != null">pause_start_date,</if>
<if test="pauseEndDate != null">pause_end_date,</if> <if test="pauseEndDate != null">pause_end_date,</if>
<if test="reason != null">reason,</if> <if test="reason != null">reason,</if>
@ -65,6 +68,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if> <if test="orderId != null">#{orderId},</if>
<if test="cusId != null">#{cusId},</if> <if test="cusId != null">#{cusId},</if>
<if test="cusId != null">md5(#{cusId}),</if>
<if test="pauseStartDate != null">#{pauseStartDate},</if> <if test="pauseStartDate != null">#{pauseStartDate},</if>
<if test="pauseEndDate != null">#{pauseEndDate},</if> <if test="pauseEndDate != null">#{pauseEndDate},</if>
<if test="reason != null">#{reason},</if> <if test="reason != null">#{reason},</if>
@ -82,6 +86,7 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="orderId != null">order_id = #{orderId},</if> <if test="orderId != null">order_id = #{orderId},</if>
<if test="cusId != null">cus_id = #{cusId},</if> <if test="cusId != null">cus_id = #{cusId},</if>
<if test="outId != null">out_id = #{outId},</if>
<if test="pauseStartDate != null">pause_start_date = #{pauseStartDate},</if> <if test="pauseStartDate != null">pause_start_date = #{pauseStartDate},</if>
<if test="pauseEndDate != null">pause_end_date = #{pauseEndDate},</if> <if test="pauseEndDate != null">pause_end_date = #{pauseEndDate},</if>
<if test="reason != null">reason = #{reason},</if> <if test="reason != null">reason = #{reason},</if>

View File

@ -49,3 +49,14 @@ export function getRecipesFullInfo(id) {
} }
}); });
} }
export function getPlanPause(id) {
return request({
url: "/wap/recipes/plan/pause/" + id,
method: "get",
headers: {
isToken: false
}
});
}

View File

@ -166,14 +166,13 @@ export default {
fetchOrderList() { fetchOrderList() {
this.loading = true; this.loading = true;
listOrder({ cusId: this.data.id }).then((res) => { listOrder({ cusId: this.data.id }).then((res) => {
this.orderList = res.rows.reduce((arr, cur) => { this.orderList = res.rows.reduce((arr, cur, idx) => {
const tarOrder = arr.find((ord) => ord.startTime === cur.startTime); const tarOrder = arr.find((ord) => ord.startTime === cur.startTime);
if (tarOrder) { if (tarOrder) {
if (!tarOrder.children) { if (!tarOrder.children) {
const firstObj = JSON.parse(JSON.stringify(tarOrder)); const firstObj = JSON.parse(JSON.stringify(tarOrder));
tarOrder.children = [{ ...firstObj, type: "main" }]; tarOrder.children = [{ ...firstObj, type: "main" }];
} }
tarOrder.amount += cur.afterSaleCommissOrder == 0 ? cur.amount : 0;
tarOrder.orderId += cur.orderId; tarOrder.orderId += cur.orderId;
tarOrder.type = "virtual"; tarOrder.type = "virtual";
tarOrder.children.push({ ...cur, type: "main" }); tarOrder.children.push({ ...cur, type: "main" });
@ -181,6 +180,13 @@ export default {
cur.type = "main"; cur.type = "main";
arr.push(cur); arr.push(cur);
} }
if (idx === res.rows.length - 1 && arr.children) {
arr.forEach((obj) => {
obj.amount = arr.children.reduce((a, c) => {
return a + c.afterSaleCommissOrder === 0 ? c.amount : 0;
}, 0);
});
}
return arr; return arr;
}, []); }, []);
// console.log(this.orderList); // console.log(this.orderList);

View File

@ -16,22 +16,21 @@
<el-button <el-button
type="info" type="info"
v-show="dataType == 0" v-show="dataType == 0"
@click="generateReport()" @click="generateReport"
plain plain
>下载报告</el-button >下载报告</el-button
> >
<el-button <el-button
type="info" type="info"
v-show="dataType == 0" v-show="dataType == 0"
@click="handleEditGuidanceClick()" @click="handleEditGuidanceClick"
plain plain
>减脂指导</el-button >减脂指导</el-button
> >
<el-button <el-button
v-hasPermi="['custom:healthy:edit']" v-hasPermi="['custom:healthy:edit']"
type="info" type="info"
v-show="dataType == 0" @click="handleEditRemarkClick"
@click="handleEditRemarkClick()"
plain plain
>修改备注</el-button >修改备注</el-button
> >
@ -39,14 +38,14 @@
v-hasPermi="['custom:healthy:edit']" v-hasPermi="['custom:healthy:edit']"
type="warning" type="warning"
v-show="dataType == 0" v-show="dataType == 0"
@click="handleEditHealthyClick()" @click="handleEditHealthyClick"
plain plain
>修改信息</el-button >修改信息</el-button
> >
<el-button <el-button
type="danger" type="danger"
v-hasPermi="['custom:healthy:remove']" v-hasPermi="['custom:healthy:remove']"
@click="handleDelete()" @click="handleDelete"
plain plain
>删除信息</el-button >删除信息</el-button
> >
@ -177,15 +176,27 @@
</div> </div>
</div> </div>
<!-- 客户体征 --> <!-- 客户体征 -->
<div v-else> <div v-else-if="dataList.length > 0 && dataType === 1">
<table-detail-message <table-detail-message v-show="dataList.length > 0" :data="dataList" />
v-show="dataList.length > 0" <!-- 备注 -->
:data="dataList" <el-table
></table-detail-message> :data="remarkList"
<div :show-header="false"
v-show="dataList.length == 0" border
style="font-size: 20px; text-align: center" :cell-style="remarkColumnStyle"
style="width: 100%"
> >
<el-table-column width="140" prop="remarkTitle"> </el-table-column>
<el-table-column prop="remarkValue">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.remarkValue"
:maxLength="100"
/></template>
</el-table-column>
</el-table>
</div>
<div v-else style="font-size: 20px; text-align: center">
<VueQr :text="copyValue" :logoSrc="logo" :size="256" /> <VueQr :text="copyValue" :logoSrc="logo" :size="256" />
<div style="text-align: center; margin-top: 20px"> <div style="text-align: center; margin-top: 20px">
<el-button <el-button
@ -201,25 +212,24 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div style="width: 200px" v-show="guidanceShow"> <div style="width: 200px" v-show="guidanceShow">
<!-- 编辑减脂指导 --> <!-- 编辑减脂指导 -->
<physicalSigns-guidance <physicalSigns-guidance
ref="physicalSignsGuidanceDialog" ref="physicalSignsGuidanceDialog"
@close="editGuidanceShow(false)" @close="editGuidanceShow(false)"
@refreshHealthyData="getCustomerHealthyByCusId()" @refreshHealthyData="getCustomerHealthyByCusId"
></physicalSigns-guidance> ></physicalSigns-guidance>
</div> </div>
</div> </div>
<!-- 编辑 --> <!-- 编辑 -->
<physicalSigns-edit <physicalSigns-edit
ref="physicalSignsEditDialog" ref="physicalSignsEditDialog"
@refreshHealthyData="getCustomerHealthyByCusId()" @refreshHealthyData="getCustomerHealthyByCusId"
></physicalSigns-edit> ></physicalSigns-edit>
<!-- 编辑备注 --> <!-- 编辑备注 -->
<physicalSigns-remark <physicalSigns-remark
ref="physicalSignsRemarkDialog" ref="physicalSignsRemarkDialog"
@refreshHealthyData="getCustomerHealthyByCusId()" @refreshHealthyData="getCustomerHealthyByCusId"
></physicalSigns-remark> ></physicalSigns-remark>
</el-dialog> </el-dialog>
</template> </template>
@ -433,9 +443,10 @@ export default {
if (res.data.customerHealthy) { if (res.data.customerHealthy) {
// //
this.dataType = res.data.type; this.dataType = res.data.type;
if (this.dataType == 0) { this.healthyData = res.data.customerHealthy;
this.healthyData = Object.assign({}, res.data.customerHealthy); this.dataList = [];
this.remarkList[0].remarkValue = this.healthyData.remark; this.remarkList[0].remarkValue = this.healthyData.remark;
if (this.dataType == 0) {
this.guidanceList[0].guidanceValue = this.healthyData.guidance; this.guidanceList[0].guidanceValue = this.healthyData.guidance;
this.getDataListByHealthyMessage(res.data.customerHealthy); this.getDataListByHealthyMessage(res.data.customerHealthy);
} else { } else {
@ -847,7 +858,8 @@ export default {
handleEditRemarkClick() { handleEditRemarkClick() {
this.$refs["physicalSignsRemarkDialog"].showDialog( this.$refs["physicalSignsRemarkDialog"].showDialog(
this.data, this.data,
this.healthyData this.healthyData,
this.dataType
); );
}, },
handleEditGuidanceClick() { handleEditGuidanceClick() {

View File

@ -1,49 +1,61 @@
<template> <template>
<el-dialog :visible.sync="visible" :title="title" width="500px" append-to-body @closed="onClosed"> <el-dialog
<el-form ref="form" :model="form" :rules="rules" label-position="top" label-width="100px"> :visible.sync="visible"
<el-form-item label="" prop="remark" > :title="title"
width="500px"
append-to-body
@closed="onClosed"
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-position="top"
label-width="100px"
>
<el-form-item label="" prop="remark">
<el-input <el-input
type="textarea" type="textarea"
:rows="6" :rows="6"
maxlength="300" maxlength="300"
show-word-limit show-word-limit
placeholder="请输入备注" placeholder="请输入备注"
v-model="form.remark"> v-model="form.remark"
>
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submit()"> </el-button> <el-button type="primary" @click="submit"> </el-button>
<el-button @click="onClosed()"> </el-button> <el-button @click="onClosed"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { updateHealthy } from "@/api/custom/healthy"; import { updateHealthy } from "@/api/custom/healthy";
import { editPhysicalSigns } from "@/api/custom/healthy";
export default { export default {
name: "PhysicalSignsRemark", name: "PhysicalSignsRemark",
components: { components: {},
},
data() { data() {
return { return {
visible: false, visible: false,
title: "", title: "",
data: undefined, data: undefined,
type: 0,
form: { form: {
id: null, id: null,
remark: null remark: null,
}, },
rules: { rules: {},
}
}; };
}, },
methods: { methods: {
showDialog(data, healthy) { showDialog(data, healthy, type) {
console.log(healthy)
this.data = data; this.data = data;
this.title = "修改"+`${data.name}`+"备注"; this.type = type;
this.title = "修改" + `${data.name}` + "备注";
this.form.id = healthy.id; this.form.id = healthy.id;
this.form.remark = healthy.remark; this.form.remark = healthy.remark;
this.visible = true; this.visible = true;
@ -52,37 +64,39 @@ export default {
this.visible = false; this.visible = false;
this.data = null; this.data = null;
}, },
submit(){ submit() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.editCustomerHealthy(); this.editCustomerHealthy();
} else { } else {
this.$message({message: "数据未填写完整", type: "warning"}); this.$message({ message: "数据未填写完整", type: "warning" });
} }
}); });
}, },
editCustomerHealthy(){ editCustomerHealthy() {
updateHealthy(this.form).then((response) => { (this.type === 0 ? updateHealthy : editPhysicalSigns)(this.form)
.then((response) => {
if (response.code === 200) { if (response.code === 200) {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.onClosed(); this.onClosed();
this.$emit('refreshHealthyData'); this.$emit("refreshHealthyData");
} }
}).catch(function() { })
.catch(function () {
console.log("error"); console.log("error");
}); });
} },
} },
}; };
</script> </script>
<style scoped> <style scoped>
.margin-top-20{ .margin-top-20 {
margin-top:20px; margin-top: 20px;
} }
.p_title_1{ .p_title_1 {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
margin-top: 20px; margin-top: 20px;
} }
</style> </style>

View File

@ -74,9 +74,7 @@
<el-button type="cyan" icon="el-icon-search" @click="handleQuery" <el-button type="cyan" icon="el-icon-search" @click="handleQuery"
>搜索</el-button >搜索</el-button
> >
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery" <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>

View File

@ -39,6 +39,7 @@ import {
getRecipesPlans, getRecipesPlans,
getHealthyInfo, getHealthyInfo,
getRecipesMenuInfoApi, getRecipesMenuInfoApi,
getPlanPause,
} from "@/api/custom/recipesShow"; } from "@/api/custom/recipesShow";
import { dealHealthy } from "@/utils/healthyData"; import { dealHealthy } from "@/utils/healthyData";
import UserInfoDrawer from "./UserInfoDrawer"; import UserInfoDrawer from "./UserInfoDrawer";
@ -76,23 +77,46 @@ export default {
data: {}, data: {},
}, },
menuData: [], menuData: [],
pauseDays: [],
}; };
}, },
created() { async created() {
// //
this.init(); this.init();
// //
getRecipesPlans(this.id).then((response) => { const planPauseRes = await getPlanPause(this.id);
if (response.code === 200) { // console.log(planPauseRes.data);
if (planPauseRes.code === 200) {
this.pauseDays = planPauseRes.data.reduce((arr, cur) => {
let startDate = cur.pauseStartDate;
while (dayjs(startDate) <= dayjs(cur.pauseEndDate)) {
arr.push(startDate);
startDate = dayjs(startDate).add(1, "days").format("YYYY-MM-DD");
}
return arr;
}, []);
// console.log(this.pauseDays);
}
const plansRes = await getRecipesPlans(this.id);
if (plansRes.code === 200) {
let curPlanId, curMenuId, curDate; let curPlanId, curMenuId, curDate;
const toDay = dayjs().format("YYYY-MM-DD"); const toDay = dayjs().format("YYYY-MM-DD");
this.planList = response.data.reduce((arr, plan) => { this.planList = plansRes.data.reduce((arr, plan) => {
if (plan.menus) { if (plan.menus) {
let tmpDate = dayjs(plan.startDate).subtract(1, "days");
arr.push({ arr.push({
menus: plan.menus.map((menu, idx) => { menus: plan.menus.map((menu) => {
const date = dayjs(plan.startDate) tmpDate = tmpDate.add(1, "days");
.add(idx, "day") //
.format("YYYY-MM-DD"); while (
this.pauseDays.includes(tmpDate.clone().format("YYYY-MM-DD"))
) {
tmpDate = tmpDate.add(1, "days");
}
const date = tmpDate.format("YYYY-MM-DD");
if (toDay === date) { if (toDay === date) {
curPlanId = plan.id; curPlanId = plan.id;
curMenuId = menu.id; curMenuId = menu.id;
@ -125,15 +149,14 @@ export default {
this.fetchRecipesInfo(this.curMenuId); this.fetchRecipesInfo(this.curMenuId);
} }
});
getHealthyInfo(this.id).then((response) => { const healthyRes = await getHealthyInfo(this.id);
if (response.code === 200) { if (healthyRes.code === 200) {
this.healthyData = { this.healthyData = {
type: response.data.type, type: healthyRes.data.type,
data: dealHealthy(response.data.customerHealthy), data: dealHealthy(healthyRes.data.customerHealthy),
}; };
} }
});
}, },
methods: { methods: {
handleOnPlanClick() { handleOnPlanClick() {