食谱展示界面开发
This commit is contained in:
parent
e352e2f8aa
commit
9e87e1c9e8
@ -9,19 +9,15 @@ import com.stdiet.common.utils.StringUtils;
|
|||||||
import com.stdiet.common.utils.poi.ExcelUtil;
|
import com.stdiet.common.utils.poi.ExcelUtil;
|
||||||
import com.stdiet.common.utils.sign.AesUtils;
|
import com.stdiet.common.utils.sign.AesUtils;
|
||||||
import com.stdiet.custom.domain.SysCustomer;
|
import com.stdiet.custom.domain.SysCustomer;
|
||||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
|
||||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||||
import com.stdiet.custom.service.ISysCustomerHealthyService;
|
import com.stdiet.custom.service.ISysCustomerHealthyService;
|
||||||
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
|
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
|
||||||
import com.stdiet.custom.service.ISysCustomerService;
|
import com.stdiet.custom.service.ISysCustomerService;
|
||||||
import com.stdiet.framework.web.domain.server.Sys;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户体征信息Controller
|
* 客户体征信息Controller
|
||||||
@ -53,7 +49,7 @@ public class SysCustomerController extends BaseController {
|
|||||||
for (SysCustomer sysCus : list) {
|
for (SysCustomer sysCus : list) {
|
||||||
if (StringUtils.isNotEmpty(sysCus.getPhone())) {
|
if (StringUtils.isNotEmpty(sysCus.getPhone())) {
|
||||||
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone()));
|
||||||
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId()+"", null) : "");
|
sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId() + "", null) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +84,7 @@ public class SysCustomerController extends BaseController {
|
|||||||
@Log(title = "客户档案", businessType = BusinessType.INSERT)
|
@Log(title = "客户档案", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception {
|
public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception {
|
||||||
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
|
if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) {
|
||||||
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
|
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
|
||||||
}
|
}
|
||||||
return AjaxResult.error("该手机号客户已存在");
|
return AjaxResult.error("该手机号客户已存在");
|
||||||
@ -101,7 +97,7 @@ public class SysCustomerController extends BaseController {
|
|||||||
@Log(title = "客户档案", businessType = BusinessType.UPDATE)
|
@Log(title = "客户档案", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception {
|
public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception {
|
||||||
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
|
if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) {
|
||||||
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
|
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
|
||||||
}
|
}
|
||||||
return AjaxResult.error("该手机号客户已存在");
|
return AjaxResult.error("该手机号客户已存在");
|
||||||
@ -122,10 +118,9 @@ public class SysCustomerController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/getCustomerAndSignByPhone")
|
@GetMapping("/getCustomerAndSignByPhone")
|
||||||
@PreAuthorize("@ss.hasPermi('custom:customer:query')")
|
@PreAuthorize("@ss.hasPermi('custom:customer:query')")
|
||||||
public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone")String phone)
|
public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone") String phone) {
|
||||||
{
|
|
||||||
SysCustomerPhysicalSigns sysCustomer = null;
|
SysCustomerPhysicalSigns sysCustomer = null;
|
||||||
if(StringUtils.isNotEmpty(phone)){
|
if (StringUtils.isNotEmpty(phone)) {
|
||||||
sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone);
|
sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone);
|
||||||
}
|
}
|
||||||
return AjaxResult.success(sysCustomer);
|
return AjaxResult.success(sysCustomer);
|
||||||
@ -133,40 +128,19 @@ public class SysCustomerController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据客户ID获取体征或健康评估信息,优先健康评估信息
|
* 根据客户ID获取体征或健康评估信息,优先健康评估信息
|
||||||
|
*
|
||||||
* @param id 客户ID
|
* @param id 客户ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/physicalSigns/{id}")
|
@GetMapping("/physicalSigns/{id}")
|
||||||
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
|
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
return AjaxResult.success(sysCustomerService.getPhysicalSignsById(id));
|
||||||
String key = "customerHealthy";
|
|
||||||
result.put("type", 0);
|
|
||||||
//查询健康评估信息
|
|
||||||
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
|
|
||||||
if(sysCustomerHealthy != null){
|
|
||||||
/* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
|
|
||||||
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
|
|
||||||
}*/
|
|
||||||
result.put(key, sysCustomerHealthy);
|
|
||||||
}else{
|
|
||||||
//查询体征信息
|
|
||||||
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
|
|
||||||
if(sysCustomerPhysicalSigns != null){
|
|
||||||
/* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
|
|
||||||
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
|
|
||||||
}*/
|
|
||||||
result.put("type", 1);
|
|
||||||
}
|
|
||||||
result.put(key, sysCustomerPhysicalSigns);
|
|
||||||
}
|
|
||||||
//对ID进行加密
|
|
||||||
result.put("enc_id", id != null ? AesUtils.encrypt(id+"", null) : "");
|
|
||||||
return AjaxResult.success(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据客户ID删除对应体征信息或健康评估信息
|
* 根据客户ID删除对应体征信息或健康评估信息
|
||||||
* @param id 客户ID
|
*
|
||||||
|
* @param customerId 客户ID
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/delCustomerHealthy/{id}")
|
@GetMapping("/delCustomerHealthy/{id}")
|
||||||
|
@ -79,4 +79,5 @@ public class SysRecipesController extends BaseController {
|
|||||||
public AjaxResult delete(@PathVariable Long id) {
|
public AjaxResult delete(@PathVariable Long id) {
|
||||||
return toAjax(sysRecipesService.deleteDishes(id));
|
return toAjax(sysRecipesService.deleteDishes(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.stdiet.web.controller.custom;
|
||||||
|
|
||||||
|
import com.stdiet.common.core.controller.BaseController;
|
||||||
|
import com.stdiet.common.core.domain.AjaxResult;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesPlanService;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesService;
|
||||||
|
import com.stdiet.custom.service.ISysWapServices;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/wap")
|
||||||
|
public class SysWapController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
ISysWapServices iSysWapServices;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysRecipesService iSysRecipesService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户食谱详情
|
||||||
|
* @param outId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/recipes/plans/{outId}")
|
||||||
|
public AjaxResult detail(@PathVariable String outId) {
|
||||||
|
return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/healthyInfo/{outId}")
|
||||||
|
public AjaxResult healthy(@PathVariable String outId) {
|
||||||
|
return AjaxResult.success(iSysWapServices.getHealthyDataByOutId(outId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/recipes/menu/{id}")
|
||||||
|
public AjaxResult dayilyMenu(@PathVariable Long id) {
|
||||||
|
return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(id));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRecipesDetail {
|
||||||
|
|
||||||
|
private List<SysRecipesPlan> plans;
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,10 @@
|
|||||||
package com.stdiet.custom.domain;
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.stdiet.common.annotation.Excel;
|
import com.stdiet.common.annotation.Excel;
|
||||||
import com.stdiet.common.core.domain.BaseEntity;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划对象 sys_recipes_plan
|
* 食谱计划对象 sys_recipes_plan
|
||||||
@ -15,14 +13,16 @@ import com.stdiet.common.core.domain.BaseEntity;
|
|||||||
* @date 2021-01-15
|
* @date 2021-01-15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SysRecipesPlan extends BaseEntity
|
public class SysRecipesPlan {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** $column.columnComment */
|
/**
|
||||||
|
* $column.columnComment
|
||||||
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 订单ID */
|
/**
|
||||||
|
* 订单ID
|
||||||
|
*/
|
||||||
//@Excel(name = "订单ID")
|
//@Excel(name = "订单ID")
|
||||||
private Long orderId;
|
private Long orderId;
|
||||||
|
|
||||||
@ -46,12 +46,16 @@ public class SysRecipesPlan extends BaseEntity
|
|||||||
//处理过的客户手机号
|
//处理过的客户手机号
|
||||||
private String hidePhone;
|
private String hidePhone;
|
||||||
|
|
||||||
/** 食谱开始日期 */
|
/**
|
||||||
|
* 食谱开始日期
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "食谱开始日期", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "食谱开始日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date startDate;
|
private Date startDate;
|
||||||
|
|
||||||
/** 食谱结束日期 */
|
/**
|
||||||
|
* 食谱结束日期
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "食谱结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "食谱结束日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
@ -78,19 +82,54 @@ public class SysRecipesPlan extends BaseEntity
|
|||||||
@Excel(name = "营养师助理")
|
@Excel(name = "营养师助理")
|
||||||
private String nutritionistAssis;
|
private String nutritionistAssis;
|
||||||
|
|
||||||
/** 食谱ID */
|
/**
|
||||||
|
* 食谱ID
|
||||||
|
*/
|
||||||
//@Excel(name = "食谱ID")
|
//@Excel(name = "食谱ID")
|
||||||
private Long recipesId;
|
private Long recipesId;
|
||||||
|
|
||||||
/** 食谱是否发送,0未发送 1已发送 */
|
/**
|
||||||
@Excel(name = "食谱是否发送", readConverterExp="0=未发送,1=已发送")
|
* 食谱是否发送,0未发送 1已发送
|
||||||
|
*/
|
||||||
|
@Excel(name = "食谱是否发送", readConverterExp = "0=未发送,1=已发送")
|
||||||
private Integer sendFlag;
|
private Integer sendFlag;
|
||||||
|
|
||||||
/** 食谱发送时间 */
|
/**
|
||||||
|
* 食谱发送时间
|
||||||
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "食谱发送时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "食谱发送时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date sendTime;
|
private Date sendTime;
|
||||||
|
|
||||||
/** 删除标识 0未删除 1已删除 默认0 */
|
/**
|
||||||
|
* 删除标识 0未删除 1已删除 默认0
|
||||||
|
*/
|
||||||
private Integer delFlag;
|
private Integer delFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核标识 0未审核 1已审核 默认0
|
||||||
|
*/
|
||||||
|
private Integer reviewStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date updateTime;
|
||||||
}
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.stdiet.custom.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysRecipesPlanListInfo {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date endDate;
|
||||||
|
|
||||||
|
private Integer startNumDay;
|
||||||
|
|
||||||
|
private Integer endNumDay;
|
||||||
|
|
||||||
|
private List<SysRecipesPlan> menus;
|
||||||
|
|
||||||
|
}
|
@ -25,4 +25,6 @@ public interface SysRecipesMapper {
|
|||||||
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
public int deleteDishes(Long id);
|
public int deleteDishes(Long id);
|
||||||
|
|
||||||
|
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食谱计划Mapper接口
|
* 食谱计划Mapper接口
|
||||||
@ -86,4 +87,10 @@ public interface SysRecipesPlanMapper
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||||
|
|
||||||
|
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||||
|
|
||||||
|
Long getCusIdByOutId(String outId);
|
||||||
|
|
||||||
|
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.stdiet.custom.service;
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.stdiet.custom.domain.SysCustomer;
|
import com.stdiet.custom.domain.SysCustomer;
|
||||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||||
|
|
||||||
@ -74,4 +76,9 @@ public interface ISysCustomerService
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean isCustomerExistByPhone(SysCustomer sysCustomer);
|
boolean isCustomerExistByPhone(SysCustomer sysCustomer);
|
||||||
|
|
||||||
|
Map<String,Object> getPhysicalSignsById(Long id);
|
||||||
|
|
||||||
|
Map<String,Object> getPhysicalSignsByOutId(String id);
|
||||||
|
|
||||||
}
|
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.stdiet.custom.domain.SysOrder;
|
import com.stdiet.custom.domain.SysOrder;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,5 +91,10 @@ public interface ISysRecipesPlanService
|
|||||||
*/
|
*/
|
||||||
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
List<SysRecipesPlan> selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan);
|
||||||
|
|
||||||
public void myGenerateRecipesPlan(SysOrder sysOrder);
|
List<SysRecipesPlan> selectPlanListByOutId(String outId);
|
||||||
|
|
||||||
|
Long getCusIdByOutId(String outId);
|
||||||
|
|
||||||
|
List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
|
||||||
|
|
||||||
}
|
}
|
@ -12,9 +12,12 @@ public interface ISysRecipesService {
|
|||||||
|
|
||||||
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
public List<SysRecipes> selectSysRecipesByRecipesId(Long id);
|
||||||
|
|
||||||
|
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id);
|
||||||
|
|
||||||
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily);
|
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
public int addDishes(SysRecipesDailyDishes sysRecipesDaily);
|
||||||
|
|
||||||
public int deleteDishes(Long id);
|
public int deleteDishes(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.stdiet.custom.service;
|
||||||
|
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ISysWapServices {
|
||||||
|
|
||||||
|
List<SysRecipesPlanListInfo> getRecipesPlanListInfo(String outId);
|
||||||
|
|
||||||
|
Map<String, Object> getHealthyDataByOutId(String outId);
|
||||||
|
}
|
@ -1,22 +1,22 @@
|
|||||||
package com.stdiet.custom.service.impl;
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.stdiet.common.core.domain.model.LoginUser;
|
|
||||||
import com.stdiet.common.utils.DateUtils;
|
import com.stdiet.common.utils.DateUtils;
|
||||||
import com.stdiet.common.utils.SecurityUtils;
|
|
||||||
import com.stdiet.common.utils.StringUtils;
|
import com.stdiet.common.utils.StringUtils;
|
||||||
import com.stdiet.common.utils.bean.ObjectUtils;
|
import com.stdiet.common.utils.sign.AesUtils;
|
||||||
|
import com.stdiet.custom.domain.SysCustomer;
|
||||||
|
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
import com.stdiet.custom.mapper.SysCustomerMapper;
|
||||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||||
|
import com.stdiet.custom.service.ISysCustomerService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.stdiet.custom.mapper.SysCustomerMapper;
|
|
||||||
import com.stdiet.custom.domain.SysCustomer;
|
|
||||||
import com.stdiet.custom.service.ISysCustomerService;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户信息Service业务层处理
|
* 客户信息Service业务层处理
|
||||||
*
|
*
|
||||||
@ -25,14 +25,19 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Transactional
|
@Transactional
|
||||||
public class SysCustomerServiceImpl implements ISysCustomerService
|
public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysCustomerMapper sysCustomerMapper;
|
private SysCustomerMapper sysCustomerMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
|
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysCustomerHealthyServiceImpl sysCustomerHealthyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysCustomerPhysicalSignsServiceImpl sysCustomerPhysicalSignsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询客户信息
|
* 查询客户信息
|
||||||
*
|
*
|
||||||
@ -40,8 +45,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 客户信息
|
* @return 客户信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysCustomer selectSysCustomerById(Long id)
|
public SysCustomer selectSysCustomerById(Long id) {
|
||||||
{
|
|
||||||
return sysCustomerMapper.selectSysCustomerById(id);
|
return sysCustomerMapper.selectSysCustomerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,8 +56,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 客户信息
|
* @return 客户信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer)
|
public List<SysCustomer> selectSysCustomerList(SysCustomer sysCustomer) {
|
||||||
{
|
|
||||||
return sysCustomerMapper.selectSysCustomerList(sysCustomer);
|
return sysCustomerMapper.selectSysCustomerList(sysCustomer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,8 +67,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertSysCustomer(SysCustomer sysCustomer)
|
public int insertSysCustomer(SysCustomer sysCustomer) {
|
||||||
{
|
|
||||||
sysCustomer.setCreateTime(DateUtils.getNowDate());
|
sysCustomer.setCreateTime(DateUtils.getNowDate());
|
||||||
return sysCustomerMapper.insertSysCustomer(sysCustomer);
|
return sysCustomerMapper.insertSysCustomer(sysCustomer);
|
||||||
}
|
}
|
||||||
@ -77,8 +79,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateSysCustomer(SysCustomer sysCustomer)
|
public int updateSysCustomer(SysCustomer sysCustomer) {
|
||||||
{
|
|
||||||
sysCustomer.setUpdateTime(DateUtils.getNowDate());
|
sysCustomer.setUpdateTime(DateUtils.getNowDate());
|
||||||
return sysCustomerMapper.updateSysCustomer(sysCustomer);
|
return sysCustomerMapper.updateSysCustomer(sysCustomer);
|
||||||
}
|
}
|
||||||
@ -90,8 +91,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysCustomerByIds(Long[] ids)
|
public int deleteSysCustomerByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return sysCustomerMapper.deleteSysCustomerByIds(ids);
|
return sysCustomerMapper.deleteSysCustomerByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,8 +102,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteSysCustomerById(Long id)
|
public int deleteSysCustomerById(Long id) {
|
||||||
{
|
|
||||||
return sysCustomerMapper.deleteSysCustomerById(id);
|
return sysCustomerMapper.deleteSysCustomerById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,26 +112,60 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
|||||||
* @param phone 手机号
|
* @param phone 手机号
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public SysCustomer getCustomerByPhone(String phone){
|
public SysCustomer getCustomerByPhone(String phone) {
|
||||||
return sysCustomerMapper.getCustomerByPhone(phone);
|
return sysCustomerMapper.getCustomerByPhone(phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断客户手机号是否已存在
|
* 判断客户手机号是否已存在
|
||||||
|
*
|
||||||
* @param sysCustomer
|
* @param sysCustomer
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isCustomerExistByPhone(SysCustomer sysCustomer){
|
public boolean isCustomerExistByPhone(SysCustomer sysCustomer) {
|
||||||
if(sysCustomer.getId() != null){
|
if (sysCustomer.getId() != null) {
|
||||||
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
|
if (StringUtils.isNotEmpty(sysCustomer.getPhone())) {
|
||||||
SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone());
|
SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone());
|
||||||
return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue();
|
return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue();
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
|
if (StringUtils.isNotEmpty(sysCustomer.getPhone())) {
|
||||||
return getCustomerByPhone(sysCustomer.getPhone()) != null;
|
return getCustomerByPhone(sysCustomer.getPhone()) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getPhysicalSignsById(Long id) {
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
String key = "customerHealthy";
|
||||||
|
result.put("type", 0);
|
||||||
|
//查询健康评估信息
|
||||||
|
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
|
||||||
|
if (sysCustomerHealthy != null) {
|
||||||
|
/* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
|
||||||
|
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
|
||||||
|
}*/
|
||||||
|
result.put(key, sysCustomerHealthy);
|
||||||
|
} else {
|
||||||
|
//查询体征信息
|
||||||
|
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
|
||||||
|
if (sysCustomerPhysicalSigns != null) {
|
||||||
|
/* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
|
||||||
|
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
|
||||||
|
}*/
|
||||||
|
result.put("type", 1);
|
||||||
|
}
|
||||||
|
result.put(key, sysCustomerPhysicalSigns);
|
||||||
|
}
|
||||||
|
//对ID进行加密
|
||||||
|
result.put("enc_id", id != null ? AesUtils.encrypt(id + "", null) : "");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getPhysicalSignsByOutId(String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ import com.stdiet.common.utils.SynchrolockUtil;
|
|||||||
import com.stdiet.custom.domain.SysOrder;
|
import com.stdiet.custom.domain.SysOrder;
|
||||||
import com.stdiet.custom.domain.SysOrderPause;
|
import com.stdiet.custom.domain.SysOrderPause;
|
||||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||||
import com.stdiet.custom.service.ISysOrderPauseService;
|
import com.stdiet.custom.service.ISysOrderPauseService;
|
||||||
import com.stdiet.custom.service.ISysOrderService;
|
import com.stdiet.custom.service.ISysOrderService;
|
||||||
@ -293,7 +294,18 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void myGenerateRecipesPlan(SysOrder sysOrder) {
|
public List<SysRecipesPlan> selectPlanListByOutId(String outId) {
|
||||||
|
return sysRecipesPlanMapper.selectPlanListByOutId(outId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCusIdByOutId(String outId) {
|
||||||
|
return sysRecipesPlanMapper.getCusIdByOutId(outId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId) {
|
||||||
|
return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -65,6 +65,11 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
|
|||||||
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
return sysRecipesMapper.selectSysRecipesByRecipesId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRecipesDailyDishes> selectDishesByMenuId(Long id) {
|
||||||
|
return sysRecipesMapper.selectDishesByMenuId(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) {
|
public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) {
|
||||||
return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes);
|
return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes);
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.stdiet.custom.service.impl;
|
||||||
|
|
||||||
|
import com.stdiet.common.utils.StringUtils;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||||
|
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||||
|
import com.stdiet.custom.service.ISysCustomerService;
|
||||||
|
import com.stdiet.custom.service.ISysRecipesPlanService;
|
||||||
|
import com.stdiet.custom.service.ISysWapServices;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class SysWapServicesImp implements ISysWapServices {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysCustomerService iSysCustomerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ISysRecipesPlanService iSysRecipesPlanService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRecipesPlanListInfo> getRecipesPlanListInfo(String outId) {
|
||||||
|
return iSysRecipesPlanService.selectRecipesPlanListInfo(outId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getHealthyDataByOutId(String outId) {
|
||||||
|
Long cusId = iSysRecipesPlanService.getCusIdByOutId(outId);
|
||||||
|
if(cusId > 0) {
|
||||||
|
return iSysCustomerService.getPhysicalSignsById(cusId);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,7 @@
|
|||||||
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
<!-- <result property="customerId" column="cus_id"></result><!– 客户ID –>-->
|
||||||
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
<result property="customer" column="customer" /><!-- 客户姓名 -->
|
||||||
<result property="phone" column="phone" />
|
<result property="phone" column="phone" />
|
||||||
|
<result property="reviewStatus" column="review_status" />
|
||||||
<result property="orderStartDate" column="order_start_date" />
|
<result property="orderStartDate" column="order_start_date" />
|
||||||
<result property="orderEndDate" column="order_end_date" />
|
<result property="orderEndDate" column="order_end_date" />
|
||||||
<result property="nutritionistId" column="nutritionist_id" />
|
<result property="nutritionistId" column="nutritionist_id" />
|
||||||
@ -32,8 +33,10 @@
|
|||||||
<result property="nutritionistAssis" column="nutritionist_assis" />
|
<result property="nutritionistAssis" column="nutritionist_assis" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sql id="selectSysRecipesPlanVo">
|
<sql id="selectSysRecipesPlanVo">
|
||||||
select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag from sys_recipes_plan
|
select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag, review_status from sys_recipes_plan
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||||
@ -47,6 +50,7 @@
|
|||||||
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
|
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
|
||||||
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
|
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
|
||||||
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
<if test="sendTime != null "> and send_time = #{sendTime}</if>
|
||||||
|
<if test="reviewStatus != null "> and review_status = #{reviewStatus}</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
|
<select id="selectSysRecipesPlanById" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||||
@ -71,6 +75,7 @@
|
|||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
<if test="reviewStatus != null">review_status,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="orderId != null">#{orderId},</if>
|
<if test="orderId != null">#{orderId},</if>
|
||||||
@ -87,6 +92,7 @@
|
|||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -107,6 +113,7 @@
|
|||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id} and del_flag = 0
|
where id = #{id} and del_flag = 0
|
||||||
</update>
|
</update>
|
||||||
@ -186,4 +193,35 @@
|
|||||||
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
|
||||||
ORDER BY srp.id ASC
|
ORDER BY srp.id ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 根据outId查询食谱计划-->
|
||||||
|
<select id="selectPlanListByOutId" parameterType="String" resultMap="SysRecipesPlanResult">
|
||||||
|
select cus_id, recipes_id, start_num_day, end_num_day from sys_recipes_plan where out_id=#{outId} order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||||
|
select cus_id from sys_recipes_plan where out_id=#{outId} limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap id="SysRecipesPlanListInfoResult" type="SysRecipesPlanListInfo">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="startDate" column="start_date" />
|
||||||
|
<result property="endDate" column="end_date" />
|
||||||
|
<result property="startNumDay" column="start_num_day" />
|
||||||
|
<result property="endNumDay" column="end_num_day" />
|
||||||
|
<association property="menus" column="recipes_id" select="selectMenuIds"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<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}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<resultMap type="SysRecipesDaily" id="SysRecipesResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="numDay" column="num_day"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="selectMenuIds" parameterType="Long" resultMap="SysRecipesResult">
|
||||||
|
select id, num_day from sys_customer_daily_menu where recipes_id=#{recipes_id} order by num_day asc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -102,6 +102,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/custom/wxUserInfo/wx/**",
|
"/custom/wxUserInfo/wx/**",
|
||||||
"/custom/wxUserLog/wx/**",
|
"/custom/wxUserLog/wx/**",
|
||||||
"/wx/**",
|
"/wx/**",
|
||||||
|
"/wap/**",
|
||||||
"/investigate/**",
|
"/investigate/**",
|
||||||
"/common/customerUploadFile"
|
"/common/customerUploadFile"
|
||||||
).anonymous()
|
).anonymous()
|
||||||
|
@ -1,68 +1,74 @@
|
|||||||
import request from '@/utils/request'
|
import request from "@/utils/request";
|
||||||
|
|
||||||
// 查询合同列表
|
// 查询合同列表
|
||||||
export function listContract(query) {
|
export function listContract(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/list',
|
url: "/custom/contract/list",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询合同详细
|
// 查询合同详细
|
||||||
export function getContract(id) {
|
export function getContract(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/' + id,
|
url: "/custom/contract/" + id,
|
||||||
method: 'get'
|
method: "get"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增合同
|
// 新增合同
|
||||||
export function addContract(data) {
|
export function addContract(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract',
|
url: "/custom/contract",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改合同
|
// 修改合同
|
||||||
export function updateContract(data) {
|
export function updateContract(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract',
|
url: "/custom/contract",
|
||||||
method: 'put',
|
method: "put",
|
||||||
data: data
|
data: data
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除合同
|
// 删除合同
|
||||||
export function delContract(id) {
|
export function delContract(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/' + id,
|
url: "/custom/contract/" + id,
|
||||||
method: 'delete'
|
method: "delete"
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导出合同
|
// 导出合同
|
||||||
export function exportContract(query) {
|
export function exportContract(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/export',
|
url: "/custom/contract/export",
|
||||||
method: 'get',
|
method: "get",
|
||||||
params: query
|
params: query
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getFile(id) {
|
export function getFile(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/file/' + id,
|
url: "/custom/contract/file/" + id,
|
||||||
method: 'get',
|
method: "get",
|
||||||
})
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function signContract(data) {
|
export function signContract(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/custom/contract/sign',
|
url: "/custom/contract/sign",
|
||||||
method: 'post',
|
method: "post",
|
||||||
data: data
|
data: data,
|
||||||
})
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
31
stdiet-ui/src/api/custom/recipesShow.js
Normal file
31
stdiet-ui/src/api/custom/recipesShow.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import request from "@/utils/request";
|
||||||
|
|
||||||
|
export function getRecipesPlans(id) {
|
||||||
|
return request({
|
||||||
|
url: "/wap/recipes/plans/" + id,
|
||||||
|
method: "get",
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHealthyInfo(id) {
|
||||||
|
return request({
|
||||||
|
url: "/wap/healthyInfo/" + id,
|
||||||
|
method: "get",
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRecipesMenuInfoApi(id) {
|
||||||
|
return request({
|
||||||
|
url: "/wap/recipes/menu/" + id,
|
||||||
|
method: "get",
|
||||||
|
headers: {
|
||||||
|
isToken: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -1,43 +1,52 @@
|
|||||||
import router from './router'
|
import router from "./router";
|
||||||
import store from './store'
|
import store from "./store";
|
||||||
import {Message} from 'element-ui'
|
import { Message } from "element-ui";
|
||||||
import NProgress from 'nprogress'
|
import NProgress from "nprogress";
|
||||||
import 'nprogress/nprogress.css'
|
import "nprogress/nprogress.css";
|
||||||
import {getToken} from '@/utils/auth'
|
import { getToken } from "@/utils/auth";
|
||||||
|
|
||||||
NProgress.configure({showSpinner: false})
|
NProgress.configure({ showSpinner: false });
|
||||||
|
|
||||||
const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question', '/subhealthyInvestigation']
|
const whiteList = [
|
||||||
|
"/login",
|
||||||
|
"/auth-redirect",
|
||||||
|
"/bind",
|
||||||
|
"/register",
|
||||||
|
"/question",
|
||||||
|
"/subhealthyInvestigation"
|
||||||
|
];
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start()
|
NProgress.start();
|
||||||
if (getToken()) {
|
if (getToken()) {
|
||||||
/* has token*/
|
/* has token*/
|
||||||
if (to.path === '/login') {
|
if (to.path === "/login") {
|
||||||
next({path: '/'})
|
next({ path: "/" });
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
} else {
|
} else {
|
||||||
if (store.getters.roles.length === 0) {
|
if (store.getters.roles.length === 0) {
|
||||||
// 判断当前用户是否已拉取完user_info信息
|
// 判断当前用户是否已拉取完user_info信息
|
||||||
store.dispatch('GetInfo').then(res => {
|
store
|
||||||
|
.dispatch("GetInfo")
|
||||||
|
.then(res => {
|
||||||
// 拉取user_info
|
// 拉取user_info
|
||||||
const roles = res.roles
|
const roles = res.roles;
|
||||||
store.dispatch('GenerateRoutes', {roles}).then(accessRoutes => {
|
store.dispatch("GenerateRoutes", { roles }).then(accessRoutes => {
|
||||||
// 测试 默认静态页面
|
// 测试 默认静态页面
|
||||||
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
|
// store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => {
|
||||||
// 根据roles权限生成可访问的路由表
|
// 根据roles权限生成可访问的路由表
|
||||||
router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
router.addRoutes(accessRoutes); // 动态添加可访问路由表
|
||||||
next({...to, replace: true}) // hack方法 确保addRoutes已完成
|
next({ ...to, replace: true }); // hack方法 确保addRoutes已完成
|
||||||
})
|
});
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
store.dispatch('FedLogOut').then(() => {
|
store.dispatch("FedLogOut").then(() => {
|
||||||
Message.error(err)
|
Message.error(err);
|
||||||
next({path: '/'})
|
next({ path: "/" });
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
next()
|
next();
|
||||||
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
|
// 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓
|
||||||
// if (hasPermission(store.getters.roles, to.meta.roles)) {
|
// if (hasPermission(store.getters.roles, to.meta.roles)) {
|
||||||
// next()
|
// next()
|
||||||
@ -49,17 +58,22 @@ router.beforeEach((to, from, next) => {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有token
|
// 没有token
|
||||||
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')
|
if (
|
||||||
|| to.path.startsWith('/foodHeatCalculator/')) {
|
whiteList.indexOf(to.path) !== -1 ||
|
||||||
|
to.path.startsWith("/f/contract/") ||
|
||||||
|
to.path.startsWith("/recipes/detail/") ||
|
||||||
|
to.path.startsWith("/subhealthyInvestigation/") ||
|
||||||
|
to.path.startsWith("/foodHeatCalculator/")
|
||||||
|
) {
|
||||||
// 在免登录白名单,直接进入
|
// 在免登录白名单,直接进入
|
||||||
next()
|
next();
|
||||||
} else {
|
} else {
|
||||||
next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
|
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
NProgress.done()
|
NProgress.done();
|
||||||
})
|
});
|
||||||
|
@ -146,6 +146,13 @@ export const constantRoutes = [
|
|||||||
meta: { title: "食谱制作" },
|
meta: { title: "食谱制作" },
|
||||||
hidden: true
|
hidden: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/recipes/detail/:id",
|
||||||
|
component: resolve => require(["@/views/custom/recipesShow"], resolve),
|
||||||
|
props: true,
|
||||||
|
meta: { title: "健康食谱" },
|
||||||
|
hidden: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/f/contract/:id(\\d+)",
|
path: "/f/contract/:id(\\d+)",
|
||||||
hidden: true,
|
hidden: true,
|
||||||
|
@ -20,7 +20,6 @@ const oriState = {
|
|||||||
recipesDataLoading: false,
|
recipesDataLoading: false,
|
||||||
cusUnitOptions: [],
|
cusUnitOptions: [],
|
||||||
cusWeightOptions: [],
|
cusWeightOptions: [],
|
||||||
dishesTypeOptions: [],
|
|
||||||
typeOptions: [],
|
typeOptions: [],
|
||||||
currentDay: -1,
|
currentDay: -1,
|
||||||
startNum: 0,
|
startNum: 0,
|
||||||
@ -87,9 +86,6 @@ const actions = {
|
|||||||
getDicts("cus_dishes_type").then(response => {
|
getDicts("cus_dishes_type").then(response => {
|
||||||
commit("updateStateData", { typeOptions: response.data });
|
commit("updateStateData", { typeOptions: response.data });
|
||||||
});
|
});
|
||||||
getDicts("cus_dishes_type").then(response => {
|
|
||||||
commit("updateStateData", { dishesTypeOptions: response.data });
|
|
||||||
});
|
|
||||||
|
|
||||||
// 健康数据
|
// 健康数据
|
||||||
if (payload.cusId) {
|
if (payload.cusId) {
|
||||||
|
@ -290,14 +290,14 @@
|
|||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="proteinRatio" label="P/100g">
|
<el-table-column prop="proteinRatio" label="蛋白质/100g">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="fatRatio" label="F/100g">
|
<el-table-column prop="fatRatio" label="脂肪/100g">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="carbonRatio" label="C/100g">
|
<el-table-column prop="carbonRatio" label="碳水/100g">
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="remark" label="备注">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<!-- <el-table-column prop="remark" label="备注">
|
||||||
|
</el-table-column> -->
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -87,7 +87,7 @@ export default {
|
|||||||
`${seriesName.substring(0, 1)}Weight`
|
`${seriesName.substring(0, 1)}Weight`
|
||||||
].toFixed(1);
|
].toFixed(1);
|
||||||
arr.push(
|
arr.push(
|
||||||
`${cur.marker} ${nutriName}:${heatVal}千卡(${weightVal}克)`
|
`${cur.marker} ${nutriName}:${weightVal}克(${heatVal}千卡)`
|
||||||
);
|
);
|
||||||
return arr;
|
return arr;
|
||||||
},
|
},
|
||||||
@ -110,7 +110,7 @@ export default {
|
|||||||
source,
|
source,
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: 40,
|
top: 55,
|
||||||
left: 20,
|
left: 20,
|
||||||
right: 20,
|
right: 20,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
@ -121,6 +121,10 @@ export default {
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: "value",
|
type: "value",
|
||||||
|
name: "热量(千卡)",
|
||||||
|
nameTextStyle: {
|
||||||
|
color: "#262626",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
series: ["pHeat", "fHeat", "cHeat"].map((dim, idx) => ({
|
series: ["pHeat", "fHeat", "cHeat"].map((dim, idx) => ({
|
||||||
name: dim,
|
name: dim,
|
||||||
|
@ -14,25 +14,14 @@
|
|||||||
class="small_table"
|
class="small_table"
|
||||||
>
|
>
|
||||||
<el-table-column label="营养" prop="type" align="center" width="60" />
|
<el-table-column label="营养" prop="type" align="center" width="60" />
|
||||||
<el-table-column
|
<el-table-column label="蛋白质" prop="p" align="center" width="80" />
|
||||||
label="重量(g)"
|
<el-table-column label="脂肪" prop="f" align="center" width="80" />
|
||||||
prop="weight"
|
<el-table-column label="碳水" prop="c" align="center" width="80" />
|
||||||
align="center"
|
|
||||||
width="80"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="热量(Kcal)"
|
|
||||||
prop="heat"
|
|
||||||
align="center"
|
|
||||||
width="90"
|
|
||||||
/>
|
|
||||||
<el-table-column
|
|
||||||
label="热量占比"
|
|
||||||
prop="heatRate"
|
|
||||||
align="center"
|
|
||||||
width="80"
|
|
||||||
/>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<div class="summary">
|
||||||
|
<div style="font-size: 12px; color: #606266;">总热量约等于</div>
|
||||||
|
<div style="color: #515a6e; font-weight: bold">{{ totalHeat.toFixed(1) }}千卡</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -69,35 +58,37 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chart: null,
|
chart: null,
|
||||||
|
totalHeat: 0,
|
||||||
nameDict: {
|
nameDict: {
|
||||||
p: "蛋白质",
|
p: "蛋白质",
|
||||||
f: "脂肪",
|
f: "脂肪",
|
||||||
c: "碳水",
|
c: "碳水",
|
||||||
},
|
},
|
||||||
|
typeDict: {
|
||||||
|
Weight: "摄入量",
|
||||||
|
Rate: "供能比",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mData() {
|
mData() {
|
||||||
const [data] = this.data;
|
const [data] = this.data;
|
||||||
let totalHeat = 0;
|
if (!data) {
|
||||||
return data
|
this.totalHeat = 0;
|
||||||
? ["p", "f", "c"].map((type) => {
|
return [];
|
||||||
if (totalHeat === 0) {
|
|
||||||
totalHeat = ["p", "f", "c"].reduce((heat, cur) => {
|
|
||||||
heat += data[`${cur}Heat`];
|
|
||||||
return heat;
|
|
||||||
}, 0);
|
|
||||||
}
|
}
|
||||||
return {
|
this.totalHeat = data.cHeat + data.fHeat + data.pHeat;
|
||||||
type: this.nameDict[type],
|
const mData = ["Weight", "Rate"].map((t, idx) => ({
|
||||||
weight: data[`${type}Weight`].toFixed(1),
|
type: this.typeDict[t],
|
||||||
heat: data[`${type}Heat`].toFixed(1),
|
...["p", "f", "c"].reduce((obj, cur) => {
|
||||||
heatRate: `${((data[`${type}Heat`] / totalHeat) * 100).toFixed(
|
obj[cur] = idx
|
||||||
2
|
? `${((data[`${cur}Heat`] / this.totalHeat) * 100).toFixed(2)}%`
|
||||||
)}%`,
|
: `${data[`${cur}Weight`].toFixed(1)}克`;
|
||||||
};
|
return obj;
|
||||||
})
|
}, {}),
|
||||||
: [];
|
}));
|
||||||
|
console.log(mData);
|
||||||
|
return mData;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -121,10 +112,10 @@ export default {
|
|||||||
this.chart.clear();
|
this.chart.clear();
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
title: {
|
title: {
|
||||||
text: `${data.name}营养统计`,
|
text: `${data.name}营养分析`,
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
position: 'right',
|
position: "right",
|
||||||
trigger: "item",
|
trigger: "item",
|
||||||
appendToBody: true,
|
appendToBody: true,
|
||||||
formatter: (params) => {
|
formatter: (params) => {
|
||||||
@ -136,9 +127,9 @@ export default {
|
|||||||
} = params;
|
} = params;
|
||||||
return [
|
return [
|
||||||
`${marker} ${name}`,
|
`${marker} ${name}`,
|
||||||
`含量:${oriData[`${dim}Weight`].toFixed(1)}克`,
|
`摄入量:${oriData[`${dim}Weight`].toFixed(1)}克`,
|
||||||
`热量:${value.toFixed(1)}千卡`,
|
`摄入热量:${value.toFixed(1)}千卡`,
|
||||||
`热量占比:${percent}%`,
|
`供能比:${percent}%`,
|
||||||
].join("</br>");
|
].join("</br>");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -199,5 +190,17 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
.summary {
|
||||||
|
padding: 2px;
|
||||||
|
border-bottom: 1px solid #dfe6ec;
|
||||||
|
border-left: 1px solid #dfe6ec;
|
||||||
|
border-right: 1px solid #dfe6ec;
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
padding: 3px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<ConfigDishes
|
<ConfigDishes
|
||||||
v-show="active === 1"
|
v-show="active === 1"
|
||||||
v-bind="selDishes"
|
v-bind="selDishes"
|
||||||
:typeOptions="typeOptions"
|
:typeOptions="dishesTypeOptions"
|
||||||
@onChange="handleOnConfigChange"
|
@onChange="handleOnConfigChange"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -65,7 +65,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
active: 0,
|
active: 0,
|
||||||
typeOptions: [],
|
dishesTypeOptions: [],
|
||||||
selDishes: {
|
selDishes: {
|
||||||
name: "",
|
name: "",
|
||||||
type: "",
|
type: "",
|
||||||
@ -76,7 +76,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["dishesTypeOptions"]),
|
...mapState(["typeOptions"]),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showDrawer() {
|
showDrawer() {
|
||||||
@ -95,11 +95,11 @@ export default {
|
|||||||
// console.log(data);
|
// console.log(data);
|
||||||
this.selDishes = data;
|
this.selDishes = data;
|
||||||
this.active = 1;
|
this.active = 1;
|
||||||
this.typeOptions = data.type.split(",").reduce((arr, cur, idx) => {
|
this.dishesTypeOptions = data.type.split(",").reduce((arr, cur, idx) => {
|
||||||
if (idx === 0) {
|
if (idx === 0) {
|
||||||
this.selDishes.type = cur;
|
this.selDishes.type = cur;
|
||||||
}
|
}
|
||||||
const tarOpt = this.dishesTypeOptions.find(
|
const tarOpt = this.typeOptions.find(
|
||||||
(obj) => obj.dictValue === cur
|
(obj) => obj.dictValue === cur
|
||||||
);
|
);
|
||||||
if (tarOpt) {
|
if (tarOpt) {
|
||||||
|
@ -24,8 +24,8 @@ const {
|
|||||||
mapGetters,
|
mapGetters,
|
||||||
} = createNamespacedHelpers("recipes");
|
} = createNamespacedHelpers("recipes");
|
||||||
|
|
||||||
import HealthyView from "./HealthyView";
|
import HealthyView from "@/components/HealthyView";
|
||||||
import BodySignView from "./BodySignView";
|
import BodySignView from "@/components/BodySignView";
|
||||||
import RecipesView from "./RecipesView/index";
|
import RecipesView from "./RecipesView/index";
|
||||||
import RecommondView from "./RecommondView";
|
import RecommondView from "./RecommondView";
|
||||||
|
|
||||||
|
@ -0,0 +1,87 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="visible"
|
||||||
|
:title="title"
|
||||||
|
width="80%"
|
||||||
|
top="30%"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
class="dishes_detail_dialog_wrapper"
|
||||||
|
>
|
||||||
|
<section class="section_zone">
|
||||||
|
<div class="section_title">
|
||||||
|
食材<em class="el-icon-shopping-cart-1" style="margin-left: 8px" />
|
||||||
|
</div>
|
||||||
|
<div v-for="igd in data.igdList" :key="igd.id" class="igd_item">
|
||||||
|
<span>{{ igd.name }}</span>
|
||||||
|
<span class="cusstr_style">
|
||||||
|
<span>{{ igd.cusStr }}</span>
|
||||||
|
<span>{{ igd.weight }}克</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="section_zone">
|
||||||
|
<div class="section_title">
|
||||||
|
做法<em class="el-icon-dish" style="margin-left: 8px" />
|
||||||
|
</div>
|
||||||
|
<div class="methods">{{ data.methods }}</div>
|
||||||
|
</section>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "dishesDetailDialog",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
data: {},
|
||||||
|
title: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showDialog(data) {
|
||||||
|
if (!data || !data.igdList.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.data = data;
|
||||||
|
this.visible = true;
|
||||||
|
this.title = `${data.name}`;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.dishes_detail_dialog_wrapper {
|
||||||
|
.section_zone {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
.section_title {
|
||||||
|
color: #262626;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.igd_item {
|
||||||
|
height: 32px;
|
||||||
|
padding: 0 8px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #dfe6ec;
|
||||||
|
|
||||||
|
.cusstr_style {
|
||||||
|
width: 40%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.methods {
|
||||||
|
padding: 0 8px;
|
||||||
|
margin-top: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="scss">
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 12px 18px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,159 @@
|
|||||||
|
<template>
|
||||||
|
<div class="nutri_compute_com_wrapper">
|
||||||
|
<div class="header">{{ date }}</div>
|
||||||
|
<div class="content">
|
||||||
|
<section class="left">
|
||||||
|
<div style="font-size: 18px">营养分析</div>
|
||||||
|
<div class="total">
|
||||||
|
<div>总热量约等于</div>
|
||||||
|
<div>{{ totalHeat }}千卡</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="right">
|
||||||
|
<table class="my_table" border="1">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>蛋白质</th>
|
||||||
|
<th>脂肪</th>
|
||||||
|
<th>碳水</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 12px">摄入量</td>
|
||||||
|
<td>{{ pWeight }}</td>
|
||||||
|
<td>{{ fWeight }}</td>
|
||||||
|
<td>{{ cWeight }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="font-size: 12px">供能比</td>
|
||||||
|
<td>{{ pRate }}</td>
|
||||||
|
<td>{{ fRate }}</td>
|
||||||
|
<td>{{ cRate }}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="mask" />
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "nutriComputeCom",
|
||||||
|
props: ["date", "value"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
totalHeat: 0,
|
||||||
|
pWeight: "0克",
|
||||||
|
fWeight: "0克",
|
||||||
|
cWeight: "0克",
|
||||||
|
pRate: "0%",
|
||||||
|
fRate: "0%",
|
||||||
|
cRate: "0%",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
if (!val || !val.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let pWeight = 0,
|
||||||
|
fWeight = 0,
|
||||||
|
cWeight = 0;
|
||||||
|
|
||||||
|
val.forEach((dishes) => {
|
||||||
|
dishes.igdList.forEach((igd) => {
|
||||||
|
pWeight += (igd.proteinRatio * igd.weight) / 100;
|
||||||
|
fWeight += (igd.fatRatio * igd.weight) / 100;
|
||||||
|
cWeight += (igd.carbonRatio * igd.weight) / 100;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.totalHeat = (pWeight * 4 + fWeight * 9 + cWeight * 4).toFixed(1);
|
||||||
|
this.pWeight = pWeight.toFixed(1) + "克";
|
||||||
|
this.fWeight = fWeight.toFixed(1) + "克";
|
||||||
|
this.cWeight = cWeight.toFixed(1) + "克";
|
||||||
|
this.pRate = (((pWeight * 4) / this.totalHeat) * 100).toFixed(2) + "%";
|
||||||
|
this.fRate = (((fWeight * 9) / this.totalHeat) * 100).toFixed(2) + "%";
|
||||||
|
this.cRate = (((cWeight * 4) / this.totalHeat) * 100).toFixed(2) + "%";
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.nutri_compute_com_wrapper {
|
||||||
|
padding: 10px 14px;
|
||||||
|
background: #409eff;
|
||||||
|
border-radius: 4px;
|
||||||
|
color: white;
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
padding-top: 10px;
|
||||||
|
& > div:nth-child(1) {
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 16px;
|
||||||
|
border: 1px solid white;
|
||||||
|
padding: 8px 16px;
|
||||||
|
|
||||||
|
& > div:nth-child(1) {
|
||||||
|
font-size: 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
flex: 2;
|
||||||
|
border: 1px solid white;
|
||||||
|
margin-left: 10px;
|
||||||
|
padding: 4px;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.my_table {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-spacing: 0;
|
||||||
|
border: 1px solid white;
|
||||||
|
border-collapse: collapse;
|
||||||
|
table-layout: fixed;
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-size: 12px;
|
||||||
|
text-align: center;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
font-size: 10px;
|
||||||
|
text-align: center;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.mask {
|
||||||
|
position: absolute;
|
||||||
|
width: calc(100% - 8px);
|
||||||
|
height: calc(100% - 8px);
|
||||||
|
top: 4px;
|
||||||
|
border: 1px solid #409eff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
141
stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
Normal file
141
stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<template>
|
||||||
|
<div class="menu_detail_wrapper">
|
||||||
|
<!-- 营养分析 -->
|
||||||
|
<NutriComputeCom :date="date" :value="value" />
|
||||||
|
<!-- 食谱详细 -->
|
||||||
|
<el-card v-for="obj in menus" :key="obj.type" style="margin-top: 12px">
|
||||||
|
<div slot="header">
|
||||||
|
<span>{{ obj.typeName }}</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="mObj in obj.values" :key="mObj.id">
|
||||||
|
<div class="dishes_item">
|
||||||
|
<div v-if="!mObj.methods" class="simple_dishes">
|
||||||
|
<span>{{ mObj.name }}</span>
|
||||||
|
<span class="weight_style">
|
||||||
|
<span style="margin-right: 20px">{{ mObj.cusStr }}</span>
|
||||||
|
<span>{{ mObj.weight }}克</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div v-else class="complex_dishes" @click="handleOnDetailClick(mObj)">
|
||||||
|
<span>{{ mObj.name }}</span>
|
||||||
|
<em class="el-icon-arrow-right" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<!-- 复杂菜品展示 -->
|
||||||
|
<DishesDetailDialog ref="detailDialogRef" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import NutriComputeCom from "./NutriComputeCom";
|
||||||
|
import DishesDetailDialog from "./DishesDetailDialog";
|
||||||
|
export default {
|
||||||
|
name: "menuDetail",
|
||||||
|
props: ["value", "date"],
|
||||||
|
components: {
|
||||||
|
NutriComputeCom,
|
||||||
|
DishesDetailDialog,
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getDicts("cus_cus_unit").then((response) => {
|
||||||
|
this.curUnitDict = response.data.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
|
this.getDicts("cus_cus_weight").then((response) => {
|
||||||
|
this.cusWeightDict = response.data.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
|
this.getDicts("cus_dishes_type").then((response) => {
|
||||||
|
this.menuTypeDict = response.data.reduce((obj, cur) => {
|
||||||
|
obj[cur.dictValue] = cur.dictLabel;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
menuTypeDict: {},
|
||||||
|
curUnitDict: {},
|
||||||
|
cusWeightDict: {},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
menus() {
|
||||||
|
const mData = this.value.reduce((obj, cur) => {
|
||||||
|
if (!obj[cur.type]) {
|
||||||
|
obj[cur.type] = [];
|
||||||
|
}
|
||||||
|
let tarMenu = cur;
|
||||||
|
if (!tarMenu.methods && tarMenu.igdList.length === 1) {
|
||||||
|
tarMenu = tarMenu.igdList[0];
|
||||||
|
tarMenu.cusStr = `${this.cusWeightDict[tarMenu.cusWeight] || ""}${
|
||||||
|
this.curUnitDict[tarMenu.cusUnit] || ""
|
||||||
|
}`;
|
||||||
|
} else {
|
||||||
|
tarMenu.igdList.forEach((igd) => {
|
||||||
|
igd.cusStr = `${this.cusWeightDict[igd.cusWeight] || ""}${
|
||||||
|
this.curUnitDict[igd.cusUnit] || ""
|
||||||
|
}`;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
obj[cur.type].push(tarMenu);
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
const mMenus = Object.keys(mData).map((type) => ({
|
||||||
|
type,
|
||||||
|
typeName: this.menuTypeDict[type],
|
||||||
|
values: mData[type],
|
||||||
|
}));
|
||||||
|
console.log(mMenus);
|
||||||
|
return mMenus;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleOnDetailClick(data) {
|
||||||
|
this.$refs["detailDialogRef"].showDialog(data);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.menu_detail_wrapper {
|
||||||
|
padding: 0 12px 12px 12px;
|
||||||
|
|
||||||
|
.dishes_item {
|
||||||
|
height: 38px;
|
||||||
|
padding: 0 8px;
|
||||||
|
border-bottom: 1px solid #dfe6ec;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
background: #409eff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.simple_dishes {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.weight_style {
|
||||||
|
width: 40%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.complex_dishes {
|
||||||
|
display: flex;
|
||||||
|
height: 100%;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
120
stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue
Normal file
120
stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:visible.sync="visible"
|
||||||
|
:with-header="false"
|
||||||
|
direction="ltr"
|
||||||
|
size="60%"
|
||||||
|
class="plan_drawer_wrapper"
|
||||||
|
>
|
||||||
|
<div class="header">
|
||||||
|
<span>食谱列表</span>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<el-collapse v-model="curPlanId" accordion>
|
||||||
|
<el-collapse-item
|
||||||
|
v-for="plan in data"
|
||||||
|
:key="plan.id"
|
||||||
|
:title="plan.label"
|
||||||
|
:name="plan.id"
|
||||||
|
:class="plan.id === hitPlanId ? 'collapse_item_hit' : ''"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-for="menu in plan.menus"
|
||||||
|
:class="`item ${menu.id === curMenuId ? 'sel_item' : ''}`"
|
||||||
|
:key="menu.id"
|
||||||
|
@click="handleOnCurrentChange(plan.id, menu)"
|
||||||
|
>
|
||||||
|
<div class="item_content">
|
||||||
|
{{ menu.date }}
|
||||||
|
<em class="el-icon-arrow-right" style="font-weight: bold" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-collapse-item>
|
||||||
|
</el-collapse>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "planDrawer",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
curPlanId: 0,
|
||||||
|
curMenuId: 0,
|
||||||
|
hitPlanId: 0,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: ["data", "planId", "menuId"],
|
||||||
|
methods: {
|
||||||
|
showDrawer() {
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
handleOnCurrentChange(planId, menu) {
|
||||||
|
// console.log({ planId, menuId });
|
||||||
|
this.hitPlanId = planId;
|
||||||
|
this.visible = false;
|
||||||
|
this.curMenuId = menu.id;
|
||||||
|
this.curPlanId = planId;
|
||||||
|
|
||||||
|
this.$emit("plan-change", menu);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
planId(val) {
|
||||||
|
this.curPlanId = val;
|
||||||
|
this.hitPlanId = val;
|
||||||
|
},
|
||||||
|
menuId(val) {
|
||||||
|
this.curMenuId = val;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.plan_drawer_wrapper {
|
||||||
|
.header {
|
||||||
|
padding: 2px 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: calc(100vh - 44px);
|
||||||
|
padding: 12px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
font-size: 14px;
|
||||||
|
height: 36px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item_content {
|
||||||
|
display: flex;
|
||||||
|
padding: 2px 8px 2px 24px;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sel_item {
|
||||||
|
background: #409eff;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.collapse_item_hit .el-collapse-item__header {
|
||||||
|
color: #409eff;
|
||||||
|
}
|
||||||
|
.el-collapse-item__header.focusing {
|
||||||
|
color: unset !important;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,84 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
:visible.sync="visible"
|
||||||
|
:with-header="false"
|
||||||
|
size="100%"
|
||||||
|
class="user_info_drawer_wrapper"
|
||||||
|
>
|
||||||
|
<div class="header">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-back"
|
||||||
|
@click="handleOnBackClick"
|
||||||
|
class="icon_btn"
|
||||||
|
/>
|
||||||
|
<span>个人信息</span>
|
||||||
|
<span class="hold" />
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<HealthView v-if="healthyData.type === 0" :data="healthyData.data" />
|
||||||
|
<BodySignView v-else :data="healthyData.data" />
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import HealthView from "@/components/HealthyView";
|
||||||
|
import BodySignView from "@/components/BodySignView";
|
||||||
|
export default {
|
||||||
|
name: "UserInfoDrawer",
|
||||||
|
props: {
|
||||||
|
healthyData: {
|
||||||
|
type: Object,
|
||||||
|
default: {
|
||||||
|
type: 0,
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
BodySignView,
|
||||||
|
HealthView,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showDrawer() {
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
handleOnBackClick() {
|
||||||
|
this.visible = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.user_info_drawer_wrapper {
|
||||||
|
.header {
|
||||||
|
padding: 2px 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 44px;
|
||||||
|
|
||||||
|
.icon_btn {
|
||||||
|
font-size: 24px;
|
||||||
|
padding: 6px;
|
||||||
|
color: #696969;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hold {
|
||||||
|
display: block;
|
||||||
|
width: 39px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: 20px;
|
||||||
|
height: calc(100vh - 44px);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
161
stdiet-ui/src/views/custom/recipesShow/index.vue
Normal file
161
stdiet-ui/src/views/custom/recipesShow/index.vue
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
<template>
|
||||||
|
<div class="recipes_show_wrapper">
|
||||||
|
<div class="header">
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-date"
|
||||||
|
type="text"
|
||||||
|
class="icon_btn"
|
||||||
|
@click="handleOnPlanClick"
|
||||||
|
/>
|
||||||
|
<img :src="logo" style="width: auto; height: 32px" alt="logo" />
|
||||||
|
<el-button
|
||||||
|
icon="el-icon-user"
|
||||||
|
type="text"
|
||||||
|
class="icon_btn"
|
||||||
|
@click="handleUserInfoClick"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="content" v-loading="loading">
|
||||||
|
<MenuDetail :value="menuData" :date="curDate" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 食谱计划 -->
|
||||||
|
<PlanDrawer
|
||||||
|
ref="planRef"
|
||||||
|
:data="planList"
|
||||||
|
:planId="curPlanId"
|
||||||
|
:menuId="curMenuId"
|
||||||
|
@plan-change="handleOnPlanChange"
|
||||||
|
/>
|
||||||
|
<!-- 用户信息 -->
|
||||||
|
<UserInfoDrawer ref="userInfoRef" :healthyData="healthyData" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getRecipesPlans,
|
||||||
|
getHealthyInfo,
|
||||||
|
getRecipesMenuInfoApi,
|
||||||
|
} from "@/api/custom/recipesShow";
|
||||||
|
import { dealHealthy } from "@/utils/healthyData";
|
||||||
|
import UserInfoDrawer from "./UserInfoDrawer";
|
||||||
|
import PlanDrawer from "./PlanDrawer";
|
||||||
|
import MenuDetail from "./MenuDetail";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { getProcessMenuData } from "./utils";
|
||||||
|
export default {
|
||||||
|
name: "recipesShow",
|
||||||
|
components: {
|
||||||
|
UserInfoDrawer,
|
||||||
|
PlanDrawer,
|
||||||
|
MenuDetail,
|
||||||
|
},
|
||||||
|
props: ["id"],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
logo: require("@/assets/logo/st_logo.png"),
|
||||||
|
planList: [],
|
||||||
|
curPlanId: 0,
|
||||||
|
curMenuId: 0,
|
||||||
|
curDate: "",
|
||||||
|
loading: false,
|
||||||
|
healthyData: {
|
||||||
|
type: 0,
|
||||||
|
data: {},
|
||||||
|
},
|
||||||
|
menuData: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
getRecipesPlans(this.id).then((response) => {
|
||||||
|
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,
|
||||||
|
}));
|
||||||
|
if (!curMenuId) {
|
||||||
|
curMenuId = this.planList[0].menus[0].id;
|
||||||
|
curPlanId = this.planList[0].id;
|
||||||
|
curDate = this.planList[0].menus[0].date;
|
||||||
|
}
|
||||||
|
this.curMenuId = curMenuId;
|
||||||
|
this.curPlanId = curPlanId;
|
||||||
|
this.curDate = curDate;
|
||||||
|
|
||||||
|
this.fetchRecipesInfo(this.curMenuId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getHealthyInfo(this.id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.healthyData = {
|
||||||
|
type: response.data.type,
|
||||||
|
data: dealHealthy(response.data.customerHealthy),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleOnPlanClick() {
|
||||||
|
this.$refs["planRef"].showDrawer();
|
||||||
|
},
|
||||||
|
handleUserInfoClick() {
|
||||||
|
this.$refs["userInfoRef"].showDrawer();
|
||||||
|
},
|
||||||
|
fetchRecipesInfo(id) {
|
||||||
|
this.loading = true;
|
||||||
|
getRecipesMenuInfoApi(id).then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.loading = false;
|
||||||
|
this.menuData = getProcessMenuData(response.data);
|
||||||
|
console.log(this.menuData);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleOnPlanChange({ date, id }) {
|
||||||
|
this.curDate = date;
|
||||||
|
this.fetchRecipesInfo(id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.recipes_show_wrapper {
|
||||||
|
height: 100vh;
|
||||||
|
|
||||||
|
.header {
|
||||||
|
padding: 2px 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
height: 44px;
|
||||||
|
|
||||||
|
.icon_btn {
|
||||||
|
font-size: 24px;
|
||||||
|
padding: 6px;
|
||||||
|
color: #696969;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: calc(100vh - 44px);
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
42
stdiet-ui/src/views/custom/recipesShow/utils.js
Normal file
42
stdiet-ui/src/views/custom/recipesShow/utils.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
export function getProcessMenuData(menuData) {
|
||||||
|
return menuData.reduce((arr, cur) => {
|
||||||
|
if (
|
||||||
|
cur.dishesId > -1 &&
|
||||||
|
cur.name &&
|
||||||
|
cur.igdList.length > 0 &&
|
||||||
|
cur.type !== "0"
|
||||||
|
) {
|
||||||
|
arr.push({
|
||||||
|
id: cur.id,
|
||||||
|
dishesId: cur.dishesId,
|
||||||
|
name: cur.name,
|
||||||
|
menuId: cur.menuId,
|
||||||
|
methods: cur.methods,
|
||||||
|
type: cur.type,
|
||||||
|
isMain: cur.isMain,
|
||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return igdArr;
|
||||||
|
}, [])
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}, []);
|
||||||
|
}
|
@ -1,14 +1,25 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
<div style="padding: 5px; text-align: center">
|
<div style="padding: 5px; text-align: center">
|
||||||
<img :src="logo" style="width: 150px; height: 35px" alt="logo" />
|
<img :src="logo" style="width: auto; height: 35px" alt="logo" />
|
||||||
</div>
|
</div>
|
||||||
<div style="margin: 10px 15px 10px 15px;" >
|
<div style="margin: 10px 15px 10px 15px">
|
||||||
<el-steps :active="stepActive" finish-status="success">
|
<el-steps :active="stepActive" finish-status="success">
|
||||||
<el-step v-for="(item,index) in stepArray" title=""></el-step>
|
<el-step
|
||||||
|
v-for="(item, index) in stepArray"
|
||||||
|
:key="index"
|
||||||
|
title=""
|
||||||
|
></el-step>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
</div>
|
</div>
|
||||||
<el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px">
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
label-position="top"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="100px"
|
||||||
|
style="padding: 16px"
|
||||||
|
>
|
||||||
<healthy-form1 v-show="stepArray[0]" :form.sync="form"></healthy-form1>
|
<healthy-form1 v-show="stepArray[0]" :form.sync="form"></healthy-form1>
|
||||||
<healthy-form2 v-show="stepArray[1]" :form.sync="form"></healthy-form2>
|
<healthy-form2 v-show="stepArray[1]" :form.sync="form"></healthy-form2>
|
||||||
<healthy-form3 v-show="stepArray[2]" :form.sync="form"></healthy-form3>
|
<healthy-form3 v-show="stepArray[2]" :form.sync="form"></healthy-form3>
|
||||||
@ -17,17 +28,44 @@
|
|||||||
<healthy-form6 v-show="stepArray[5]" :form.sync="form"></healthy-form6>
|
<healthy-form6 v-show="stepArray[5]" :form.sync="form"></healthy-form6>
|
||||||
<healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7>
|
<healthy-form7 v-show="stepArray[6]" :form.sync="form"></healthy-form7>
|
||||||
<healthy-form8 v-show="stepArray[7]" :form.sync="form"></healthy-form8>
|
<healthy-form8 v-show="stepArray[7]" :form.sync="form"></healthy-form8>
|
||||||
<healthy-form9 v-show="stepArray[8]" ref="fileForm" @addOrEditHealthy="addCustomerHealthy()" :form.sync="form"></healthy-form9>
|
<healthy-form9
|
||||||
<el-form-item style="text-align: center; margin: 30px auto" >
|
v-show="stepArray[8]"
|
||||||
<el-button @click="nextStep(-1)" style="margin-right: 10px;width: 40%" v-show="stepActive != 0">上一步</el-button>
|
ref="fileForm"
|
||||||
<el-button type="primary" @click="nextStep(1)" style="width: 40%" v-show="stepActive != stepArray.length-1">下一步</el-button>
|
@addOrEditHealthy="addCustomerHealthy()"
|
||||||
<el-button type="primary" @click="submit()" style="width: 40%" v-show="stepActive == stepArray.length-1">提交数据</el-button>
|
:form.sync="form"
|
||||||
|
></healthy-form9>
|
||||||
|
<el-form-item style="text-align: center; margin: 30px auto">
|
||||||
|
<el-button
|
||||||
|
@click="nextStep(-1)"
|
||||||
|
style="margin-right: 10px; width: 40%"
|
||||||
|
v-show="stepActive != 0"
|
||||||
|
>上一步</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="nextStep(1)"
|
||||||
|
style="width: 40%"
|
||||||
|
v-show="stepActive != stepArray.length - 1"
|
||||||
|
>下一步</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="submit()"
|
||||||
|
style="width: 40%"
|
||||||
|
v-show="stepActive == stepArray.length - 1"
|
||||||
|
>提交数据</el-button
|
||||||
|
>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getDictData,addCustomerHealthy,physicalSignsList,getCustomerBaseMessage } from "@/api/custom/customerInvestigation";
|
import {
|
||||||
|
getDictData,
|
||||||
|
addCustomerHealthy,
|
||||||
|
physicalSignsList,
|
||||||
|
getCustomerBaseMessage,
|
||||||
|
} from "@/api/custom/customerInvestigation";
|
||||||
import * as healthyData from "@/utils/healthyData";
|
import * as healthyData from "@/utils/healthyData";
|
||||||
const logo = require("@/assets/logo/st_logo.png");
|
const logo = require("@/assets/logo/st_logo.png");
|
||||||
import Form1 from "@/components/HealthyForm/Form1";
|
import Form1 from "@/components/HealthyForm/Form1";
|
||||||
@ -44,11 +82,11 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
//客户是否存在标识
|
//客户是否存在标识
|
||||||
customerExistFlag:false,
|
customerExistFlag: false,
|
||||||
healthyData:healthyData,
|
healthyData: healthyData,
|
||||||
logo,
|
logo,
|
||||||
submitFlag: false,
|
submitFlag: false,
|
||||||
stepArray: [true,false,false,false,false,false,false,false,false],
|
stepArray: [true, false, false, false, false, false, false, false, false],
|
||||||
stepActive: 0,
|
stepActive: 0,
|
||||||
form: {
|
form: {
|
||||||
customerEncId: null,
|
customerEncId: null,
|
||||||
@ -59,23 +97,23 @@ export default {
|
|||||||
age: null,
|
age: null,
|
||||||
tall: null,
|
tall: null,
|
||||||
weight: null,
|
weight: null,
|
||||||
condiment:["1","2","3"],
|
condiment: ["1", "2", "3"],
|
||||||
otherCondiment:null,
|
otherCondiment: null,
|
||||||
cookingStyle: ["8","9","4","11"],
|
cookingStyle: ["8", "9", "4", "11"],
|
||||||
cookingStyleRate:[1,1,1,1,1,1],
|
cookingStyleRate: [1, 1, 1, 1, 1, 1],
|
||||||
washVegetablesStyle:["2"],
|
washVegetablesStyle: ["2"],
|
||||||
otherWashVegetablesStyle: null,
|
otherWashVegetablesStyle: null,
|
||||||
breakfastType:"2",
|
breakfastType: "2",
|
||||||
breakfastFood: null,
|
breakfastFood: null,
|
||||||
lunchType:["3"],
|
lunchType: ["3"],
|
||||||
dinner:["2"],
|
dinner: ["2"],
|
||||||
vegetableRate: 5,
|
vegetableRate: 5,
|
||||||
commonMeat: null,
|
commonMeat: null,
|
||||||
dinnerTime: "19:00",
|
dinnerTime: "19:00",
|
||||||
supperNum:1,
|
supperNum: 1,
|
||||||
supperFood:null,
|
supperFood: null,
|
||||||
dietHotAndCold: "3",
|
dietHotAndCold: "3",
|
||||||
dietFlavor: ["1","2"],
|
dietFlavor: ["1", "2"],
|
||||||
vegetablesNum: 1,
|
vegetablesNum: 1,
|
||||||
vegetablesRateType: "3",
|
vegetablesRateType: "3",
|
||||||
fruitsNum: 1,
|
fruitsNum: 1,
|
||||||
@ -85,28 +123,28 @@ export default {
|
|||||||
riceFull: 8,
|
riceFull: 8,
|
||||||
eatingSpeed: "3",
|
eatingSpeed: "3",
|
||||||
snacks: ["1"],
|
snacks: ["1"],
|
||||||
otherSnacks:null,
|
otherSnacks: null,
|
||||||
healthProductsFlag: 0,
|
healthProductsFlag: 0,
|
||||||
healthProductsBrand:null,
|
healthProductsBrand: null,
|
||||||
healthProductsName: null,
|
healthProductsName: null,
|
||||||
healthProductsWeekRate:0,
|
healthProductsWeekRate: 0,
|
||||||
healthProductsDayRate:0,
|
healthProductsDayRate: 0,
|
||||||
|
|
||||||
waterNum: 1500,
|
waterNum: 1500,
|
||||||
waterType: ["3"],
|
waterType: ["3"],
|
||||||
waterHabit: ["5"],
|
waterHabit: ["5"],
|
||||||
drinksNum:[0,0,0,0,0,0,0,0],
|
drinksNum: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
drinkWineFlag: "3",
|
drinkWineFlag: "3",
|
||||||
drinkWineClassify:["3"],
|
drinkWineClassify: ["3"],
|
||||||
otherWineClassify: null,
|
otherWineClassify: null,
|
||||||
drinkWineAmount:[0,0,0],
|
drinkWineAmount: [0, 0, 0],
|
||||||
smokeFlag: 0,
|
smokeFlag: 0,
|
||||||
smokeRate:[0,0,0],
|
smokeRate: [0, 0, 0],
|
||||||
secondSmoke: 0,
|
secondSmoke: 0,
|
||||||
workIndustry: null,
|
workIndustry: null,
|
||||||
workType:["2"],
|
workType: ["2"],
|
||||||
defecationNum: 1,
|
defecationNum: 1,
|
||||||
otherDefecationNum:0,
|
otherDefecationNum: 0,
|
||||||
defecationTime: ["1"],
|
defecationTime: ["1"],
|
||||||
defecationShape: null,
|
defecationShape: null,
|
||||||
defecationSmell: null,
|
defecationSmell: null,
|
||||||
@ -117,46 +155,46 @@ export default {
|
|||||||
motionDuration: 40,
|
motionDuration: 40,
|
||||||
motionTime: "08:00",
|
motionTime: "08:00",
|
||||||
//motionMode:"有氧",
|
//motionMode:"有氧",
|
||||||
aerobicMotionClassify:["2"],
|
aerobicMotionClassify: ["2"],
|
||||||
anaerobicMotionClassify:[],
|
anaerobicMotionClassify: [],
|
||||||
anaerobicAerobicMotionClassify:[],
|
anaerobicAerobicMotionClassify: [],
|
||||||
otherMotionClassify: null,
|
otherMotionClassify: null,
|
||||||
motionField:["1"],
|
motionField: ["1"],
|
||||||
otherMotionField:null,
|
otherMotionField: null,
|
||||||
|
|
||||||
sleepTime: "23:00",
|
sleepTime: "23:00",
|
||||||
sleepQuality:["2"],
|
sleepQuality: ["2"],
|
||||||
sleepDrugFlag: 0,
|
sleepDrugFlag: 0,
|
||||||
sleepDrug: null,
|
sleepDrug: null,
|
||||||
stayupLateFlag: 0,
|
stayupLateFlag: 0,
|
||||||
stayupLateWeekNum: 0,
|
stayupLateWeekNum: 0,
|
||||||
|
|
||||||
physicalSignsId:[],
|
physicalSignsId: [],
|
||||||
otherPhysicalSigns: null,
|
otherPhysicalSigns: null,
|
||||||
bloodData:[],
|
bloodData: [],
|
||||||
moistureDate:[],
|
moistureDate: [],
|
||||||
familyIllnessHistory:[],
|
familyIllnessHistory: [],
|
||||||
otherFamilyIllnessHistory:null,
|
otherFamilyIllnessHistory: null,
|
||||||
operationHistory:[],
|
operationHistory: [],
|
||||||
otherOperationHistory:null,
|
otherOperationHistory: null,
|
||||||
nearOperationFlag:0,
|
nearOperationFlag: 0,
|
||||||
recoveryeSituation:null,
|
recoveryeSituation: null,
|
||||||
longEatDrugFlag:0,
|
longEatDrugFlag: 0,
|
||||||
longEatDrugClassify:[],
|
longEatDrugClassify: [],
|
||||||
otherLongEatDrugClassify:null,
|
otherLongEatDrugClassify: null,
|
||||||
allergyFlag: 0,
|
allergyFlag: 0,
|
||||||
allergySituation: null,
|
allergySituation: null,
|
||||||
allergen:[],
|
allergen: [],
|
||||||
otherAllergen:null,
|
otherAllergen: null,
|
||||||
medicalReport:[],
|
medicalReport: [],
|
||||||
medicalReportName:[],
|
medicalReportName: [],
|
||||||
position:0,
|
position: 0,
|
||||||
experience: null,
|
experience: null,
|
||||||
rebound: 1,
|
rebound: 1,
|
||||||
difficulty:null,
|
difficulty: null,
|
||||||
crux:1,
|
crux: 1,
|
||||||
dishesIngredient:null,
|
dishesIngredient: null,
|
||||||
makeFoodType:3
|
makeFoodType: 3,
|
||||||
},
|
},
|
||||||
timer: null,
|
timer: null,
|
||||||
rules: {
|
rules: {
|
||||||
@ -188,45 +226,47 @@ export default {
|
|||||||
message: "体重格式不正确",
|
message: "体重格式不正确",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
conditioningProjectId:[
|
conditioningProjectId: [
|
||||||
{ required: true, trigger: "blur", message: "请选择调理项目" }
|
{ required: true, trigger: "blur", message: "请选择调理项目" },
|
||||||
],
|
],
|
||||||
position:[
|
position: [
|
||||||
{ required: true, trigger: "blur", message: "请选择地理位置" }
|
{ required: true, trigger: "blur", message: "请选择地理位置" },
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'healthy-form1': Form1,
|
"healthy-form1": Form1,
|
||||||
'healthy-form2': Form2,
|
"healthy-form2": Form2,
|
||||||
'healthy-form3': Form3,
|
"healthy-form3": Form3,
|
||||||
'healthy-form4': Form4,
|
"healthy-form4": Form4,
|
||||||
'healthy-form5': Form5,
|
"healthy-form5": Form5,
|
||||||
'healthy-form6': Form6,
|
"healthy-form6": Form6,
|
||||||
'healthy-form7': Form7,
|
"healthy-form7": Form7,
|
||||||
'healthy-form8': Form8,
|
"healthy-form8": Form8,
|
||||||
'healthy-form9': Form9,
|
"healthy-form9": Form9,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//根据用户ID获取用户基本信息(手机号、姓名)
|
//根据用户ID获取用户基本信息(手机号、姓名)
|
||||||
getCustomerBase(id){
|
getCustomerBase(id) {
|
||||||
if(id == null || id == undefined){
|
if (id == null || id == undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getCustomerBaseMessage(id).then((response) => {
|
getCustomerBaseMessage(id)
|
||||||
|
.then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
if(response.data){
|
if (response.data) {
|
||||||
this.customerExistFlag = true;
|
this.customerExistFlag = true;
|
||||||
this.form.name = response.data.name;
|
this.form.name = response.data.name;
|
||||||
this.form.phone = response.data.phone;
|
this.form.phone = response.data.phone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(function() {
|
})
|
||||||
|
.catch(function () {
|
||||||
console.log("error");
|
console.log("error");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
submit(){
|
submit() {
|
||||||
if (this.submitFlag) {
|
if (this.submitFlag) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: "请勿重复提交,1分钟后重试",
|
message: "请勿重复提交,1分钟后重试",
|
||||||
@ -237,7 +277,7 @@ export default {
|
|||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.submitFlag = true;
|
this.submitFlag = true;
|
||||||
this.timer = setTimeout(this.fail,1000*60);
|
this.timer = setTimeout(this.fail, 1000 * 60);
|
||||||
this.$refs.fileForm.uploadFile();
|
this.$refs.fileForm.uploadFile();
|
||||||
} else {
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
@ -247,13 +287,15 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addCustomerHealthy(){
|
addCustomerHealthy() {
|
||||||
//数据处理
|
//数据处理
|
||||||
let cusMessage = Object.assign({}, this.form);
|
let cusMessage = Object.assign({}, this.form);
|
||||||
this.healthyData['arrayName'].forEach(function (item, index) {
|
this.healthyData["arrayName"].forEach(function (item, index) {
|
||||||
cusMessage[item] = cusMessage[item] != null ? cusMessage[item].join(",") : null;
|
cusMessage[item] =
|
||||||
|
cusMessage[item] != null ? cusMessage[item].join(",") : null;
|
||||||
});
|
});
|
||||||
addCustomerHealthy(cusMessage).then((response) => {
|
addCustomerHealthy(cusMessage)
|
||||||
|
.then((response) => {
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: "提交成功",
|
title: "提交成功",
|
||||||
@ -261,26 +303,27 @@ export default {
|
|||||||
type: "success",
|
type: "success",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).catch(function() {
|
})
|
||||||
|
.catch(function () {
|
||||||
console.log("error");
|
console.log("error");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fail(){
|
fail() {
|
||||||
// console.log("定时--------");
|
// console.log("定时--------");
|
||||||
this.submitFlag = false;
|
this.submitFlag = false;
|
||||||
},
|
},
|
||||||
nextStep(step){
|
nextStep(step) {
|
||||||
if(!this.customerExistFlag){
|
if (!this.customerExistFlag) {
|
||||||
this.$message.error('客户不存在');
|
this.$message.error("客户不存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if(valid || step < 0){
|
if (valid || step < 0) {
|
||||||
this.stepArray[this.stepActive] = false;
|
this.stepArray[this.stepActive] = false;
|
||||||
this.stepActive = this.stepActive + step;
|
this.stepActive = this.stepActive + step;
|
||||||
this.stepArray[this.stepActive] = true;
|
this.stepArray[this.stepActive] = true;
|
||||||
this.goTop();
|
this.goTop();
|
||||||
}else{
|
} else {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: "数据未填写完整",
|
message: "数据未填写完整",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@ -288,10 +331,9 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goTop (){
|
goTop() {
|
||||||
window.scroll(0, 0);
|
window.scroll(0, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.form.customerEncId = this.$route.params.id;
|
this.form.customerEncId = this.$route.params.id;
|
||||||
@ -304,45 +346,42 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.el-form-item {
|
||||||
.el-form-item {
|
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.p_title_1{
|
.p_title_1 {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
.p_title_2{
|
.p_title_2 {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
.p_title_3{
|
.p_title_3 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
.margin-left{
|
.margin-left {
|
||||||
margin-left: 14px;
|
margin-left: 14px;
|
||||||
}
|
}
|
||||||
.el-input__inner{
|
.el-input__inner {
|
||||||
width: 30%;
|
width: 30%;
|
||||||
}
|
}
|
||||||
.margin-top-10{
|
.margin-top-10 {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
.width-50-left-8-right-5{
|
.width-50-left-8-right-5 {
|
||||||
width:50%;
|
width: 50%;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
.width-70-left-8-right-5{
|
.width-70-left-8-right-5 {
|
||||||
width:70%;
|
width: 70%;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user