客户档案的合同添加、复制健康调查链接

Merge pull request  from 德仔/xzj
This commit is contained in:
德仔 2021-02-01 19:45:14 +08:00 committed by Gitee
commit 851802861f
32 changed files with 621 additions and 1102 deletions

@ -3,6 +3,8 @@ package com.stdiet.web.controller.common;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.domain.SysPhysicalSigns;
@ -16,7 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 客户相关信息调查Controller
@ -40,14 +44,18 @@ public class InvestigateController extends BaseController {
@Autowired
private ISysCustomerHealthyService sysCustomerHealthyService;
@Autowired
private ISysCustomerService sysCustomerService;
/**
* 建立客户信息档案
*/
@PostMapping("/customerInvestigate")
public AjaxResult customerInvestigate(@RequestBody CustomerInvestigateRequest customerInvestigateRequest) throws Exception
{
customerInvestigateRequest.setId(null); //只能添加无法修改
return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest);
return AjaxResult.error("请填写新版健康评估表");
//customerInvestigateRequest.setId(null); //只能添加无法修改
//return sysCustomerPhysicalSignsService.addOrupdateCustomerAndSign(customerInvestigateRequest);
}
/**
@ -70,13 +78,33 @@ public class InvestigateController extends BaseController {
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
}
/**
* 根据加密ID获取客户基本信息
* @param enc_id
* @return
*/
@GetMapping("/getCustomerBaseMessage/{id}")
public AjaxResult getCustomerBaseMessage(@PathVariable(value = "id") String enc_id){
String id = StringUtils.isEmpty(enc_id) ? "" : AesUtils.decrypt(enc_id, null);
if(StringUtils.isNotEmpty(id)){
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(id));
if(sysCustomer != null){
Map<String, Object> result = new HashMap<>();
result.put("name", sysCustomer.getName());
result.put("phone", sysCustomer.getPhone());
return AjaxResult.success(result);
}
}
return AjaxResult.success();
}
/**
* 新增客户健康
*/
@PostMapping("/addCustomerHealthy")
public AjaxResult addCustomerHealthy(@RequestBody SysCustomerHealthy sysCustomerHealthy)
{
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
return sysCustomerHealthyService.insertSysCustomerHealthy(sysCustomerHealthy);
}
}

@ -7,6 +7,7 @@ import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
@ -86,7 +87,10 @@ public class SysCustomerController extends BaseController {
@Log(title = "客户档案", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception {
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
return toAjax(sysCustomerService.insertSysCustomer(sysCustomer));
}
return AjaxResult.error("该手机号客户已存在");
}
/**
@ -96,7 +100,10 @@ public class SysCustomerController extends BaseController {
@Log(title = "客户档案", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception {
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){
return toAjax(sysCustomerService.updateSysCustomer(sysCustomer));
}
return AjaxResult.error("该手机号客户已存在");
}
/**
@ -131,6 +138,7 @@ public class SysCustomerController extends BaseController {
@GetMapping("/physicalSigns/{id}")
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
Map<String, Object> result = new HashMap<>();
String key = "customerHealthy";
result.put("type", 0);
//查询健康评估信息
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
@ -138,7 +146,7 @@ public class SysCustomerController extends BaseController {
if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
}
result.put("customerHealthy", sysCustomerHealthy);
result.put(key, sysCustomerHealthy);
}else{
//查询体征信息
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
@ -148,8 +156,22 @@ public class SysCustomerController extends BaseController {
}
result.put("type", 1);
}
result.put("customerHealthy", sysCustomerPhysicalSigns);
result.put(key, sysCustomerPhysicalSigns);
}
//对ID进行加密
result.put("enc_id", id != null ? AesUtils.encrypt(id+"", null) : "");
return AjaxResult.success(result);
}
/**
* 根据客户ID删除对应体征信息或健康评估信息
* @param id 客户ID
* @return
*/
@GetMapping("/delCustomerHealthy/{id}")
public AjaxResult delCustomerHealthy(@PathVariable("id") Long customerId) {
int signRow = sysCustomerPhysicalSignsService.delCustomerSignByCustomerId(customerId);
int healthyRow = sysCustomerHealthyService.deleteCustomerHealthyByCustomerId(customerId);
return toAjax(signRow + healthyRow);
}
}

