Merge branch 'develop' of gitee.com:darlk/ShengTangManage into develop
This commit is contained in:
		| @@ -8,6 +8,7 @@ import java.util.Map; | ||||
| import java.util.TreeMap; | ||||
|  | ||||
| import com.stdiet.common.utils.DateUtils; | ||||
| import com.stdiet.common.utils.StringUtils; | ||||
| import com.stdiet.custom.domain.SysCommissionDayDetail; | ||||
| import com.stdiet.custom.domain.SysOrder; | ||||
| import com.stdiet.custom.domain.SysOrderCommisionDayDetail; | ||||
| @@ -169,12 +170,45 @@ public class SysCommisionController extends BaseController { | ||||
|     public TableDataInfo getDetail(SysCommision sysCommision) { | ||||
|         startPage(); | ||||
|         if(sysCommision.getPostId() != null && sysCommision.getPostId().intValue() > 0){ | ||||
|             //查询售后所有ID | ||||
|             SysCommision param = new SysCommision(); | ||||
|             param.setPostId(sysCommision.getPostId()); | ||||
|             List<Long> userIds = sysCommisionService.getAfterSaleId(param); | ||||
|             sysCommision.setUserIds(userIds.size() == 0 ? null : userIds); | ||||
|             sysCommision.setPostId(null); | ||||
|             String postCodeId = ""; | ||||
|             switch (sysCommision.getPostId().intValue()){ | ||||
|                 case 5: | ||||
|                     postCodeId = "pre_sale_id"; | ||||
|                     break; | ||||
|                 case 18: | ||||
|                     postCodeId = "push_pre_sale_id"; | ||||
|                     break; | ||||
|                 case 16: | ||||
|                     postCodeId = "on_sale_id"; | ||||
|                     break; | ||||
|                 case 6: | ||||
|                     postCodeId = "after_sale_id"; | ||||
|                     break; | ||||
|                 case 9: | ||||
|                     postCodeId = "nutritionist_id"; | ||||
|                     break; | ||||
|                 case 10: | ||||
|                     postCodeId = "nutri_assis_id"; | ||||
|                     break; | ||||
|                 case 11: | ||||
|                     postCodeId = "operator_id"; | ||||
|                     break; | ||||
|                 case 13: | ||||
|                     postCodeId = "operator_assis_id"; | ||||
|                     break; | ||||
|                 case 7: | ||||
|                     postCodeId = "planner_id"; | ||||
|                     break; | ||||
|                 case 8: | ||||
|                     postCodeId = "planner_assis_id"; | ||||
|                     break; | ||||
|                 default: | ||||
|             } | ||||
|             if(StringUtils.isEmpty(postCodeId)){ | ||||
|                 sysCommision.setPostId(null); | ||||
|             }else{ | ||||
|                 sysCommision.setPostCode(postCodeId); | ||||
|             } | ||||
|         } | ||||
|         List<SysCommision> list = sysCommisionService.selectSysCommisionDetail(sysCommision); | ||||
|         for (SysCommision detail : list) { | ||||
|   | ||||
| @@ -154,12 +154,12 @@ public class SysImportFanRecordController extends BaseController | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('custom:importFanRecord:add')") | ||||
|     @GetMapping(value = "/getWxAccountAndSale") | ||||
|     public AjaxResult getWxAccountAndSale(SysImportFanWxAccount sysImportFanWxAccount){ | ||||
|     public AjaxResult getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){ | ||||
|         Map<String, Object> result = new HashMap<>(); | ||||
|         List<SysWxSaleAccount> list = sysWxSaleAccountService.getWxAccountAndSale(); | ||||
|         List<Map<String,Object>> fanNumList = sysImportFanWxAccountService.getTotalImportFanNum(sysImportFanWxAccount); | ||||
|         List<SysWxSaleAccount> list = sysWxSaleAccountService.getWxAccountAndSale(sysWxSaleAccount); | ||||
|         //List<Map<String,Object>> fanNumList = sysImportFanWxAccountService.getTotalImportFanNum(sysImportFanWxAccount); | ||||
|         result.put("wxSaleAccountList", list); | ||||
|         result.put("fanNumList", fanNumList); | ||||
|         //result.put("fanNumList", fanNumList); | ||||
|         return AjaxResult.success(result); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -162,6 +162,9 @@ public class SysOrderController extends OrderBaseController { | ||||
|             if (user.getUserId().equals(order.getOperatorAssisId())) { | ||||
|                 order.setOperatorAssis(user.getNickName()); | ||||
|             } | ||||
|             if (user.getUserId().equals(order.getPushPreSaleId())) { | ||||
|                 order.setPushPreSale(user.getNickName()); | ||||
|             } | ||||
|         } | ||||
|         order.setOrderTypeName(OrderUtils.getOrderTypeName(order)); | ||||
|     } | ||||
|   | ||||
| @@ -38,6 +38,11 @@ public class SysCommision extends BaseEntity { | ||||
|      */ | ||||
|     private Long postId; | ||||
|  | ||||
|     /** | ||||
|      * 岗位编码code | ||||
|      */ | ||||
|     private String postCode; | ||||
|  | ||||
|     /** | ||||
|      * 业务员 | ||||
|      */ | ||||
|   | ||||
| @@ -39,4 +39,7 @@ public class SysImportFanWxAccount extends BaseEntity | ||||
|     //导粉日期 | ||||
|     @JsonFormat(pattern = "yyyy-MM-dd") | ||||
|     private Date importFanDate; | ||||
|  | ||||
|     //售前 | ||||
|     private Long preSaleId; | ||||
| } | ||||
| @@ -84,6 +84,17 @@ public class SysOrder extends BaseEntity { | ||||
|     @Excel(name = "售前") | ||||
|     private String preSale; | ||||
|  | ||||
|     /** | ||||
|      * 售前推送人(售中一开单才存在) | ||||
|      */ | ||||
|     //@Excel(name = "售前推送人") | ||||
|     private Long pushPreSaleId; | ||||
|  | ||||
|     /** | ||||
|      * 售前推送人(售中一开单才存在) | ||||
|      */ | ||||
|     private String pushPreSale; | ||||
|  | ||||
|     /** 售中ID */ | ||||
|     private Long onSaleId; | ||||
|  | ||||
|   | ||||
| @@ -45,6 +45,12 @@ public class SysWxSaleAccount extends BaseEntity | ||||
|  | ||||
|     private Integer useCount; | ||||
|  | ||||
|     //进粉渠道 | ||||
|     private Integer channel; | ||||
|  | ||||
|     //销售ID | ||||
|     private Long saleId; | ||||
|  | ||||
|     //销售昵称 | ||||
|     private String saleName; | ||||
| } | ||||
| @@ -76,5 +76,5 @@ public interface SysWxSaleAccountMapper | ||||
|      * 获取可接粉的微信号以及分配的销售昵称 | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysWxSaleAccount> getWxAccountAndSale(); | ||||
|     List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount); | ||||
| } | ||||
| @@ -70,4 +70,11 @@ public interface SysWxUserInfoMapper | ||||
|      * @return | ||||
|      */ | ||||
|     public SysWxUserInfo getSysWxUserInfoByPhone(@Param("phone")String phone); | ||||
|  | ||||
|     /** | ||||
|      * 根据openid移除对应绑定的cusId | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     public int removeCusIdByOpenId(@Param("openid")String openid); | ||||
| } | ||||
| @@ -77,5 +77,5 @@ public interface ISysWxSaleAccountService | ||||
|      * 获取可接粉的微信号以及分配的销售昵称 | ||||
|      * @return | ||||
|      */ | ||||
|     List<SysWxSaleAccount> getWxAccountAndSale(); | ||||
|     List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount); | ||||
| } | ||||
| @@ -70,5 +70,12 @@ public interface ISysWxUserInfoService | ||||
|      */ | ||||
|     public SysWxUserInfo getSysWxUserInfoByPhone(String phone); | ||||
|  | ||||
|     /** | ||||
|      * 根据openid移除对应绑定的cusId | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     public int removeCusIdByOpenId(String openid); | ||||
|  | ||||
|  | ||||
| } | ||||
| @@ -198,11 +198,33 @@ public class SysCustomerServiceImpl implements ISysCustomerService { | ||||
|         if(newCustomer == null || newCustomer.getId() == null || StringUtils.isEmpty(newCustomer.getPhone())){ | ||||
|             return; | ||||
|         } | ||||
|         //先根据cusId查询是否已经绑定过微信用户 | ||||
|         SysWxUserInfo cusIdWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoByCusId(newCustomer.getId()); | ||||
|         //根据手机号查询微信用户记录 | ||||
|         SysWxUserInfo wxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone()); | ||||
|         if(wxUserInfo != null && (wxUserInfo.getCusId() == null || wxUserInfo.getCusId().longValue() != newCustomer.getId())){ | ||||
|             wxUserInfo.setCusId(newCustomer.getId()); | ||||
|             sysWxUserInfoService.updateSysWxUserInfo(wxUserInfo); | ||||
|         SysWxUserInfo phoneWxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone()); | ||||
|         if(cusIdWxUserInfo != null) { | ||||
|             if(phoneWxUserInfo != null){ | ||||
|                 if(!cusIdWxUserInfo.getOpenid().equals(phoneWxUserInfo.getOpenid())){ | ||||
|                     //解绑之前记录 | ||||
|                     sysWxUserInfoService.removeCusIdByOpenId(cusIdWxUserInfo.getOpenid()); | ||||
|                     //更新 | ||||
|                     SysWxUserInfo param = new SysWxUserInfo(); | ||||
|                     param.setOpenid(phoneWxUserInfo.getOpenid()); | ||||
|                     param.setCusId(newCustomer.getId()); | ||||
|                     sysWxUserInfoService.updateSysWxUserInfo(param); | ||||
|                 } | ||||
|             }else{ | ||||
|                 //解绑之前记录 | ||||
|                 sysWxUserInfoService.removeCusIdByOpenId(cusIdWxUserInfo.getOpenid()); | ||||
|             } | ||||
|         }else{ | ||||
|             if(phoneWxUserInfo != null){ | ||||
|                 //更新 | ||||
|                 SysWxUserInfo param = new SysWxUserInfo(); | ||||
|                 param.setOpenid(phoneWxUserInfo.getOpenid()); | ||||
|                 param.setCusId(newCustomer.getId()); | ||||
|                 sysWxUserInfoService.updateSysWxUserInfo(param); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -105,7 +105,7 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|                 row = sysOrderMapper.insertSysOrder(sysOrder); | ||||
|                 //需要自动创建售后二开提成单 | ||||
|                 if(row > 0 && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){ | ||||
|                     autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|                     row = autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|                 } | ||||
|             }else{ | ||||
|                 row = sysOrderMapper.insertSysOrder(sysOrder); | ||||
| @@ -143,7 +143,7 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|             //二开,是否需要自动创建售后二开提成单 | ||||
|             if(row > 0 && "1".equals(sysOrder.getOrderCountType()) && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){ | ||||
|                 sysOrder.setAmount(amount); | ||||
|                 autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|                 row = autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|             } | ||||
|         } | ||||
|         //体验单 | ||||
| @@ -155,6 +155,64 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|             sysOrder.setNutriAssisId(null); | ||||
|             row = sysOrderMapper.insertSysOrder(sysOrder); | ||||
|         } | ||||
|         //售中单 | ||||
|         else if("3".equals(sysOrder.getOrderType())){ | ||||
|             sysOrder.setPreSaleId(null); | ||||
|             //一开、二开 | ||||
|            if("0".equals(sysOrder.getOrderCountType()) || "1".equals(sysOrder.getOrderCountType())){ | ||||
|                 sysOrder.setNutritionistId((sysOrder.getNutritionistIdList() != null && sysOrder.getNutritionistIdList().length > 0) ? sysOrder.getNutritionistIdList()[0] : null); | ||||
|                 sysOrder.setMainOrderId(0L); | ||||
|                 sysOrder.setAfterSaleCommissOrder(0); | ||||
|                 if("0".equals(sysOrder.getOrderCountType())){ | ||||
|                     row = sysOrderMapper.insertSysOrder(sysOrder); | ||||
|                 }else{ | ||||
|                     //二开单不存在售前推荐人 | ||||
|                     sysOrder.setPushPreSaleId(null); | ||||
|                     row = sysOrderMapper.insertSysOrder(sysOrder); | ||||
|                     //需要自动创建售后二开提成单 | ||||
|                     if(row > 0 && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){ | ||||
|                         row = autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|                     } | ||||
|                 } | ||||
|            }else{ | ||||
|                sysOrder.setAfterSaleCommissOrder(0); | ||||
|                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); | ||||
|                //拆分二开单 | ||||
|                if("3".equals(sysOrder.getOrderCountType())){ | ||||
|                    //二开单不存在售前推荐人 | ||||
|                    sysOrder.setPushPreSaleId(null); | ||||
|                } | ||||
|                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 && "3".equals(sysOrder.getOrderCountType()) && sysOrder.getSecondAfterSaleFlag() != null && sysOrder.getSecondAfterSaleFlag().intValue() == 1){ | ||||
|                    sysOrder.setAmount(amount); | ||||
|                    row = autoCreateSecondAfterSaleOrder(sysOrder); | ||||
|                } | ||||
|            } | ||||
|         } | ||||
|         return row; | ||||
|     } | ||||
|  | ||||
| @@ -166,6 +224,8 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|     private int autoCreateSecondAfterSaleOrder(SysOrder sysOrder){ | ||||
|         if(sysOrder != null){ | ||||
|             sysOrder.setPreSaleId(sysOrder.getAfterSaleId()); | ||||
|             sysOrder.setOnSaleId(null); | ||||
|             sysOrder.setPushPreSaleId(null); | ||||
|             sysOrder.setAfterSaleId(null); | ||||
|             sysOrder.setNutritionistId(null); | ||||
|             sysOrder.setNutriAssisId(null); | ||||
| @@ -173,6 +233,7 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|             sysOrder.setPlannerAssisId(null); | ||||
|             sysOrder.setOperatorId(null); | ||||
|             sysOrder.setOperatorAssisId(null); | ||||
|             sysOrder.setMainOrderId(0L); | ||||
|             sysOrder.setAfterSaleCommissOrder(1); | ||||
|             sysOrder.setOrderId(sysOrder.getOrderId()+1); | ||||
|             return sysOrderMapper.insertSysOrder(sysOrder); | ||||
| @@ -208,6 +269,9 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|             sysOrder.setOperatorId(null); | ||||
|             sysOrder.setOperatorAssisId(null); | ||||
|         } | ||||
|         if("3".equals(sysOrder.getOrderType())){ | ||||
|             sysOrder.setPreSaleId(null); | ||||
|         } | ||||
|         if(oldSysOrder.getStartTime() == null){//确保提成计算时间不为空 | ||||
|             sysOrder.setCommissStartTime(sysOrder.getOrderTime()); | ||||
|         } | ||||
| @@ -313,7 +377,7 @@ public class SysOrderServiceImpl implements ISysOrderService { | ||||
|             for (SysOrder sysOrder : orderList) { | ||||
|                 LocalDate newStartTime = null; | ||||
|                 //判断是否提成单,拆分单中的副单,体验单,定金单 | ||||
|                 if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() != 0) || | ||||
|                 if(sysOrder.getStartTime() == null || sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 || | ||||
|                         "2".equals(sysOrder.getOrderType()) || "1".equals(sysOrder.getOrderMoneyType())){ | ||||
|                     continue; | ||||
|                 } | ||||
|   | ||||
| @@ -170,7 +170,7 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { | ||||
|                             continue; | ||||
|                         } | ||||
|                         //判断是否提成单,拆分单中的副单,体验单,定金单 | ||||
|                         if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || ("1".equals(sysOrder.getOrderType()) && sysOrder.getMainOrderId().intValue() != 0) || | ||||
|                         if (sysOrder.getAfterSaleCommissOrder().intValue() == 1 || sysOrder.getMainOrderId().intValue() != 0 || | ||||
| //                                "2".equals(sysOrder.getOrderType()) || // 体验单也需要生成计划 2021.05.29 | ||||
|                                 "1".equals(sysOrder.getOrderMoneyType()) || sysOrder.getCounted() == 1) { | ||||
|                             System.out.println("---------------------" + sysOrder.getOrderId() + "不生成食谱------------------------"); | ||||
|   | ||||
| @@ -136,7 +136,7 @@ public class SysWxSaleAccountServiceImpl implements ISysWxSaleAccountService { | ||||
|      * @param sysWxSaleAccount | ||||
|      * @return | ||||
|      */ | ||||
|     public List<SysWxSaleAccount> getWxAccountAndSale(){ | ||||
|         return sysWxSaleAccountMapper.getWxAccountAndSale(); | ||||
|     public List<SysWxSaleAccount> getWxAccountAndSale(SysWxSaleAccount sysWxSaleAccount){ | ||||
|         return sysWxSaleAccountMapper.getWxAccountAndSale(sysWxSaleAccount); | ||||
|     } | ||||
| } | ||||
| @@ -106,4 +106,13 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService { | ||||
|     public SysWxUserInfo getSysWxUserInfoByPhone(String phone){ | ||||
|         return sysWxUserInfoMapper.getSysWxUserInfoByPhone(phone); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 根据openid移除对应绑定的cusId | ||||
|      * @param openid | ||||
|      * @return | ||||
|      */ | ||||
|     public int removeCusIdByOpenId(String openid){ | ||||
|         return sysWxUserInfoMapper.removeCusIdByOpenId(openid); | ||||
|     } | ||||
| } | ||||
| @@ -4,9 +4,9 @@ import com.stdiet.custom.domain.SysOrder; | ||||
|  | ||||
| public class OrderUtils { | ||||
|  | ||||
|     private static final String[] orderTypeArray = {"普通单","比例拆分单","体验单"}; | ||||
|     private static final String[] orderTypeArray = {"普通单","比例拆分单","体验单","售中单"}; | ||||
|  | ||||
|     private static final String[] orderCountTypeArray = {"一开单","二开单"}; | ||||
|     private static final String[] orderCountTypeArray = {"一开单","二开单","一开单(拆分)","二开单(拆分)"}; | ||||
|  | ||||
|     private static final String[] orderMoneyTypeArray = {"全款单","定金单","尾款单"}; | ||||
|  | ||||
| @@ -27,7 +27,7 @@ public class OrderUtils { | ||||
|         orderTypeName += "/"+orderCountTypeArray[Integer.parseInt(sysOrder.getOrderCountType())]; | ||||
|         orderTypeName += "/"+orderMoneyTypeArray[Integer.parseInt(sysOrder.getOrderMoneyType())]; | ||||
|         //判断是不是二开提成单 | ||||
|         if("1".equals(sysOrder.getOrderCountType()) && sysOrder.getAfterSaleCommissOrder().intValue() == 1){ | ||||
|         if(sysOrder.getAfterSaleCommissOrder() != null && sysOrder.getAfterSaleCommissOrder().intValue() == 1){ | ||||
|             orderTypeName += "/提成单"; | ||||
|         } | ||||
|         return orderTypeName; | ||||
|   | ||||
| @@ -42,12 +42,17 @@ | ||||
|         <if test="endTime != null and endTime != ''">AND date_format(order_time,'%y%m%d') <= | ||||
|             date_format(${endTime},'%y%m%d') | ||||
|         </if> | ||||
|         <!-- 因为体验单、售中单都存在售中,所以售中的提成金额只计算售中单的,不计算体验单 --> | ||||
|         <if test="postCode != null and postCode == 'on_sale_id'"> | ||||
|             and order_type = 3 | ||||
|         </if> | ||||
|         GROUP BY ${column} | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysCommisionDetail" parameterType="SysCommision" resultMap="SysCommisionResult"> | ||||
|         SELECT * FROM view_user_post pa | ||||
|         JOIN ( | ||||
|         <if test="postId == null or postId == 0"> | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="pre_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
| @@ -56,6 +61,22 @@ | ||||
|             <property name="postId" value="5"/> | ||||
|         </include> | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="push_pre_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="18"/> | ||||
|         </include> | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="on_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|             <property name="beginTime" value="#{beginTime}"/> | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="16"/> | ||||
|         </include> | ||||
|         UNION | ||||
|         <include refid="groupAmountVo"> | ||||
|             <property name="column" value="after_sale_id"/> | ||||
|             <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
| @@ -111,9 +132,19 @@ | ||||
|             <property name="endTime" value="#{endTime}"/> | ||||
|             <property name="postId" value="8"/> | ||||
|         </include> | ||||
|         </if> | ||||
|         <if test="postId != null and postId > 0"> | ||||
|             <include refid="groupAmountVo"> | ||||
|                 <property name="column" value="${postCode}"/> | ||||
|                 <property name="reviewStatus" value="#{reviewStatus}"/> | ||||
|                 <property name="beginTime" value="#{beginTime}"/> | ||||
|                 <property name="endTime" value="#{endTime}"/> | ||||
|                 <property name="postId" value="${postId}"/> | ||||
|             </include> | ||||
|         </if> | ||||
|         ) AS a USING(user_id, post_id) | ||||
|         <where> | ||||
|             <if test="postId != null and postId != ''">and post_id = #{postId}</if> | ||||
|             <!--<if test="postId != null and postId != ''">and post_id = #{postId}</if>--> | ||||
|             <if test="userId != null and userId != ''">and user_id = #{userId}</if> | ||||
|             <if test="userIds != null"> | ||||
|                 and user_id in | ||||
| @@ -122,6 +153,7 @@ | ||||
|                 </foreach> | ||||
|             </if> | ||||
|         </where> | ||||
|         order by user_id asc | ||||
|     </select> | ||||
|  | ||||
|     <sql id="selectSysCommisionVo"> | ||||
|   | ||||
| @@ -41,6 +41,7 @@ | ||||
|         <result property="serverEndTime" column="server_end_time"/> | ||||
|         <result property="becomeFanTime" column="become_fan_time"/> | ||||
|  | ||||
|         <result property="pushPreSaleId"    column="push_pre_sale_id"    /> | ||||
|         <result property="onSaleId" column="on_sale_id"/> | ||||
|         <result property="orderType" column="order_type"/> | ||||
|         <result property="orderCountType" column="order_count_type"/> | ||||
| @@ -63,7 +64,7 @@ | ||||
|         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.on_sale_id,o.order_type,o.order_count_type,o.order_money_type,o.main_order_id,o.after_sale_commiss_order,o.commiss_start_time, o.counted | ||||
|         o.on_sale_id,o.order_type,o.order_count_type,o.order_money_type,o.main_order_id,o.after_sale_commiss_order,o.commiss_start_time, o.counted,o.push_pre_sale_id | ||||
|         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 | ||||
| @@ -227,6 +228,7 @@ | ||||
|             <if test="operatorId != null">operator_id,</if> | ||||
|             <if test="serveTimeId != null">serve_time_id,</if> | ||||
|             <if test="recommender != null">recommender,</if> | ||||
|             <if test="pushPreSaleId != null">push_pre_sale_id,</if> | ||||
|             <if test="amount != null">amount,</if> | ||||
|             <if test="orderTime != null">order_time,</if> | ||||
|             <if test="createBy != null">create_by,</if> | ||||
| @@ -270,6 +272,7 @@ | ||||
|             <if test="operatorId != null">#{operatorId},</if> | ||||
|             <if test="serveTimeId != null">#{serveTimeId},</if> | ||||
|             <if test="recommender != null">#{recommender},</if> | ||||
|             <if test="pushPreSaleId != null">#{pushPreSaleId},</if> | ||||
|             <if test="amount != null">#{amount},</if> | ||||
|             <if test="orderTime != null">#{orderTime},</if> | ||||
|             <if test="createBy != null">#{createBy},</if> | ||||
| @@ -316,6 +319,7 @@ | ||||
|             <if test="operatorId != null">operator_id = #{operatorId},</if> | ||||
|             <if test="serveTimeId != null">serve_time_id = #{serveTimeId},</if> | ||||
|             <if test="recommender != null">recommender = #{recommender},</if> | ||||
|             <if test="pushPreSaleId != null">push_pre_sale_id = #{pushPreSaleId},</if> | ||||
|             <if test="amount != null">amount = #{amount},</if> | ||||
|             <if test="orderTime != null">order_time = #{orderTime},</if> | ||||
|             <if test="createBy != null">create_by = #{createBy},</if> | ||||
| @@ -387,6 +391,7 @@ | ||||
|         <result property="serverEndTime" column="server_end_time"/> | ||||
|         <result property="becomeFanTime" column="become_fan_time"/> | ||||
|  | ||||
|         <result property="pushPreSaleId"    column="push_pre_sale_id"    /> | ||||
|         <result property="onSaleId" column="on_sale_id"/> | ||||
|         <result property="orderType" column="order_type"/> | ||||
|         <result property="orderCountType" column="order_count_type"/> | ||||
|   | ||||
| @@ -35,7 +35,7 @@ | ||||
|       FROM sys_wx_distribution AS swd | ||||
|       lEFT JOIN sys_wx_sale_account swsa ON swsa.id = swd.wechat_account and swsa.del_flag = 0 | ||||
|       LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0 | ||||
|       LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'fan_channel') AS acc ON acc.dict_value = swd.account_id | ||||
|       LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = swd.account_id | ||||
|       LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sale_group') AS asg ON asg.dict_value = swd.sale_group_id | ||||
|       where swd.del_flag = 0 | ||||
|     </sql> | ||||
|   | ||||
| @@ -37,7 +37,7 @@ | ||||
|          left join sys_wx_sale_account swsa on swsa.id = swfs.wx_id and swsa.del_flag = 0 | ||||
|          left join sys_wx_distribution swd on swd.wechat_account = swfs.wx_id and swd.del_flag = 0 | ||||
|          left join sys_user su on su.user_id = swd.user_id and su.del_flag = 0 | ||||
|          LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'fan_channel') AS acc ON acc.dict_value = swd.account_id | ||||
|          LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'cus_account') AS acc ON acc.dict_value = swd.account_id | ||||
|          LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'sale_group') AS asg ON asg.dict_value = swd.sale_group_id | ||||
|     </sql> | ||||
|  | ||||
|   | ||||
| @@ -145,6 +145,15 @@ | ||||
|         left join sys_wx_distribution swd on wa.id = swd.wechat_account and swd.del_flag = 0 | ||||
|         LEFT JOIN sys_user su ON su.user_id = swd.user_id AND su.del_flag = 0 | ||||
|         where wa.del_flag = 0 and wa.status = 0 | ||||
|         <if test="saleId != null"> | ||||
|            and swd.user_id = #{saleId} | ||||
|         </if> | ||||
|         <if test="wxAccount != null and wxAccount != ''"> | ||||
|             and wa.wx_account like concat('%',#{wxAccount},'%') | ||||
|         </if> | ||||
|         <if test="channel != null"> | ||||
|             and swd.account_id = #{channel} | ||||
|         </if> | ||||
|         order by su.user_id asc | ||||
|     </select> | ||||
|  | ||||
|   | ||||
| @@ -135,4 +135,9 @@ | ||||
|         where phone = #{phone} order by create_time desc limit 1 | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据openid移除绑定的cusId --> | ||||
|     <update id="removeCusIdByOpenId" parameterType="String"> | ||||
|         update sys_wx_user_info set cus_id = null where openid = #{openid} | ||||
|     </update> | ||||
|  | ||||
| </mapper> | ||||
| @@ -1,15 +1,56 @@ | ||||
| <template> | ||||
|     <!--  --> | ||||
|     <!-- 添加或修改导粉管理对话框 --> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="1000px" :close-on-click-modal="false" append-to-body @closed="cancel"> | ||||
|       <div style="margin-bottom: 20px;color:red">1、添加导粉记录时会根据进粉渠道、当前时间来自动确定所属直播间,当前时间段没有直播,则取上一次直播,若账号从未直播过,则为空</div> | ||||
|     <el-dialog :title="title" :visible.sync="open" width="1050px" :close-on-click-modal="false" append-to-body @closed="cancel"> | ||||
|       <!--<div style="margin-bottom: 20px;color:red">1、添加导粉记录时会根据进粉渠道、当前时间来自动确定所属直播间,当前时间段没有直播,则取上一次直播,若账号从未直播过,则为空</div>--> | ||||
|         <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> | ||||
|       <!--<el-form-item label="账号渠道" prop="channel"> | ||||
|           <el-select | ||||
|               v-model="queryParams.channel" | ||||
|               placeholder="请选择账号渠道" | ||||
|               clearable | ||||
|               filterable | ||||
|               size="small" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in fanChanneloptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="parseInt(dict.dictValue)" | ||||
|               /> | ||||
|             </el-select> | ||||
|         </el-form-item>--> | ||||
|         <el-form-item label="销售" prop="saleId" label-width="50px"> | ||||
|           <el-select | ||||
|               v-model="queryParams.saleId" | ||||
|               placeholder="请选择销售" | ||||
|               clearable | ||||
|               filterable | ||||
|               size="small" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in preSaleIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="parseInt(dict.dictValue)" | ||||
|               /> | ||||
|             </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="微信账号" prop="wxAccount"> | ||||
|             <el-input v-model.trim="queryParams.wxAccount" placeholder="请输入微信号" /> | ||||
|         </el-form-item> | ||||
|       <el-form-item> | ||||
|         <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||||
|         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
|         <div style="height: 500px; overflow: auto"> | ||||
|             <el-table v-loading="loading" :data="wxAccountList"> | ||||
|                 <!--<el-table-column label="微信昵称" align="center" prop="wxNickName" />--> | ||||
|                 <el-table-column label="微信号" align="center" prop="wxAccount" width="160"/> | ||||
|                 <el-table-column label="销售" align="center" prop="saleName" width="120"/> | ||||
|                 <el-table-column label="已导粉数量" align="center" prop="importFanNum" width="120"/> | ||||
|                 <el-table-column label="进粉渠道" align="center" prop="importFanChannel" > | ||||
|                 <!--<el-table-column label="已导粉数量" align="center" prop="importFanNum" width="120"/>--> | ||||
|                 <el-table-column label="账号渠道" align="center" prop="importFanChannel" width="180"> | ||||
|                     <template slot-scope="scope"> | ||||
|                             <el-select | ||||
|                         v-model="scope.row.importFanChannel" | ||||
| @@ -46,7 +87,23 @@ | ||||
|                         </el-select> | ||||
|                     </template> | ||||
|                 </el-table-column>--> | ||||
|                 <el-table-column label="导粉数量" align="center" prop="fanNum" width="200"> | ||||
|                  <el-table-column label="导粉时间" align="center" prop="fanTime" width="240"> | ||||
|                    <template slot-scope="scope"> | ||||
|                   <el-date-picker | ||||
|                     v-model="scope.row.fanTime" | ||||
|                     type="datetime" | ||||
|                     placeholder="选择导粉时间" | ||||
|                     format="yyyy-MM-dd HH:mm" | ||||
|                     value-format="yyyy-MM-dd HH:mm" | ||||
|                     :picker-options="fanPickerOptions" | ||||
|                     @change="autoSelectLive(scope.row)" | ||||
|                   > | ||||
|                   </el-date-picker> | ||||
|                    </template> | ||||
|                 </el-table-column> | ||||
|                  | ||||
|  | ||||
|                 <el-table-column label="导粉数量" align="center" prop="fanNum" width="180"> | ||||
|                     <template slot-scope="scope"> | ||||
|                             <el-input-number v-model="scope.row.fanNum" :min="1" :max="10000" label="导粉数量" style="width:160px"></el-input-number> | ||||
|                     </template> | ||||
| @@ -76,6 +133,7 @@ | ||||
| <script> | ||||
| import { addImportFanRecord,getWxAccountAndSale } from "@/api/custom/importFanRecord"; | ||||
| import { getAllLiveSchedulByDate,getLiveSchedulByTime } from "@/api/custom/liveSchedul"; | ||||
| import { mapGetters } from "vuex"; | ||||
| import dayjs from "dayjs"; | ||||
| const nowTime = dayjs().format("YYYY-MM-DD HH:mm"); | ||||
| export default { | ||||
| @@ -107,12 +165,28 @@ export default { | ||||
|       //总导粉统计 | ||||
|       fanNumList:[], | ||||
|       //是否进行了导粉操作 | ||||
|       importFanFlag: false | ||||
|       importFanFlag: false, | ||||
|       queryParams:{ | ||||
|           channel: null, | ||||
|           saleId: null, | ||||
|           wxAccount: null | ||||
|       }, | ||||
|       fanPickerOptions: { | ||||
|         disabledDate(time) { | ||||
|           return time.getTime() > Date.now() || time.getTime() < Date.now(); | ||||
|         }, | ||||
|       }, | ||||
|     }; | ||||
|   }, | ||||
|   created(){ | ||||
|      | ||||
|          | ||||
|   }, | ||||
|   computed: { | ||||
|     ...mapGetters([ | ||||
|       // 售前字典 | ||||
|       "preSaleIdOptions" | ||||
|     ]), | ||||
|   }, | ||||
|   methods: { | ||||
|     showDialog(data, callback, fanChanneloptions) { | ||||
| @@ -149,18 +223,29 @@ export default { | ||||
|     //获取所有可接粉的微信号 | ||||
|     getListWxAccount() { | ||||
|         this.loading = true; | ||||
|         getWxAccountAndSale({'importFanDate': this.data.importFanDate}).then((response) => { | ||||
|         getWxAccountAndSale(this.queryParams).then((response) => { | ||||
|             response.data.wxSaleAccountList.forEach((item,index) => { | ||||
|                 item.fanNum = 1; | ||||
|                 item.importFanNum =  this.getTotalFanNum(response.data.fanNumList, item.id); | ||||
|                 //item.importFanNum =  this.getTotalFanNum(response.data.fanNumList, item.id); | ||||
|                 item.importFanChannel = null; | ||||
|                 item.importFanLive = null; | ||||
|                 item.fanTime = null; | ||||
|             }); | ||||
|             this.wxAccountList = response.data.wxSaleAccountList; | ||||
|             this.fanNumList = response.data.fanNumList; | ||||
|             //this.fanNumList = response.data.fanNumList; | ||||
|             this.loading = false; | ||||
|         }); | ||||
|     }, | ||||
|     handleQuery(){ | ||||
|         this.getListWxAccount(); | ||||
|     }, | ||||
|     resetQuery(){ | ||||
|         this.queryParams = { | ||||
|           channel: null, | ||||
|           saleId: null, | ||||
|           wxAccount: null | ||||
|         }; | ||||
|     }, | ||||
|     getAllLiveSchedulByDate(){ | ||||
|       getAllLiveSchedulByDate({'liveSchedulDate':this.data.importFanDate}).then((response) => { | ||||
|           response.data.forEach((item,index) => { | ||||
| @@ -186,7 +271,15 @@ export default { | ||||
|         if(row.importFanChannel == undefined || row.importFanChannel == null || row.importFanChannel == ""){ | ||||
|           this.$message({ | ||||
|                 type: 'warning', | ||||
|                 message: '进粉渠道不能为空', | ||||
|                 message: '账号渠道不能为空', | ||||
|                 center: true | ||||
|           }); | ||||
|           return; | ||||
|         } | ||||
|         if(row.fanTime == undefined || row.fanTime == null || row.fanTime == ""){ | ||||
|           this.$message({ | ||||
|                 type: 'warning', | ||||
|                 message: '导粉时间不能为空', | ||||
|                 center: true | ||||
|           }); | ||||
|           return; | ||||
| @@ -273,7 +366,7 @@ export default { | ||||
|            row.importFanLive = null; | ||||
|            return; | ||||
|         } | ||||
|         getLiveSchedulByTime({'fanChannel':row.importFanChannel,'liveStartTimeString':encodeURIComponent(dayjs().format("YYYY-MM-DD HH:mm"))}).then((response) => { | ||||
|         getLiveSchedulByTime({'fanChannel':row.importFanChannel,'liveStartTimeString':encodeURIComponent(row.fanTime)}).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                  let live = response.data; | ||||
|                  if(live != undefined && live != null){ | ||||
|   | ||||
| @@ -111,8 +111,8 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|           <el-form-item label="售前" prop="preSaleId"> | ||||
|         <el-col :span="8" v-show="preSaleShow"> | ||||
|           <el-form-item label="售前" prop="preSaleId" > | ||||
|             <el-select v-model="form.preSaleId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
| @@ -124,7 +124,20 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8" v-show="!afterNutiShow"> | ||||
|         <el-col :span="8" v-show="pushPreSaleShow"> | ||||
|           <el-form-item label="售前推送" prop="preSaleId" title="售前推送人就是该客户体验单的销售,只有售中一开单需要选择"> | ||||
|             <el-select v-model="form.pushPreSaleId" placeholder="请选择" filterable | ||||
|               clearable> | ||||
|               <el-option | ||||
|                 v-for="dict in pushPreSaleIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="parseInt(dict.dictValue)" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8" v-show="onSaleShow"> | ||||
|           <el-form-item label="售中" prop="onSaleId"> | ||||
|             <el-select v-model="form.onSaleId" placeholder="请选择"> | ||||
|               <el-option | ||||
| @@ -243,11 +256,11 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|         <!--<el-col :span="8"> | ||||
|           <el-form-item label="推荐人" prop="recommender"> | ||||
|             <el-input v-model="form.recommender" placeholder="请输入推荐人" /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         </el-col>--> | ||||
|         <el-col :span="10"> | ||||
|           <el-form-item label="成交时间" prop="orderTime"> | ||||
|             <el-date-picker | ||||
| @@ -263,7 +276,7 @@ | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="10"> | ||||
|           <el-form-item label="服务开始时间" prop="startTime" label-width="120"> | ||||
|           <el-form-item label="服务开始时间" prop="startTime" label-width="180"> | ||||
|             <el-date-picker | ||||
|               style="width: 182.5px" | ||||
|               v-model="form.startTime" | ||||
| @@ -347,11 +360,15 @@ export default { | ||||
|       visible: false, | ||||
|       // 表单校验 | ||||
|       rules: { | ||||
|         customer: [ | ||||
|         /*customer: [ | ||||
|           { required: true, message: "客户姓名不能为空", trigger: "blur" }, | ||||
|         ], | ||||
|         ],*/ | ||||
|         amount: [{ required: true, message: "金额不能为空", trigger: "blur" }], | ||||
|         phone: [ | ||||
|         /*payTypeId: [{ required: true, message: "收款方式不能为空", trigger: "blur" }], | ||||
|         accountId: [{ required: true, message: "渠道不能为空", trigger: "blur" }], | ||||
|         serveTime: [{ required: true, message: "服务时间不能为空", trigger: "blur" }], | ||||
|         conditioningProjectId: [{ required: true, message: "服务项目不能为空", trigger: "blur" }],*/ | ||||
|         /*phone: [ | ||||
|           { required: true, message: "手机号不能为空", trigger: "blur" }, | ||||
|           { | ||||
|             required: true, | ||||
| @@ -359,7 +376,7 @@ export default { | ||||
|             pattern: /^[0-9]{5,11}$/, | ||||
|             message: "手机号格式不正确", | ||||
|           }, | ||||
|         ], | ||||
|         ],*/ | ||||
|         orderTime: [ | ||||
|           { required: true, message: "成交时间不能为空", trigger: "blur" }, | ||||
|           { required: true, trigger: "blur", validator: checkOrderTime }, | ||||
| @@ -425,6 +442,7 @@ export default { | ||||
|           return time.getTime() < Date.now(); | ||||
|         }, | ||||
|       }, | ||||
|       data: null, | ||||
|       // 收款方式字典 | ||||
|       payTypeIdOptions: [], | ||||
|       // 账号 | ||||
| @@ -444,7 +462,14 @@ export default { | ||||
|       secondAfterSaleFlagShow: false, | ||||
|       //分成比例 | ||||
|       orderRateOptions: orderTypeData["orderRateArray"], | ||||
|       //比例是否显示 | ||||
|       orderRateOptionsShow: false, | ||||
|       //售前是否显示 | ||||
|       preSaleShow: true, | ||||
|       //售中是否显示 | ||||
|       onSaleShow: false, | ||||
|       //售前推送人是否显示(售中一开单才存在) | ||||
|       pushPreSaleShow: false, | ||||
|       //售后、营养师、营养师助理是否显示 | ||||
|       afterNutiShow: true, | ||||
|     }; | ||||
| @@ -511,6 +536,8 @@ export default { | ||||
|       "operatorIdOptions", | ||||
|       // 运营助理字典 | ||||
|       "operatorAssisIdOptions", | ||||
|       //售前推送 | ||||
|       "pushPreSaleIdOptions" | ||||
|     ]), | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -518,7 +545,7 @@ export default { | ||||
|       // this.data = data; | ||||
|       this.callback = callback; | ||||
|       this.reset(data); | ||||
|  | ||||
|       this.data = data; | ||||
|       this.title = `${data.orderId ? "修改" : "创建"}「${ | ||||
|         data.customer | ||||
|       }」客户订单`; | ||||
| @@ -527,15 +554,15 @@ export default { | ||||
|     /** 提交按钮 */ | ||||
|     submitForm() { | ||||
|       this.$refs["form"].validate((valid) => { | ||||
|         if (valid) { | ||||
|         if (valid && this.validateAddOrder()) { | ||||
|           if (this.form.orderId != null) { | ||||
|             updateOrder(this.form).then((response) => { | ||||
|             /*updateOrder(this.form).then((response) => { | ||||
|               if (response.code === 200) { | ||||
|                 this.msgSuccess("修改成功"); | ||||
|                 this.visible = false; | ||||
|                 this.callback && this.callback(); | ||||
|               } | ||||
|             }); | ||||
|             });*/ | ||||
|           } else { | ||||
|             addOrder(this.form).then((response) => { | ||||
|               if (response.code === 200) { | ||||
| @@ -548,6 +575,88 @@ export default { | ||||
|         } | ||||
|       }); | ||||
|     }, | ||||
|     //验证订单参数 | ||||
|     validateAddOrder(){ | ||||
|       //普通单、拆分单 | ||||
|       if(this.form.orderTypeList[0] == 0 || this.form.orderTypeList[0] == 1){ | ||||
|            //售前、售后、营养师助理都不能为空 | ||||
|            if(this.form.preSaleId == null || this.form.preSaleId <= 0 || this.form.afterSaleId == null || this.form.afterSaleId <= 0  | ||||
|               || this.form.nutriAssisId == null ||  this.form.nutriAssisId <= 0){ | ||||
|               this.$message({ | ||||
|                 type: 'warning', | ||||
|                 message: '售前、售后、营养师助理不能为空', | ||||
|                 center: true | ||||
|               }); | ||||
|               return false; | ||||
|            } | ||||
|            //根据是否拆分判断营养师 | ||||
|            if(this.form.orderTypeList[0] == 0){ | ||||
|               if(this.form.nutritionistIdList == null || this.form.nutritionistIdList.length != 1 || this.form.nutritionistIdList[0] <= 0){ | ||||
|                 this.$message({ | ||||
|                   type: 'warning', | ||||
|                   message: '营养师不能为空,普通单只能选择一个营养师', | ||||
|                   center: true | ||||
|                 }); | ||||
|                 return false; | ||||
|               } | ||||
|            }else{ | ||||
|               if(this.form.nutritionistIdList == null || this.form.nutritionistIdList.length != 2 || this.form.nutritionistIdList[0] <= 0 || this.form.nutritionistIdList[1] <= 0){ | ||||
|                 this.$message({ | ||||
|                   type: 'warning', | ||||
|                   message: '营养师不能为空,拆分单需要选择两个营养师', | ||||
|                   center: true | ||||
|                 }); | ||||
|                 return false; | ||||
|               } | ||||
|            } | ||||
|       } | ||||
|       //体验单 | ||||
|       else if(this.form.orderTypeList[0] == 2){ | ||||
|           //售前、售中不能为空 | ||||
|           if(this.form.preSaleId == null || this.form.preSaleId <= 0 || this.form.onSaleId == null ||  this.form.onSaleId <= 0){ | ||||
|               this.$message({ | ||||
|                 type: 'warning', | ||||
|                 message: '售前、售中不能为空', | ||||
|                 center: true | ||||
|               }); | ||||
|               return false; | ||||
|            } | ||||
|       } | ||||
|       //售中单 | ||||
|       else if(this.form.orderTypeList[0] == 3){ | ||||
|           //售中、售后、营养师助理不能为空 | ||||
|           if(this.form.onSaleId == null || this.form.onSaleId <= 0 || this.form.afterSaleId == null || this.form.afterSaleId <= 0  | ||||
|               || this.form.nutriAssisId == null ||  this.form.nutriAssisId <= 0){ | ||||
|               this.$message({ | ||||
|                 type: 'warning', | ||||
|                 message: '售中、售后、营养师助理不能为空', | ||||
|                 center: true | ||||
|               }); | ||||
|               return false; | ||||
|            } | ||||
|            //判断是否拆分单 | ||||
|            if(this.form.orderTypeList[1] == 0 || this.form.orderTypeList[1] == 1){ | ||||
|               if(this.form.nutritionistIdList == null || this.form.nutritionistIdList.length != 1 || this.form.nutritionistIdList[0] <= 0){ | ||||
|                 this.$message({ | ||||
|                   type: 'warning', | ||||
|                   message: '营养师不能为空,普通单只能选择一个营养师', | ||||
|                   center: true | ||||
|                 }); | ||||
|                 return false; | ||||
|               } | ||||
|            }else{ | ||||
|               if(this.form.nutritionistIdList == null || this.form.nutritionistIdList.length != 2 || this.form.nutritionistIdList[0] <= 0 || this.form.nutritionistIdList[1] <= 0){ | ||||
|                 this.$message({ | ||||
|                   type: 'warning', | ||||
|                   message: '营养师不能为空,拆分单需要选择两个营养师', | ||||
|                   center: true | ||||
|                 }); | ||||
|                 return false; | ||||
|               } | ||||
|            } | ||||
|       } | ||||
|       return true; | ||||
|     }, | ||||
|     reset(obj = {}) { | ||||
|       const defaultPayType = this.payTypeIdOptions.find( | ||||
|         (opt) => opt.remark === "default" | ||||
| @@ -614,6 +723,7 @@ export default { | ||||
|         pauseTime: null, | ||||
|         payTypeId: defaultPayType ? parseInt(defaultPayType.dictValue) : null, | ||||
|         preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null, | ||||
|         pushPreSaleId: null, | ||||
|         createBy: null, | ||||
|         createTime: null, | ||||
|         onSaleId: null, | ||||
| @@ -696,7 +806,7 @@ export default { | ||||
|     // }, | ||||
|     "form.orderTypeList": function (newVal, oldVal) { | ||||
|       //判断订单类型是否选择了二开 | ||||
|       if (newVal[1] == 1) { | ||||
|       if (newVal[1] == 1 || newVal[1] == 3) { | ||||
|         this.form.secondAfterSaleFlag = 1; | ||||
|         this.secondAfterSaleFlagShow = true; | ||||
|       } else { | ||||
| @@ -704,7 +814,7 @@ export default { | ||||
|         this.secondAfterSaleFlagShow = false; | ||||
|       } | ||||
|       //判断是否选择了比例拆分单 | ||||
|       if (newVal[0] == 1) { | ||||
|       if (newVal[0] == 1 || newVal[1] == 2 || newVal[1] == 3) { | ||||
|         this.orderRateOptionsShow = true; | ||||
|         this.form.nutritionistRate = "2,8"; | ||||
|       } else { | ||||
| @@ -713,15 +823,40 @@ export default { | ||||
|       } | ||||
|       //判断是否选择了体验单 | ||||
|       if (newVal[0] == 2) { | ||||
|         this.afterNutiShow = false; | ||||
|         this.form.onSaleId = parseInt(this.onSaleIdOptions[1].dictValue); | ||||
|         this.form.serveTimeId = 7; | ||||
|         this.form.conditioningProjectId = 12; | ||||
|         this.onSaleShow = true; | ||||
|         this.afterNutiShow = false; | ||||
|       } else { | ||||
|         this.form.onSaleId = null; | ||||
|         this.form.serveTimeId = 90; | ||||
|         this.afterNutiShow = true; | ||||
|         this.form.conditioningProjectId = 0; | ||||
|         this.onSaleShow = false; | ||||
|         this.afterNutiShow = true; | ||||
|       } | ||||
|       //判断是否选择了售中单 | ||||
|       if(newVal[0] == 3){ | ||||
|         //不需要选择销售,需要选择售中 | ||||
|         this.form.preSaleId = null; | ||||
|         this.onSaleShow = true; | ||||
|         this.preSaleShow = false; | ||||
|         //一开单 | ||||
|         if(newVal[1] == 0 || newVal[1] == 2){ | ||||
|           this.form.pushPreSaleId = (this.data && this.data.preSaleId != null) ? this.data.preSaleId : null; | ||||
|             this.pushPreSaleShow = true; | ||||
|         }else{ | ||||
|             this.pushPreSaleShow = false; | ||||
|             this.form.pushPreSaleId = null; | ||||
|         } | ||||
|       }else{ | ||||
|           this.form.pushPreSaleId = null; | ||||
|           this.pushPreSaleShow = false; | ||||
|           this.preSaleShow = true; | ||||
|           //需要判断是否为体验单 | ||||
|           if (newVal[0] != 2) { | ||||
|             this.form.onSaleId = null; | ||||
|             this.onSaleShow = false; | ||||
|           } | ||||
|       } | ||||
|     }, | ||||
|   }, | ||||
|   | ||||
| @@ -66,16 +66,18 @@ export default { | ||||
|     return { | ||||
|       orderDetailList: [], | ||||
|       visible: false, | ||||
|       preSaleTitle: "售前", | ||||
|       preSaleValue: "preSale", | ||||
|       //订单详情的标题,按竖显示 | ||||
|       orderTitleData: [ | ||||
|         ["订单类型","审核状态", "成交时间"], | ||||
|         ["调理项目","姓名", "手机号"], | ||||
|         ["金额","收款方式", "收款账号"], | ||||
|         ["服务时长","赠送时长", "售前"], | ||||
|         ["售中","售后","营养师"], | ||||
|         ["助理营养师","策划","策划助理"], | ||||
|         ["运营","运营助理","开始时间"], | ||||
|         ["结束时间","备注",""] | ||||
|         ["售前推送","售中","售后"], | ||||
|         ["营养师","助理营养师","策划"], | ||||
|         ["策划助理","运营","运营助理"], | ||||
|         ["开始时间","结束时间","备注"] | ||||
|       ], | ||||
|       //订单详情的属性名称,与标题对应,按竖显示 | ||||
|       orderValueData: [ | ||||
| @@ -83,10 +85,10 @@ export default { | ||||
|         ["conditioningProject","customer", "phone"], | ||||
|         ["amount","payType", "account"], | ||||
|         ["serveTime","giveServeDay", "preSale"], | ||||
|         ["onSale","afterSale","nutritionist"], | ||||
|         ["nutriAssis","planner","plannerAssis"], | ||||
|         ["operator","operatorAssis","startTime"], | ||||
|         ["serverEndTime","remark",""] | ||||
|         ["pushPreSale","onSale","afterSale"], | ||||
|         ["nutritionist","nutriAssis","planner"], | ||||
|         ["plannerAssis","operator","operatorAssis"], | ||||
|         ["startTime","serverEndTime","remark"] | ||||
|       ], | ||||
|     }; | ||||
|   }, | ||||
|   | ||||
| @@ -90,7 +90,7 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|         <el-col :span="8" v-show="preSaleShow"> | ||||
|           <el-form-item label="售前" prop="preSaleId"> | ||||
|             <el-select v-model="form.preSaleId" placeholder="请选择"> | ||||
|               <el-option | ||||
| @@ -102,6 +102,19 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|  | ||||
|         <el-col :span="8" v-show="pushPreSaleShow"> | ||||
|           <el-form-item label="售前推送" prop="preSaleId"> | ||||
|             <el-select v-model="form.pushPreSaleId" placeholder="请选择"> | ||||
|               <el-option | ||||
|                 v-for="dict in pushPreSaleIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="parseInt(dict.dictValue)" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8" v-show="onSaleShow"> | ||||
|           <el-form-item label="售中" prop="onSaleId"> | ||||
|             <el-select v-model="form.onSaleId" placeholder="请选择"> | ||||
| @@ -198,11 +211,11 @@ | ||||
|             </el-select> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="8"> | ||||
|         <!--<el-col :span="8"> | ||||
|           <el-form-item label="推荐人" prop="recommender"> | ||||
|             <el-input v-model="form.recommender" placeholder="请输入推荐人" /> | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         </el-col>--> | ||||
|         <el-col :span="10"> | ||||
|           <el-form-item label="成交时间" prop="orderTime"> | ||||
|             <el-date-picker | ||||
| @@ -218,7 +231,7 @@ | ||||
|           </el-form-item> | ||||
|         </el-col> | ||||
|         <el-col :span="12"> | ||||
|           <el-form-item label="服务开始时间" prop="startTime" label-width="120"> | ||||
|           <el-form-item label="服务开始时间" prop="startTime" label-width="160"> | ||||
|             <el-date-picker | ||||
|               style="width: 182.5px" | ||||
|               v-model="form.startTime" | ||||
| @@ -392,8 +405,12 @@ export default { | ||||
|       reviewStatusOptions: [], | ||||
|       //下拉列表对应关系(用于选择收款账号自动选择策划、策划助理、运营、运营助理) | ||||
|       orderDropdownCorrespondingOptions: [], | ||||
|       //是否显示售中 | ||||
|       //售前是否显示 | ||||
|       preSaleShow: true, | ||||
|       //售中是否显示 | ||||
|       onSaleShow: false, | ||||
|       //售前推送人是否显示(售中一开单才存在) | ||||
|       pushPreSaleShow: false, | ||||
|       //是否显示售后、营养师、营养师助理 | ||||
|       afterSaleNutriAssShow: true, | ||||
|       //是否显示策划、策划助理、运营、运营助理 | ||||
| @@ -448,6 +465,8 @@ export default { | ||||
|       "operatorIdOptions", | ||||
|       // 运营助理字典 | ||||
|       "operatorAssisIdOptions", | ||||
|       //售前推送 | ||||
|       "pushPreSaleIdOptions" | ||||
|     ]), | ||||
|   }, | ||||
|   methods: { | ||||
| @@ -545,6 +564,7 @@ export default { | ||||
|         pauseTime: null, | ||||
|         payTypeId: defaultPayType ? parseInt(defaultPayType.dictValue) : null, | ||||
|         preSaleId: defaultPresale ? parseInt(defaultPresale.dictValue) : null, | ||||
|         pushPreSaleId: null, | ||||
|         onSaleId: null, | ||||
|         createBy: null, | ||||
|         createTime: null, | ||||
| @@ -575,13 +595,42 @@ export default { | ||||
|         accountId, | ||||
|         ...obj, | ||||
|       }; | ||||
|       // console.log(this.form); | ||||
|       this.resetForm("form"); | ||||
|       // console.log("--"+obj.orderType); | ||||
|       this.onSaleShow = this.form.orderType == "2"; | ||||
|       this.afterSaleNutriAssShow = | ||||
|         this.form.orderType != "2" && this.form.afterSaleCommissOrder == 0; | ||||
|       this.planOperatorShow = this.form.afterSaleCommissOrder == 0; | ||||
|  | ||||
|       //售前是否显示 | ||||
|       this.preSaleShow = true; | ||||
|       //售中是否显示 | ||||
|       this.onSaleShow = false; | ||||
|       //售前推送人是否显示(售中一开单才存在) | ||||
|       this.pushPreSaleShow= false; | ||||
|       //是否显示售后、营养师、营养师助理 | ||||
|       this.afterSaleNutriAssShow= true; | ||||
|       //是否显示策划、策划助理、运营、运营助理 | ||||
|       this.planOperatorShow = true; | ||||
|        | ||||
|       if(this.form.orderType == "3"){ | ||||
|          //售中单的非提成单不显示售前 | ||||
|          if(this.form.afterSaleCommissOrder == null || this.form.afterSaleCommissOrder == 0){ | ||||
|             this.preSaleShow = false; | ||||
|          } | ||||
|          if(this.form.orderCountType == 0 || this.form.orderCountType == 2){ | ||||
|            this.pushPreSaleShow = true; | ||||
|          } | ||||
|       } | ||||
|  | ||||
|       if(this.form.orderType == "2" || (this.form.orderType == "3" && (this.form.afterSaleCommissOrder == null || this.form.afterSaleCommissOrder == 0))){ | ||||
|         this.onSaleShow = true; | ||||
|       } | ||||
|  | ||||
|       if((this.form.afterSaleCommissOrder != null && this.form.afterSaleCommissOrder != 0) || this.form.orderType == "2"){ | ||||
|         this.afterSaleNutriAssShow = false; | ||||
|       } | ||||
|  | ||||
|       if(this.form.afterSaleCommissOrder != null && this.form.afterSaleCommissOrder != 0){ | ||||
|         this.planOperatorShow = false; | ||||
|       } | ||||
|  | ||||
|       //console.log(this.preSaleShow + " | " + this.pushPreSaleShow + " | " + this.onSaleShow + " | " + this.afterSaleNutriAssShow + "|" + this.planOperatorShow); | ||||
|     }, | ||||
|     handleOnClosed() { | ||||
|       this.reset(); | ||||
|   | ||||
| @@ -23,6 +23,7 @@ const getters = { | ||||
|   plannerIdOptions: state => state.global.plannerIdOptions, | ||||
|   plannerAssisIdOptions: state => state.global.plannerAssisIdOptions, | ||||
|   operatorIdOptions: state => state.global.operatorIdOptions, | ||||
|   operatorAssisIdOptions: state => state.global.operatorAssisIdOptions | ||||
|   operatorAssisIdOptions: state => state.global.operatorAssisIdOptions, | ||||
|   pushPreSaleIdOptions: state => state.global.pushPreSaleIdOptions | ||||
| }; | ||||
| export default getters; | ||||
|   | ||||
| @@ -11,6 +11,7 @@ const oriState = { | ||||
|   operatorIdOptions: [], | ||||
|   operatorAssisIdOptions: [], | ||||
|   msgUnreadCount: 0, | ||||
|   pushPreSaleIdOptions:[] | ||||
| }; | ||||
|  | ||||
| const mutations = { | ||||
| @@ -48,7 +49,8 @@ const actions = { | ||||
|       plannerIdOptions: options["planner"] || [], | ||||
|       plannerAssisIdOptions: options["planner_assis"] || [], | ||||
|       operatorIdOptions: options["operator"] || [], | ||||
|       operatorAssisIdOptions: options["operator_assis"] || [] | ||||
|       operatorAssisIdOptions: options["operator_assis"] || [], | ||||
|       pushPreSaleIdOptions: options["push_pre_sale"] || [], | ||||
|     }); | ||||
|   } | ||||
| }; | ||||
|   | ||||
| @@ -25,6 +25,29 @@ export const orderCountTypeArray = [ | ||||
|   } | ||||
| ] | ||||
|  | ||||
| //订单次数加拆分类型 | ||||
| export const orderCountExtendedTypeArray = [ | ||||
|   { | ||||
|     value: 0, | ||||
|     label: "一开单", | ||||
|     children: orderMoneyTypeArray | ||||
|   },{ | ||||
|     value: 1, | ||||
|     label: "二开单", | ||||
|     children: orderMoneyTypeArray | ||||
|   }, | ||||
|   { | ||||
|     value: 2, | ||||
|     label: "一开单(拆分)", | ||||
|     children: orderMoneyTypeArray | ||||
|   }, | ||||
|   { | ||||
|     value: 3, | ||||
|     label: "二开单(拆分)", | ||||
|     children: orderMoneyTypeArray | ||||
|   } | ||||
| ] | ||||
|  | ||||
| //订单类型(订单新增) | ||||
| export const orderTypeArray = [ | ||||
|   { | ||||
| @@ -47,6 +70,11 @@ export const orderTypeArray = [ | ||||
|         label: "全款单" | ||||
|       }] | ||||
|     }] | ||||
|   }, | ||||
|   { | ||||
|     value: 3, | ||||
|     label: "售中单", | ||||
|     children: orderCountExtendedTypeArray | ||||
|   } | ||||
| ] | ||||
|  | ||||
|   | ||||
| @@ -27,7 +27,7 @@ | ||||
|         </el-select> | ||||
|       </el-form-item> --> | ||||
|       <el-form-item label="进粉渠道" prop="channelId"> | ||||
|         <el-select v-model="queryParams.channelId" placeholder="请选择"> | ||||
|         <el-select v-model="queryParams.channelId" filterable clearable placeholder="请选择"> | ||||
|           <el-option | ||||
|             v-for="dict in accountIdOptions" | ||||
|             :key="dict.dictValue" | ||||
|   | ||||
| @@ -356,7 +356,7 @@ export default { | ||||
|   }, | ||||
|   created() { | ||||
|     this.getList(); | ||||
|     this.getDicts("fan_channel").then((response) => { | ||||
|     this.getDicts("cus_account").then((response) => { | ||||
|       this.accountIdOptions = response.data; | ||||
|     }); | ||||
|   }, | ||||
|   | ||||
| @@ -327,7 +327,7 @@ export default { | ||||
|   }, | ||||
|   created() { | ||||
|     this.getList(); | ||||
|     this.getDicts("fan_channel").then((response) => { | ||||
|     this.getDicts("cus_account").then((response) => { | ||||
|       this.accountIdOptions = response.data; | ||||
|     }); | ||||
|     this.getDicts("sale_group").then((response) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user