commit
b2feaff34a
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
SysCommisionController.javaSysOrderController.javaSysRecipesPlanModelController.javaSysRecipesTemplateController.java
stdiet-custom/src/main
java/com/stdiet/custom
domain
dto/request
mapper
SysCommisionMapper.javaSysOrderMapper.javaSysRecipesPlanModelMapper.javaSysRecipesTemplateMapper.java
service
ISysCommisionService.javaISysCommissionDayService.javaISysRecipesPlanModelService.javaISysRecipesTemplateService.java
impl
utils
resources/mapper/custom
stdiet-ui/src
api/custom
components
store/modules
utils
views/custom
@ -5,6 +5,7 @@ import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.custom.domain.SysCommissionDayDetail;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
import com.stdiet.custom.service.ISysCommissionDayService;
|
||||
import com.stdiet.framework.web.domain.server.Sys;
|
||||
import com.stdiet.system.domain.CusSalesman;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.stdiet.common.annotation.Log;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.domain.entity.SysUser;
|
||||
@ -19,6 +20,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URLDecoder;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.List;
|
||||
|
||||
@ -47,6 +49,7 @@ public class SysOrderController extends OrderBaseController {
|
||||
@GetMapping("/list")
|
||||
public OrderTableDataInfo list(SysOrder sysOrder) {
|
||||
startPage();
|
||||
dealOrderType(sysOrder);
|
||||
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
|
||||
List<SysUser> userList = userService.selectAllUser();
|
||||
BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder);
|
||||
@ -68,6 +71,20 @@ public class SysOrderController extends OrderBaseController {
|
||||
return getOrderDataTable(list, totalAmount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理订单类型
|
||||
* @param sysOrder
|
||||
*/
|
||||
private void dealOrderType(SysOrder sysOrder) {
|
||||
if(StringUtils.isNotEmpty(sysOrder.getOrderType())){
|
||||
try {
|
||||
JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(),"UTF-8"));
|
||||
sysOrder.setSearchOrderTypeArray(array.size() > 0 ? array : null);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售订单列表
|
||||
|
@ -1,68 +0,0 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱模板
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/recipes/model")
|
||||
public class SysRecipesPlanModelController extends BaseController {
|
||||
@Autowired
|
||||
private ISysRecipesPlanModelService iSysRecipesPlanModelService;
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
startPage();
|
||||
List<SysRecipesPlanModel> list = iSysRecipesPlanModelService.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesModel:edit')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return toAjax(iSysRecipesPlanModelService.insertRecipsesModel(sysRecipesPlanModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sysRecipesPlanModel
|
||||
* @return
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:list')")
|
||||
@PutMapping(value = "/update")
|
||||
public AjaxResult update(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return toAjax(iSysRecipesPlanModelService.updateRecipesModel(sysRecipesPlanModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesPlan:query')")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iSysRecipesPlanModelService.removeRecipesModel(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
71
stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesTemplateController.java
Normal file
71
stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesTemplateController.java
Normal file
@ -0,0 +1,71 @@
|
||||
package com.stdiet.web.controller.custom;
|
||||
|
||||
import com.stdiet.common.core.controller.BaseController;
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.core.page.TableDataInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱模板
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/recipes/template")
|
||||
public class SysRecipesTemplateController extends BaseController {
|
||||
@Autowired
|
||||
private ISysRecipesTemplateService iSysRecipesTemplateService;
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRecipesTemplate sysRecipesTemplate) {
|
||||
startPage();
|
||||
List<SysRecipesTemplate> list = iSysRecipesTemplateService.selectRecipesTemplateListByCondition(sysRecipesTemplate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult detail(@PathVariable Long id) {
|
||||
return AjaxResult.success(iSysRecipesTemplateService.getRecipesTemplateById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:edit')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
||||
return toAjax(iSysRecipesTemplateService.insertRecipsesTemplate(sysRecipesTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:list')")
|
||||
@PutMapping(value = "/update")
|
||||
public AjaxResult update(@RequestBody SysRecipesTemplate sysRecipesTemplate) {
|
||||
return toAjax(iSysRecipesTemplateService.updateRecipesTemplate(sysRecipesTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('recipes:recipesTemplate:query')")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
public AjaxResult delete(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iSysRecipesTemplateService.removeRecipesTemplate(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
@ -13,6 +14,7 @@ import java.math.BigDecimal;
|
||||
* @author wonder
|
||||
* @date 2020-09-24
|
||||
*/
|
||||
@Data
|
||||
public class SysCommision extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ -58,86 +60,6 @@ public class SysCommision extends BaseEntity {
|
||||
@Excel(name = "提成", scale = 2)
|
||||
private BigDecimal commision;
|
||||
|
||||
public BigDecimal getCommision() {
|
||||
return commision;
|
||||
}
|
||||
|
||||
public void setCommision(BigDecimal commision) {
|
||||
this.commision = commision;
|
||||
}
|
||||
|
||||
public Long getPostId() {
|
||||
return postId;
|
||||
}
|
||||
|
||||
public void setPostId(Long postId) {
|
||||
this.postId = postId;
|
||||
}
|
||||
|
||||
public void setPostName(String postName) {
|
||||
this.postName = postName;
|
||||
}
|
||||
|
||||
public String getPostName() {
|
||||
return postName;
|
||||
}
|
||||
|
||||
public void setRuleId(Long ruleId) {
|
||||
this.ruleId = ruleId;
|
||||
}
|
||||
|
||||
public Long getRuleId() {
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setRate(Float rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
public Float getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("ruleId", getRuleId())
|
||||
.append("userId", getUserId())
|
||||
.append("userName", getUserName())
|
||||
.append("postId", getPostId())
|
||||
.append("postName", getPostName())
|
||||
.append("amount", getAmount())
|
||||
.append("commision", getCommision())
|
||||
.append("rate", getRate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
//订单审核状态
|
||||
private String reviewStatus;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import com.stdiet.common.annotation.Excel;
|
||||
@ -269,6 +270,9 @@ public class SysOrder extends BaseEntity {
|
||||
//拆分比例,如:1,9就是按照比例10%、90%拆分,非持久化字段
|
||||
private String nutritionistRate;
|
||||
|
||||
//订单查询时的订单类型二维数组
|
||||
private JSONArray searchOrderTypeArray;
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,23 +1,32 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysRecipesPlanModel {
|
||||
public class SysRecipesTemplate {
|
||||
Long id;
|
||||
|
||||
String name;
|
||||
|
||||
Long nutritionistId;
|
||||
|
||||
String nutritionist;
|
||||
|
||||
Long nutriAssisId;
|
||||
|
||||
String nutriAssis;
|
||||
|
||||
Long planId;
|
||||
|
||||
String remark;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date updateTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date createTime;
|
||||
|
||||
String updateBy;
|
||||
@ -25,4 +34,6 @@ public class SysRecipesPlanModel {
|
||||
String createBy;
|
||||
|
||||
Long recipesId;
|
||||
|
||||
Integer reviewStatus;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.stdiet.custom.dto.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class SysOrderCommision implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//后台用户ID
|
||||
private Long userId;
|
||||
|
||||
//岗位ID
|
||||
private Long postId;
|
||||
|
||||
//订单审核状态
|
||||
private String reviewStatus;
|
||||
|
||||
//订单截止结束时间
|
||||
private String endTime;
|
||||
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysCommision;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
|
||||
/**
|
||||
* 业务提成比例Mapper接口
|
||||
@ -61,5 +62,10 @@ public interface SysCommisionMapper
|
||||
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
|
||||
|
||||
List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision);
|
||||
/**
|
||||
* 查询售后、营养师用户信息
|
||||
* @param sysCommision
|
||||
* @return
|
||||
*/
|
||||
List<SysCommision> getAfterSaleAndNutri(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||
import com.stdiet.custom.domain.SysCommision;
|
||||
import com.stdiet.custom.domain.SysCommissionDayDetail;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -72,7 +73,7 @@ public interface SysOrderMapper
|
||||
public BigDecimal selectAllOrderAmount(SysOrder sysOrder);
|
||||
|
||||
/**
|
||||
* 获取订单信息
|
||||
* 获取订单信息(按天提成计算)
|
||||
* @return
|
||||
*/
|
||||
List<SysOrder> selectSimpleOrderMessage(SysCommision sysCommision);
|
||||
|
@ -1,24 +0,0 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Mapper接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface SysRecipesPlanModelMapper
|
||||
{
|
||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int removeRecipesModel(Long id);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Mapper接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface SysRecipesTemplateMapper {
|
||||
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int removeRecipesTemplate(Long id);
|
||||
|
||||
SysRecipesTemplate getRecipesTemplateById(Long id);
|
||||
}
|
@ -62,6 +62,4 @@ public interface ISysCommisionService
|
||||
public int deleteSysCommisionById(Long ruleId);
|
||||
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision);
|
||||
|
||||
List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.stdiet.custom.domain.SysCommision;
|
||||
import com.stdiet.custom.domain.SysCommissionDayDetail;
|
||||
import com.stdiet.custom.domain.SysOrder;
|
||||
import com.stdiet.custom.domain.SysOrderCommisionDayDetail;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
|
@ -1,25 +0,0 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanListInfo;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface ISysRecipesPlanModelService
|
||||
{
|
||||
|
||||
List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel);
|
||||
|
||||
int removeRecipesModel(Long id);
|
||||
}
|
24
stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesTemplateService.java
Normal file
24
stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesTemplateService.java
Normal file
@ -0,0 +1,24 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service接口
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
public interface ISysRecipesTemplateService {
|
||||
|
||||
List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate);
|
||||
|
||||
int removeRecipesTemplate(Long id);
|
||||
|
||||
SysRecipesTemplate getRecipesTemplateById(Long id);
|
||||
}
|
@ -98,9 +98,4 @@ public class SysCommisionServiceImpl implements ISysCommisionService
|
||||
public List<SysCommision> selectSysCommisionDetail(SysCommision sysCommision) {
|
||||
return sysCommisionMapper.selectSysCommisionDetail(sysCommision);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysCommision> selectSysCommisionDayDetail(SysCommision sysCommision){
|
||||
return sysCommisionMapper.selectSysCommisionDayDetail(sysCommision);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.stdiet.custom.service.impl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.custom.domain.*;
|
||||
import com.stdiet.custom.dto.request.SysOrderCommision;
|
||||
import com.stdiet.custom.mapper.SysCommisionMapper;
|
||||
import com.stdiet.custom.mapper.SysOrderMapper;
|
||||
import com.stdiet.custom.mapper.SysOrderPauseMapper;
|
||||
@ -32,7 +33,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
|
||||
public List<SysCommissionDayDetail> calculateCommissionByDay(SysCommision sysCommision){
|
||||
List<SysCommissionDayDetail> result = new ArrayList<>();
|
||||
//查询用户
|
||||
List<SysCommision> list = sysCommisionMapper.selectSysCommisionDayDetail(sysCommision);
|
||||
List<SysCommision> list = sysCommisionMapper.getAfterSaleAndNutri(sysCommision);
|
||||
//合计
|
||||
SysCommissionDayDetail total = new SysCommissionDayDetail();
|
||||
total.setTotalCommissionAmount(new BigDecimal(0));
|
||||
|
@ -1,67 +0,0 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.SecurityUtils;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesPlanModel;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanModelMapper;
|
||||
import com.stdiet.custom.service.ISysRecipesPlanModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service业务层处理
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@Service("sysRecipesPlanModelService")
|
||||
@Transactional
|
||||
public class SysRecipesPlanModelServiceImpl implements ISysRecipesPlanModelService {
|
||||
|
||||
@Autowired
|
||||
SysRecipesPlanModelMapper sysRecipesPlanModelMapper;
|
||||
|
||||
@Autowired
|
||||
SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||
|
||||
@Override
|
||||
public List<SysRecipesPlanModel> selectRecipesModelListByCondition(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
return sysRecipesPlanModelMapper.selectRecipesModelListByCondition(sysRecipesPlanModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRecipsesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||
sysRecipesPlan.setStartNumDay(1);
|
||||
sysRecipesPlan.setEndNumDay(7);
|
||||
sysRecipesPlan.setType(1);
|
||||
int rows = sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||
if (rows > 0) {
|
||||
sysRecipesPlanModel.setCreateBy(SecurityUtils.getUsername());
|
||||
sysRecipesPlanModel.setCreateTime(DateUtils.getNowDate());
|
||||
sysRecipesPlanModel.setPlanId(sysRecipesPlan.getId());
|
||||
return sysRecipesPlanModelMapper.insertRecipsesModel(sysRecipesPlanModel);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRecipesModel(SysRecipesPlanModel sysRecipesPlanModel) {
|
||||
sysRecipesPlanModel.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysRecipesPlanModel.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysRecipesPlanModelMapper.updateRecipesModel(sysRecipesPlanModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeRecipesModel(Long id) {
|
||||
return sysRecipesPlanModelMapper.removeRecipesModel(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
70
stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesTemplateServiceImpl.java
Normal file
70
stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesTemplateServiceImpl.java
Normal file
@ -0,0 +1,70 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.SecurityUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.custom.domain.SysRecipesPlan;
|
||||
import com.stdiet.custom.domain.SysRecipesTemplate;
|
||||
import com.stdiet.custom.mapper.SysRecipesPlanMapper;
|
||||
import com.stdiet.custom.mapper.SysRecipesTemplateMapper;
|
||||
import com.stdiet.custom.service.ISysRecipesTemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 食谱计划Service业务层处理
|
||||
*
|
||||
* @author wonder
|
||||
* @date 2021-02-27
|
||||
*/
|
||||
@Service("sysRecipesPlanModelService")
|
||||
@Transactional
|
||||
public class SysRecipesTemplateServiceImpl implements ISysRecipesTemplateService {
|
||||
|
||||
@Autowired
|
||||
SysRecipesTemplateMapper sysRecipesTemplateMapper;
|
||||
|
||||
@Autowired
|
||||
SysRecipesPlanMapper sysRecipesPlanMapper;
|
||||
|
||||
@Override
|
||||
public List<SysRecipesTemplate> selectRecipesTemplateListByCondition(SysRecipesTemplate sysRecipesTemplate) {
|
||||
return sysRecipesTemplateMapper.selectRecipesTemplateListByCondition(sysRecipesTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertRecipsesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
||||
SysRecipesPlan sysRecipesPlan = new SysRecipesPlan();
|
||||
sysRecipesPlan.setStartNumDay(1);
|
||||
sysRecipesPlan.setEndNumDay(7);
|
||||
sysRecipesPlan.setType(1);
|
||||
sysRecipesPlanMapper.insertSysRecipesPlan(sysRecipesPlan);
|
||||
if (!StringUtils.isNull(sysRecipesPlan.getId())) {
|
||||
sysRecipesTemplate.setCreateBy(SecurityUtils.getUsername());
|
||||
sysRecipesTemplate.setCreateTime(DateUtils.getNowDate());
|
||||
sysRecipesTemplate.setPlanId(sysRecipesPlan.getId());
|
||||
return sysRecipesTemplateMapper.insertRecipsesTemplate(sysRecipesTemplate);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRecipesTemplate(SysRecipesTemplate sysRecipesTemplate) {
|
||||
sysRecipesTemplate.setUpdateBy(SecurityUtils.getUsername());
|
||||
sysRecipesTemplate.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysRecipesTemplateMapper.updateRecipesTemplate(sysRecipesTemplate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeRecipesTemplate(Long id) {
|
||||
return sysRecipesTemplateMapper.removeRecipesTemplate(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysRecipesTemplate getRecipesTemplateById(Long id) {
|
||||
return sysRecipesTemplateMapper.getRecipesTemplateById(id);
|
||||
}
|
||||
}
|
@ -10,6 +10,8 @@ public class OrderUtils {
|
||||
|
||||
private static final String[] orderMoneyTypeArray = {"全款单","定金单","尾款单"};
|
||||
|
||||
private static final String[] orderMainTypeArray = {"主单","副单"};
|
||||
|
||||
/**
|
||||
* 根据订单对象获取订单类型名称
|
||||
* @param sysOrder
|
||||
@ -18,8 +20,16 @@ public class OrderUtils {
|
||||
public static final String getOrderTypeName(SysOrder sysOrder){
|
||||
String orderTypeName = "";
|
||||
orderTypeName += orderTypeArray[Integer.parseInt(sysOrder.getOrderType())];
|
||||
//比例拆分单需要确认出主单副单
|
||||
/*if("1".equals(sysOrder.getOrderType())){
|
||||
orderTypeName += "("+(sysOrder.getMainOrderId().intValue() == 0 ? orderMainTypeArray[0] : orderMainTypeArray[1])+")";
|
||||
}*/
|
||||
orderTypeName += "/"+orderCountTypeArray[Integer.parseInt(sysOrder.getOrderCountType())];
|
||||
orderTypeName += "/"+orderMoneyTypeArray[Integer.parseInt(sysOrder.getOrderMoneyType())];
|
||||
//判断是不是二开提成单
|
||||
if("1".equals(sysOrder.getOrderCountType()) && sysOrder.getAfterSaleCommissOrder().intValue() == 1){
|
||||
orderTypeName += "/提成单";
|
||||
}
|
||||
return orderTypeName;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,9 @@
|
||||
SELECT ${column} AS user_id, ${postId} AS post_id, SUM(amount) AS amount
|
||||
FROM sys_order
|
||||
WHERE ${column} IS NOT NULL AND ${column} <> 0 AND del_flag = 0
|
||||
AND review_status = 'yes'
|
||||
<if test="reviewStatus != null and reviewStatus != ''">
|
||||
AND review_status = #{reviewStatus}
|
||||
</if>
|
||||
<if test="beginTime != null and beginTime != ''">AND date_format(order_time,'%y%m%d') >=
|
||||
date_format(${beginTime},'%y%m%d')
|
||||
</if>
|
||||
@ -47,6 +49,7 @@
|
||||
JOIN (
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="pre_sale_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="5"/>
|
||||
@ -54,6 +57,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="after_sale_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="6"/>
|
||||
@ -61,6 +65,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="nutritionist_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="9"/>
|
||||
@ -68,6 +73,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="nutri_assis_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="10"/>
|
||||
@ -75,6 +81,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="operator_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="11"/>
|
||||
@ -82,6 +89,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="operator_assis_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="13"/>
|
||||
@ -89,6 +97,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="planner_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="7"/>
|
||||
@ -96,6 +105,7 @@
|
||||
UNION
|
||||
<include refid="groupAmountVo">
|
||||
<property name="column" value="planner_assis_id"/>
|
||||
<property name="reviewStatus" value="#{reviewStatus}"/>
|
||||
<property name="beginTime" value="#{beginTime}"/>
|
||||
<property name="endTime" value="#{endTime}"/>
|
||||
<property name="postId" value="8"/>
|
||||
@ -188,7 +198,8 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectSysCommisionDayDetail" parameterType="SysCommision" resultMap="SysCommisionResult">
|
||||
<!-- 查询售后和营养师 -->
|
||||
<select id="getAfterSaleAndNutri" parameterType="SysCommision" resultMap="SysCommisionResult">
|
||||
SELECT su.user_id,su.nick_name as user_name,sp.post_id, sp.post_code,sp.post_name FROM sys_user su
|
||||
LEFT JOIN sys_user_post sup ON sup.user_id = su.user_id
|
||||
LEFT JOIN sys_post sp ON sp.post_id = sup.post_id
|
||||
|
@ -103,6 +103,8 @@
|
||||
</if>
|
||||
</if>
|
||||
<if test="true">and del_flag = 0</if>
|
||||
<!-- 计算总额时需要除去二开售后提成单 -->
|
||||
AND after_sale_commiss_order = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -139,6 +141,26 @@
|
||||
and 0 > amount
|
||||
</if>
|
||||
</if>
|
||||
<if test="searchOrderTypeArray != null">
|
||||
<trim prefix="AND (" suffix=")" suffixOverrides="or">
|
||||
<foreach collection="searchOrderTypeArray" separator="or" item="typeArray" index="i">
|
||||
(
|
||||
<foreach collection="typeArray" separator="and" item="type" index="j">
|
||||
<if test="j == 0">
|
||||
order_type = #{type}
|
||||
</if>
|
||||
<if test="j == 1">
|
||||
order_count_type = #{type}
|
||||
</if>
|
||||
<if test="j == 2">
|
||||
order_money_type = #{type}
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
<!--(order_type = #{typeArray[0]} and order_count_type = #{typeArray[1]} and order_money_type =#{typeArray[2]})-->
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
<if test="true">and o.del_flag = 0</if>
|
||||
</where>
|
||||
order by order_time desc
|
||||
@ -365,7 +387,10 @@
|
||||
from sys_order o
|
||||
left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
where review_status = 'yes' and o.order_time >= '2021-01-01' and o.del_flag = 0
|
||||
where o.order_time >= '2021-01-01' and o.del_flag = 0
|
||||
<if test="reviewStatus != null and reviewStatus != ''">
|
||||
and review_status = #{reviewStatus}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
|
||||
</if>
|
||||
|
@ -86,6 +86,7 @@
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
<if test="type != null">type,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderId != null">#{orderId},</if>
|
||||
@ -104,6 +105,7 @@
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -163,7 +165,7 @@
|
||||
<!-- 食谱计划、订单表联查 -->
|
||||
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
|
||||
SELECT srp.id,srp.order_id,srp.recipes_id,srp.start_num_day,srp.end_num_day,srp.cus_id,sc.phone,
|
||||
su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||
su_nutritionist.nick_name AS nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,
|
||||
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer, srp.review_status
|
||||
FROM sys_recipes_plan srp
|
||||
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
|
||||
@ -215,7 +217,7 @@
|
||||
<!-- 根据cusId查询食谱计划-->
|
||||
<select id="selectPlanListByCusId" parameterType="Long" resultMap="SysRecipesPlanResult">
|
||||
select id, out_id, start_date, end_date, start_num_day, end_num_day, recipes_id, review_status from sys_recipes_plan
|
||||
where cus_id=#{cusId} order by create_time desc
|
||||
where cus_id=#{cusId} order by id desc
|
||||
</select>
|
||||
|
||||
<select id="getCusIdByOutId" parameterType="String" resultType="Long">
|
||||
|
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesPlanModelMapper">
|
||||
|
||||
<resultMap type="SysRecipesPlanModel" id="SysRecipesModelResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="planId" column="plan_id"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="recipesId" column="recipes_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRecipesModelListByCondition" parameterType="SysRecipesPlanModel" resultMap="SysRecipesModelResult">
|
||||
select srpm.id, srpm.nutritionist_id, srpm.nutri_assis_id, srpm.remark, srpm.update_time,
|
||||
srpm.create_time, srpm.update_by, srpm.create_by, srpm.plan_id, srp.recipes_id, srp.review_status
|
||||
from sys_recipes_plan_model srpm
|
||||
left join sys_recipes_plan srp on srp.id = srpm.plan_id
|
||||
where del_flag = 0
|
||||
<if test="nutriAssisId != null ">and nutri_assis_id = #{nutriAssisId}</if>
|
||||
<if test="nutritionistId != null ">and nutritionist_id = #{nutritionistId}</if>
|
||||
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
|
||||
order by srpm.create_time desc
|
||||
</select>
|
||||
|
||||
<insert id="insertRecipsesModel" parameterType="SysRecipesPlanModel" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_recipes_plan_model
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="reviewStatus != null">review_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="reviewStatus != null">#{reviewStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRecipesModel" parameterType="SysRecipesPlanModel">
|
||||
update sys_recipes_plan_model
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="removeRecipesModel" parameterType="Long">
|
||||
update sys_recipes_plan_model set del_flag=1 where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,96 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysRecipesTemplateMapper">
|
||||
|
||||
<resultMap type="SysRecipesTemplate" id="SysRecipesTemplateResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="planId" column="plan_id"/>
|
||||
<result property="nutritionistId" column="nutritionist_id"/>
|
||||
<result property="nutriAssisId" column="nutri_assis_id"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="recipesId" column="recipes_id"/>
|
||||
<result property="reviewStatus" column="review_status"/>
|
||||
|
||||
<result property="nutritionist" column="nutritionist"/>
|
||||
<result property="nutriAssis" column="nutritionist_assis"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectRecipesTemplateListByCondition" parameterType="SysRecipesTemplate" resultMap="SysRecipesTemplateResult">
|
||||
select srt.id, srt.name, srt.nutritionist_id, srt.nutri_assis_id, srt.remark, srt.update_time,
|
||||
srt.create_time, srt.update_by, srt.create_by, srt.plan_id, srp.recipes_id, srp.review_status,
|
||||
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutritionist_assis
|
||||
from sys_recipes_template srt
|
||||
left join sys_recipes_plan srp on srp.id = srt.plan_id
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = srt.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
left join sys_user su_nutritionist_assis on su_nutritionist_assis.user_id = srt.nutri_assis_id and su_nutritionist_assis.del_flag = 0
|
||||
where srt.del_flag = 0
|
||||
<if test="name != null and name != ''">and srt.name like concat('%', #{name}, '%')</if>
|
||||
<if test="nutriAssisId != null ">and srt.nutri_assis_id = #{nutriAssisId}</if>
|
||||
<if test="nutritionistId != null ">and srt.nutritionist_id = #{nutritionistId}</if>
|
||||
<if test="reviewStatus != null ">and srp.review_status = #{reviewStatus}</if>
|
||||
order by srt.id desc
|
||||
</select>
|
||||
|
||||
<select id="getRecipesTemplateById" parameterType="Long" resultType="SysRecipesTemplate">
|
||||
select srt.id, srt.name, srt.nutritionist_id as nutritionistId, srt.nutri_assis_id as nutriAssisId, srt.remark, srt.update_time as updateTime,
|
||||
srt.create_time as createTime, srt.update_by as updateBy, srt.create_by as createBy, srt.plan_id as planId,
|
||||
su_nutritionist.nick_name as nutritionist, su_nutritionist_assis.nick_name as nutriAssis
|
||||
from sys_recipes_template srt
|
||||
left join sys_user su_nutritionist on su_nutritionist.user_id = srt.nutritionist_id and su_nutritionist.del_flag = 0
|
||||
left join sys_user su_nutritionist_assis on su_nutritionist_assis.user_id = srt.nutri_assis_id and su_nutritionist_assis.del_flag = 0
|
||||
where srt.id = #{id} and srt.del_flag = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertRecipsesTemplate" parameterType="SysRecipesTemplate" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_recipes_template
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="planId != null">plan_id,</if>
|
||||
<if test="nutriAssisId != null">nutri_assis_id,</if>
|
||||
<if test="nutritionistId != null">nutritionist_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="planId != null">#{planId},</if>
|
||||
<if test="nutriAssisId != null">#{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">#{nutritionistId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRecipesTemplate" parameterType="SysRecipesTemplate">
|
||||
update sys_recipes_template
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
|
||||
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="removeRecipesTemplate" parameterType="Long">
|
||||
update sys_recipes_template set del_flag=1 where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -1,33 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function listRecipesModel(query) {
|
||||
return request({
|
||||
url: "/recipes/model/list",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export function addRecipesModel(data){
|
||||
return request({
|
||||
url: "/recipes/model/add",
|
||||
method: "post",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function updateRecipesModel(data) {
|
||||
return request({
|
||||
url: "/recipes/model/update",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function deleteRecipesModel(id) {
|
||||
return request({
|
||||
url: "/recipes/model/delete/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
39
stdiet-ui/src/api/custom/recipesTemplate.js
Normal file
39
stdiet-ui/src/api/custom/recipesTemplate.js
Normal file
@ -0,0 +1,39 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
export function listRecipesTemplate(query) {
|
||||
return request({
|
||||
url: "/recipes/template/list",
|
||||
method: "get",
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
export function getRecipesTemplateDetail(id) {
|
||||
return request({
|
||||
url: "/recipes/template/" + id,
|
||||
method: "get"
|
||||
});
|
||||
}
|
||||
|
||||
export function addRecipesTemplate(data) {
|
||||
return request({
|
||||
url: "/recipes/template/add",
|
||||
method: "post",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function updateRecipesTemplate(data) {
|
||||
return request({
|
||||
url: "/recipes/template/update",
|
||||
method: "put",
|
||||
data: data
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteRecipesTemplate(id) {
|
||||
return request({
|
||||
url: "/recipes/template/delete/" + id,
|
||||
method: "delete"
|
||||
});
|
||||
}
|
@ -37,7 +37,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="成交金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入金额" />
|
||||
<el-input v-model.trim="form.amount" placeholder="请输入金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
@ -16,7 +16,7 @@
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="成交金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入金额" />
|
||||
<el-input v-model.trim="form.amount" placeholder="请输入金额" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
|
@ -7,12 +7,14 @@ import {
|
||||
deleteDishesApi,
|
||||
addRecipesApi
|
||||
} from "@/api/custom/recipes";
|
||||
import { getRecipesTemplateDetail } from "@/api/custom/recipesTemplate";
|
||||
import { getRecipesPlan, updateRecipesPlan } from "@/api/custom/recipesPlan";
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
|
||||
const oriState = {
|
||||
cusId: undefined,
|
||||
planId: undefined,
|
||||
temId: undefined,
|
||||
recipesId: undefined,
|
||||
healthyData: {},
|
||||
healthDataLoading: false,
|
||||
@ -25,7 +27,8 @@ const oriState = {
|
||||
currentDay: -1,
|
||||
startNum: 0,
|
||||
endNum: 0,
|
||||
reviewStatus: 0
|
||||
reviewStatus: 0,
|
||||
templateInfo: undefined
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
@ -87,6 +90,7 @@ const actions = {
|
||||
cusId,
|
||||
recipesId,
|
||||
reviewStatus,
|
||||
temId: payload.temId,
|
||||
planId: payload.planId,
|
||||
startNum: startNumDay,
|
||||
endNum: endNumDay
|
||||
@ -108,12 +112,25 @@ const actions = {
|
||||
dispatch("getHealthyData", { cusId }).catch(err => rej(err));
|
||||
}
|
||||
|
||||
// 模板信息
|
||||
if (payload.temId) {
|
||||
dispatch("getRecipesTemplate", payload).catch(err => rej(err));
|
||||
}
|
||||
|
||||
// 食谱数据
|
||||
if (recipesId) {
|
||||
dispatch("getRecipesInfo", { recipesId }).catch(err => rej(err));
|
||||
}
|
||||
});
|
||||
},
|
||||
async getRecipesTemplate({ commit, state }, { temId }) {
|
||||
const response = await getRecipesTemplateDetail(temId);
|
||||
if (response.code === 200) {
|
||||
commit("updateStateData", {
|
||||
templateInfo: response.data
|
||||
});
|
||||
}
|
||||
},
|
||||
async updateReviewStatus({ commit, state }, payload) {
|
||||
const response = await updateRecipesPlan({
|
||||
id: state.planId,
|
||||
|
@ -25,7 +25,7 @@ export const orderCountTypeArray = [
|
||||
}
|
||||
]
|
||||
|
||||
//订单类型
|
||||
//订单类型(订单新增)
|
||||
export const orderTypeArray = [
|
||||
{
|
||||
value: 0,
|
||||
|
@ -48,6 +48,21 @@
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选择审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -155,6 +170,8 @@ export default {
|
||||
totalUserIdOptions: [],
|
||||
//
|
||||
searchUserIdOptions: [],
|
||||
// 审核状态
|
||||
reviewStatusOptions: [],
|
||||
//
|
||||
options: {},
|
||||
// 查询参数
|
||||
@ -163,6 +180,7 @@ export default {
|
||||
pageSize: 10,
|
||||
userId: null,
|
||||
postId: null,
|
||||
reviewStatus: "yes"
|
||||
},
|
||||
};
|
||||
},
|
||||
@ -202,6 +220,9 @@ export default {
|
||||
);
|
||||
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
||||
});
|
||||
this.getDicts("cus_review_status").then((response) => {
|
||||
this.reviewStatusOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询业务提成比例列表 */
|
||||
|
@ -48,6 +48,21 @@
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选择审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
@ -242,6 +257,8 @@ export default {
|
||||
//
|
||||
searchUserIdOptions: [],
|
||||
//
|
||||
// 审核状态
|
||||
reviewStatusOptions: [],
|
||||
options: {},
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
@ -249,6 +266,7 @@ export default {
|
||||
pageSize: 20,
|
||||
userId: null,
|
||||
postId: null,
|
||||
reviewStatus: "yes",
|
||||
},
|
||||
sendCommissionPlanTable: false,
|
||||
sendCommissionPlan: {},
|
||||
@ -291,6 +309,9 @@ export default {
|
||||
);
|
||||
this.searchUserIdOptions = this.totalUserIdOptions.slice();
|
||||
});
|
||||
this.getDicts("cus_review_status").then((response) => {
|
||||
this.reviewStatusOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询业务提成比例列表 */
|
||||
|
@ -9,7 +9,7 @@
|
||||
>
|
||||
<el-form-item label="名字" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
v-model.trim="queryParams.name"
|
||||
placeholder="请输入名字"
|
||||
clearable
|
||||
size="small"
|
||||
@ -18,7 +18,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
v-model.trim="queryParams.phone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
size="small"
|
||||
@ -260,12 +260,12 @@
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户名字" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入名字" />
|
||||
<el-input v-model.trim="form.name" placeholder="请输入名字" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号" />
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
|
@ -11,7 +11,7 @@
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户信息" prop="customer">
|
||||
<el-input
|
||||
v-model="queryParams.customer"
|
||||
v-model.trim="queryParams.customer"
|
||||
placeholder="请输入客户姓名或手机号"
|
||||
clearable
|
||||
size="small"
|
||||
@ -248,6 +248,19 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="订单类型" prop="searchOrderTypeArray" >
|
||||
<el-cascader
|
||||
placeholder="请选择订单类型"
|
||||
v-model="searchOrderTypeArray"
|
||||
:options="orderTypeOptions"
|
||||
:props="orderTypeProps"
|
||||
collapse-tags
|
||||
clearable
|
||||
style="width: 300px"
|
||||
></el-cascader>
|
||||
</el-form-item><!-- -->
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="成交日期" prop="orderTime">
|
||||
<el-date-picker
|
||||
@ -428,7 +441,7 @@
|
||||
@pagination="getList"
|
||||
>
|
||||
<span style="margin-right: 12px"
|
||||
>总计:{{ toThousands(this.totalAmount) }} 元</span
|
||||
>总计收款(已除去二开售后提成金额):{{ toThousands(this.totalAmount) }} 元</span
|
||||
>
|
||||
</pagination>
|
||||
|
||||
@ -459,7 +472,7 @@
|
||||
import { delOrder, exportOrder, listOrder } from "@/api/custom/order";
|
||||
import dayjs from "dayjs";
|
||||
import orderPause from "./orderPause";
|
||||
|
||||
import * as orderTypeData from "@/utils/orderType";
|
||||
import OrderDetail from "@/components/OrderDetail";
|
||||
import OrderEdit from "@/components/OrderEdit";
|
||||
import AutoHideMessage from "@/components/AutoHideMessage";
|
||||
@ -510,6 +523,9 @@ export default {
|
||||
conditioningProjectIdOption: [],
|
||||
// 审核状态
|
||||
reviewStatusOptions: [],
|
||||
//订单类型
|
||||
orderTypeOptions: orderTypeData["orderTypeArray"],
|
||||
orderTypeProps: { multiple: true,expandTrigger: 'click' },//,checkStrictly:true
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -531,6 +547,8 @@ export default {
|
||||
reviewStatus: null,
|
||||
serveTimeId: null,
|
||||
},
|
||||
//查询时选择的订单类型数组
|
||||
searchOrderTypeArray: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -578,6 +596,9 @@ export default {
|
||||
/** 查询销售订单列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.orderType = this.searchOrderTypeArray != null ? encodeURIComponent(JSON.stringify(this.searchOrderTypeArray)) : null;
|
||||
console.log(this.queryParams.searchOrderTypeArray);
|
||||
//this.dealOrderTypeArray();
|
||||
listOrder(this.addDateRange(this.queryParams, this.daterange)).then(
|
||||
(response) => {
|
||||
this.orderList = response.rows;
|
||||
@ -586,7 +607,27 @@ export default {
|
||||
this.totalAmount = response.totalAmount;
|
||||
}
|
||||
);
|
||||
}, // 收款方式字典翻译
|
||||
},
|
||||
/*dealOrderTypeArray(){
|
||||
this.queryParams.orderType = "";
|
||||
this.queryParams.orderCountType = "";
|
||||
this.queryParams.orderMoneyType = "";
|
||||
if(this.searchOrderTypeArray == null){
|
||||
return;
|
||||
}
|
||||
this.searchOrderTypeArray.forEach((item,index) => {
|
||||
if(this.queryParams.orderType.indexOf(item[0]+"") == -1){
|
||||
this.queryParams.orderType += this.queryParams.orderType != "" ? (","+item[0]) : item[0];
|
||||
}
|
||||
if(this.queryParams.orderCountType.indexOf(item[1]+"") == -1){
|
||||
this.queryParams.orderCountType += this.queryParams.orderCountType != "" ? (","+item[1]) : item[1];
|
||||
}
|
||||
if(this.queryParams.orderMoneyType.indexOf(item[2]+"") == -1){
|
||||
this.queryParams.orderMoneyType += this.queryParams.orderMoneyType != "" ? (","+item[2]) : item[2];
|
||||
}
|
||||
});
|
||||
},*/
|
||||
// 收款方式字典翻译
|
||||
payTypeIdFormat(row, column) {
|
||||
return this.selectDictLabel(this.payTypeIdOptions, row.payTypeId);
|
||||
},
|
||||
@ -711,7 +752,7 @@ export default {
|
||||
return "warning-row";
|
||||
}
|
||||
return "success-row";
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
};
|
||||
|
@ -4,6 +4,9 @@
|
||||
:style="`height: ${collapse ? 30 : 200}px`"
|
||||
>
|
||||
<div class="header">
|
||||
<el-button size="mini" v-if="!recipesId" @click="handleOnBack"
|
||||
>返回</el-button
|
||||
>
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
@ -101,6 +104,9 @@ export default {
|
||||
hanldeOnReveiwChange(reviewStatus) {
|
||||
this.updateReviewStatus({ reviewStatus });
|
||||
},
|
||||
handleOnBack() {
|
||||
this.updateReviewStatus({ recipesData: [] });
|
||||
},
|
||||
...mapActions(["saveRecipes", "updateReviewStatus"]),
|
||||
},
|
||||
};
|
||||
|
@ -0,0 +1,8 @@
|
||||
<template>
|
||||
<div>推荐列表</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "TemplateView",
|
||||
};
|
||||
</script>
|
@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div class="template_view_wrapper">
|
||||
<div class="header">
|
||||
<el-button size="mini" @click="handleOnBackClick">返回</el-button>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h2>选择模板</h2>
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
<el-table-column label="模板名称" align="center" prop="name" />
|
||||
<el-table-column label="营养师" align="center" prop="nutritionist" />
|
||||
<el-table-column label="营养师助理" align="center" prop="nutriAssis" />
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { listRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||
export default {
|
||||
name: "TemplateView",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
dataList: [],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reviewStatus: 2,
|
||||
},
|
||||
};
|
||||
},
|
||||
props: ["view"],
|
||||
methods: {
|
||||
handleOnBackClick() {
|
||||
this.$emit("update:view", 0);
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reviewStatus: 2,
|
||||
};
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRecipesTemplate(this.queryParams).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.dataList = res.rows;
|
||||
this.total = res.total;
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
handleCurrentChange(data) {
|
||||
this.$emit("onSelect", data);
|
||||
setTimeout(() => {
|
||||
this.$emit("update:view", 0);
|
||||
}, 500);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
view: function (val, oldVal) {
|
||||
if (val === 1) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.template_view_wrapper {
|
||||
height: 100%;
|
||||
|
||||
.header {
|
||||
height: 32px;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
.content {
|
||||
height: calc(100% - 32px);
|
||||
padding-top: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
@ -0,0 +1,90 @@
|
||||
|
||||
<template>
|
||||
<div class="recommend_view_wrapper">
|
||||
<div class="selector_view" v-if="curView === 0">
|
||||
<div class="card_content" @click="handleOnClick(1)">
|
||||
<em class="el-icon-brush" />
|
||||
<span>模板</span>
|
||||
</div>
|
||||
<div class="card_content" @click="handleOnClick(2)" v-if="false">
|
||||
<em class="el-icon-star-off" />
|
||||
<span>推荐</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TemplateView :view.sync="curView" @onSelect="handleOnSelect" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
import TemplateView from "./TemplateView";
|
||||
import RecommendView from "./RecommendView";
|
||||
const {
|
||||
mapActions,
|
||||
mapState,
|
||||
mapMutations,
|
||||
mapGetters,
|
||||
} = createNamespacedHelpers("recipes");
|
||||
export default {
|
||||
name: "RecommondView",
|
||||
components: {
|
||||
RecommendView,
|
||||
TemplateView,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
curView: 0,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleOnClick(type) {
|
||||
this.curView = type;
|
||||
},
|
||||
handleOnSelect(data) {
|
||||
const { recipesId } = data;
|
||||
this.getRecipesInfo({ recipesId });
|
||||
},
|
||||
...mapActions(["getRecipesInfo"]),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.recommend_view_wrapper {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
.selector_view {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.card_content {
|
||||
cursor: pointer;
|
||||
margin: 6px;
|
||||
padding: 100px 80px;
|
||||
border: 3px solid #e6ebf5;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
|
||||
& > em {
|
||||
font-size: 48px;
|
||||
}
|
||||
|
||||
& > span {
|
||||
margin-top: 12px;
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: #409eff;
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -1,22 +0,0 @@
|
||||
|
||||
<template>
|
||||
<el-button @click="handleOnClick">推荐</el-button>
|
||||
</template>
|
||||
<script>
|
||||
import { createNamespacedHelpers } from "vuex";
|
||||
const {
|
||||
mapActions,
|
||||
mapState,
|
||||
mapMutations,
|
||||
mapGetters,
|
||||
} = createNamespacedHelpers("recipes");
|
||||
export default {
|
||||
name: "RecommondView",
|
||||
methods: {
|
||||
handleOnClick() {
|
||||
this.getRecipesInfo({ recipesId: 73 });
|
||||
},
|
||||
...mapActions(["getRecipesInfo"]),
|
||||
},
|
||||
};
|
||||
</script>
|
@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div class="template_info_wrapper">
|
||||
<h2>{{ data.name }}</h2>
|
||||
<TextInfo title="营养师" :value="data.nutritionist" />
|
||||
<TextInfo
|
||||
title="营养师助理"
|
||||
:value="data.nutriAssis"
|
||||
style="margin-top: 24px"
|
||||
/>
|
||||
<div class="remark_info">
|
||||
<span class="info_title">备注:</span>
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="8"
|
||||
placeholder="请输入内容"
|
||||
v-model="data.remark"
|
||||
>
|
||||
</el-input>
|
||||
</div>
|
||||
<div style="margin-top: 12px; text-align: right">
|
||||
<el-button v-if="change" type="primary" size="mini" @click="handleSubmit"
|
||||
>提交</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import TextInfo from "@/components/TextInfo";
|
||||
import { updateRecipesTemplate } from "@/api/custom/recipesTemplate";
|
||||
export default {
|
||||
name: "TemplateInfoView",
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
id: "",
|
||||
name: "",
|
||||
nutritionist: "",
|
||||
nutriAssis: "",
|
||||
remark: "",
|
||||
}),
|
||||
},
|
||||
},
|
||||
components: {
|
||||
TextInfo,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
oriRemark: "",
|
||||
change: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"data.remark": function (val, oldVal) {
|
||||
if (!oldVal && val) {
|
||||
this.oriRemark = val;
|
||||
}
|
||||
this.change = this.oriRemark !== val;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleSubmit() {
|
||||
const { remark, id } = this.data;
|
||||
updateRecipesTemplate({ id, remark }).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("修改成功");
|
||||
this.change = false;
|
||||
this.oriRemark = remark;
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.template_info_wrapper {
|
||||
.remark_info {
|
||||
font-size: 14px;
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
|
||||
.info_title {
|
||||
color: #8c8c8c;
|
||||
flex: 0 0 48px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -7,10 +7,11 @@
|
||||
:name="healthyData.name"
|
||||
:analyseData="analyseData"
|
||||
/>
|
||||
<RecommondView v-else />
|
||||
<RecommendView v-else />
|
||||
</div>
|
||||
<div class="right" v-loading="healthDataLoading">
|
||||
<HealthyView :data="healthyData" v-if="healthyDataType === 0" />
|
||||
<TemplateInfoView v-if="!!temId" :data="templateInfo" />
|
||||
<HealthyView :data="healthyData" v-else-if="healthyDataType === 0" />
|
||||
<BodySignView :data="healthyData" v-else />
|
||||
</div>
|
||||
</div>
|
||||
@ -27,16 +28,21 @@ const {
|
||||
import HealthyView from "@/components/HealthyView";
|
||||
import BodySignView from "@/components/BodySignView";
|
||||
import RecipesView from "./RecipesView/index";
|
||||
import RecommondView from "./RecommondView";
|
||||
import RecommendView from "./RecommendView";
|
||||
import TemplateInfoView from "./TemplateInfoView";
|
||||
|
||||
export default {
|
||||
name: "BuildRecipies",
|
||||
data() {
|
||||
return {};
|
||||
const { temId } = this.$route.query;
|
||||
return {
|
||||
temId,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.init({
|
||||
planId: this.planId,
|
||||
temId: this.temId,
|
||||
}).catch((err) => {
|
||||
this.$message.error(err.message);
|
||||
});
|
||||
@ -49,13 +55,15 @@ export default {
|
||||
HealthyView,
|
||||
BodySignView,
|
||||
RecipesView,
|
||||
RecommondView,
|
||||
RecommendView,
|
||||
TemplateInfoView,
|
||||
},
|
||||
props: ["name", "planId"],
|
||||
computed: {
|
||||
...mapState([
|
||||
"healthyData",
|
||||
"healthyDataType",
|
||||
"templateInfo",
|
||||
"recipesData",
|
||||
"recipesDataLoading",
|
||||
"healthDataLoading",
|
||||
|
@ -1,331 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistId"
|
||||
placeholder="请选择营养师"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师助理" prop="nutritionistAssisId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistAssisId"
|
||||
placeholder="请选择营养师助理"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutriAssisIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="recipesPlanList">
|
||||
<el-table-column label="审核状态" align="center" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
!scope.row.reviewStatus
|
||||
? 'info'
|
||||
: scope.row.reviewStatus === 1
|
||||
? 'danger'
|
||||
: 'success'
|
||||
"
|
||||
>{{
|
||||
`${
|
||||
!scope.row.reviewStatus
|
||||
? "未制作"
|
||||
: scope.row.reviewStatus == 1
|
||||
? "未审核"
|
||||
: "已审核"
|
||||
}`
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="营养师"
|
||||
align="center"
|
||||
prop="nutritionist"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
label="营养师助理"
|
||||
align="center"
|
||||
width="100"
|
||||
prop="nutritionistAssis"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
width="100"
|
||||
prop="create_time"
|
||||
/>
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
width="300"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
v-hasPermi="['recipes:recipesPlan:edit']"
|
||||
:icon="`${
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
}`"
|
||||
@click="handleBuild(scope.row)"
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}` }}</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listRecipesModel,
|
||||
addRecipesModel,
|
||||
updateRecipesModel,
|
||||
deleteRecipesModel,
|
||||
} from "@/api/custom/recipesPlanModel";
|
||||
import dayjs from "dayjs";
|
||||
import store from "@/store";
|
||||
import { mapState } from "vuex";
|
||||
|
||||
const userId = store.getters && store.getters.userId;
|
||||
export default {
|
||||
name: "recipesPlan",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 食谱计划表格数据
|
||||
recipesPlanList: [],
|
||||
orderDialog: undefined,
|
||||
reviewStatusOptions: [
|
||||
{ dictValue: 0, dictLabel: "未制作" },
|
||||
{ dictValue: 1, dictLabel: "未审核" },
|
||||
{ dictValue: 2, dictLabel: "已审核" },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
nutritionistId: null,
|
||||
nutritionistAssisId: null,
|
||||
reviewStatus: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {},
|
||||
//食谱开始时间范围
|
||||
planStartDateScope: [nextDate, nextDate],
|
||||
//订单对于所有计划安排数据
|
||||
allRecipesPlanList: [],
|
||||
//订单弹窗状态
|
||||
allRecipesPlanOpen: false,
|
||||
allRecipesPlanTitle: "",
|
||||
//订单弹窗中查询参数
|
||||
allRecipesPlanQueryParam: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderId: null,
|
||||
sendFlag: 0,
|
||||
},
|
||||
//订单弹窗中列表数据的总条数
|
||||
allRecipesPlanTotal: 0,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
// "order-dialog": OrderDetail,
|
||||
// body_sign_dialog: BodySignDetail,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
//营养师
|
||||
nutritionistIdOptions: (state) =>
|
||||
state.global.nutritionistIdOptions.slice(1),
|
||||
//营养师助理
|
||||
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
nutritionistIdOptions: function (val, oldVal) {
|
||||
if (val.length && !oldVal.length) {
|
||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
if (tarObj) {
|
||||
this.queryParams.nutritionistId = userId;
|
||||
}
|
||||
}
|
||||
},
|
||||
nutriAssisIdOptions: function (val, oldVal) {
|
||||
if (val.length && !oldVal.length) {
|
||||
const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
if (tarObj) {
|
||||
this.queryParams.nutritionistAssisId = userId;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询食谱计划列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
if (
|
||||
this.planStartDateScope != null &&
|
||||
this.planStartDateScope.length > 0
|
||||
) {
|
||||
this.queryParams.startDate = dayjs(this.planStartDateScope[0]).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
this.queryParams.endDate = dayjs(this.planStartDateScope[1]).format(
|
||||
"YYYY-MM-DD"
|
||||
);
|
||||
} else {
|
||||
this.queryParams.startDate = null;
|
||||
this.queryParams.endDate = null;
|
||||
}
|
||||
listRecipesPlan(this.queryParams).then((response) => {
|
||||
this.recipesPlanList = response.rows;
|
||||
this.recipesPlanList.forEach(function (item, index) {
|
||||
item.scopeDate =
|
||||
dayjs(item.startDate).format("YYYY-MM-DD") +
|
||||
" 至 " +
|
||||
dayjs(item.endDate).format("YYYY-MM-DD");
|
||||
item.scopeDay = `第${item.startNumDay} 至 ${item.endNumDay}天`;
|
||||
});
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
orderId: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
recipesId: null,
|
||||
sendFlag: null,
|
||||
sendTime: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.planStartDateScope = [nextDate, nextDate];
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return exportRecipesPlan(queryParams);
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
handleBuild(data) {
|
||||
// console.log(data);
|
||||
const { id, customer } = data;
|
||||
window.open("/recipes/build/" + customer + "/" + id, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
458
stdiet-ui/src/views/custom/recipesTemplate/index.vue
Normal file
458
stdiet-ui/src/views/custom/recipesTemplate/index.vue
Normal file
@ -0,0 +1,458 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
>
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入模板名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId">
|
||||
<el-select
|
||||
v-model="queryParams.nutritionistId"
|
||||
placeholder="请选择营养师"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师助理" prop="nutriAssisId">
|
||||
<el-select
|
||||
v-model="queryParams.nutriAssisId"
|
||||
placeholder="请选择营养师助理"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in nutriAssisIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="reviewStatus">
|
||||
<el-select
|
||||
v-model="queryParams.reviewStatus"
|
||||
placeholder="请选审核状态"
|
||||
clearable
|
||||
size="small"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in reviewStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="cyan"
|
||||
icon="el-icon-search"
|
||||
size="mini"
|
||||
@click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8" style="margin-top: 10px">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['custom:ingredient:add']"
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="recipesTemplateList">
|
||||
<el-table-column label="审核状态" align="center" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-tag
|
||||
:type="
|
||||
!scope.row.reviewStatus
|
||||
? 'info'
|
||||
: scope.row.reviewStatus === 1
|
||||
? 'danger'
|
||||
: 'success'
|
||||
"
|
||||
>{{
|
||||
`${
|
||||
!scope.row.reviewStatus
|
||||
? "未制作"
|
||||
: scope.row.reviewStatus == 1
|
||||
? "未审核"
|
||||
: "已审核"
|
||||
}`
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="模板名称"
|
||||
align="center"
|
||||
prop="name"
|
||||
width="160"
|
||||
/>
|
||||
<el-table-column
|
||||
label="营养师"
|
||||
align="center"
|
||||
prop="nutritionistId"
|
||||
width="100"
|
||||
:formatter="nutritionistIdFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
label="营养师助理"
|
||||
align="center"
|
||||
width="100"
|
||||
prop="nutriAssisId"
|
||||
:formatter="nutriAssisIdFormat"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
width="180"
|
||||
prop="createTime"
|
||||
/>
|
||||
<el-table-column label="备注" prop="remark" align="center" />
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
width="300"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleOnTemplateEdit(scope.row)"
|
||||
>
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
v-hasPermi="['recipes:recipesTemplate:edit']"
|
||||
:icon="`${
|
||||
scope.row.recipesId ? 'el-icon-edit' : 'el-icon-edit-outline'
|
||||
}`"
|
||||
@click="handleOnRecipesEdit(scope.row)"
|
||||
>{{ `${scope.row.recipesId ? "编辑" : "制作"}食谱` }}</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleOnDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改食材对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="520px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="模板名称" prop="name" label-width="100px">
|
||||
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="营养师" prop="nutritionistId" label-width="100px">
|
||||
<el-select v-model="form.nutritionistId" placeholder="请选择营养师">
|
||||
<el-option
|
||||
v-for="dict in nutritionistIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="营养师助理"
|
||||
prop="nutriAssisId"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-select v-model="form.nutriAssisId" placeholder="请选择营养师助理">
|
||||
<el-option
|
||||
v-for="dict in nutriAssisIdOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark" label-width="100px">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
:rows="4"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listRecipesTemplate,
|
||||
addRecipesTemplate,
|
||||
updateRecipesTemplate,
|
||||
deleteRecipesTemplate,
|
||||
} from "@/api/custom/recipesTemplate";
|
||||
import store from "@/store";
|
||||
import { mapState } from "vuex";
|
||||
|
||||
const userId = store.getters && store.getters.userId;
|
||||
export default {
|
||||
name: "recipesTemplate",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 食谱计划表格数据
|
||||
recipesTemplateList: [],
|
||||
orderDialog: undefined,
|
||||
reviewStatusOptions: [
|
||||
{ dictValue: 0, dictLabel: "未制作" },
|
||||
{ dictValue: 1, dictLabel: "未审核" },
|
||||
{ dictValue: 2, dictLabel: "已审核" },
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
nutritionistId: null,
|
||||
nutriAssisId: null,
|
||||
reviewStatus: null,
|
||||
},
|
||||
open: false,
|
||||
title: "",
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [{ required: true, message: "请输入模板名称", trigger: "blur" }],
|
||||
nutritionistId: [
|
||||
{ required: true, message: "请选择营养师", trigger: "blur" },
|
||||
],
|
||||
nutriAssisId: [
|
||||
{ required: true, message: "请选择营养师助理", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
//订单对于所有计划安排数据
|
||||
allRecipesPlanList: [],
|
||||
//订单弹窗状态
|
||||
allRecipesPlanOpen: false,
|
||||
allRecipesPlanTitle: "",
|
||||
//订单弹窗中查询参数
|
||||
allRecipesPlanQueryParam: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
orderId: null,
|
||||
sendFlag: 0,
|
||||
},
|
||||
//订单弹窗中列表数据的总条数
|
||||
allRecipesPlanTotal: 0,
|
||||
};
|
||||
},
|
||||
components: {
|
||||
// "order-dialog": OrderDetail,
|
||||
// body_sign_dialog: BodySignDetail,
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
//营养师
|
||||
nutritionistIdOptions: (state) =>
|
||||
state.global.nutritionistIdOptions.slice(1),
|
||||
//营养师助理
|
||||
nutriAssisIdOptions: (state) => state.global.nutriAssisIdOptions.slice(1),
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
// nutritionistIdOptions: function (val, oldVal) {
|
||||
// if (val.length && !oldVal.length) {
|
||||
// const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
// if (tarObj) {
|
||||
// this.queryParams.nutritionistId = userId;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// nutriAssisIdOptions: function (val, oldVal) {
|
||||
// if (val.length && !oldVal.length) {
|
||||
// const tarObj = val.find((opt) => opt.dictValue == userId);
|
||||
// if (tarObj) {
|
||||
// this.queryParams.nutriAssisId = userId;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询食谱计划列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRecipesTemplate(this.queryParams).then((response) => {
|
||||
this.recipesTemplateList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加模板";
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
remark: null,
|
||||
nutritionistId: null,
|
||||
nutriAssisId: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有食谱计划数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(function () {
|
||||
return exportRecipesPlan(queryParams);
|
||||
})
|
||||
.then((response) => {
|
||||
this.download(response.msg);
|
||||
})
|
||||
.catch(function () {});
|
||||
},
|
||||
handleOnDelete(data) {
|
||||
this.$confirm(`是否确认删除「${data.name}」?`, "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
deleteRecipesTemplate(data.id).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
});
|
||||
})
|
||||
|
||||
.catch(() => {});
|
||||
},
|
||||
handleOnTemplateEdit(data) {
|
||||
this.open = true;
|
||||
this.title = "修改模板";
|
||||
this.reset();
|
||||
this.form = data;
|
||||
},
|
||||
handleOnRecipesEdit(data) {
|
||||
// console.log(data);
|
||||
const { planId, name, id } = data;
|
||||
window.open(
|
||||
"/recipes/build/" + name + "/" + planId + "?temId=" + id,
|
||||
"_blank"
|
||||
);
|
||||
},
|
||||
// 主营养师字典翻译
|
||||
nutritionistIdFormat(row, column) {
|
||||
return this.selectDictLabel(
|
||||
this.nutritionistIdOptions,
|
||||
row.nutritionistId
|
||||
);
|
||||
},
|
||||
// 助理营养师字典翻译
|
||||
nutriAssisIdFormat(row, column) {
|
||||
return this.selectDictLabel(this.nutriAssisIdOptions, row.nutriAssisId);
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRecipesTemplate(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
addRecipesTemplate(this.form).then((response) => {
|
||||
if (response.code === 200) {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user