@ -85,7 +85,7 @@ public class SysCustomerHealthyController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody SysCustomerHealthy sysCustomerHealthy)
{
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
return AjaxResult.success();
}
/**
@ -96,7 +96,7 @@ public class SysCustomerHealthyController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody SysCustomerHealthy sysCustomerHealthy)
{
return sysCustomerHealthyService.insertOrUpdateSysCustomerHealthy(sysCustomerHealthy);
return AjaxResult.success();
}
/**

@ -0,0 +1,95 @@
package com.stdiet.common.utils.sign;
import org.apache.commons.codec.binary.Hex;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
/**
* AES加密工具类
*/
public class AesUtils {
private static final String KEY_ALGORITHM = "AES";
private static final int KEYSIZE = 128; //AES密钥长度
private static final String DEFAULT_CIPHER_ALGORITHM = "AES/ECB/PKCS5Padding"; //默认的加密算法
private static final String DEFAULT_KEY = "Yhokm#876OTG!c";
/**
* AES 加密操作
* @param content 待加密内容
* @param key 加密密码
* @return 返回Base64转码后的加密数据
*/
public static String encrypt(String content, String key) {
key = key == null ? DEFAULT_KEY : key;
try {
Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);// 创建密码器
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(key)); // 初始化为加密模式的密码器
byte[] result = cipher.doFinal(byteContent); // 加密
return Hex.encodeHexString(result);
//return Base64Utils.encodeToString(result); //通过Base64转码返回
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
/**
* AES 解密操作
* @param content
* @param key
* @return
*/
public static String decrypt(String content, String key) {
key = key == null ? DEFAULT_KEY : key;
try {
//实例化
Cipher cipher = Cipher.getInstance(DEFAULT_CIPHER_ALGORITHM);
//使用密钥初始化设置为解密模式
cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key));
//执行操作
byte[] result = cipher.doFinal(Hex.decodeHex(content));//Base64Utils.decodeFromString(content)
return new String(result, "utf-8");
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
/**
* 生成加密秘钥
*
* @return
*/
private static SecretKeySpec getSecretKey(String key) {
//返回生成指定算法密钥生成器的 KeyGenerator 对象
KeyGenerator kg = null;
try {
kg = KeyGenerator.getInstance(KEY_ALGORITHM);
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
random.setSeed(key.getBytes());
//AES 要求密钥长度为 128
kg.init(KEYSIZE, random);
//生成一个密钥
SecretKey secretKey = kg.generateKey();
return new SecretKeySpec(secretKey.getEncoded(), KEY_ALGORITHM);// 转换为AES专用密钥
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
}
}

@ -72,4 +72,11 @@ public interface SysCustomerHealthyMapper
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
int deleteCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
}

@ -66,4 +66,11 @@ public interface SysCustomerPhysicalSignsMapper
* @return
*/
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
int delCustomerSignByCustomerId(@Param("customerId")Long customerId);
}

@ -2,6 +2,9 @@ package com.stdiet.custom.mapper;
import java.math.BigDecimal;
import java.util.List;
import com.stdiet.custom.domain.SysCommision;
import com.stdiet.custom.domain.SysCommissionDayDetail;
import com.stdiet.custom.domain.SysOrder;
import org.apache.ibatis.annotations.Param;
@ -72,5 +75,5 @@ public interface SysOrderMapper
* 获取订单信息
* @return
*/
List<SysOrder> selectSimpleOrderMessage(@Param("userId") Long userId);
List<SysOrder> selectSimpleOrderMessage(SysCommision sysCommision);
}

@ -31,13 +31,21 @@ public interface ISysCustomerHealthyService
public List<SysCustomerHealthy> selectSysCustomerHealthyList(SysCustomerHealthy sysCustomerHealthy);
/**
* 新增或修改客户健康
* 新增或修改客户健康已弃用
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
/**
* 新增客户健康
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
/**
* 批量删除客户健康
*
@ -64,4 +72,11 @@ public interface ISysCustomerHealthyService
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId);
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
int deleteCustomerHealthyByCustomerId(Long customerId);
}

@ -6,6 +6,7 @@ import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
import org.apache.ibatis.annotations.Param;
/**
* 客户体征信息Service接口
@ -84,4 +85,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
int delCustomerSignByCustomerId(Long customerId);
}

@ -67,4 +67,11 @@ public interface ISysCustomerService
* @return 结果
*/
SysCustomer getCustomerByPhone(String phone);
/**
* 判断客户手机号是否已存在
* @param sysCustomer
* @return
*/
boolean isCustomerExistByPhone(SysCustomer sysCustomer);
}

