Merge pull request !73 from 德仔/develop
This commit is contained in:
德仔
2021-02-24 19:00:42 +08:00
committed by Gitee
28 changed files with 709 additions and 323 deletions

View File

@ -6,8 +6,6 @@ import java.util.List;
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.core.domain.BaseEntity;
@ -51,6 +49,7 @@ public class SysOrder extends BaseEntity {
private String status;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
private Date pauseTime;
@ -77,6 +76,10 @@ public class SysOrder extends BaseEntity {
@Excel(name = "售前")
private String preSale;
/** 售中ID */
@Excel(name = "售中ID")
private Long onSaleId;
/**
* 售后
*/
@ -93,9 +96,6 @@ public class SysOrder extends BaseEntity {
*/
private Long nutritionistId;
//营养师数组,比例拆分单时需要两个营养师,非持久化字段
private Long[] nutritionistIdList;
/**
* 营养师
*/
@ -223,7 +223,7 @@ public class SysOrder extends BaseEntity {
/**
* 服务天数
*/
@Excel(name = "服务结束时间", width = 30)
@Excel(name = "服务天数", width = 30)
private Integer serverDay;
/**
@ -234,33 +234,41 @@ public class SysOrder extends BaseEntity {
//查询参数
private Integer amountFlag;
/**
* 订单类型 0普通单 1比例拆分单 2售后二开提成单
*/
/** 订单类型 0普通单 1比例拆分单 2体验单 */
@Excel(name = "订单类型 0普通单 1比例拆分单 2体验单")
private String orderType;
/**
* 订单次数类型 0一开单 1二开单
*/
/** 订单次数类型 0一开单 1二开单 */
@Excel(name = "订单次数类型 0一开单 1二开单")
private String orderCountType;
/**
* 订单金额类型 0全款单 1定金单 2尾款单
*/
/** 订单金额类型 0全款单 1定金单 2尾款单 */
@Excel(name = "订单金额类型 0全款单 1定金单 2尾款单")
private String orderMoneyType;
/**
* 拆分订单中的主订单id非拆分订单时该id都为0
*/
/** 拆分订单中的主订单id非拆分订单时该id都为0 */
@Excel(name = "拆分订单中的主订单id非拆分订单时该id都为0")
private Long mainOrderId;
//订单类型数组,用于接收订单类型、订单次数类型、订单金额类型,非持久化字段
private Long[] orderTypeList;
/** 售后二开提成单, 0非提成单 1提成单 */
@Excel(name = "售后二开提成单, 0非提成单 1提成单")
private Integer afterSaleCommissOrder;
//是否自动创建售后二开提成单,非持久化字段
/** 删除标记 */
private Integer delFlag;
//订单类型数组,用于接收订单类型、订单次数类型、订单金额类型,非持久化字段
private Integer[] orderTypeList;
//是否自动创建售后二开提成单0否 1是非持久化字段
private Integer secondAfterSaleFlag;
//营养师数组,比例拆分单时需要两个营养师,非持久化字段
private Long[] nutritionistIdList;
//拆分比例1,9就是按照比例10%、90%拆分,非持久化字段
private Integer[] nutritionistRate;
private String nutritionistRate;
}

View File

@ -29,7 +29,11 @@ public class SysRecipesPlan extends BaseEntity
private Long cusId;
//客户ID
private Long customerId;
// private Long customerId;
private Integer startNumDay;
private Integer endNumDay;
//非持久化字段,客户姓名
@Excel(name = "客户姓名")

View File

@ -27,6 +27,7 @@ public class AsyncCommonServiceImpl implements AsyncCommonService {
@Autowired
private SysFoodHeatStatisticsMapper sysFoodHeatStatisticsMapper;
public static final long sleepTime = 5000; //异步线程睡眠时间,毫秒
/**
* 异步更新每个食材对应的蛋白质、脂肪、碳水的质量
@ -34,6 +35,11 @@ public class AsyncCommonServiceImpl implements AsyncCommonService {
@Override
@Async
public void updateFoodNutritionalQualityAndHeat(Long customerHeatId){
try {
Thread.sleep(sleepTime);
}catch (Exception e){
e.printStackTrace();
}
SysCustomerHeatStatistics sysCustomerHeatStatistics = sysCustomerHeatStatisticsMapper.selectSysCustomerHeatStatisticsById(customerHeatId);
if(sysCustomerHeatStatistics != null && sysCustomerHeatStatistics.getFoodHeatStatisticsList() != null
&& sysCustomerHeatStatistics.getFoodHeatStatisticsList().size() > 0){

View File

@ -76,10 +76,12 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
LocalDate serverStartDate = DateUtils.dateToLocalDate(sysOrder.getStartTime());
//订单总服务月数
int serverMonth = sysOrder.getServeTimeId() != null ? sysOrder.getServeTimeId().intValue()/30 : 0;
//服务天数(不满一个月的零头)
int serverSmallDay = sysOrder.getServeTimeId().intValue()%30 - (serverMonth > 0 ? 0 : 1);
//赠送时长
int giveDay = sysOrder.getGiveServeDay() != null ? sysOrder.getGiveServeDay().intValue() : 0;
//服务到期时间(加赠送时间,不加暂停时间)
serverEndDate = serverStartDate.plusMonths(serverMonth).plusDays(giveDay);
serverEndDate = serverStartDate.plusMonths(serverMonth).plusDays(giveDay+serverSmallDay);
List<SysOrderPause> pausesList = sysOrder.getOrderPauseList();
if(pausesList == null){
if(sysOrder.getOrderId() != null){
@ -90,12 +92,10 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
pausesList = new ArrayList<>();
}
}
//System.out.println("结束时间:"+serverEndDate);
//每年每月暂停天数key为年份加月份如:2021年1月=20211
Map<String, Integer> everyYearMonthPauseDay = getEveryYearMonthPauseDay(pausesList, serverStartDate, serverEndDate);
//该笔订单暂停总天数
int pauseTotalDay = getTotalByMap(everyYearMonthPauseDay);
//System.out.println("暂停天数:"+pauseTotalDay);
//服务到期时间加上暂停时间
serverEndDate = serverEndDate.plusDays(pauseTotalDay);
}
@ -278,10 +278,12 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
LocalDate serverStartDate = DateUtils.dateToLocalDate(sysOrder.getStartTime());
//订单总服务月数
int serverMonth = sysOrder.getServeTimeId().intValue()/30;
//服务天数(不满一个月的零头)
int serverSmallDay = sysOrder.getServeTimeId().intValue()%30 - (serverMonth > 0 ? 0 : 1);
//赠送时长
int giveDay = sysOrder.getGiveServeDay().intValue();
//服务到期时间(加赠送时间,不加暂停时间)
LocalDate serverEndDate = serverStartDate.plusMonths(serverMonth).plusDays(giveDay);
LocalDate serverEndDate = serverStartDate.plusMonths(serverMonth).plusDays(giveDay+serverSmallDay);
//订单金额
BigDecimal orderAmount = sysOrder.getAmount();
//每年每月暂停天数key为年份加月份如:2021年1月=20211
@ -355,9 +357,6 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
//服务到期时间刷新
serverEndDate = serverEndDate.plusDays(totalDay);
}
/*for(String key : pauseMap.keySet()){
System.out.println(key+":"+pauseMap.get(key).intValue());
}*/
return pauseMap;
}

View File

@ -1,6 +1,9 @@
package com.stdiet.custom.service.impl;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.custom.domain.SysOrder;
import com.stdiet.custom.mapper.SysOrderMapper;
import com.stdiet.custom.service.ISysCommissionDayService;
@ -70,18 +73,106 @@ public class SysOrderServiceImpl implements ISysOrderService {
public int insertSysOrder(SysOrder sysOrder) {
Date orderTime = DateUtils.getNowDate();
sysOrder.setCreateTime(orderTime);
sysOrder.setCreateBy(SecurityUtils.getUsername());
//sysOrder.setOrderTime(orderTime);
//计算服务到期时间
setOrderServerEndDate(sysOrder);
sysOrder.setOrderId(Long.parseLong(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, orderTime)));
int row = sysOrderMapper.insertSysOrder(sysOrder);
// if (row > 0) {
// //异步生成食谱计划
// sysRecipesPlanService.regenerateRecipesPlan(sysOrder.getOrderId());
// }
//获取订单类型
Integer[] orderType = sysOrder.getOrderTypeList();
if(orderType == null || orderType.length != 3){
return 0;
}
sysOrder.setOrderType(String.valueOf(orderType[0]));
sysOrder.setOrderCountType(String.valueOf(orderType[1]));
sysOrder.setOrderMoneyType(String.valueOf(orderType[2]));
int row = 0;
//普通单
if("0".equals(sysOrder.getOrderType())){
sysOrder.setNutritionistId((sysOrder.getNutritionistIdList() != null && sysOrder.getNutritionistIdList().length > 0) ? sysOrder.getNutritionistIdList()[0] : null);
sysOrder.setMainOrderId(0L);
sysOrder.setAfterSaleCommissOrder(0);
sysOrder.setOnSaleId(null);
//二开单
if("1".equals(sysOrder.getOrderCountType())){
row = sysOrderMapper.insertSysOrder(sysOrder);
//需要自动创建售后二开提成单
if(row > 0 && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){
autoCreateSecondAfterSaleOrder(sysOrder);
}
}else{
row = sysOrderMapper.insertSysOrder(sysOrder);
}
}
//比例拆分单
else if("1".equals(sysOrder.getOrderType())){
sysOrder.setAfterSaleCommissOrder(0);
sysOrder.setOnSaleId(null);
String rate = sysOrder.getNutritionistRate();
if(StringUtils.isEmpty(rate) || rate.indexOf(",") == -1 || "0,10".equals(rate) || sysOrder.getNutritionistIdList().length != 2){
return 0;
}
String[] rateArray = rate.split(",");
if(Integer.parseInt(rateArray[0]) + Integer.parseInt(rateArray[1]) != 10){
return 0;
}
BigDecimal amount = sysOrder.getAmount();
//获取主单的数组下标
int mainIndex = 0;
if(Integer.parseInt(rateArray[1]) > Integer.parseInt(rateArray[0])){
mainIndex = 1;
}
//添加主单
sysOrder.setNutritionistId(sysOrder.getNutritionistIdList()[mainIndex]);
sysOrder.setAmount(BigDecimal.valueOf(amount.doubleValue()*Integer.parseInt(rateArray[mainIndex])/10));
sysOrder.setMainOrderId(0L);
row = sysOrderMapper.insertSysOrder(sysOrder);
//添加副单
sysOrder.setMainOrderId(sysOrder.getOrderId());
sysOrder.setOrderId(sysOrder.getOrderId()+1);
sysOrder.setNutritionistId(sysOrder.getNutritionistIdList()[1-mainIndex]);
sysOrder.setAmount(BigDecimal.valueOf(amount.doubleValue()*Integer.parseInt(rateArray[1-mainIndex])/10));
row = sysOrderMapper.insertSysOrder(sysOrder);
//二开,是否需要自动创建售后二开提成单
if(row > 0 && "1".equals(sysOrder.getOrderCountType()) && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){
sysOrder.setAmount(amount);
autoCreateSecondAfterSaleOrder(sysOrder);
}
}
//体验单
else if("2".equals(sysOrder.getOrderType())){
sysOrder.setMainOrderId(0L);
sysOrder.setAfterSaleCommissOrder(0);
sysOrder.setAfterSaleId(null);
sysOrder.setNutritionistId(null);
sysOrder.setNutriAssisId(null);
row = sysOrderMapper.insertSysOrder(sysOrder);
}
return row;
}
/**
* 创建售后二开提成订单
* @param sysOrder
* @return
*/
private int autoCreateSecondAfterSaleOrder(SysOrder sysOrder){
if(sysOrder != null){
sysOrder.setPreSaleId(sysOrder.getAfterSaleId());
sysOrder.setAfterSaleId(null);
sysOrder.setNutritionistId(null);
sysOrder.setNutriAssisId(null);
sysOrder.setPlannerId(null);
sysOrder.setPlannerAssisId(null);
sysOrder.setOperatorId(null);
sysOrder.setOperatorAssisId(null);
sysOrder.setAfterSaleCommissOrder(1);
sysOrder.setOrderId(sysOrder.getOrderId()+1);
return sysOrderMapper.insertSysOrder(sysOrder);
}
return 0;
}
/**
* 修改销售订单
*
@ -94,6 +185,7 @@ public class SysOrderServiceImpl implements ISysOrderService {
SysOrder oldSysOrder = sysOrderMapper.selectSysOrderById(sysOrder.getOrderId());
//计算服务到期时间
setOrderServerEndDate(sysOrder);
sysOrder.setUpdateBy(SecurityUtils.getUsername());
sysOrder.setUpdateTime(DateUtils.getNowDate());
//更新订单
int row = sysOrderMapper.updateSysOrder(sysOrder);

View File

@ -30,7 +30,6 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
public int addRecipes(SysRecipes sysRecipes) {
int rows = sysRecipesMapper.addRecipes(sysRecipes);
if (rows > 0) {
int count = sysRecipesMapper.getNumDayByCusId(sysRecipes.getCusId());
List<SysRecipesDaily> menus = sysRecipes.getMenus();
List<SysRecipesDailyDishes> dishes = new ArrayList<>();
int size = menus.size();
@ -41,8 +40,6 @@ public class SysRecipesServiceImpl implements ISysRecipesService {
tarMenu.setId(dailyId);
// 插入recipiesId
tarMenu.setRecipesId(sysRecipes.getId());
// 插入numDay
tarMenu.setNumDay(count + i + 1);
for (SysRecipesDailyDishes tmpDishes : tarMenu.getDishes()) {
// 让菜品插入menuId
tmpDishes.setMenuId(dailyId);

View File

@ -40,6 +40,15 @@
<result property="conditioningProjectId" column="conditioning_project_id"/>
<result property="serverEndTime" column="server_end_time"/>
<result property="becomeFanTime" column="become_fan_time"/>
<result property="onSaleId" column="on_sale_id" />
<result property="orderType" column="order_type" />
<result property="orderCountType" column="order_count_type" />
<result property="orderMoneyType" column="order_money_type" />
<result property="mainOrderId" column="main_order_id" />
<result property="afterSaleCommissOrder" column="after_sale_commiss_order" />
<result property="delFlag" column="del_flag" />
<!-- 非持久化字段 -->
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
<result property="nutritionist" column="nutritionist_name"></result><!-- 营养师名称 -->
@ -47,10 +56,12 @@
</resultMap>
<sql id="selectSysOrderVo">
select o.order_id, o.review_status, o.cus_id, o.customer, o.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time,
select o.order_id, o.review_status, o.cus_id, sc.name as customer, sc.phone, o.amount, o.start_time, o.pause_time, o.status, o.weight, ser.dict_label as serve_time,
o.serve_time_id, o.pay_type_id, pay.dict_label as pay_type, o.pre_sale_id, o.create_by, o.create_time, o.after_sale_id, o.update_by, o.update_time,
o.nutritionist_id, o.remark, o.nutri_assis_id, o.account_id, acc.dict_label as account, o.planner_id, o.planner_assis_id, o.operator_id, o.operator_assis_id,
o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time from sys_order o
o.recommender, o.order_time,o.give_serve_day,o.conditioning_project_id,cp.dict_label as conditioning_project,o.server_end_time,o.become_fan_time
from sys_order o
LEFT JOIN sys_customer sc ON sc.id = o.cus_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_pay_type') AS pay ON pay.dict_value = o.pay_type_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = o.account_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_serve_time') AS ser ON ser.dict_value = o.serve_time_id
@ -99,7 +110,7 @@
<where>
<if test="orderId != null and orderId != ''">and order_id = #{orderId}</if>
<if test="customer != null and customer != ''">
and (customer like concat('%',#{customer},'%') or phone like concat('%',#{customer},'%'))
and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%'))
</if>
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
<!--<if test="phone != null and phone != ''">and phone = #{phone}</if>-->
@ -127,85 +138,97 @@
and 0 > amount
</if>
</if>
<if test="true">and del_flag = 0</if>
<if test="true">and o.del_flag = 0</if>
</where>
order by order_time desc
</select>
<select id="selectSysOrderById" parameterType="Long" resultMap="SysOrderResult">
<include refid="selectSysOrderVo"/>
where order_id = #{orderId}
where order_id = #{orderId} and o.del_flag = 0
</select>
<insert id="insertSysOrder" parameterType="SysOrder" useGeneratedKeys="true" keyProperty="orderId">
insert into sys_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="customer != null and customer != ''">customer,</if>
<if test="cusId != null">cus_id,</if>
<if test="phone != null">phone,</if>
<if test="amount != null">amount,</if>
<if test="status != null">status,</if>
<if test="pauseTime != null">pause_time,</if>
<if test="startTime != null">start_time,</if>
<if test="weight != null">weight,</if>
<if test="payTypeId != null">pay_type_id,</if>
<if test="reviewStatus != null">review_status,</if>
<if test="preSaleId != null">pre_sale_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="status != null">status,</if>
<if test="weight != null">weight,</if>
<if test="afterSaleId != null">after_sale_id,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="startTime != null">start_time,</if>
<if test="pauseTime != null">pause_time,</if>
<if test="nutritionistId != null">nutritionist_id,</if>
<if test="remark != null">remark,</if>
<if test="nutriAssisId != null">nutri_assis_id,</if>
<if test="onSaleId != null">on_sale_id,</if>
<if test="accountId != null">account_id,</if>
<if test="plannerId != null">planner_id,</if>
<if test="plannerAssisId != null">planner_assis_id,</if>
<if test="operatorId != null">operator_id,</if>
<if test="operatorAssisId != null">operator_assis_id,</if>
<if test="recommender != null">recommender,</if>
<if test="orderTime != null">order_time,</if>
<if test="operatorId != null">operator_id,</if>
<if test="serveTimeId != null">serve_time_id,</if>
<if test="reviewStatus != null">review_status,</if>
<if test="recommender != null">recommender,</if>
<if test="amount != null">amount,</if>
<if test="orderTime != null">order_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="giveServeDay != null">give_serve_day,</if>
<if test="conditioningProjectId != null">conditioning_project_id,</if>
<if test="serverEndTime != null">server_end_time,</if>
<if test="becomeFanTime != null">become_fan_time,</if>
<if test="orderType != null">order_type,</if>
<if test="orderCountType != null">order_count_type,</if>
<if test="orderMoneyType != null">order_money_type,</if>
<if test="mainOrderId != null">main_order_id,</if>
<if test="afterSaleCommissOrder != null">after_sale_commiss_order,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="customer != null and customer != ''">#{customer},</if>
<if test="cusId != null">#{cusId},</if>
<if test="phone != null">#{phone},</if>
<if test="amount != null">#{amount},</if>
<if test="status != null">#{status},</if>
<if test="pauseTime != null">#{pauseTime},</if>
<if test="startTime != null">#{startTime},</if>
<if test="weight != null">#{weight},</if>
<if test="payTypeId != null">#{payTypeId},</if>
<if test="reviewStatus != null">#{reviewStatus},</if>
<if test="preSaleId != null">#{preSaleId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="status != null">#{status},</if>
<if test="weight != null">#{weight},</if>
<if test="afterSaleId != null">#{afterSaleId},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="startTime != null">#{startTime},</if>
<if test="pauseTime != null">#{pauseTime},</if>
<if test="nutritionistId != null">#{nutritionistId},</if>
<if test="remark != null">#{remark},</if>
<if test="nutriAssisId != null">#{nutriAssisId},</if>
<if test="onSaleId != null">#{onSaleId},</if>
<if test="accountId != null">#{accountId},</if>
<if test="plannerId != null">#{plannerId},</if>
<if test="plannerAssisId != null">#{plannerAssisId},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="operatorAssisId != null">#{operatorAssisId},</if>
<if test="recommender != null">#{recommender},</if>
<if test="orderTime != null">#{orderTime},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="serveTimeId != null">#{serveTimeId},</if>
<if test="reviewStatus != null">#{reviewStatus},</if>
<if test="recommender != null">#{recommender},</if>
<if test="amount != null">#{amount},</if>
<if test="orderTime != null">#{orderTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="giveServeDay != null">#{giveServeDay},</if>
<if test="conditioningProjectId != null">#{conditioningProjectId},</if>
<if test="serverEndTime != null">#{serverEndTime},</if>
<if test="becomeFanTime != null">#{becomeFanTime},</if>
<if test="orderType != null">#{orderType},</if>
<if test="orderCountType != null">#{orderCountType},</if>
<if test="orderMoneyType != null">#{orderMoneyType},</if>
<if test="mainOrderId != null">#{mainOrderId},</if>
<if test="afterSaleCommissOrder != null">#{afterSaleCommissOrder},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
@ -215,34 +238,41 @@
<if test="customer != null and customer != ''">customer = #{customer},</if>
<if test="cusId != null">cus_id = #{cusId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="status != null">status = #{status},</if>
<if test="pauseTime != null">pause_time = #{pauseTime},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="payTypeId != null">pay_type_id = #{payTypeId},</if>
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
<if test="preSaleId != null">pre_sale_id = #{preSaleId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="status != null">status = #{status},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="afterSaleId != null">after_sale_id = #{afterSaleId},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="pauseTime != null">pause_time = #{pauseTime},</if>
<if test="nutritionistId != null">nutritionist_id = #{nutritionistId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="nutriAssisId != null">nutri_assis_id = #{nutriAssisId},</if>
<if test="onSaleId != null">on_sale_id = #{onSaleId},</if>
<if test="accountId != null">account_id = #{accountId},</if>
<if test="plannerId != null">planner_id = #{plannerId},</if>
<if test="plannerAssisId != null">planner_assis_id = #{plannerAssisId},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="operatorAssisId != null">operator_assis_id = #{operatorAssisId},</if>
<if test="recommender != null">recommender = #{recommender},</if>
<if test="orderTime != null">order_time = #{orderTime},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="serveTimeId != null">serve_time_id = #{serveTimeId},</if>
<if test="reviewStatus != null">review_status = #{reviewStatus},</if>
<if test="recommender != null">recommender = #{recommender},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="orderTime != null">order_time = #{orderTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="giveServeDay != null">give_serve_day = #{giveServeDay},</if>
<if test="conditioningProjectId != null">conditioning_project_id = #{conditioningProjectId},</if>
<if test="serverEndTime != null">server_end_time = #{serverEndTime},</if>
<if test="becomeFanTime != null">become_fan_time = #{becomeFanTime},</if>
<if test="orderType != null">order_type = #{orderType},</if>
<if test="orderCountType != null">order_count_type = #{orderCountType},</if>
<if test="orderMoneyType != null">order_money_type = #{orderMoneyType},</if>
<if test="mainOrderId != null">main_order_id = #{mainOrderId},</if>
<if test="afterSaleCommissOrder != null">after_sale_commiss_order = #{afterSaleCommissOrder},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where order_id = #{orderId}
</update>
@ -294,6 +324,15 @@
<result property="conditioningProjectId" column="conditioning_project_id"/>
<result property="serverEndTime" column="server_end_time"/>
<result property="becomeFanTime" column="become_fan_time"/>
<result property="onSaleId" column="on_sale_id" />
<result property="orderType" column="order_type" />
<result property="orderCountType" column="order_count_type" />
<result property="orderMoneyType" column="order_money_type" />
<result property="mainOrderId" column="main_order_id" />
<result property="afterSaleCommissOrder" column="after_sale_commiss_order" />
<result property="delFlag" column="del_flag" />
<!-- 非持久化字段 -->
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
<result property="nutritionist" column="nutritionist_name"></result><!-- 营养师名称 -->
@ -325,7 +364,7 @@
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 del_flag = 0
where review_status = 'yes' and o.order_time >= '2021-01-01' and o.del_flag = 0
<if test="userId != null">
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>

View File

@ -127,9 +127,9 @@
<!-- 新增每菜单 -->
<insert id="bashAddMenus">
insert into sys_customer_daily_menu (id, num_day, date, recipes_id, cus_id) values
insert into sys_customer_daily_menu (id, num_day, recipes_id, cus_id) values
<foreach collection="list" separator="," item="item" index="index">
(#{item.id}, #{item.numDay}, #{item.date}, #{item.recipesId}, #{item.cusId})
(#{item.id}, #{item.numDay}, #{item.recipesId}, #{item.cusId})
</foreach>
</insert>

View File

@ -9,6 +9,8 @@
<result property="orderId" column="order_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" />
<result property="recipesId" column="recipes_id" />
<result property="sendFlag" column="send_flag" />
<result property="sendTime" column="send_time" />
@ -19,7 +21,7 @@
<result property="delFlag" column="del_flag" />
<result property="cusId" column="cus_id" />
<!-- 非持久化字段 -->
<result property="customerId" column="cus_id"></result><!-- 客户ID -->
<!-- <result property="customerId" column="cus_id"></result>&lt;!&ndash; 客户ID &ndash;&gt;-->
<result property="customer" column="customer" /><!-- 客户姓名 -->
<result property="phone" column="phone" />
<result property="orderStartDate" column="order_start_date" />
@ -31,7 +33,7 @@
</resultMap>
<sql id="selectSysRecipesPlanVo">
select id, order_id, cus_id, start_date, end_date, 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 from sys_recipes_plan
</sql>
<select id="selectSysRecipesPlanList" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
@ -40,6 +42,8 @@
<if test="cusId != null "> and cus_id = #{cusId}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="startNumDay != null "> and start_num_day = #{startNumDay}</if>
<if test="endNumDay != null "> and end_num_day = #{endNumDay}</if>
<if test="recipesId != null "> and recipes_id = #{recipesId}</if>
<if test="sendFlag != null "> and send_flag = #{sendFlag}</if>
<if test="sendTime != null "> and send_time = #{sendTime}</if>
@ -57,6 +61,8 @@
<if test="cusId != null">cus_id,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="startNumDay != null">start_num_day,</if>
<if test="endNumDay != null">end_num_day,</if>
<if test="recipesId != null">recipes_id,</if>
<if test="sendFlag != null">send_flag,</if>
<if test="sendTime != null">send_time,</if>
@ -71,6 +77,8 @@
<if test="cusId != null">#{cusId},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="startNumDay != null">#{startNumDay},</if>
<if test="endNumDay != null">#{endNumDay},</if>
<if test="recipesId != null">#{recipesId},</if>
<if test="sendFlag != null">#{sendFlag},</if>
<if test="sendTime != null">#{sendTime},</if>
@ -89,6 +97,8 @@
<if test="cusId != null">cus_id = #{cusId},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="startNumDay != null">start_num_day = #{startNumDay},</if>
<if test="endNumDay != null">end_num_day = #{endNumDay},</if>
<if test="recipesId != null">recipes_id = #{recipesId},</if>
<if test="sendFlag != null">send_flag = #{sendFlag},</if>
<if test="sendTime != null">send_time = #{sendTime},</if>
@ -115,10 +125,10 @@
<!-- 批量插入食谱计划 -->
<insert id="insertBatch">
INSERT INTO sys_recipes_plan
(order_id, cus_id, start_date, end_date, send_flag, send_time, recipes_id)
(order_id, cus_id, start_date, end_date, start_num_day, end_num_day, send_flag, send_time, recipes_id)
VALUES
<foreach collection ="list" item="plan" separator =",">
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
(#{plan.orderId}, #{plan.cusId}, #{plan.startDate}, #{plan.endDate}, #{plan.startNumDay}, #{plan.endNumDay}, #{plan.sendFlag}, #{plan.sendTime}, #{plan.recipesId})
</foreach >
</insert>
@ -132,15 +142,18 @@
<!-- 食谱计划、订单表联查 -->
<select id="selectPlanListByCondition" parameterType="SysRecipesPlan" resultMap="SysRecipesPlanResult">
SELECT srp.id,srp.order_id,srp.recipes_id,sr.customer,sr.cus_id,sr.phone,su_nutritionist.nick_name nutritionist,su_nutritionist_assis.nick_name AS nutritionist_assis,sr.start_time,sr.server_end_time, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
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,
srp.start_date,srp.end_date,srp.send_flag,srp.send_time, sc.name as customer
FROM sys_recipes_plan srp
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
LEFT JOIN sys_customer sc ON sc.id = srp.cus_id
LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = sr.nutritionist_id AND su_nutritionist.del_flag = 0
LEFT JOIN sys_user su_nutritionist_assis ON su_nutritionist_assis.user_id = sr.nutri_assis_id AND su_nutritionist_assis.del_flag = 0
WHERE srp.del_flag = 0
WHERE srp.del_flag = 0 and sr.del_flag = 0
<if test="orderId != null">AND srp.order_id = #{orderId}</if>
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
<if test="customer != null and customer != ''">AND (sr.customer like concat('%',#{customer},'%') OR sr.phone like concat('%',#{customer},'%'))</if>
<if test="customer != null and customer != ''">AND (sc.name like concat('%',#{customer},'%') OR sc.phone like concat('%',#{customer},'%'))</if>
<if test="nutritionistId != null">AND su_nutritionist.user_id = #{nutritionistId}</if>
<if test="nutritionistAssisId != null">AND su_nutritionist_assis.user_id = #{nutritionistAssisId}</if>
<if test="startDate != null and endDate != null ">AND srp.start_date BETWEEN date_format(#{startDate},'%y%m%d') AND date_format(#{endDate},'%y%m%d') </if>
@ -169,7 +182,7 @@
SELECT srp.id,srp.order_id,sr.customer,sr.phone, srp.start_date,srp.end_date,srp.send_flag,srp.send_time
FROM sys_recipes_plan srp
LEFT JOIN sys_order sr ON sr.order_id = srp.order_id
WHERE srp.del_flag = 0 AND srp.order_id = #{orderId}
WHERE srp.del_flag = 0 AND sr.del_flag = 0 AND srp.order_id = #{orderId}
<if test="sendFlag != null">AND srp.send_flag = #{sendFlag}</if>
ORDER BY srp.id ASC
</select>

View File

@ -65,6 +65,7 @@
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",
"vue-router": "3.0.2",
"vue-scrollto": "^2.20.0",
"vue-splitpane": "1.0.4",
"vuedraggable": "2.20.0",
"vuex": "3.1.0"

View File

@ -4,7 +4,6 @@
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
:wrapperClosable="false"
@closed="handleOnClosed"
size="40%"
>

View File

@ -10,16 +10,16 @@
<el-row :gutter="15">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-col :span="12">
<el-form-item label="订单类型" prop="orderType">
<el-form-item label="订单类型" prop="orderTypeList">
<el-cascader
v-model="form.orderType"
v-model="form.orderTypeList"
:options="orderTypeOptions"
style="width: 100%"
>
</el-cascader>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-show="secondAfterSaleFlagShow">
<el-form-item
label="自动创建售后提成订单"
prop="secondAfterSaleFlag"
@ -27,7 +27,6 @@
>
<el-select
v-model="form.secondAfterSaleFlag"
:disabled="secondAfterSaleFlagShow"
style="width: 100px"
placeholder="请选择"
>
@ -116,7 +115,18 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-show="!afterNutiShow">
<el-form-item label="售中" prop="onSaleId">
<el-select v-model="form.onSaleId" placeholder="请选择">
<el-option
:key="177"
:label="'时瑞瑞'"
:value="parseInt('177')"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" v-show="afterNutiShow">
<el-form-item label="售后" prop="afterSaleId">
<el-select v-model="form.afterSaleId" placeholder="请选择">
<el-option
@ -128,7 +138,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-show="afterNutiShow">
<el-form-item label="主营养师" prop="nutritionistIdList">
<el-select
v-model="form.nutritionistIdList"
@ -144,11 +154,10 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-show="orderRateOptionsShow">
<el-form-item label="拆分比例" prop="nutritionistRate">
<el-select
v-model="form.nutritionistRate"
:disabled="orderRateOptionsShow"
placeholder="请选择"
>
<el-option
@ -160,7 +169,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-col :span="8" v-show="afterNutiShow">
<el-form-item label="助理营养师" prop="nutriAssisId">
<el-select v-model="form.nutriAssisId" placeholder="请选择">
<el-option
@ -252,7 +261,8 @@
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="10" v-hasPermi="['custom:order:review']">
<!-- 添加时默认未审核不能改 -->
<el-col :span="10" v-hasPermi="['custom:order:review']" v-show="false">
<el-form-item label="审核状态" prop="reviewStatus">
<el-select v-model="form.reviewStatus" placeholder="请选择审核状态">
<el-option
@ -417,10 +427,12 @@ export default {
orderDropdownCorrespondingOptions: [],
//订单类型
orderTypeOptions: orderTypeData["orderTypeArray"],
secondAfterSaleFlagShow: true,
secondAfterSaleFlagShow: false,
//分成比例
orderRateOptions: orderTypeData["orderRateArray"],
orderRateOptionsShow: true,
orderRateOptionsShow: false,
//售后、营养师、营养师助理是否显示
afterNutiShow: true,
};
},
created() {
@ -571,7 +583,8 @@ export default {
: [0, 0, 0, 0];
this.form = {
orderId: null,
orderType: [0, 0, 0],
orderType: null,
orderTypeList: [0, 0, 0],
secondAfterSaleFlag: 0,
customer: null,
phone: null,
@ -587,6 +600,7 @@ export default {
preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null,
createBy: null,
createTime: null,
onSaleId: null,
afterSaleId: defaultAftersale
? parseInt(defaultAftersale.dictValue)
: null,
@ -653,7 +667,7 @@ export default {
}
},
handleOrderTypeChange() {
console.log(this.form.orderType);
console.log(this.form.orderTypeList);
},
},
watch: {
@ -661,23 +675,37 @@ export default {
"form.accountId": function (newVal, oldVal) {
this.initPlanningAndOperation();
},
"form.orderType": function (newVal, oldVal) {
"form.orderTypeList": function (newVal, oldVal) {
//判断订单类型是否选择了二开
if (newVal[1] == 1) {
this.form.secondAfterSaleFlag = 1;
this.secondAfterSaleFlagShow = false;
this.secondAfterSaleFlagShow = true;
} else {
this.form.secondAfterSaleFlag = 0;
this.secondAfterSaleFlagShow = true;
this.secondAfterSaleFlagShow = false;
}
//判断是否选择了比例拆分单
if (newVal[0] == 1) {
this.orderRateOptionsShow = false;
this.orderRateOptionsShow = true;
this.form.nutritionistRate = "2,8";
} else {
this.orderRateOptionsShow = true;
this.orderRateOptionsShow = false;
this.form.nutritionistRate = "0,10";
}
//判断是否选择了体验单
if (newVal[0] == 2) {
/*this.form.nutritionistId = null;
this.form.nutritionistIdList = null;
this.form.afterSaleId = null;
this.form.nutriAssisId = null;*/
this.afterNutiShow = false;
this.form.onSaleId = 177;
this.form.serveTimeId = 7;
}else{
this.form.onSaleId = null;
this.form.serveTimeId = 90;
this.afterNutiShow = true;
}
},
},
};

