This commit is contained in:
xiezhijun 2021-04-20 18:18:48 +08:00
commit 8ae2f83ef9
15 changed files with 397 additions and 225 deletions

View File

@ -19,7 +19,7 @@ stdiet:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8091 port: 8090
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /
@ -186,5 +186,6 @@ aliyun:
lucene: lucene:
index: index:
nutritionQuestion: D:\develop\LuceneIndex\nutritionQuestion # nutritionQuestion: D:\develop\LuceneIndex\nutritionQuestion
nutritionQuestion: /Users/wonder/Documents/Workspaces/java/ShengtangManage/running/uploadPath/nutritionQuestion

View File

@ -3,8 +3,10 @@ package com.stdiet.web.controller.custom;
import com.stdiet.common.annotation.Log; import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController; import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.domain.entity.SysUser;
import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.common.utils.sign.AesUtils;
@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -44,7 +47,16 @@ public class SysCustomerController extends BaseController {
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysCustomer sysCustomer) { public TableDataInfo list(SysCustomer sysCustomer) {
startPage(); startPage();
List<SysCustomer> list = sysCustomerService.selectSysCustomerList(sysCustomer); List<SysCustomer> list = new ArrayList<>();
if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
String remark = SecurityUtils.getLoginUser().getUser().getRemark();
if (StringUtils.isEmpty(remark)) {
return getDataTable(list);
} else if (remark.contains("|") && sysCustomer.getChannelId() == null) {
sysCustomer.setChannels(remark.split("\\|"));
}
}
list = sysCustomerService.selectSysCustomerList(sysCustomer);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
for (SysCustomer sysCus : list) { for (SysCustomer sysCus : list) {
if (StringUtils.isNotEmpty(sysCus.getPhone())) { if (StringUtils.isNotEmpty(sysCus.getPhone())) {

View File

@ -5,7 +5,7 @@ import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.domain.AjaxResult; import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.domain.entity.SysUser; import com.stdiet.common.core.domain.entity.SysUser;
import com.stdiet.common.enums.BusinessType; import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.DateUtils; import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.custom.controller.OrderBaseController; import com.stdiet.custom.controller.OrderBaseController;
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.time.temporal.ChronoUnit; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
@ -50,37 +50,42 @@ public class SysOrderController extends OrderBaseController {
public OrderTableDataInfo list(SysOrder sysOrder) { public OrderTableDataInfo list(SysOrder sysOrder) {
startPage(); startPage();
dealOrderType(sysOrder); dealOrderType(sysOrder);
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); List<SysOrder> list = new ArrayList<>();
if (SecurityUtils.getLoginUser().getUser().getRoles().get(0).getRoleKey().equals("partner")) {
String remark = SecurityUtils.getLoginUser().getUser().getRemark();
if (StringUtils.isEmpty(remark)) {
return getOrderDataTable(list, new BigDecimal(0));
} else if (remark.contains("|") && StringUtils.isEmpty(sysOrder.getAccount())) {
sysOrder.setAccRange(remark.split("\\|"));
}
}
list = sysOrderService.selectSysOrderList(sysOrder);
List<SysUser> userList = userService.selectAllUser(); List<SysUser> userList = userService.selectAllUser();
BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder); BigDecimal totalAmount = sysOrderService.selectAllOrderAmount(sysOrder);
if (totalAmount == null) { if (totalAmount == null) {
totalAmount = new BigDecimal(0); totalAmount = new BigDecimal(0);
} }
for (SysOrder order : list) { for (SysOrder order : list) {
initUserNickNameAndOrderType(userList,order); initUserNickNameAndOrderType(userList, order);
if (StringUtils.isNotEmpty(order.getPhone())) { if (StringUtils.isNotEmpty(order.getPhone())) {
order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone())); order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
} }
/*//根据服务时长赠送天数计算服务天数
int month = order.getServeTimeId() != null ? order.getServeTimeId().intValue() / 30 : 0;
if (order.getStartTime() != null && order.getServerEndTime() != null && order.getServeTimeId() != null && month > 0) {
long serverDay = ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(order.getStartTime()), DateUtils.dateToLocalDate(order.getStartTime()).plusMonths(month).plusDays(order.getGiveServeDay() == null ? 0 : order.getGiveServeDay())) + 1;
order.setServerDay(Integer.parseInt(serverDay + ""));
}*/
} }
return getOrderDataTable(list, totalAmount); return getOrderDataTable(list, totalAmount);
} }
/** /**
* 处理订单类型 * 处理订单类型
*
* @param sysOrder * @param sysOrder
*/ */
private void dealOrderType(SysOrder sysOrder) { private void dealOrderType(SysOrder sysOrder) {
if(StringUtils.isNotEmpty(sysOrder.getOrderType())){ if (StringUtils.isNotEmpty(sysOrder.getOrderType())) {
try { try {
JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(),"UTF-8")); JSONArray array = JSONArray.parseArray(URLDecoder.decode(sysOrder.getOrderType(), "UTF-8"));
sysOrder.setSearchOrderTypeArray(array.size() > 0 ? array : null); sysOrder.setSearchOrderTypeArray(array.size() > 0 ? array : null);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -96,7 +101,7 @@ public class SysOrderController extends OrderBaseController {
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
List<SysUser> userList = userService.selectAllUser(); List<SysUser> userList = userService.selectAllUser();
for (SysOrder order : list) { for (SysOrder order : list) {
initUserNickNameAndOrderType(userList,order); initUserNickNameAndOrderType(userList, order);
if (StringUtils.isNotEmpty(order.getPhone())) { if (StringUtils.isNotEmpty(order.getPhone())) {
order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone())); order.setPhone(StringUtils.hiddenPhoneNumber(order.getPhone()));
} }
@ -123,12 +128,12 @@ public class SysOrderController extends OrderBaseController {
SysOrder order = sysOrderService.selectSysOrderById(orderId); SysOrder order = sysOrderService.selectSysOrderById(orderId);
if (order != null) { if (order != null) {
List<SysUser> userList = userService.selectAllUser(); List<SysUser> userList = userService.selectAllUser();
initUserNickNameAndOrderType(userList,order); initUserNickNameAndOrderType(userList, order);
} }
return AjaxResult.success(order); return AjaxResult.success(order);
} }
private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order){ private void initUserNickNameAndOrderType(List<SysUser> userList, SysOrder order) {
for (SysUser user : userList) { for (SysUser user : userList) {
if (user.getUserId().equals(order.getPreSaleId())) { if (user.getUserId().equals(order.getPreSaleId())) {
order.setPreSale(user.getNickName()); order.setPreSale(user.getNickName());

View File

@ -97,4 +97,9 @@ public class SysCustomer extends BaseEntity
/** 体征数据,非持久化字段 */ /** 体征数据,非持久化字段 */
private SysCustomerPhysicalSigns sign; private SysCustomerPhysicalSigns sign;
@Excel(name = "进粉渠道")
private Long channelId;
private String[] channels;
} }

View File

@ -134,6 +134,8 @@ public class SysOrder extends BaseEntity {
@Excel(name = "账号") @Excel(name = "账号")
private String account; private String account;
private String[] accRange;
/** /**
* 策划 * 策划
*/ */

View File

@ -26,10 +26,11 @@
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="channelId" column="channel_id" />
</resultMap> </resultMap>
<sql id="selectSysCustomerVo"> <sql id="selectSysCustomerVo">
select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by, channel_id from sys_customer
</sql> </sql>
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult"> <select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
@ -45,6 +46,13 @@
<if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if> <if test="assistantDietitian != null and assistantDietitian != ''"> and assistant_dietitian = #{assistantDietitian}</if>
<if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if> <if test="assistantDietitian == 0"> and (isnull(assistant_dietitian) or assistant_dietitian=0)</if>
<if test="fansChannel != null "> and fans_channel = #{fansChannel}</if> <if test="fansChannel != null "> and fans_channel = #{fansChannel}</if>
<if test="channelId != null "> and channel_id = #{channelId}</if>
<if test="channels != null">
and channel_id in
<foreach collection="channels" item="cn" separator="," open="(" close=")">
#{cn}
</foreach>
</if>
order by create_time desc order by create_time desc
</select> </select>
@ -76,6 +84,7 @@
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="channelId != null">channel_id,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
@ -98,6 +107,7 @@
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="channelId != null">#{channelId},</if>
</trim> </trim>
</insert> </insert>
@ -124,6 +134,7 @@
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="channelId != null">channel_id = #{channelId},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -41,14 +41,14 @@
<result property="serverEndTime" column="server_end_time"/> <result property="serverEndTime" column="server_end_time"/>
<result property="becomeFanTime" column="become_fan_time"/> <result property="becomeFanTime" column="become_fan_time"/>
<result property="onSaleId" column="on_sale_id" /> <result property="onSaleId" column="on_sale_id"/>
<result property="orderType" column="order_type" /> <result property="orderType" column="order_type"/>
<result property="orderCountType" column="order_count_type" /> <result property="orderCountType" column="order_count_type"/>
<result property="orderMoneyType" column="order_money_type" /> <result property="orderMoneyType" column="order_money_type"/>
<result property="mainOrderId" column="main_order_id" /> <result property="mainOrderId" column="main_order_id"/>
<result property="afterSaleCommissOrder" column="after_sale_commiss_order" /> <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/>
<result property="commissStartTime" column="commiss_start_time" /> <result property="commissStartTime" column="commiss_start_time"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<!-- 非持久化字段 --> <!-- 非持久化字段 -->
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 --> <result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
@ -73,7 +73,7 @@
<sql id="searchOrderType"> <sql id="searchOrderType">
<if test="searchOrderTypeArray != null"> <if test="searchOrderTypeArray != null">
<trim prefix="AND (" suffix=")" suffixOverrides="or"> <trim prefix="AND (" suffix=")" suffixOverrides="or">
<foreach collection="searchOrderTypeArray" separator="or" item="typeArray" index="i"> <foreach collection="searchOrderTypeArray" separator="or" item="typeArray" index="i">
( (
<foreach collection="typeArray" separator="and" item="type" index="j"> <foreach collection="typeArray" separator="and" item="type" index="j">
<if test="j == 0"> <if test="j == 0">
@ -99,8 +99,14 @@
<if test="customer != null and customer != ''"> <if test="customer != null and customer != ''">
and (customer like concat('%',#{customer},'%') or phone like concat('%',#{customer},'%')) and (customer like concat('%',#{customer},'%') or phone like concat('%',#{customer},'%'))
</if> </if>
<if test="accRange != null">
and account_id in
<foreach collection="accRange" separator="," item="acc" open="(" close=")" >
#{acc}
</foreach>
</if>
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if> <if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
<!-- <if test="phone != null and phone != ''">and phone = #{phone}</if>--> <!-- <if test="phone != null and phone != ''">and phone = #{phone}</if>-->
<if test="status != null ">and status = #{status}</if> <if test="status != null ">and status = #{status}</if>
<if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if> <if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
<if test="preSaleId != null ">and pre_sale_id = #{preSaleId}</if> <if test="preSaleId != null ">and pre_sale_id = #{preSaleId}</if>
@ -113,8 +119,12 @@
<if test="operatorId != null ">and operator_id = #{operatorId}</if> <if test="operatorId != null ">and operator_id = #{operatorId}</if>
<if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if> <if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if>
<if test="recommender != null and recommender != ''">and recommender = #{recommender}</if> <if test="recommender != null and recommender != ''">and recommender = #{recommender}</if>
<if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')</if> <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;=
<if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if> date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;=
date_format(#{endTime},'%y%m%d')
</if>
<if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if> <if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if> <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
<if test="amountFlag != null"> <if test="amountFlag != null">
@ -141,7 +151,13 @@
<if test="customer != null and customer != ''"> <if test="customer != null and customer != ''">
and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%')) and (sc.name like concat('%',#{customer},'%') or sc.phone like concat('%',#{customer},'%'))
</if> </if>
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if> <if test="accRange != null">
and account_id in
<foreach collection="accRange" separator="," item="acc" open="(" close=")">
#{acc}
</foreach>
</if>
<if test="cusId != null and cusId != ''">and cus_id = #{cusId}</if>
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if> <if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
<if test="status != null ">and status = #{status}</if> <if test="status != null ">and status = #{status}</if>
<if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if> <if test="payTypeId != null ">and pay_type_id = #{payTypeId}</if>
@ -155,8 +171,12 @@
<if test="operatorId != null ">and operator_id = #{operatorId}</if> <if test="operatorId != null ">and operator_id = #{operatorId}</if>
<if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if> <if test="operatorAssisId != null ">and operator_assis_id = #{operatorAssisId}</if>
<if test="recommender != null and recommender != ''">and recommender = #{recommender}</if> <if test="recommender != null and recommender != ''">and recommender = #{recommender}</if>
<if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')</if> <if test="beginTime != null and beginTime != ''">and date_format(order_time,'%y%m%d') &gt;=
<if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')</if> date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''">and date_format(order_time,'%y%m%d') &lt;=
date_format(#{endTime},'%y%m%d')
</if>
<if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if> <if test="serveTimeId != null ">and serve_time_id = #{serveTimeId}</if>
<if test="reviewStatus != null ">and review_status = #{reviewStatus}</if> <if test="reviewStatus != null ">and review_status = #{reviewStatus}</if>
<if test="amountFlag != null"> <if test="amountFlag != null">
@ -319,10 +339,10 @@
</delete> </delete>
<delete id="deleteSysOrderByIds" parameterType="String"> <delete id="deleteSysOrderByIds" parameterType="String">
<!-- delete from sys_order where order_id in--> <!-- delete from sys_order where order_id in-->
<!-- <foreach item="orderId" collection="array" open="(" separator="," close=")">--> <!-- <foreach item="orderId" collection="array" open="(" separator="," close=")">-->
<!-- #{orderId}--> <!-- #{orderId}-->
<!-- </foreach>--> <!-- </foreach>-->
</delete> </delete>
<resultMap type="SysOrder" id="SysOrderResultExtended"> <resultMap type="SysOrder" id="SysOrderResultExtended">
@ -362,14 +382,14 @@
<result property="serverEndTime" column="server_end_time"/> <result property="serverEndTime" column="server_end_time"/>
<result property="becomeFanTime" column="become_fan_time"/> <result property="becomeFanTime" column="become_fan_time"/>
<result property="onSaleId" column="on_sale_id" /> <result property="onSaleId" column="on_sale_id"/>
<result property="orderType" column="order_type" /> <result property="orderType" column="order_type"/>
<result property="orderCountType" column="order_count_type" /> <result property="orderCountType" column="order_count_type"/>
<result property="orderMoneyType" column="order_money_type" /> <result property="orderMoneyType" column="order_money_type"/>
<result property="mainOrderId" column="main_order_id" /> <result property="mainOrderId" column="main_order_id"/>
<result property="afterSaleCommissOrder" column="after_sale_commiss_order" /> <result property="afterSaleCommissOrder" column="after_sale_commiss_order"/>
<result property="commissStartTime" column="commiss_start_time" /> <result property="commissStartTime" column="commiss_start_time"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<!-- 非持久化字段 --> <!-- 非持久化字段 -->
<result property="afterSale" column="afterSale_name"></result><!-- 售后名称 --> <result property="afterSale" column="afterSale_name"></result><!-- 售后名称 -->
@ -378,17 +398,17 @@
</resultMap> </resultMap>
<resultMap type="SysOrderPause" id="SysOrderPauseResult"> <resultMap type="SysOrderPause" id="SysOrderPauseResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="orderId" column="order_id" /> <result property="orderId" column="order_id"/>
<result property="pauseStartDate" column="pause_start_date" /> <result property="pauseStartDate" column="pause_start_date"/>
<result property="pauseEndDate" column="pause_end_date" /> <result property="pauseEndDate" column="pause_end_date"/>
<result property="reason" column="reason" /> <result property="reason" column="reason"/>
<result property="remarks" column="remarks" /> <result property="remarks" column="remarks"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
</resultMap> </resultMap>
<select id="getOrderPauseByOrderId" parameterType="Long" resultMap="SysOrderPauseResult"> <select id="getOrderPauseByOrderId" parameterType="Long" resultMap="SysOrderPauseResult">
@ -398,34 +418,15 @@
<!-- 查询2021年开始的已审核的订单信息用于计算提成,请勿随意改动) --> <!-- 查询2021年开始的已审核的订单信息用于计算提成,请勿随意改动) -->
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended" parameterType="SysCommision"> <select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended" parameterType="SysCommision">
select o.order_id,o.order_time,o.commiss_start_time,o.server_end_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name select
from sys_order o o.order_id,o.order_time,o.commiss_start_time,o.server_end_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name
left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0 as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null)
and o.amount is not null
<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>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
<if test="serverScopeEndTime != null and serverScopeEndTime != ''">
AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
</if>
order by o.order_time desc
</select>
<!-- 查询2021年开始的已审核的订单信息的总条数用于计算提成,请勿随意改动) -->
<select id="selectSimpleOrderMessageCount" resultType="int" parameterType="SysCommision">
select count(o.order_id) as orderCount
from sys_order o 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_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 left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag =
where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null) 0
where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
su_nutritionist.user_id is not null)
and o.amount is not null and o.amount is not null
<if test="reviewStatus != null and reviewStatus != ''"> <if test="reviewStatus != null and reviewStatus != ''">
and review_status = #{reviewStatus} and review_status = #{reviewStatus}
@ -437,31 +438,59 @@
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime} AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if> </if>
<if test="serverScopeEndTime != null and serverScopeEndTime != ''"> <if test="serverScopeEndTime != null and serverScopeEndTime != ''">
AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d') AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
</if>
order by o.order_time desc
</select>
<!-- 查询2021年开始的已审核的订单信息的总条数用于计算提成,请勿随意改动) -->
<select id="selectSimpleOrderMessageCount" resultType="int" parameterType="SysCommision">
select count(o.order_id) as orderCount
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 o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
su_nutritionist.user_id is not null)
and o.amount is not null
<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>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
<if test="serverScopeEndTime != null and serverScopeEndTime != ''">
AND #{serverScopeEndTime} >= DATE_FORMAT(o.commiss_start_time,'%Y-%m-%d')
</if> </if>
order by o.order_time desc order by o.order_time desc
</select> </select>
<!-- 查询售后、营养师的每个月服务总金额 --> <!-- 查询售后、营养师的每个月服务总金额 -->
<select id="getTotalAmountByUserId" parameterType="SysCommision" resultType="com.stdiet.custom.dto.response.EveryMonthTotalAmount"> <select id="getTotalAmountByUserId" parameterType="SysCommision"
resultType="com.stdiet.custom.dto.response.EveryMonthTotalAmount">
SELECT s.yearMonth,SUM(s.amount) AS totalAmount FROM SELECT s.yearMonth,SUM(s.amount) AS totalAmount FROM
( (
SELECT CONCAT(YEAR(o.order_time),'',MONTH(o.order_time)) AS yearMonth,o.amount SELECT CONCAT(YEAR(o.order_time),'',MONTH(o.order_time)) AS yearMonth,o.amount
FROM sys_order o 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_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 LEFT JOIN sys_user su_nutritionist ON su_nutritionist.user_id = o.nutritionist_id AND su_nutritionist.del_flag =
where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR su_nutritionist.user_id is not null) 0
and o.amount is not null where o.order_time >= '2021-01-01' and o.del_flag = 0 and (su_sale.user_id is not null OR
<if test="reviewStatus != null and reviewStatus != ''"> su_nutritionist.user_id is not null)
and o.amount is not null
<if test="reviewStatus != null and reviewStatus != ''">
and o.review_status = #{reviewStatus} and o.review_status = #{reviewStatus}
</if> </if>
<if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 --> <if test="userId != null"><!-- 限于营养师、售后不可能同一个的情况下 -->
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId}) and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime} AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if> </if>
ORDER BY o.order_time ASC ORDER BY o.order_time ASC
) s ) s
GROUP BY s.yearMonth GROUP BY s.yearMonth
</select> </select>

View File

@ -53,8 +53,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="收款账号" prop="accountId"> <el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择"> <el-select
v-model="form.accountId"
placeholder="请选择"
@change="handleOnChanelIdChange"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -157,10 +161,7 @@
</el-col> </el-col>
<el-col :span="8" v-show="orderRateOptionsShow"> <el-col :span="8" v-show="orderRateOptionsShow">
<el-form-item label="拆分比例" prop="nutritionistRate"> <el-form-item label="拆分比例" prop="nutritionistRate">
<el-select <el-select v-model="form.nutritionistRate" placeholder="请选择">
v-model="form.nutritionistRate"
placeholder="请选择"
>
<el-option <el-option
v-for="dict in orderRateOptions" v-for="dict in orderRateOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -672,12 +673,15 @@ export default {
handleOrderTypeChange() { handleOrderTypeChange() {
// console.log(this.form.orderTypeList); // console.log(this.form.orderTypeList);
}, },
handleOnChanelIdChange(val) {
this.initPlanningAndOperation();
},
}, },
watch: { watch: {
// //
"form.accountId": function (newVal, oldVal) { // "form.accountId": function (newVal, oldVal) {
this.initPlanningAndOperation(); // this.initPlanningAndOperation();
}, // },
"form.orderTypeList": function (newVal, oldVal) { "form.orderTypeList": function (newVal, oldVal) {
// //
if (newVal[1] == 1) { if (newVal[1] == 1) {
@ -697,11 +701,11 @@ export default {
} }
// //
if (newVal[0] == 2) { if (newVal[0] == 2) {
this.afterNutiShow = false; this.afterNutiShow = false;
this.form.onSaleId = parseInt(this.onSaleIdOptions[1].dictValue); this.form.onSaleId = parseInt(this.onSaleIdOptions[1].dictValue);
this.form.serveTimeId = 7; this.form.serveTimeId = 7;
this.form.conditioningProjectId = 12; this.form.conditioningProjectId = 12;
}else{ } else {
this.form.onSaleId = null; this.form.onSaleId = null;
this.form.serveTimeId = 90; this.form.serveTimeId = 90;
this.afterNutiShow = true; this.afterNutiShow = true;

View File

@ -212,6 +212,7 @@ export default {
this.$refs.cusCreateOrderDialogRef.showDialog( this.$refs.cusCreateOrderDialogRef.showDialog(
{ {
customer: this.data.name, customer: this.data.name,
accountId: this.data.channelId,
cusId: this.data.id, cusId: this.data.id,
preSaleId: this.data.salesman, preSaleId: this.data.salesman,
afterSaleId: this.data.afterDietitian, afterSaleId: this.data.afterDietitian,

View File

@ -11,7 +11,11 @@
<el-form ref="form" :model="form" :rules="rules" label-width="90px"> <el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-col :span="16"> <el-col :span="16">
<el-form-item label="订单类型" prop="orderTypeName"> <el-form-item label="订单类型" prop="orderTypeName">
<el-input v-model="form.orderTypeName" placeholder="" :disabled="true"/> <el-input
v-model="form.orderTypeName"
placeholder=""
:disabled="true"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@ -32,8 +36,12 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="收款账号" prop="accountId"> <el-form-item label="进粉渠道" prop="accountId">
<el-select v-model="form.accountId" placeholder="请选择"> <el-select
v-model="form.accountId"
placeholder="请选择"
@change="handleOnChannelIdChange"
>
<el-option <el-option
v-for="dict in accountIdOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
@ -389,7 +397,7 @@ export default {
// //
afterSaleNutriAssShow: true, afterSaleNutriAssShow: true,
// //
planOperatorShow: true planOperatorShow: true,
}; };
}, },
created() { created() {
@ -571,9 +579,9 @@ export default {
this.resetForm("form"); this.resetForm("form");
// console.log("--"+obj.orderType); // console.log("--"+obj.orderType);
this.onSaleShow = this.form.orderType == "2"; this.onSaleShow = this.form.orderType == "2";
this.afterSaleNutriAssShow = this.form.orderType != "2" && this.form.afterSaleCommissOrder == 0; this.afterSaleNutriAssShow =
this.form.orderType != "2" && this.form.afterSaleCommissOrder == 0;
this.planOperatorShow = this.form.afterSaleCommissOrder == 0; this.planOperatorShow = this.form.afterSaleCommissOrder == 0;
}, },
handleOnClosed() { handleOnClosed() {
this.reset(); this.reset();
@ -609,13 +617,17 @@ export default {
}; };
} }
}, },
}, handleOnChannelIdChange(val) {
watch: { console.log(val);
//
"form.accountId": function (newVal, oldVal) {
// console.log("updte");
this.initPlanningAndOperation(); this.initPlanningAndOperation();
}, },
}, },
watch: {
//
// "form.accountId": function (newVal, oldVal) {
// // console.log("updte");
// this.initPlanningAndOperation();
// },
},
}; };
</script> </script>

View File

@ -11,6 +11,7 @@ const getters = {
roles: state => state.user.roles, roles: state => state.user.roles,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
userId: state => state.user.userId, userId: state => state.user.userId,
userRemark: state => state.user.remark,
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
// //
nutritionistIdOptions: state => state.global.nutritionistIdOptions, nutritionistIdOptions: state => state.global.nutritionistIdOptions,

View File

@ -1,100 +1,117 @@
import { login, logout, getInfo } from '@/api/login' import { login, logout, getInfo } from "@/api/login";
import { getToken, setToken, removeToken } from '@/utils/auth' import { getToken, setToken, removeToken } from "@/utils/auth";
const user = { const user = {
state: { state: {
token: getToken(), token: getToken(),
name: '', name: "",
avatar: '', avatar: "",
remark: "",
roles: [], roles: [],
permissions: [] permissions: []
}, },
mutations: { mutations: {
SET_TOKEN: (state, token) => { SET_TOKEN: (state, token) => {
state.token = token state.token = token;
}, },
SET_NAME: (state, name) => { SET_NAME: (state, name) => {
state.name = name state.name = name;
}, },
SET_AVATAR: (state, avatar) => { SET_AVATAR: (state, avatar) => {
state.avatar = avatar state.avatar = avatar;
}, },
SET_ROLES: (state, roles) => { SET_ROLES: (state, roles) => {
state.roles = roles state.roles = roles;
}, },
SET_PERMISSIONS: (state, permissions) => { SET_PERMISSIONS: (state, permissions) => {
state.permissions = permissions state.permissions = permissions;
}, },
SET_USERID: (state, userId) => { SET_USERID: (state, userId) => {
state.userId = userId state.userId = userId;
},
SET_REMARK: (state, remark) => {
state.remark = remark;
} }
}, },
actions: { actions: {
// 登录 // 登录
Login({ commit }, userInfo) { Login({ commit }, userInfo) {
const username = userInfo.username.trim() const username = userInfo.username.trim();
const password = userInfo.password const password = userInfo.password;
const code = userInfo.code const code = userInfo.code;
const uuid = userInfo.uuid const uuid = userInfo.uuid;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
login(username, password, code, uuid).then(res => { login(username, password, code, uuid)
setToken(res.token) .then(res => {
commit('SET_TOKEN', res.token) setToken(res.token);
resolve() commit("SET_TOKEN", res.token);
}).catch(error => { resolve();
reject(error) })
}) .catch(error => {
}) reject(error);
});
});
}, },
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo(state.token).then(res => { getInfo(state.token)
const user = res.user .then(res => {
const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; const user = res.user;
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 const avatar =
commit('SET_ROLES', res.roles) user.avatar == ""
commit('SET_PERMISSIONS', res.permissions) ? require("@/assets/image/profile.jpg")
} else { : process.env.VUE_APP_BASE_API + user.avatar;
commit('SET_ROLES', ['ROLE_DEFAULT']) if (res.roles && res.roles.length > 0) {
} // 验证返回的roles是否是一个非空数组
commit('SET_NAME', user.userName) commit("SET_ROLES", res.roles);
commit('SET_AVATAR', avatar) commit("SET_PERMISSIONS", res.permissions);
commit('SET_USERID', user.userId) } else {
resolve(res) commit("SET_ROLES", ["ROLE_DEFAULT"]);
}).catch(error => { }
reject(error) commit("SET_NAME", user.userName);
}) commit("SET_AVATAR", avatar);
}) commit("SET_USERID", user.userId);
commit("SET_REMARK", user.remark);
resolve(res);
})
.catch(error => {
reject(error);
});
});
}, },
// 退出系统 // 退出系统
LogOut({ commit, state }) { LogOut({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logout(state.token).then(() => { logout(state.token)
commit('SET_TOKEN', '') .then(() => {
commit('SET_ROLES', []) commit("SET_TOKEN", "");
commit('SET_PERMISSIONS', []) commit("SET_ROLES", []);
removeToken() commit("SET_PERMISSIONS", []);
resolve() commit("SET_USERID", "");
}).catch(error => { commit("SET_REMARK", "");
reject(error) removeToken();
}) resolve();
}) })
.catch(error => {
reject(error);
});
});
}, },
// 前端 登出 // 前端 登出
FedLogOut({ commit }) { FedLogOut({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
commit('SET_TOKEN', '') commit("SET_TOKEN", "");
removeToken() removeToken();
resolve() resolve();
}) });
} }
} }
} };
export default user export default user;