@ -40,7 +40,7 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
total.setTotalNotSentCommissionAmount(new BigDecimal(0));
total.setNextMonthCommission(new BigDecimal(0));
if(list != null && list.size() > 0){
Map<Long, List<SysOrderCommisionDayDetail>> orderDetailMap = getOrderByList(sysCommision.getUserId());
Map<Long, List<SysOrderCommisionDayDetail>> orderDetailMap = getOrderByList(sysCommision);
SysCommissionDayDetail sysCommissionDayDetail = null;
for(SysCommision commision : list){
sysCommissionDayDetail = new SysCommissionDayDetail();
@ -232,9 +232,9 @@ public class SysCommissionDayServiceImpl implements ISysCommissionDayService {
/**
* 查询2021年1月份之后所有订单对订单进行处理得出每笔订单的相关信息
* */
public Map<Long, List<SysOrderCommisionDayDetail>> getOrderByList(Long userId){
public Map<Long, List<SysOrderCommisionDayDetail>> getOrderByList(SysCommision sysCommision){
//查询2021年1月份之后所有订单
List<SysOrder> orderList = sysOrderMapper.selectSimpleOrderMessage(userId);
List<SysOrder> orderList = sysOrderMapper.selectSimpleOrderMessage(sysCommision);
//整理出每个用户对应的订单List
Map<Long, List<SysOrderCommisionDayDetail>> userOrderResultMap = new HashMap<>();
for (SysOrder sysOrder : orderList) {

@ -3,7 +3,9 @@ package com.stdiet.custom.service.impl;
import java.util.List;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.bean.ObjectUtils;
import com.stdiet.common.utils.sign.AesUtils;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.service.ISysCustomerService;
@ -53,7 +55,7 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
}
/**
* 新增客户健康
* 新增客户健康(已弃用)
*
* @param sysCustomerHealthy 客户健康
* @return 结果
@ -119,6 +121,34 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 新增客户健康
*
* @param sysCustomerHealthy 客户健康
* @return 结果
*/
public AjaxResult insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy){
//客户ID解密
String customerId = StringUtils.isNotEmpty(sysCustomerHealthy.getCustomerEncId()) ? AesUtils.decrypt(sysCustomerHealthy.getCustomerEncId(), null) : "";
if(StringUtils.isEmpty(customerId)){
return AjaxResult.error("客户不存在");
}
//判断客户是否存在
SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(Long.parseLong(customerId));
if(sysCustomer == null){
return AjaxResult.error("客户不存在");
}
//判断是否已存在客户健康评估
SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByCustomerId(Long.parseLong(customerId));
if(customerHealthy != null){
return AjaxResult.error("已存在健康评估信息,无法重复添加");
}
//设置客户ID
sysCustomerHealthy.setCustomerId(Long.parseLong(customerId));
int rows = sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy);
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
/**
* 批量删除客户健康
*
@ -158,4 +188,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByCustomerId(customerId);
}
/**
* 根据客户ID删除客户健康评估信息
* @param customerId
* @return
*/
public int deleteCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.deleteCustomerHealthyByCustomerId(customerId);
}
}

@ -182,4 +182,14 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
public SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone){
return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignByPhone(phone);
}
/**
* 根据客户ID删除对应体征信息
* @param customerId
* @return
*/
@Override
public int delCustomerSignByCustomerId(Long customerId){
return sysCustomerPhysicalSignsMapper.delCustomerSignByCustomerId(customerId);
}
}

@ -5,6 +5,7 @@ import java.util.List;
import com.stdiet.common.core.domain.model.LoginUser;
import com.stdiet.common.utils.DateUtils;
import com.stdiet.common.utils.SecurityUtils;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.bean.ObjectUtils;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
@ -115,4 +116,23 @@ public class SysCustomerServiceImpl implements ISysCustomerService
public SysCustomer getCustomerByPhone(String phone){
return sysCustomerMapper.getCustomerByPhone(phone);
}
/**
* 判断客户手机号是否已存在
* @param sysCustomer
* @return
*/
public boolean isCustomerExistByPhone(SysCustomer sysCustomer){
if(sysCustomer.getId() != null){
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone());
return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue();
}
}else{
if(StringUtils.isNotEmpty(sysCustomer.getPhone())){
return getCustomerByPhone(sysCustomer.getPhone()) != null;
}
}
return false;
}
}