View File

@ -4,7 +4,6 @@
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
:wrapperClosable="false"
@closed="handleOnClosed"
size="40%"
>
@ -103,7 +102,7 @@
</el-drawer>
<!-- 新增订单 -->
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
<create-order-dialog ref="cusCreateOrderDialogRef" />
<!-- 订单编辑 -->
<edit-order-dialog ref="cusEditOrderDialogRef" />
@ -113,7 +112,7 @@
<script>
import { listOrder, delOrder } from "@/api/custom/order";
import OrderEdit from "@/components/OrderEdit";
// import OrderAdd from "@/components/OrderAdd";
import OrderAdd from "@/components/OrderAdd";
import OrderDetail from "@/components/OrderDetail";
import { mapGetters } from "vuex";
import { checkPermi } from "@/utils/permission";
@ -123,7 +122,7 @@ export default {
components: {
"edit-order-dialog": OrderEdit,
"order-detail": OrderDetail,
//"create-order-dialog": OrderAdd
"create-order-dialog": OrderAdd
},
data() {
return {
@ -172,13 +171,13 @@ export default {
});
},
handleAdd() {
this.$refs.cusEditOrderDialogRef.showDialog(
this.$refs.cusCreateOrderDialogRef.showDialog(
{
customer: this.data.name,
cusId: this.data.id,
preSaleId: this.data.salesman,
afterSaleId: this.data.afterDietitian,
nutritionistId: this.data.mainDietitian,
nutritionistIdList: [this.data.mainDietitian],
nutriAssisId: this.data.assistantDietitian,
},
() => {

View File

@ -0,0 +1,81 @@
<template>
<el-drawer
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
@closed="handleOnClosed"
size="40%"
>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleInnerOpen"
>查看暂停记录
</el-button>
</el-col>
</el-row>
<el-drawer
:title="innerTitle"
:append-to-body="true"
:close-on-press-escape="false"
:visible.sync="innerVisible"
@closed="handleOnInnerClosed"
>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleInnerOpen"
>查看暂停记录
</el-button>
</el-col>
</el-row>
</div>
</el-drawer>
</div>
</el-drawer>
</template>
<script>
export default {
name: "RecipesPlanDrawer",
data() {
return {
visible: false,
innerVisible: false,
title: "",
innerTitle: "",
};
},
methods: {
showDrawer(data) {
this.data = data;
if (!this.data) {
return;
}
this.visible = true;
this.title = `${this.data.name}」食谱计划`;
},
handleOnClosed() {
this.data = undefined;
},
handleInnerOpen() {
this.innerVisible = true;
this.innerTitle = `${this.data.name}」暂停记录`;
},
handleOnInnerClosed() {},
},
};
</script>
<style lang="scss" scoped>
/deep/ :focus {
outline: 0;
}
</style>

View File

@ -1,22 +1,24 @@
import Vue from 'vue'
import Vue from "vue";
import Cookies from 'js-cookie'
import Cookies from "js-cookie";
import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import "normalize.css/normalize.css"; // a modern alternative to CSS resets
import Element from "element-ui";
import "./assets/styles/element-variables.scss";
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
import store from './store'
import router from './router'
import permission from './directive/permission'
import "@/assets/styles/index.scss"; // global css
import "@/assets/styles/ruoyi.scss"; // ruoyi css
import App from "./App";
import store from "./store";
import router from "./router";
import permission from "./directive/permission";
import "./assets/icons"; // icon
import "./permission"; // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import VueScrollTo from "vue-scrollto";
import './assets/icons' // icon
import './permission' // permission control
import {getDicts} from "@/api/system/dict/data";
import {getConfigKey} from "@/api/system/config";
import {
addDateRange,
download,
@ -32,40 +34,40 @@ import {
} from "@/utils/ruoyi";
import Pagination from "@/components/Pagination";
//自定义表格工具扩展
import RightToolbar from "@/components/RightToolbar"
import RightToolbar from "@/components/RightToolbar";
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.downloadResource = downloadResource
Vue.prototype.handleTree = handleTree
Vue.prototype.toThousands = toThousands
Vue.prototype.digitUppercase = digitUppercase
Vue.prototype.validatorIDCard = validatorIDCard
Vue.prototype.getDicts = getDicts;
Vue.prototype.getConfigKey = getConfigKey;
Vue.prototype.parseTime = parseTime;
Vue.prototype.resetForm = resetForm;
Vue.prototype.addDateRange = addDateRange;
Vue.prototype.selectDictLabel = selectDictLabel;
Vue.prototype.selectDictLabels = selectDictLabels;
Vue.prototype.download = download;
Vue.prototype.downloadResource = downloadResource;
Vue.prototype.handleTree = handleTree;
Vue.prototype.toThousands = toThousands;
Vue.prototype.digitUppercase = digitUppercase;
Vue.prototype.validatorIDCard = validatorIDCard;
Vue.prototype.msgSuccess = function (msg) {
this.$message({showClose: true, message: msg, type: "success"});
}
Vue.prototype.msgSuccess = function(msg) {
this.$message({ showClose: true, message: msg, type: "success" });
};
Vue.prototype.msgError = function (msg) {
this.$message({showClose: true, message: msg, type: "error"});
}
Vue.prototype.msgError = function(msg) {
this.$message({ showClose: true, message: msg, type: "error" });
};
Vue.prototype.msgInfo = function (msg) {
Vue.prototype.msgInfo = function(msg) {
this.$message.info(msg);
}
};
// 全局组件挂载
Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component("Pagination", Pagination);
Vue.component("RightToolbar", RightToolbar);
Vue.use(permission)
Vue.use(permission);
/**
* If you don't want to use mock-server
@ -77,14 +79,34 @@ Vue.use(permission)
*/
Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size
})
size: Cookies.get("size") || "medium" // set element-ui default size
});
Vue.config.productionTip = false
Vue.config.productionTip = false;
Vue.directive("title", {
inserted: function(el, binding) {
document.title = el.dataset.title;
}
});
Vue.use(VueScrollTo, {
container: "body",
duration: 500,
easing: "ease",
offset: 0,
force: true,
cancelable: true,
onStart: false,
onDone: false,
onCancel: false,
x: false,
y: true
});
new Vue({
el: '#app',
el: "#app",
router,
store,
render: h => h(App)
})
});