View File

@ -16,8 +16,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<!-- <el-form-item label="进粉方式" prop="fansChannel">
<el-form-item label="进粉渠道" prop="fansChannel">
<el-select v-model="queryParams.fansChannel" placeholder="请选择"> <el-select v-model="queryParams.fansChannel" placeholder="请选择">
<el-option <el-option
v-for="dict in fansChannelOptions" v-for="dict in fansChannelOptions"
@ -26,8 +25,18 @@
:value="parseInt(dict.dictValue)" :value="parseInt(dict.dictValue)"
/> />
</el-select> </el-select>
</el-form-item> -->
<el-form-item label="进粉渠道" prop="channelId">
<el-select v-model="queryParams.channelId" placeholder="请选择">
<el-option
v-for="dict in accountIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="营养师" prop="mainDietitian"> <el-form-item label="营养师" prop="mainDietitian" v-if="!isPartner">
<el-select v-model="queryParams.mainDietitian" placeholder="请选择"> <el-select v-model="queryParams.mainDietitian" placeholder="请选择">
<el-option <el-option
v-for="dict in nutritionistIdOptions" v-for="dict in nutritionistIdOptions"
@ -37,7 +46,11 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="营养师助理" prop="assistantDietitian"> <el-form-item
label="营养师助理"
prop="assistantDietitian"
v-if="!isPartner"
>
<el-select <el-select
v-model="queryParams.assistantDietitian" v-model="queryParams.assistantDietitian"
placeholder="请选择" placeholder="请选择"
@ -50,7 +63,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="销售人员" prop="salesman"> <el-form-item label="销售人员" prop="salesman" v-if="!isPartner">
<el-select v-model="queryParams.salesman" placeholder="请选择"> <el-select v-model="queryParams.salesman" placeholder="请选择">
<el-option <el-option
v-for="dict in preSaleIdOptions" v-for="dict in preSaleIdOptions"
@ -60,7 +73,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="售后营养师" prop="afterDietitian"> <el-form-item label="售后营养师" prop="afterDietitian" v-if="!isPartner">
<el-select v-model="queryParams.afterDietitian" placeholder="请选择"> <el-select v-model="queryParams.afterDietitian" placeholder="请选择">
<el-option <el-option
v-for="dict in afterSaleIdOptions" v-for="dict in afterSaleIdOptions"
@ -132,13 +145,18 @@
<span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span> <span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <!-- <el-table-column
label="进粉渠道" label="进粉方式"
align="center" align="center"
prop="fansChannel" prop="fansChannel"
:formatter="fansChannelFormat" :formatter="fansChannelFormat"
> /> -->
</el-table-column> <el-table-column
label="进粉渠道"
align="center"
prop="channelId"
:formatter="channelFormat"
/>
<el-table-column label="客户姓名" align="center" prop="name" /> <el-table-column label="客户姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" /> <el-table-column label="手机号" align="center" prop="phone" />
<el-table-column <el-table-column
@ -250,13 +268,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="操作" label="操作"
align="center" align="center"
fixed="right" fixed="right"
width="120" width="120"
class-name="small-padding fixed-width" class-name="small-padding fixed-width"
v-if="!isPartner"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -363,10 +381,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="进粉渠道" prop="fansChannel"> <el-form-item label="进粉渠道" prop="channelId">
<el-select v-model="form.fansChannel" placeholder="请选择"> <el-select v-model="form.channelId" placeholder="请选择">
<el-option <el-option
v-for="dict in fansChannelOptions" v-for="dict in accountIdOptions"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="parseInt(dict.dictValue)" :value="parseInt(dict.dictValue)"
@ -393,7 +411,9 @@
<!-- 食谱计划抽屉 --> <!-- 食谱计划抽屉 -->
<RecipesPlanDrawer ref="recipesPlanDrawerRef" /> <RecipesPlanDrawer ref="recipesPlanDrawerRef" />
<!-- 客户打卡记录 --> <!-- 客户打卡记录 -->
<CustomerPunchLogDrawer ref="customerPunchLogDrawerRef"></CustomerPunchLogDrawer> <CustomerPunchLogDrawer
ref="customerPunchLogDrawerRef"
></CustomerPunchLogDrawer>
</div> </div>
</template> </template>
@ -413,7 +433,7 @@ import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer"; import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer"; import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
import RecipesPlanDrawer from "@/components/RecipesPlanDrawer"; import RecipesPlanDrawer from "@/components/RecipesPlanDrawer";
import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog"; import CustomerPunchLogDrawer from "@/components/PunchLog/CustomerPunchLog";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
export default { export default {
@ -424,7 +444,7 @@ export default {
"contract-drawer": ContractDrawer, "contract-drawer": ContractDrawer,
heatStatisticsDrawer: HeatStatisticsDrawer, heatStatisticsDrawer: HeatStatisticsDrawer,
RecipesPlanDrawer, RecipesPlanDrawer,
CustomerPunchLogDrawer CustomerPunchLogDrawer,
}, },
data() { data() {
const userId = store.getters && store.getters.userId; const userId = store.getters && store.getters.userId;
@ -446,6 +466,8 @@ export default {
customerCenterList: [], customerCenterList: [],
// //
fansChannelOptions: [], fansChannelOptions: [],
//
accountIdOptions: [],
// //
title: "", title: "",
// //
@ -493,6 +515,9 @@ export default {
fansTime: [ fansTime: [
{ required: true, message: "进粉时间不能为空", trigger: "blur" }, { required: true, message: "进粉时间不能为空", trigger: "blur" },
], ],
channelId: [
{ required: true, message: "进粉渠道不能为空", trigger: "blur" },
],
}, },
fanPickerOptions: { fanPickerOptions: {
disabledDate(time) { disabledDate(time) {
@ -505,9 +530,26 @@ export default {
this.getDicts("customer_fans_channel").then((response) => { this.getDicts("customer_fans_channel").then((response) => {
this.fansChannelOptions = response.data; this.fansChannelOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => {
if (this.isPartner) {
const accRange = this.userRemark.split("|");
this.accountIdOptions = accRange.reduce((arr, accId) => {
const tarObj = response.data.find((obj) => obj.dictValue === accId);
if (tarObj) {
arr.push(tarObj);
}
return arr;
}, []);
} else {
this.accountIdOptions = response.data;
}
});
this.getList(); this.getList();
}, },
computed: { computed: {
isPartner() {
return this.roles && this.roles.includes("partner");
},
...mapGetters([ ...mapGetters([
// //
"preSaleIdOptions", "preSaleIdOptions",
@ -517,6 +559,10 @@ export default {
"nutritionistIdOptions", "nutritionistIdOptions",
// //
"nutriAssisIdOptions", "nutriAssisIdOptions",
//
"userRemark",
//
"roles",
]), ]),
}, },
methods: { methods: {
@ -554,6 +600,9 @@ export default {
fansChannelFormat(row, column) { fansChannelFormat(row, column) {
return this.selectDictLabel(this.fansChannelOptions, row.fansChannel); return this.selectDictLabel(this.fansChannelOptions, row.fansChannel);
}, },
channelFormat(row, column) {
return this.selectDictLabel(this.accountIdOptions, row.channelId);
},
handleOnOrderClick(row) { handleOnOrderClick(row) {
this.$refs["cusOrderDrawerRef"].showDrawer(row); this.$refs["cusOrderDrawerRef"].showDrawer(row);
}, },
@ -576,7 +625,7 @@ export default {
handleClickCustomerPunchLog(row) { handleClickCustomerPunchLog(row) {
this.$refs["customerPunchLogDrawerRef"].showDrawer(row); this.$refs["customerPunchLogDrawerRef"].showDrawer(row);
}, },
// //
cancel() { cancel() {
this.open = false; this.open = false;

View File

@ -19,7 +19,7 @@
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="收款方式" prop="payTypeId"> <el-form-item label="收款方式" prop="payTypeId">
<el-select <el-select
v-model="queryParams.payTypeId" v-model="queryParams.payTypeId"
@ -37,10 +37,10 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<el-form-item label="收款账号" prop="accountId"> <el-form-item label="进粉渠道" prop="accountId">
<el-select <el-select
v-model="queryParams.accountId" v-model="queryParams.accountId"
placeholder="请选择账号" placeholder="请选择渠道"
clearable clearable
size="small" size="small"
> >
@ -70,7 +70,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="销售" prop="preSaleId"> <el-form-item label="销售" prop="preSaleId">
<el-select <el-select
v-model="queryParams.preSaleId" v-model="queryParams.preSaleId"
@ -88,7 +88,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="售后" prop="afterSaleId"> <el-form-item label="售后" prop="afterSaleId">
<el-select <el-select
v-model="queryParams.afterSaleId" v-model="queryParams.afterSaleId"
@ -106,7 +106,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="主营养师" prop="nutritionistId"> <el-form-item label="主营养师" prop="nutritionistId">
<el-select <el-select
v-model="queryParams.nutritionistId" v-model="queryParams.nutritionistId"
@ -124,7 +124,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item <el-form-item
label="营养师助理" label="营养师助理"
prop="nutriAssisId" prop="nutriAssisId"
@ -147,7 +147,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="策划" prop="plannerId"> <el-form-item label="策划" prop="plannerId">
<el-select <el-select
v-model="queryParams.plannerId" v-model="queryParams.plannerId"
@ -165,7 +165,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="策划助理" prop="plannerAssisId"> <el-form-item label="策划助理" prop="plannerAssisId">
<el-select <el-select
v-model="queryParams.plannerAssisId" v-model="queryParams.plannerAssisId"
@ -183,7 +183,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="运营" prop="operatorId"> <el-form-item label="运营" prop="operatorId">
<el-select <el-select
v-model="queryParams.operatorId" v-model="queryParams.operatorId"
@ -201,7 +201,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="运营助理" prop="operatorAssisId"> <el-form-item label="运营助理" prop="operatorAssisId">
<el-select <el-select
v-model="queryParams.operatorAssisId" v-model="queryParams.operatorAssisId"
@ -235,7 +235,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6" v-if="!isPartner">
<el-form-item label="订单金额" prop="amountFlag"> <el-form-item label="订单金额" prop="amountFlag">
<el-select <el-select
v-model="queryParams.amountFlag" v-model="queryParams.amountFlag"
@ -356,7 +356,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="收款账号" label="进粉渠道"
align="center" align="center"
prop="account" prop="account"
width="90" width="90"
@ -586,6 +586,9 @@ export default {
isMobile() { isMobile() {
return this.device === "mobile"; return this.device === "mobile";
}, },
isPartner() {
return this.roles && this.roles.includes("partner");
},
...mapGetters([ ...mapGetters([
// //
"preSaleIdOptions", "preSaleIdOptions",
@ -606,6 +609,10 @@ export default {
// //
"userId", "userId",
// //
"userRemark",
//
"roles",
//
"device", "device",
]), ]),
}, },
@ -615,7 +622,18 @@ export default {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });
this.getDicts("cus_account").then((response) => { this.getDicts("cus_account").then((response) => {
this.accountIdOptions = response.data; if (this.isPartner) {
const accRange = this.userRemark.split("|");
this.accountIdOptions = accRange.reduce((arr, accId) => {
const tarObj = response.data.find((obj) => obj.dictValue === accId);
if (tarObj) {
arr.push(tarObj);
}
return arr;
}, []);
} else {
this.accountIdOptions = response.data;
}
}); });
this.getDicts("cus_serve_time").then((response) => { this.getDicts("cus_serve_time").then((response) => {
this.serveTimeIdOption = response.data; this.serveTimeIdOption = response.data;

View File

@ -19,21 +19,26 @@ export function getProcessMenuData(menuData) {
igdList: cur.igdList.reduce((igdArr, igdData) => { igdList: cur.igdList.reduce((igdArr, igdData) => {
if (igdData.id > 0) { if (igdData.id > 0) {
const tarDetail = cur.detail.find(obj => obj.id === igdData.id); const tarDetail = cur.detail.find(obj => obj.id === igdData.id);
if (tarDetail) {
igdArr.push({ if (tarDetail && tarDetail.weight === -1) {
id: igdData.id, return igdArr;
name: igdData.name,
carbonRatio: igdData.carbonRatio,
fatRatio: igdData.fatRatio,
proteinRatio: igdData.proteinRatio,
cusUnit: tarDetail.cus_unit,
cusWeight: tarDetail.cus_weight,
weight: parseFloat(tarDetail.weight),
notRec: igdData.notRec,
rec: igdData.rec,
type: igdData.type
});
} }
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 ? tarDetail.cus_weight : igdData.cusWeight,
weight: tarDetail
? parseFloat(tarDetail.weight)
: parseFloat(igdData.weight),
notRec: igdData.notRec,
rec: igdData.rec,
type: igdData.type
});
} }
return igdArr; return igdArr;
}, []) }, [])