@ -508,5 +508,9 @@
where sch.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1
</select>
<!-- 根据客户ID删除健康评估信息 -->
<update id="deleteCustomerHealthyByCustomerId" parameterType="Long">
update sys_customer_healthy set del_flag = 1 where customer_id = #{customerId}
</update>
</mapper>

@ -207,4 +207,9 @@
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and sc.phone = #{phone} limit 1
</select>
<!-- 根据客户ID删除对应体征信息 -->
<update id="delCustomerSignByCustomerId" parameterType="Long">
update sys_customer_physical_signs set del_flag = 1 where customer_id = #{customerId}
</update>
</mapper>

@ -318,7 +318,7 @@
</select>
<!-- 查询2021年开始的已审核的订单信息用于计算提成 -->
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended">
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended" parameterType="SysCommision">
select o.order_id,o.order_time,o.start_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
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
@ -327,6 +327,12 @@
<if test="userId != null">
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>
<if test="beginTime != null and beginTime != ''">
AND o.order_time &gt;= #{beginTime}
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(o.order_time,'%Y-%m-%d') &lt;= #{endTime}
</if>
order by o.order_time desc
</select>

@ -68,3 +68,12 @@ export function getCustomerPhysicalSignsByCusId(id) {
method: "get"
});
}
// 删除客户健康评估信息或体征信息
export function delCustomerHealthy(id) {
return request({
url: "/custom/customer/delCustomerHealthy/" + id,
method: "get"
});
}

@ -34,3 +34,12 @@ export function addCustomerHealthy(data) {
data: data
})
}
// 根据加密客户ID获取对应客户信息
export function getCustomerBaseMessage(id) {
return request({
url: '/investigate/getCustomerBaseMessage/' + id,
method: 'get'
})
}

@ -0,0 +1,180 @@
<template>
<!-- 添加或修改合同对话框 -->
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="调理项目" prop="projectId">
<el-select v-model="form.projectId" placeholder="请选择调理项目" filterable clearable size="small">
<el-option v-for="dict in conditioningProjectIdOption"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"/>
</el-select>
</el-form-item>
<!--<el-form-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item>-->
<el-form-item label="金额" prop="amount" style="width: 300px;">
<el-input v-model="form.amount" placeholder="请输入金额"/>
</el-form-item>
<el-form-item label="服务承诺" prop="servePromise" v-show="form.projectId == 0" >
<el-input style="width: 200px;" v-model="form.servePromise" placeholder="请输入服务承诺"/><span style="margin-left: 5px;"></span>
</el-form-item>
<el-form-item label="营养师" prop="nutritionistId">
<el-select v-model="form.nutritionistId" placeholder="请选择营养师" clearable size="small">
<el-option v-for="dict in nutritionistIdOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"/>
</el-select>
</el-form-item>
<el-form-item label="服务时间" prop="serveTime">
<el-select v-model="form.serveTime" placeholder="请选择服务时间">
<el-option
v-for="dict in serveTimeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</template>
<script>
import {addContract} from "@/api/custom/contract";
import {getOptions} from "@/api/custom/order";
export default {
name: "ContractAdd",
components: {
},
props: {},
data() {
const checkServePromise = (rule, value, callback) => {
if (this.form.projectId == 0 && !value) {
return callback(new Error('请输入服务承诺'))
}
callback();
};
return {
//
title: "",
//
open: false,
callback: undefined,
//
form: {},
//
rules: {
projectId:[
{required: true, message: "请选择调理项目", trigger: "blur"}
],
/*name: [
{required: true, message: "请输入客户姓名", trigger: "blur"}
],*/
amount: [
{required: true, message: "请输入签订金额", trigger: "blur"},
{
required: true,
trigger: "blur",
pattern: /^[1-9]\d*$/,
message: "签订金额格式不正确",
},
],
servePromise: [
{required: true, trigger: "blur", validator: checkServePromise}
],
serveTime: [
{required: true, message: "请选择服务时间", trigger: "blur"}
],
nutritionistId: [
{required: true, message: "请选择营养师", trigger: "blur"}
]
},
conditioningProjectIdOption:[],
serveTimeOptions:[],
nutritionistIdOptions:[]
};
},
created() {
getOptions().then(response => {
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName, remark: cur.remark})
return opts;
}, {})
this.nutritionistIdOptions = options['nutri'] || [];
})
this.getDicts("cus_serve_time").then(response => {
this.serveTimeOptions = response.data;
});
this.getDicts("conditioning_project").then(response => {
this.conditioningProjectIdOption = response.data;
});
},
methods: {
showDialog(data, callback) {
this.callback = callback;
this.reset(data);
this.title = "新增"+`${data.customer}」客户合同`;
this.open = true;
},
//
reset(obj) {
const defaultNutritionist = this.nutritionistIdOptions.find(opt => opt.dictValue === obj.nutritionistId);
const defaultProjectIdOption = this.conditioningProjectIdOption.find(opt => opt.remark === 'default');
this.form = {
id: null,
customerId: obj.customerId,
projectId: defaultProjectIdOption ? parseInt(defaultProjectIdOption.dictValue) : null,
name: obj.customer,
phone: null,
serveTime: null,
amount: null,
path: null,
createBy: null,
nutritionistId: defaultNutritionist ? parseInt(defaultNutritionist.dictValue) : null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
this.resetForm("form");
},
//
cancel() {
this.open = false;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.tutor = this.selectDictLabel(this.nutritionistIdOptions, this.form.nutritionistId)
if(this.form.projectId != 0){
this.form.servePromise = null;
}
addContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.callback && this.callback();
}
});
}
});
}
}
};
</script>