View File

@ -140,19 +140,11 @@ export const constantRoutes = [
]
},
{
path: "/recipes",
component: Layout,
hidden: true,
children: [
{
path: "build",
component: resolve =>
require(["@/views/custom/recipesBuild"], resolve),
name: "RecipiesBuild",
props: true,
meta: { title: "食谱制作" }
}
]
path: "/recipes/build",
component: resolve => require(["@/views/custom/recipesBuild"], resolve),
name: "RecipiesBuild",
meta: { title: "食谱制作" },
hidden: true
},
{
path: "/f/contract/:id(\\d+)",
@ -174,14 +166,13 @@ export const constantRoutes = [
hidden: true,
meta: { title: "胜唐体控健康评估表" }
},
{
{
path: "/foodHeatCalculator/:id",
component: resolve =>
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
require(["@/views/custom/foodHeatStatistics/investigate"], resolve),
hidden: true,
meta: { title: "外食计算器" }
},
}
];
export default new Router({

View File

@ -8,7 +8,6 @@ import {
addRecipesApi
} from "@/api/custom/recipes";
import { getDicts } from "@/api/system/dict/data";
import dayjs from "dayjs";
const oriState = {
cusId: undefined,
@ -24,8 +23,8 @@ const oriState = {
dishesTypeOptions: [],
typeOptions: [],
currentDay: -1,
startDate: "",
endDate: ""
startNum: 0,
endNum: 0
};
const mutations = {
@ -36,9 +35,9 @@ const mutations = {
if (tarDishes) {
const tarIgd = tarDishes.igdList.find(obj => obj.id === payload.igdId);
if (tarIgd) {
Object.keys(payload).forEach(key => {
tarIgd[key] = payload[key];
});
payload.weight && (tarIgd.weight = payload.weight);
payload.cusWeight && (tarIgd.cusWeight = payload.cusWeight);
payload.cusUnit && (tarIgd.cusUnit = payload.cusUnit);
}
}
},
@ -125,63 +124,73 @@ const actions = {
healthyData
});
},
async getRecipesInfo({ commit }, payload) {
async getRecipesInfo({ commit, state }, payload) {
commit("updateStateData", {
recipesDataLoading: true
});
const recipesDataResult = await getRecipesApi(payload.recipesId);
let recipesData = undefined;
let recipesData = [];
if (recipesDataResult.code === 200) {
recipesData = recipesDataResult.data.map(dayData => {
return {
id: dayData.id,
numDay: dayData.numDay,
dishes: dayData.dishes.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;
}, [])
};
});
const { endNum, startNum } = state;
let length = null;
if (endNum && startNum) {
length = endNum - startNum;
}
recipesData = recipesDataResult.data.reduce((outArr, dayData, idx) => {
if (!length || (length && length >= idx)) {
outArr.push({
id: dayData.id,
numDay: startNum ? startNum + idx : dayData.numDay,
dishes: dayData.dishes.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;
}, [])
});
}
return outArr;
}, []);
} else {
throw new Error(recipesDataResult.msg);
}
@ -193,9 +202,7 @@ const actions = {
cusId,
planId,
menus: recipesData.map((menu, idx) => ({
date: dayjs(state.startDate)
.add(idx, "day")
.format("YYYY-MM-DD"),
numDay: menu.numDay,
cusId,
dishes: menu.dishes.map(dObj => ({
dishesId: dObj.dishesId,
@ -209,11 +216,19 @@ const actions = {
}))
}))
};
const result = await addRecipesApi(params);
if (result.code === 200) {
const recipesId = result.data;
commit("updateStateData", { recipesId });
dispatch("getRecipesInfo", { recipesId });
payload.callback &&
payload.callback({
recipesId: result.data,
name: state.healthyData.name,
cusId: state.cusId,
planId: state.planId
});
}
// console.log(params);
},
@ -247,6 +262,7 @@ const actions = {
}
},
async updateDishes({ commit, state }, payload) {
// console.log(payload);
if (state.recipesId) {
const tarDishes = state.recipesData[payload.num].dishes.find(
obj => obj.dishesId === payload.dishesId
@ -273,9 +289,9 @@ const actions = {
commit("updateRecipesDishesDetail", payload);
}
}
} else {
commit("updateRecipesDishesDetail", payload);
}
} else {
commit("updateRecipesDishesDetail", payload);
}
},
async deleteDishes({ commit, state }, payload) {

View File

@ -35,6 +35,18 @@ export const orderTypeArray = [
value: 1,
label: "比例拆分单",
children: orderCountTypeArray
},
{
value: 2,
label: "体验单",
children:[{
value: 0,
label: "一开单",
children: [{
value: 0,
label: "全款单"
}]
}]
}
]
@ -43,7 +55,7 @@ export const orderRateArray = [
{
dictValue: "0,10",
dictLabel: "不拆分",
remark: ""
remark: "default"
},
{
dictValue: "1,9",
@ -52,7 +64,7 @@ export const orderRateArray = [
},{
dictValue: "2,8",
dictLabel: "2-8开",
remark: "default"
remark: ""
},
{
dictValue: "3,7",

View File

@ -346,6 +346,7 @@
<!-- 外食热量统计 -->
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
<!-- 食谱计划抽屉 -->
<RecipesPlanDrawer ref="recipesPlanDrawerRef"/>
</div>
</template>
@ -364,6 +365,7 @@ import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
import RecipesPlanDrawer from '@/components/RecipesPlanDrawer'
import { mapGetters } from "vuex";
export default {
@ -373,6 +375,7 @@ export default {
"physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer,
heatStatisticsDrawer: HeatStatisticsDrawer,
RecipesPlanDrawer
},
data() {
const userId = store.getters && store.getters.userId;
@ -392,14 +395,6 @@ export default {
total: 0,
// 客户档案表格数据
customerCenterList: [],
// 售前字典
// preSaleIdOptions: [],
// 售后字典
// afterSaleIdOptions: [],
// 主营养师字典
// nutritionistIdOptions: [],
// 助理营养师字典
// nutriAssisIdOptions: [],
// 弹出层标题
title: "",
// 是否显示弹出层
@ -459,9 +454,13 @@ export default {
},
computed: {
...mapGetters([
// 售前字典
"preSaleIdOptions",
// 售后字典
"afterSaleIdOptions",
// 主营养师字典
"nutritionistIdOptions",
// 助理营养师字典
"nutriAssisIdOptions",
]),
},
@ -511,6 +510,7 @@ export default {
},
handleOnMenuClick(row) {
// console.log(row);
this.$refs['recipesPlanDrawerRef'].showDrawer(row);
},
handleClickHeatStatistics(row) {
this.$refs["heatStatisticsRef"].showDrawer(row);

View File

@ -335,7 +335,7 @@
</template>
</el-table-column>
<el-table-column label="客户姓名" align="center" prop="customer" />
<!-- <el-table-column label="手机号" align="center" prop="phone" width="100" /> -->
<el-table-column label="手机号" align="center" prop="phone" width="100" />
<el-table-column label="成交金额" align="center" prop="amount">
<template slot-scope="scope">
{{ toThousands(scope.row.amount) }}
@ -391,14 +391,14 @@
@click="handleUpdate(scope.row)"
>修改
</el-button>
<!-- <el-button
<el-button
size="mini"
type="text"
icon="el-icon-s-data"
@click="orderPauseManage(scope.row)"
v-hasPermi="['orderPause:pause:query']"
>暂停记录管理
</el-button> -->
</el-button>
<el-button
size="mini"
v-if="
@ -660,7 +660,7 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
this.$confirm(
'是否确认删除销售订单编号为"' + orderIds + '"的数据项?',
'是否确认删除销售订单编号为"' + row.orderId + '"的数据项?',
"警告",
{
confirmButtonText: "确定",

View File

@ -4,9 +4,11 @@
<script>
import echarts from "echarts";
import VueScrollTo from "vue-scrollto";
require("@/utils/echarts/myShine");
import resize from "@/views/dashboard/mixins/resize";
import { createNamespacedHelpers } from "vuex";
const { mapMutations } = createNamespacedHelpers("recipes");
const animationDuration = 6000;
export default {
@ -55,8 +57,10 @@ export default {
// console.log("updated");
},
methods: {
...mapMutations(["setCurrentDay"]),
initChart() {
this.chart = echarts.init(this.$el, "myShine");
this.chart.on("click", this.handleOnClick);
this.updateChart(this.data.length > 0 ? this.data : {});
},
updateChart(source) {
@ -134,6 +138,14 @@ export default {
})),
});
},
handleOnClick(params) {
// console.log(params);
const { dataIndex } = params;
this.setCurrentDay({ currentDay: dataIndex });
VueScrollTo.scrollTo(`#recipes${dataIndex}`, 500, {
container: "#recipes_content",
});
},
},
watch: {
data(newVal, oldVal) {

View File

@ -124,6 +124,7 @@ export default {
text: `${data.name}营养统计`,
},
tooltip: {
position: 'right',
trigger: "item",
appendToBody: true,
formatter: (params) => {

View File

@ -60,7 +60,12 @@ export default {
this.$emit("update:collapse", !this.collapse);
},
handleOnSave() {
this.saveRecipes();
this.saveRecipes({
callback: (query) => {
console.log(query);
this.$router.replace({ path: "/recipes/build", query });
},
});
},
...mapActions(["saveRecipes"]),
},

View File

@ -6,7 +6,7 @@
}}</span>
</el-form-item>
<el-form-item label="菜品类型">
<el-radio-group v-model="type" @change="handleOnTypeChange">
<el-radio-group v-model="mType" @change="handleOnTypeChange">
<el-radio
v-for="item in typeOptions"
:key="item.dictValue"
@ -41,11 +41,7 @@
/>
</template>
</el-table-column>
<el-table-column
prop="proteinRatio"
label="P/100g"
align="center"
/>
<el-table-column prop="proteinRatio" label="P/100g" align="center" />
<el-table-column prop="fatRatio" label="F/100g" align="center" />
<el-table-column prop="carbonRatio" label="C/100g" align="center" />
</el-table>
@ -80,7 +76,7 @@ export default {
name: "ConfigDishes",
data() {
return {
nType: this.type,
mType: this.type,
};
},
props: {
@ -113,14 +109,19 @@ export default {
EditableText,
EditableUnit,
},
watch: {
type(val) {
this.mType = val;
},
},
computed: {},
methods: {
handleOnTypeChange(type) {
this.$emit("onChane", { type });
this.$emit("onChange", { type });
},
handleOnWeightChange(data, val) {
// console.log({ data, val });
this.$emit("onChane", {
this.$emit("onChange", {
igdList: produce(this.igdList, (draftState) => {
const tarIgd = draftState.find((obj) => obj.id === data.id);
if (tarIgd) {
@ -131,7 +132,7 @@ export default {
},
handleOnCustomUnitChange(data, val) {
// console.log({ data, val });
this.$emit("onChane", {
this.$emit("onChange", {
igdList: produce(this.igdList, (draftState) => {
const tarIgd = draftState.find((obj) => obj.id === data.id);
if (tarIgd) {

View File

@ -7,15 +7,14 @@
:cell-style="{ padding: '2px 0' }"
:header-cell-style="{ padding: '4px 0', height: 'unset' }"
size="mini"
:style="`outline: ${
currentDay + 1 === num ? '1px solid #d96969' : 'none'
}`"
:style="`outline: ${currentDay === num ? '1px solid #d96969' : 'none'}`"
>
<el-table-column prop="type" :width="100" align="center">
<template slot="header">
<span class="num_day" @click="handleOnOneDayAnalysis">{{
`${name}${num}`
}}</span>
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>{{ name }}</div>
<div>{{ `${numDay}` }}</div>
</div>
</template>
<template slot-scope="scope">
<span style="font-weight: bold; font-size: 14px">{{
@ -23,7 +22,7 @@
}}</span>
</template>
</el-table-column>
<el-table-column label="菜品" prop="name" align="center">
<el-table-column label="菜品" prop="name" align="center" :width="180">
<template slot="header">
<el-tooltip
class="item"
@ -50,7 +49,12 @@
</el-popover>
</template>
</el-table-column>
<el-table-column label="食材" prop="igdName" align="center" />
<el-table-column
label="食材"
prop="igdName"
align="center"
:width="180"
/>
<el-table-column label="分量估算" :width="80" align="center">
<template slot-scope="scope">
<EditableUnit
@ -71,42 +75,84 @@
<el-table-column
label="蛋白质/100g"
prop="proteinRatio"
:width="100"
:width="60"
align="center"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>蛋白质</div>
<div>/100g</div>
</div>
</template>
</el-table-column>
<el-table-column
label="脂肪/100g"
prop="fatRatio"
:width="90"
:width="60"
align="center"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>脂肪</div>
<div>/100g</div>
</div>
</template>
</el-table-column>
<el-table-column
label="碳水/100g"
prop="carbonRatio"
:width="90"
:width="60"
align="center"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>碳水</div>
<div>/100g</div>
</div>
</template>
</el-table-column>
<el-table-column
label="蛋白质含量"
prop="proteinRatio"
:width="90"
:width="60"
align="center"
:formatter="nutriFormatter"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>蛋白质</div>
<div>含量</div>
</div>
</template>
</el-table-column>
<el-table-column
label="脂肪含量"
prop="fatRatio"
:width="90"
:width="60"
align="center"
:formatter="nutriFormatter"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>脂肪</div>
<div>含量</div>
</div>
</template>
</el-table-column>
<el-table-column
label="碳水含量"
prop="carbonRatio"
:width="90"
:width="60"
align="center"
:formatter="nutriFormatter"
/>
>
<template slot="header">
<div class="num_day" @click="handleOnOneDayAnalysis">
<div>碳水</div>
<div>含量</div>
</div>
</template>
</el-table-column>
<el-table-column label="做法" prop="methods" />
</el-table>
<AddDishesDrawer ref="drawerRef" @onConfirm="handleOnDishesConfirm" />
@ -141,6 +187,10 @@ export default {
type: Number,
default: 0,
},
numDay: {
type: Number,
default: 0,
},
},
components: {
EditableText,
@ -266,7 +316,7 @@ export default {
},
handleOnOneDayAnalysis(e) {
// 校验某天
this.setCurrentDay({ currentDay: this.num - 1 });
this.setCurrentDay({ currentDay: this.num });
},
handleOnAdd() {
// console.log(this.num);
@ -274,12 +324,12 @@ export default {
},
handleOnDelete(data) {
// console.log(data);
this.deleteDishes({ num: this.num - 1, id: data.id });
this.deleteDishes({ num: this.num, id: data.id });
},
handleOnWeightChange(data, weight) {
// console.log({ data, weight });
console.log({ data, weight });
this.updateDishes({
num: this.num - 1,
num: this.num,
dishesId: data.dishesId,
igdId: data.igdId,
weight,
@ -288,7 +338,7 @@ export default {
handleOnCustomUnitChange(data, { cusWeight, cusUnit }) {
// console.log({ data, cusWeight, cusUnit });
this.updateDishes({
num: this.num - 1,
num: this.num,
dishesId: data.dishesId,
igdId: data.igdId,
cusWeight,
@ -298,7 +348,7 @@ export default {
handleOnDishesConfirm(data) {
// console.log(data);
this.addDishes({
num: this.num - 1,
num: this.num,
data,
});
},

View File

@ -2,15 +2,18 @@
<div class="recipes_view_wrapper">
<RecipesAspectCom :collapse.sync="collapse" :data="analyseData" />
<div
id="recipes_content"
class="recipes_content"
:style="`height: calc(100vh - ${collapse ? 142 : 312}px)`"
:style="`height: calc(100vh - ${collapse ? 62 : 232}px)`"
>
<RecipesCom
v-for="(item, index) in data"
:id="`recipes${index}`"
:key="item.id"
:data="item"
:name="name"
:num="index + 1"
:num="index"
:numDay="item.numDay"
/>
</div>
</div>

View File

@ -1,5 +1,5 @@
<template>
<div class="recipes_build_wrapper">
<div class="recipes_build_wrapper" v-title :data-title="$route.query.name">
<div class="left" v-loading="recipesDataLoading">
<RecipesView
v-if="!!recipesData.length"
@ -35,13 +35,13 @@ export default {
return {};
},
mounted() {
const { cusId, planId, startDate, endDate, recipesId } = this.$route.query;
const { cusId, planId, startNum, endNum, recipesId } = this.$route.query;
this.init({
cusId,
planId,
startDate,
endDate,
startNum: parseInt(startNum),
endNum: parseInt(endNum),
recipesId,
}).catch((err) => {
this.$message.error(err.message);
@ -78,7 +78,7 @@ export default {
.recipes_build_wrapper {
padding: 16px;
display: flex;
height: calc(100vh - 86px);
height: 100vh;
.left {
flex: 4;
border-right: 1px solid #e6ebf5;

View File

@ -113,18 +113,24 @@
>
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="客户姓名" align="center" prop="customer" />
<!-- <el-table-column
<el-table-column
label="客户手机号"
align="center"
prop="hidePhone"
width="180"
/> -->
/>
<el-table-column
label="食谱日期范围"
align="center"
prop="scopeDate"
width="200"
/>
<el-table-column
label="食谱天数范围"
align="center"
prop="scopeDay"
width="200"
/>
<el-table-column label="营养师" align="center" prop="nutritionist" />
<el-table-column
label="营养师助理"
@ -447,8 +453,9 @@ export default {
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;
@ -603,25 +610,25 @@ export default {
},
handleBuild(data) {
// console.log(data);
const { startDate, endDate, id, cusId, recipesId } = data;
const { id, cusId, recipesId, customer, startNumDay, endNumDay } = data;
// const params = { id: data.id, cusId: data.orderId };
// const path = `/recipes/build/${orderId}/${id}/${recipesId || 0}`;
// this.$router.push({
// name: "build",
// params,
// });
const queryParam = {
planId: id,
cusId,
name: customer,
};
if (!recipesId) {
queryParam.startDate = startDate;
queryParam.endDate = endDate;
} else {
if (recipesId) {
queryParam.recipesId = recipesId;
} else {
queryParam.startNum = startNumDay;
queryParam.endNum = endNumDay;
}
this.$router.push({ path: "/recipes/build", query: queryParam });
const routeUrl = this.$router.resolve({
path: "/recipes/build",
query: queryParam,
});
window.open(routeUrl.href, "_blank");
// this.$router.push({ path: "/recipes/build", query: queryParam });
},
},
};