@ -8,17 +8,18 @@
size="40%"
>
<div class="app-container">
<!--<el-row :gutter="10" class="mb8">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
v-hasPermi="['custom:contract:add']"
@click="handleAdd"
>创建合同
</el-button>
</el-col>
</el-row>-->
</el-row>
<el-table :data="contractList">
<el-table-column label="合同编号" align="center" prop="id" width="150"/>
@ -71,7 +72,7 @@
</div>
</el-drawer>
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
<add-contract ref="cusAddContractDialogRef" />
<contract-detail ref="contractDetailRef" />
</div>
@ -80,11 +81,13 @@
import {delContract, listContract} from "@/api/custom/contract";
import ContractDetail from "@/components/ContractDetail";
import Clipboard from 'clipboard';
import ContractAdd from "@/components/ContractAdd";
export default {
name: "CustomerContractDrawer",
components: {
'contract-detail': ContractDetail
'contract-detail': ContractDetail,
'add-contract':ContractAdd
},
data() {
return {
@ -111,17 +114,14 @@ export default {
});
},
handleAdd() {
this.$refs.cusCreateOrderDialogRef.showDialog(
this.$refs.cusAddContractDialogRef.showDialog(
{
customer: this.data.name,
cusId: this.data.id,
preSaleId: this.data.salesman,
afterSaleId: this.data.afterDietitian,
nutritionistId: this.data.mainDietitian,
nutriAssisId: this.data.assistantDietitian,
customerId: this.data.id,
nutritionistId: this.data.mainDietitian
},
() => {
this.fetchOrderList(this.data.id);
this.fetchContractList(this.data.id);
}
);
},

@ -14,6 +14,7 @@
type="primary"
icon="el-icon-plus"
size="mini"
v-hasPermi="['custom:order:add']"
@click="handleAdd"
>创建订单
</el-button>
@ -73,12 +74,14 @@
size="mini"
type="text"
@click="handleOnEditClick(scope.row)"
v-hasPermi="['custom:order:edit']"
>修改</el-button
>
<el-button
v-if="scope.row.orderType === 'main'"
size="mini"
type="text"
v-hasPermi="['custom:order:remove']"
@click="handleOnDeleteClick(scope.row)"
>删除</el-button
>

@ -1,5 +1,9 @@
<template>
<el-dialog :visible.sync="visible" :title="title" append-to-body @closed="onClosed">
<div style="float:right;margin-top:-10px;margin-bottom: 10px;" v-show="dataList.length > 0">
<!--<el-button v-hasPermi="['custom:healthy:edit']" @click="" plain>修改信息</el-button>-->
<el-button type="danger" v-hasPermi="['custom:healthy:remove']" @click="handleDelete()" plain>删除信息</el-button>
</div>
<!-- 客户健康评估 -->
<div v-if="dataList.length > 0 && dataType == 0">
<!-- 基础信息 -->
@ -46,15 +50,18 @@
<!-- 客户体征 -->
<div v-else>
<table-detail-message v-show="dataList.length > 0" :data="dataList" ></table-detail-message>
<p v-show="dataList.length == 0" style="font-size: 20px;text-align:center">暂无数据</p>
<p v-show="dataList.length == 0" style="font-size: 20px;text-align:center;">暂无数据
<el-button icon="el-icon-share" size="small" title="点击复制链接" class="copyBtn" type="primary" :data-clipboard-text="copyValue" @click="handleCopy()">健康评估表链接</el-button>
</p>
</div>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import { getCustomerPhysicalSignsByCusId,delCustomerHealthy } from "@/api/custom/customer";
import TableDetailMessage from "@/components/TableDetailMessage";
import AutoHideMessage from "@/components/AutoHideMessage";
import * as healthyData from "@/utils/healthyData";
import Clipboard from 'clipboard';
export default {
name: "PhysicalSignsDialog",
@ -66,6 +73,7 @@ export default {
return {
visible: false,
title: "",
data: null,
dataList: [],
dataType: 0,
//
@ -171,8 +179,9 @@ export default {
[
["medicalReport_one","medicalReport_two","medicalReport_three"]
]
]
],
copyValue: "",
enc_id: ""
};
},
methods: {
@ -186,6 +195,7 @@ export default {
}
},
showDialog(data) {
this.data = data;
this.title = `${data.name}`;
getCustomerPhysicalSignsByCusId(data.id).then((res) => {
if (res.data.customerHealthy) {
@ -198,11 +208,15 @@ export default {
}
}
this.title += (this.dataType == 0 ? "客户健康评估信息" : "客户体征信息");
this.enc_id = res.data.enc_id;
this.visible = true;
});
},
onClosed() {
this.dataList = [];
this.data = null;
this.enc_id = "";
this.copyValue = "";
},
//
getDataListBySignMessage(sign){
@ -383,8 +397,34 @@ export default {
str = str.substring(0,str.length-1);
}
return str;
}
},
},
handleCopy() {
this.copyValue = window.location.origin.replace('manage', 'sign') + "/subhealthyInvestigation/"+this.enc_id;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',
type: 'success'
});
},
/** 删除健康信息操作 */
handleDelete() {
const ids = this.data.id;
this.$confirm(
'是否确认删除客户姓名为为"' + this.data.name + '"的体征信息?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
).then(function () {
return delCustomerHealthy(ids);
}).then(() => {
this.dataList = [];
this.msgSuccess("删除成功");
}).catch(function () {});
},
}
};
</script>

@ -49,7 +49,7 @@ router.beforeEach((to, from, next) => {
}
} else {
// 没有token
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/')) {
if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/')) {
// 在免登录白名单,直接进入
next()
} else {

@ -150,7 +150,7 @@ export const constantRoutes = [
meta: { title: '营养体征调查问卷'}
},
{
path: '/subhealthyInvestigation',
path: '/subhealthyInvestigation/:id',
component: (resolve) => require(['@/views/custom/subhealthy/investigation'], resolve),
hidden: true,
meta: { title: '胜唐体控健康评估表'}

@ -12,7 +12,7 @@
</el-select>
</el-form-item>
<el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small">
<el-option
v-for="dict in searchUserIdOptions"
:key="dict.dictValue"

@ -12,7 +12,7 @@
</el-select>
</el-form-item>
<el-form-item label="业务员" prop="userId">
<el-select v-model="queryParams.userId" placeholder="请选择业务员" clearable size="small">
<el-select v-model="queryParams.userId" filterable placeholder="请选择业务员" clearable size="small">
<el-option
v-for="dict in searchUserIdOptions"
:key="dict.dictValue"
@ -21,14 +21,14 @@
/>
</el-select>
</el-form-item>
<!--<el-form-item label="月份" prop="month">
<el-form-item label="月份" prop="month">
<el-date-picker
v-model="month"
@change="monthRangeChange"
type="month"
placeholder="选择月">
placeholder="选择月">
</el-date-picker>
</el-form-item>-->
</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>
@ -239,7 +239,7 @@
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
//this.handleQuery();
this.searchUserIdOptions = this.totalUserIdOptions.slice();
},
//

@ -54,14 +54,14 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
<!--<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['custom:contract:add']"
>新增
</el-button>
</el-button>-->
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->

@ -25,7 +25,7 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="主营养师" prop="mainDietitian">
<!--<el-form-item label="主营养师" prop="mainDietitian">
<el-input
v-model="queryParams.mainDietitian"
placeholder="请输入主营养师"
@ -60,7 +60,7 @@
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-form-item>-->
<el-form-item>
<el-button
type="cyan"
@ -149,7 +149,7 @@
prop="salesman"
:formatter="preSaleIdFormat"
/>
<el-table-column label="订单" align="center">
<el-table-column label="订单" align="center" v-hasPermi="['custom:order:list']">
<template slot-scope="scope">
<el-button
size="mini"
@ -159,7 +159,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="合同" align="center">
<el-table-column label="合同" align="center" v-hasPermi="['custom:contract:list']">
<template slot-scope="scope">
<el-button
size="mini"
@ -169,7 +169,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="健康评估" align="center">
<el-table-column label="健康评估" align="center" v-hasPermi="['custom:healthy:list']">
<template slot-scope="scope">
<el-button
size="mini"
@ -179,7 +179,7 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="食谱计划" align="center">
<el-table-column label="食谱计划" align="center" v-hasPermi="['recipes:recipesPlan:list']">
<template slot-scope="scope">
<el-button
size="mini"

@ -76,6 +76,7 @@
v-model="queryParams.preSaleId"
placeholder="请选择售前"
clearable
filterable
size="small"
>
<el-option
@ -93,6 +94,7 @@
v-model="queryParams.afterSaleId"
placeholder="请选择售后"
clearable
filterable
size="small"
>
<el-option
@ -110,6 +112,7 @@
v-model="queryParams.nutritionistId"
placeholder="请选择主营养师"
clearable
filterable
size="small"
>
<el-option
@ -131,6 +134,7 @@
v-model="queryParams.nutriAssisId"
placeholder="请选择营养师助理"
clearable
filterable
style="width: 170px"
size="small"
>
@ -149,6 +153,7 @@
v-model="queryParams.plannerId"
placeholder="请选择策划"
clearable
filterable
size="small"
>
<el-option
@ -166,6 +171,7 @@
v-model="queryParams.plannerAssisId"
placeholder="请选择策划助理"
clearable
filterable
size="small"
>
<el-option
@ -183,6 +189,7 @@
v-model="queryParams.operatorId"
placeholder="请选择运营"
clearable
filterable
size="small"
>
<el-option
@ -200,6 +207,7 @@
v-model="queryParams.operatorAssisId"
placeholder="请选择运营助理"
clearable
filterable
size="small"
>
<el-option
@ -250,7 +258,6 @@
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
>
</el-date-picker>
</el-form-item>
@ -379,14 +386,14 @@
v-hasPermi="['custom:order:edit']"
>修改
</el-button>
<!-- <el-button
<el-button
size="mini"
type="text"
icon="el-icon-s-data"
@click="orderPauseManage(scope.row)"
v-hasPermi="['orderPause:pause:query']"
>暂停记录管理
</el-button> -->
</el-button>
<el-button
size="mini"
type="text"

@ -10,10 +10,14 @@
</div>
<el-form ref="form" label-position="top" :model="form" :rules="rules" label-width="100px" style="padding: 16px">
<div v-show="stepArray[0]">
<p class="p_title_1" style="margin-top: 5px;">{{healthyData['titleArray'][0]}}</p>
<el-form-item label="真实姓名" prop="name" style="padding-top: 10px;">
<el-input v-model="form.name" placeholder="请输入真实姓名" maxlength="20"/>
<p class="p_title_1" style="margin-top: 10px;">{{healthyData['titleArray'][0]}}</p>
<p style="font-size: 15px; margin-bottom: 12px;margin-top: 10px;">请您确认下方姓名手机号是否正确</p>
<el-form-item label="真实姓名" prop="name">
<el-input v-model="form.name" :readonly="true" placeholder="请输入真实姓名" maxlength="20"/>
</el-form-item>
<el-form-item label="手机号" prop="phone" >
<el-input type="number" :readonly="true" v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-radio-group v-model="form.sex" size="small" >
<el-radio :label="parseInt('0')" border></el-radio>
@ -29,10 +33,6 @@
<el-form-item label="体重(斤)" prop="weight" >
<el-input type="number" v-model="form.weight" placeholder="请输入体重" autocomplete="off" ></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone" >
<el-input type="number" v-model="form.phone" placeholder="请输入手机号" />
</el-form-item>
<el-form-item label="调理项目" prop="conditioningProjectId">
<el-select v-model="form.conditioningProjectId" filterable clearable placeholder="请选择">
<el-option
@ -652,7 +652,7 @@
</section>
</template>
<script>
import { getDictData,addCustomerHealthy,physicalSignsList } from "@/api/custom/customerInvestigation";
import { getDictData,addCustomerHealthy,physicalSignsList,getCustomerBaseMessage } from "@/api/custom/customerInvestigation";
import * as healthyData from "@/utils/healthyData";
const logo = require("@/assets/logo/st_logo.png");
export default {
@ -665,6 +665,8 @@ export default {
callback();
};
return {
//
customerExistFlag:false,
healthyData:healthyData,
logo,
submitFlag: false,
@ -675,6 +677,7 @@ export default {
stepArray: [true,false,false,false,false,false,false,false,false],
stepActive: 0,
form: {
customerEncId: null,
name: null,
phone: null,
conditioningProjectId: 0,
@ -801,10 +804,10 @@ export default {
},
timer: null,
rules: {
name: [
/*name: [
{ required: true, trigger: "blur", message: "请填写姓名" },
{ min: 1, max: 20, trigger: "blur", message: "姓名过长" },
],
],*/
sex: [{ required: true, trigger: "blur", message: "请选择性别" }],
age: [
{ required: true, trigger: "blur", message: "请填写年龄" },
@ -833,7 +836,7 @@ export default {
message: "体重格式不正确",
},
],
phone: [
/*phone: [
{ required: true, trigger: "blur", message: "请填写手机号" },
{ required: true, trigger: "blur", message: "请填写正确的手机号" },
{
@ -842,7 +845,7 @@ export default {
pattern: /^[0-9]{5,11}$/,
message: "手机号格式不正确",
},
],
],*/
conditioningProjectId:[
{ required: true, trigger: "blur", message: "请选择调理项目" }
],
@ -853,6 +856,24 @@ export default {
};
},
methods: {
//ID
getCustomerBase(id){
if(id == null || id == undefined){
return;
}
getCustomerBaseMessage(id).then((response) => {
if (response.code === 200) {
if(response.data){
console.log(response.data);
this.customerExistFlag = true;
this.form.name = response.data.name;
this.form.phone = response.data.phone;
}
}
}).catch(function() {
console.log("error");
});
},
submit(){
if (this.submitFlag) {
this.$message({
@ -885,7 +906,7 @@ export default {
this.healthyData['arrayName'].forEach(function (item, index) {
cusMessage[item] = cusMessage[item] != null ? cusMessage[item].join(",") : null;
});
this.timer = setTimeout(this.fail,1000*60);
//this.timer = setTimeout(this.fail,1000*60);
addCustomerHealthy(cusMessage).then((response) => {
if (response.code === 200) {
this.$notify({
@ -899,11 +920,14 @@ export default {
});
},
fail(){
console.log("fail");
this.submitFlag = false;
this.upload.isUploading = false;
},
nextStep(step){
if(!this.customerExistFlag){
this.$message.error('客户不存在');
return;
}
this.$refs.form.validate((valid) => {
if(valid || step < 0){
this.stepArray[this.stepActive] = false;
@ -928,15 +952,6 @@ export default {
},
//
handleFileChange(file, fileList) {
/*console.log("------------")
let existFile = fileList.slice(0, fileList.length - 1).find(f => f.name === file.name);
if (existFile) {
this.$message({
message: "当前文件已经存在",
type: "warning",
});
fileList.pop();
}*/
let sizeFlag = file.size > this.upload.fileSize;
if (sizeFlag) {
this.$message({
@ -1000,6 +1015,8 @@ export default {
},
},
created() {
this.form.customerEncId = this.$route.params.id;
this.getCustomerBase(this.form.customerEncId);
this.getDict("conditioning_project");
this.getPhysicalSignsList();
this.getMoistureDictData();