客户档案的体征、合同展示

This commit is contained in:
xiezhijun 2021-01-30 19:26:56 +08:00
parent 1c58b13bcf
commit 9470aa6b5e
18 changed files with 754 additions and 384 deletions

View File

@ -6,8 +6,10 @@ 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.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.custom.domain.SysContract;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.page.PdfProcessInfo;
import com.stdiet.custom.service.ISysContractService;
import org.springframework.beans.factory.annotation.Autowired;
@ -67,7 +69,13 @@ public class SysContractController extends BaseController {
@PreAuthorize("@ss.hasPermi('custom:contract:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysContractService.selectSysContractById(id));
SysContract contract = sysContractService.selectSysContractById(id);
if(contract != null){
if (contract.getSignName() != null && !contract.getSignName().equals("") && !contract.getName().trim().equals(contract.getSignName())) {
contract.setName(contract.getName() + "" + contract.getSignName() + "");
}
}
return AjaxResult.success(contract);
}
/**

View File

@ -8,14 +8,19 @@ import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.custom.domain.SysCustomer;
import com.stdiet.custom.domain.SysCustomerHealthy;
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
import com.stdiet.custom.service.ISysCustomerHealthyService;
import com.stdiet.custom.service.ISysCustomerPhysicalSignsService;
import com.stdiet.custom.service.ISysCustomerService;
import com.stdiet.framework.web.domain.server.Sys;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 客户体征信息Controller
@ -32,6 +37,9 @@ public class SysCustomerController extends BaseController {
@Autowired
private ISysCustomerPhysicalSignsService sysCustomerPhysicalSignsService;
@Autowired
private ISysCustomerHealthyService sysCustomerHealthyService;
/**
* 查询客户信息列表
*/
@ -115,8 +123,33 @@ public class SysCustomerController extends BaseController {
return AjaxResult.success(sysCustomer);
}
/**
* 根据客户ID获取体征或健康评估信息优先健康评估信息
* @param id 客户ID
* @return
*/
@GetMapping("/physicalSigns/{id}")
public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) {
return AjaxResult.success(sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id));
Map<String, Object> result = new HashMap<>();
result.put("type", 0);
//查询健康评估信息
SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id);
if(sysCustomerHealthy != null){
if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) {
sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone()));
}
result.put("customerHealthy", sysCustomerHealthy);
}else{
//查询体征信息
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id);
if(sysCustomerPhysicalSigns != null){
if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) {
sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone()));
}
result.put("type", 1);
}
result.put("customerHealthy", sysCustomerPhysicalSigns);
}
return AjaxResult.success(result);
}
}

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.domain;
import com.stdiet.common.annotation.Excel;
import com.stdiet.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -15,6 +16,7 @@ import java.util.Map;
* @author wonder
* @date 2020-10-23
*/
@Data
public class SysContract extends BaseEntity {
private static final long serialVersionUID = 1L;
@ -24,6 +26,11 @@ public class SysContract extends BaseEntity {
@Excel(name = "合同编号")
private Long id;
/**
* 客户ID
*/
private Long customerId;
/**
* 调理项目ID
*/
@ -96,290 +103,9 @@ public class SysContract extends BaseEntity {
private String servePromise;
public String getSignName() {
return signName;
}
public void setSignName(String signName) {
this.signName = signName;
}
public String getTutor() {
return tutor;
}
public void setTutor(String tutor) {
this.tutor = tutor;
}
public String getServePromise() {
return servePromise;
}
public void setServePromise(String servePromise) {
this.servePromise = servePromise;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public int getServeTime() {
return serveTime;
}
public void setServeTime(int serveTime) {
this.serveTime = serveTime;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getAmountUpper() {
return amountUpper;
}
public void setAmountUpper(String amountUpper) {
this.amountUpper = amountUpper;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getStatus() {
return Status;
}
public void setStatus(String status) {
Status = status;
}
public String getCusId() {
return cusId;
}
public void setCusId(String cusId) {
this.cusId = cusId;
}
public String getSignDate() {
return signDate;
}
public void setSignDate(String signDate) {
this.signDate = signDate;
}
public String getServeTimeStr() {
return serveTimeStr;
}
public void setServeTimeStr(String serveTimeStr) {
this.serveTimeStr = serveTimeStr;
}
public Long getProjectId() {
return projectId;
}
public void setProjectId(Long projectId) {
this.projectId = projectId;
}
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("cusId", getCusId())
.append("status", getStatus())
.append("phone", getPhone())
.append("serveTime", getServeTime())
.append("amount", getAmount())
.append("amountUpper", getAmountUpper())
.append("signDate", getSignDate())
.append("path", getPath())
.append("createBy", getCreateBy())
.append("tutor", getTutor())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("signName", getSignName())
.toString();
}
/**
* 微信用户对象 sys_wx_user_info
*
* @author wonder
* @date 2020-11-28
* 删除标识
*/
public static class SysWxUserInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Integer delFlag;
/** 微信openid */
private String openid;
/** 昵称 */
@Excel(name = "昵称")
private String nickName;
/** 电话 */
@Excel(name = "电话")
private String phone;
/** 用户头像 */
@Excel(name = "用户头像")
private String avatarUrl;
/** 用户性别0男 1女 2未知 */
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
private String sex;
/** 城市 */
@Excel(name = "城市")
private String city;
/** 省份 */
@Excel(name = "省份")
private String province;
/** 国家 */
@Excel(name = "国家")
private String country;
public void setOpenid(String openid)
{
this.openid = openid;
}
public String getOpenid()
{
return openid;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setPhone(String phone)
{
this.phone = phone;
}
public String getPhone()
{
return phone;
}
public void setAvatarUrl(String avatarUrl)
{
this.avatarUrl = avatarUrl;
}
public String getAvatarUrl()
{
return avatarUrl;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setCity(String city)
{
this.city = city;
}
public String getCity()
{
return city;
}
public void setProvince(String province)
{
this.province = province;
}
public String getProvince()
{
return province;
}
public void setCountry(String country)
{
this.country = country;
}
public String getCountry()
{
return country;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("openid", getOpenid())
.append("nickName", getNickName())
.append("phone", getPhone())
.append("avatarUrl", getAvatarUrl())
.append("sex", getSex())
.append("city", getCity())
.append("province", getProvince())
.append("country", getCountry())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
}

View File

@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
import java.util.List;
import com.stdiet.custom.domain.SysContract;
import org.apache.ibatis.annotations.Param;
/**
* 合同Mapper接口

View File

@ -67,4 +67,9 @@ public interface SysCustomerHealthyMapper
* @param phone
*/
SysCustomerHealthy selectSysCustomerHealthyByPhone(@Param("phone") String phone);
/**
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(@Param("customerId")Long customerId);
}

View File

@ -59,4 +59,9 @@ public interface ISysCustomerHealthyService
* @param phone
*/
SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone);
/**
* 根据客户ID查询健康评估表信息
*/
SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId);
}

View File

@ -22,6 +22,11 @@ public interface ISysCustomerPhysicalSignsService {
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
/**
* 根据客户ID查询体征数据
* @param id
* @return
*/
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsByCusId(Long id);
/**

View File

@ -151,4 +151,11 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
public SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByPhone(phone);
}
/**
* 根据客户ID查询健康评估表信息
*/
public SysCustomerHealthy selectSysCustomerHealthyByCustomerId(Long customerId){
return sysCustomerHealthyMapper.selectSysCustomerHealthyByCustomerId(customerId);
}
}

View File

@ -6,6 +6,7 @@
<resultMap type="SysContract" id="SysContractResult">
<result property="id" column="id"/>
<result property="customerId" column="customer_id"></result>
<result property="projectId" column="project_id"></result>
<result property="status" column="status"/>
<result property="name" column="name"/>
@ -22,38 +23,39 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="delFlag" column="del_flag"></result>
<!-- 非持久化字段 -->
<result property="projectName" column="project_name"></result>
</resultMap>
<sql id="selectSysContractVo">
select sc.id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount,
sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark,cp.dict_label as project_name
select sc.id, sc.customer_id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount,
sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark, sc.del_flag, cp.dict_label as project_name
from sys_contract as sc
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') as cp ON cp.dict_value = sc.project_id
</sql>
<select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
<where>
<include refid="selectSysContractVo"/> where del_flag = 0
<if test="id != null ">and sc.id = #{id}</if>
<if test="customerId != null">and sc.customer_id = #{customerId}</if>
<if test="status != null ">and sc.status = #{status}</if>
<if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if>
<if test="name != null and name != ''">and sc.name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''">and sc.phone = #{phone}</if>
</where>
order by create_time desc
</select>
<select id="selectSysContractById" parameterType="Long" resultMap="SysContractResult">
<include refid="selectSysContractVo"/>
where sc.id = #{id}
where sc.id = #{id} and del_flag = 0
</select>
<insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id">
insert into sys_contract
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="customerId != null">customer_id,</if>
<if test="projectId != null">project_id,</if>
<if test="status != null">status,</if>
<if test="name != null and name != ''">name,</if>
@ -73,6 +75,7 @@
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="customerId != null">#{customerId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="status != null">#{status},</if>
<if test="name != null and name != ''">#{name},</if>
@ -95,6 +98,7 @@
<update id="updateSysContract" parameterType="SysContract">
update sys_contract
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="status != null">status = #{status},</if>
<if test="name != null and name != ''">name = #{name},</if>
@ -116,11 +120,11 @@
</update>
<delete id="deleteSysContractById" parameterType="Long">
delete from sys_contract where id = #{id}
update sys_contract set del_flag = 1 where id = #{id}
</delete>
<delete id="deleteSysContractByIds" parameterType="String">
delete from sys_contract where id in
update sys_contract set del_flag = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>

View File

@ -144,10 +144,18 @@
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.id = #{id}
</select>
<!-- 根据客户ID查询客户健康评估 -->
<select id="selectSysCustomerHealthyByCustomerId" parameterType="Long" resultMap="SysCustomerHealthyResult">
<include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project
from sys_customer_healthy as sch
left join sys_customer sc on sc.id = sch.customer_id
LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id
where sch.del_flag = 0 and sc.del_flag = 0 and sch.customer_id = #{customerId}
</select>
<insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy">
insert into sys_customer_healthy
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -67,6 +67,7 @@
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id}
</select>
<!-- 根据客户ID查询用户体征 -->
<select id="selectSysCustomerPhysicalSignsByCusId" parameterType="Long" resultMap="SysCustomerSignResult">
<include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.customer_id = #{id}
</select>

View File

@ -317,13 +317,13 @@
where del_flag = 0 and order_id = #{order_id}
</select>
<!-- 查询订单信息(用于计算提成) -->
<!-- 查询2021年开始的已审核的订单信息(用于计算提成) -->
<select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended">
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
left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0
where o.order_time >= '2021-01-01'
where review_status = 'yes' and o.order_time >= '2021-01-01'
<if test="userId != null">
and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId})
</if>

View File

@ -0,0 +1,129 @@
<template>
<el-dialog
title="合同详情"
:visible.sync="visible"
width="1000px"
append-to-body
@closed="onClosed"
>
<el-table
:show-header="false"
:data="contractDetailList"
border
:cell-style="columnStyle"
style="width: 100%"
>
<el-table-column width="120" prop="attr_name_one"> </el-table-column>
<el-table-column prop="value_one">
<template slot-scope="scope">
<auto-hide-message :data="scope.row.value_one == null ? '' : scope.row.value_one + ''" :maxLength="20"/>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_two"></el-table-column>
<el-table-column prop="value_two">
<template slot-scope="scope">
<el-tag v-if="scope.row.attr_name_two === '合同状态'" :type="scope.row.value_two === 'yes' ? 'success' : 'danger'">
{{ scope.row.value_two === "yes" ? "已签订" : "未签订" }}
</el-tag>
<el-button v-else-if="scope.row.attr_name_two === '合同地址'" type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.value_two)" class="copyBtn"
:data-clipboard-text="copyValue">复制
</el-button>
<auto-hide-message v-else :data="scope.row.value_two == null ? '' : scope.row.value_two + ''" :maxLength="20"/>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_three"></el-table-column>
<el-table-column prop="value_three">
<template slot-scope="scope">
<auto-hide-message :data="scope.row.value_three == null ? '' : scope.row.value_three + ''" :maxLength="20"/>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import AutoHideMessage from "@/components/AutoHideMessage";
import { getContract } from "@/api/custom/contract";
import Clipboard from 'clipboard';
export default {
name: "ContractDialog",
components: {
"auto-hide-message": AutoHideMessage,
},
props: {},
data() {
return {
contractDetailList: [],
visible: false,
copyValue: "",
//
contractTitleData: [
["合同编号", "合同状态", "客户姓名"],
["证件号", "电话", "服务时间"],
["服务承诺", "金额", "调理项目"],
["签订时间", "合同地址", "备注"]
],
//
contractValueData: [
["id", "status", "name"],
["cusId", "phone", "serveTime"],
["servePromise", "amount", "projectName"],
["updateTime", "path", "remark"]
],
};
},
created() {},
methods: {
//
columnStyle({ row, column, rowIndex, columnIndex }) {
if (
columnIndex == 0 ||
columnIndex == 2 ||
columnIndex == 4 ||
columnIndex == 6
) {
//23
return "background:#f3f6fc;font-weight:bold";
} else {
return "background:#ffffff;";
}
},
showDialog(id) {
getContract(id).then((response) => {
let contractDetail = response.data;
contractDetail.serveTime = contractDetail.serveTime/30 + "个月";
contractDetail.servePromise += contractDetail.servePromise ? "斤" : "";
for (let i = 0; i < this.contractTitleData.length; i++) {
this.contractDetailList.push({
attr_name_one: this.contractTitleData[i][0],
value_one: response.data[this.contractValueData[i][0]],
attr_name_two: this.contractTitleData[i][1],
value_two: response.data[this.contractValueData[i][1]],
attr_name_three: this.contractTitleData[i][2],
value_three: response.data[this.contractValueData[i][2]]
});
}
this.visible = true;
});
},
onClosed() {
this.contractDetailList = [];
},
handleCopy(path) {
this.copyValue = window.location.origin.replace('manage', 'sign') + path;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',
type: 'success'
});
// btnCopy.destroy();
}
},
watch: {
// visible: function (val, oldVal) {
// console.log({val, oldVal})
// }
},
};
</script>

View File

@ -0,0 +1,177 @@
<template>
<div>
<el-drawer
:title="title"
:close-on-press-escape="false"
:visible.sync="visible"
@closed="handleOnClosed"
size="40%"
>
<div class="app-container">
<!--<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>创建合同
</el-button>
</el-col>
</el-row>-->
<el-table :data="contractList">
<el-table-column label="合同编号" align="center" prop="id" width="150"/>
<el-table-column label="合同状态" align="center" prop="status" width="80" >
<template slot-scope="scope">
<el-tag
:type="scope.row.status === 'yes' ? 'success' : 'danger'"
disable-transitions>
{{scope.row.status === 'yes' ? '已签订':'未签订'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="客户姓名" align="center" prop="name" width="200"/>
<el-table-column label="合同地址" align="center" prop="path" width="80">
<template slot-scope="scope">
<el-button type="text" icon="el-icon-copy-document" @click="handleCopy(scope.row.path)" class="copyBtn"
:data-clipboard-text="copyValue">复制
</el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleOnDetailClick(scope.row)"
>详情
</el-button>
<el-button
v-if="scope.row.status==='yes'"
size="mini"
type="text"
icon="el-icon-view"
@click="handleLook(scope.row.path)"
>查看
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleOnDeleteClick(scope.row)"
v-hasPermi="['custom:contract:remove']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-drawer>
<!--<create-order-dialog ref="cusCreateOrderDialogRef" />-->
<contract-detail ref="contractDetailRef" />
</div>
</template>
<script>
import {delContract, listContract} from "@/api/custom/contract";
import ContractDetail from "@/components/ContractDetail";
import Clipboard from 'clipboard';
export default {
name: "CustomerContractDrawer",
components: {
'contract-detail': ContractDetail
},
data() {
return {
visible: false,
title: "",
data: undefined,
copyValue:"",
contractList: [],
};
},
methods: {
showDrawer(data) {
this.data = data;
if (!this.data) {
return;
}
this.title = `${this.data.name}」合同列表`;
this.fetchContractList(data.id);
},
fetchContractList(cusId) {
listContract({"customerId": cusId }).then((res) => {
this.contractList = res.rows;
this.visible = true;
});
},
handleAdd() {
this.$refs.cusCreateOrderDialogRef.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,
},
() => {
this.fetchOrderList(this.data.id);
}
);
},
handleOnClosed() {
this.data = undefined;
},
handleOnDetailClick(data) {
this.$refs.contractDetailRef.showDialog(data.id);
},
handleOnEditClick(data) {
},
handleOnDeleteClick(data) {
const contractIds = data.id;
this.$confirm(
'是否确认删除姓名为"' + data.name + '"的合同信息?',
"警告",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}
)
.then(function () {
return delContract(contractIds);
})
.then(() => {
this.fetchContractList(this.data.id);
this.msgSuccess("删除成功");
})
.catch(function () {});
},
handleCopy(path) {
this.copyValue = window.location.origin.replace('manage', 'sign') + path;
const btnCopy = new Clipboard('.copyBtn');
this.$message({
message: '拷贝成功',
type: 'success'
});
},
handleLook(path) {
const url = window.location.origin.replace('manage', 'sign') + path;
// const url = "http://stsign.busyinn.com" + path;
window.open(url, '_blank');
}
},
};
</script>
<style lang="scss" scoped>
/deep/ :focus {
outline: 0;
}
</style>

View File

@ -1,65 +1,75 @@
<template>
<el-dialog
:visible.sync="visible"
:title="title"
append-to-body
@closed="onClosed"
>
<el-table
:show-header="false"
:data="dataList"
border
:cell-style="columnStyle"
style="width: 100%"
>
<el-table-column width="120" prop="attr_name_one"> </el-table-column>
<el-dialog :visible.sync="visible" :title="title" append-to-body @closed="onClosed">
<!-- 客户健康评估 -->
<div v-if="dataList.length > 0 && dataType == 0">
<!-- 基础信息 -->
<div v-for="(item,index) in dataList.slice(0,1)" style="margin-bottom: 50px;" :key="index">
<div>
<p class="p_title_1" style="margin-top: 5px;">{{titleArray[index]}}</p>
<table-detail-message :data="item" ></table-detail-message>
</div>
</div>
<!-- 其他信息 -->
<div style="height:400px;overflow: auto">
<div v-for="(item,index) in dataList.slice(1,10)" style="margin-bottom: 50px;" :key="index">
<div>
<p class="p_title_1" style="margin-top: 5px;">{{titleArray[index+1]}}</p>
<table-detail-message :data="item" v-if="index != dataList.length-2"></table-detail-message>
<el-table :show-header="false" v-if="index == dataList.length-2" :data="item" border :cell-style="columnStyle" style="width: 100%;">
<el-table-column width="140" prop="attr_name_one">
</el-table-column>
<el-table-column prop="value_one">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.value_one == null ? '' : scope.row.value_one + ''"
:maxLength="20"
/>
<auto-hide-message :data="scope.row.value_one == null ? '' : (scope.row.value_one+'')" :maxLength="20"/>
<el-button type="primary" v-show="scope.row.value_one" @click="downloadFile(medicalReportPathArray[0])">下载</el-button>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_two"></el-table-column>
<el-table-column width="140" prop="attr_name_two"></el-table-column>
<el-table-column prop="value_two">
<template slot-scope="scope">
<auto-hide-message
:data="scope.row.value_two == null ? '' : scope.row.value_two + ''"
:maxLength="20"
/>
<auto-hide-message :data="scope.row.value_two == null ? '' : (scope.row.value_two+'')" :maxLength="20"/>
<el-button type="primary" v-show="scope.row.value_two" @click="downloadFile(medicalReportPathArray[1])">下载</el-button>
</template>
</el-table-column>
<el-table-column width="120" prop="attr_name_three"></el-table-column>
<el-table-column width="140" prop="attr_name_three"></el-table-column>
<el-table-column prop="value_three">
<template slot-scope="scope">
<auto-hide-message
:data="
scope.row.value_three == null ? '' : scope.row.value_three + ''
"
:maxLength="20"
/>
<auto-hide-message :data="scope.row.value_three == null ? '' : (scope.row.value_three+'')" :maxLength="20"/>
<el-button type="primary" v-show="scope.row.value_three" @click="downloadFile(medicalReportPathArray[2])">下载</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</div>
<!-- 客户体征 -->
<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>
</div>
</el-dialog>
</template>
<script>
import { getCustomerPhysicalSignsByCusId } from "@/api/custom/customer";
import TableDetailMessage from "@/components/TableDetailMessage";
import AutoHideMessage from "@/components/AutoHideMessage";
import * as healthyData from "@/utils/healthyData";
export default {
name: "PhysicalSignsDialog",
components: {
"auto-hide-message": AutoHideMessage,
"table-detail-message": TableDetailMessage
},
data() {
return {
visible: false,
title: "",
dataList: [],
//
titleData: [
dataType: 0,
//
signTitleData: [
["创建时间", "姓名", "年龄"],
["性别", "手机号", "身高(cm)"],
["体重(斤)", "地域", "病史"],
@ -71,11 +81,11 @@ export default {
["方便沟通时间", "湿气数据", "气血数据"],
["减脂经历", "减脂遇到的困难", "备注"],
],
//
valueData: [
//
signValueData: [
["createTime", "name", "age"],
["sex", "phone", "tall"],
["weight", "position", "singList"],
["weight", "position", "signStr"],
["dishesIngredientId", "constipation", "staylate"],
["motion", "makeFoodType", "remarks"],
["makeFoodTaste", "vocation", "night"],
@ -84,6 +94,85 @@ export default {
["connectTime", "bloodData", "moistureDate"],
["experience", "difficulty", "comments"],
],
//
titleArray: healthyData['titleArray'],
//
healthyTitleData:[
[
["创建时间","客户姓名","手机号"],["调理项目","性别","年龄"],["身高(厘米)","体重(斤)","位置"]
],
[
["减脂经历","减脂遇到的困难","减脂是否反弹"],["是否意识到生活习惯是减脂关键","",""]
],
[
["调味品种","烹调方式","烹调频次"],["洗菜方式","",""]
],
[
["早餐习惯","早餐吃的食物","午餐习惯"],["晚餐习惯","正餐中素菜占比","最常吃的肉类"],
["晚餐时间","每周吃夜宵次数","夜宵通常吃的食物"],["食物的冷热偏好","食物的口味偏好","平均每周吃生菜几次"],
["每周吃生菜的频次类型","平均每天吃水果次数","吃水果的时间段"],["平时吃水果的频次","一餐吃几碗饭","吃几成饱"],
["吃饭速度","饮食特点","常吃的零食"],["有无服用营养保健品","营养保健品品牌名","营养保健品产品名"],
["服用营养保健品频次","忌口过敏食物",""]
],
[
["每天的饮水量","喜欢喝什么水","喝水习惯"],["常喝的饮品的每周频次","是否喝酒","喝酒种类"],["对应酒的量","是否抽烟","抽烟频次和烟龄"],
["是否经常抽二手烟","工作行业","工作性质"],["排便次数","排便时间段","排便的形状"],["排便的气味","排便的速度","排便的颜色"]
],
[
["每周运动次数","每次运动的时长","每天运动的时间"],
["运动","运动场地",""]
],
[
["睡觉时间","睡眠质量","是否有辅助入睡药物"],
["辅助睡眠类药物名称","是否经常熬夜","熬夜频次"]
],
[
["病史体征","湿气数据","气血数据"],
["家族疾病史","手术史","近期是否做过手术"],
["手术恢复情况","是否长期服用药物","长期服用的药物"],
["是否出现过过敏症状","过敏症状","过敏源"]
],
[
["体检报告(1)","体检报告(2)","体检报告(3)"]
]
],
//
healthyValueData:[
[["createTime","name","phone"],["conditioningProject","sex","age"],["tall","weight","position"]],
[
["experience","difficulty","rebound"],["crux","",""]
],
[["condiment","cookingStyle","cookingStyleRate"],["washVegetablesStyle","",""]],
[
["breakfastType","breakfastFood","lunchType"],["dinner","vegetableRate","commonMeat"],
["dinnerTime","supperNum","supperFood"],["dietHotAndCold","dietFlavor","vegetablesNum"],
["vegetablesRateType","fruitsNum","fruitsTime"],["fruitsRate","riceNum","riceNum"],
["eatingSpeed","makeFoodType","snacks"],
["healthProductsFlag","healthProductsBrand","healthProductsName"],
["healthProductsWeekRate","dishesIngredient",""]
],
[
["waterNum","waterType","waterHabit"],["drinksNum","drinkWineFlag","drinkWineClassify"],["drinkWineAmount","smokeFlag","smokeRate"],
["secondSmoke","workIndustry","workType"],["defecationNum","defecationTime","defecationShape"],["defecationSmell","defecationSpeed","defecationColor"]
],
[
["motionNum","motionDuration","motionTime"],["motion","motionField",""]
],
[
["sleepTime","sleepQuality","sleepDrugFlag"],
["sleepDrug","stayupLateFlag","stayupLateWeekNum"]
],
[
["physicalSigns","moistureDate","bloodData"],
["familyIllnessHistory","operationHistory","nearOperationFlag"],
["recoveryeSituation","longEatDrugFlag","longEatDrugClassify"],
["allergyFlag","allergySituation","allergen"]
],
[
["medicalReport_one","medicalReport_two","medicalReport_three"]
]
]
};
},
methods: {
@ -97,16 +186,29 @@ export default {
}
},
showDialog(data) {
this.title = `${data.name}客户体征`;
this.title = `${data.name}`;
getCustomerPhysicalSignsByCusId(data.id).then((res) => {
if (!res.data) {
this.visible = true;
return;
if (res.data.customerHealthy) {
//
this.dataType = res.data.type;
if(this.dataType == 0){
this.getDataListByHealthyMessage(res.data.customerHealthy);
}else{
this.getDataListBySignMessage(res.data.customerHealthy)
}
const sign = res.data;
}
this.title += (this.dataType == 0 ? "客户健康评估信息" : "客户体征信息");
this.visible = true;
});
},
onClosed() {
this.dataList = [];
},
//
getDataListBySignMessage(sign){
sign.sex = sign.sex === 0 ? `` : "女";
sign.position = sign.position === 0 ? `南方` : "北方";
sign.signString = sign.signList.join("");
sign.signStr = this.getSignString(sign.signList);
sign.constipation = sign.constipation === 0 ? "是" : "否";
sign.staylate = sign.staylate === 0 ? "是" : "否";
sign.motion = sign.motion === 0 ? "是" : "否";
@ -120,23 +222,179 @@ export default {
sign.sleepTime = sign.sleepTime + "点";
sign.getupTime = sign.getupTime + "点";
sign.connectTime = sign.connectTime + "点";
for (let i = 0; i < this.titleData.length; i++) {
for (let i = 0; i < this.signTitleData.length; i++) {
this.dataList.push({
attr_name_one: this.titleData[i][0],
value_one: sign[this.valueData[i][0]],
attr_name_two: this.titleData[i][1],
value_two: sign[this.valueData[i][1]],
attr_name_three: this.titleData[i][2],
value_three: sign[this.valueData[i][2]],
attr_name_one: this.signTitleData[i][0],
value_one: sign[this.signValueData[i][0]],
attr_name_two: this.signTitleData[i][1],
value_two: sign[this.signValueData[i][1]],
attr_name_three: this.signTitleData[i][2],
value_three: sign[this.signValueData[i][2]],
});
}
this.visible = true;
},
//
getDataListByHealthyMessage(healthy){
let detailHealthy = this.dealHealthy(healthy);
//
detailHealthy.sex = detailHealthy.sex == 0 ? "男" : (detailHealthy.sex == 1 ? "女" : "未知");
detailHealthy.position = detailHealthy.position == 0 ? "南方" : "北方";
detailHealthy.rebound = detailHealthy.rebound == 0 ? "否" : "是";
detailHealthy.crux = detailHealthy.crux == 0 ? "否" : "是";
//
detailHealthy.condiment += detailHealthy.otherCondiment ? (""+detailHealthy.otherCondiment) : "";
//
let cookingStyleRate = "";
if(detailHealthy.cookingStyleRate != null){
detailHealthy.cookingStyleRate.split(",").forEach(function(item, index){
cookingStyleRate += (cookingStyleRate != "" ? "" : "") + (healthyData["cookingStyleRateArray"][index])+item +"次";
});
}
detailHealthy.cookingStyleRate = cookingStyleRate;
//
detailHealthy.washVegetablesStyle += detailHealthy.otherWashVegetablesStyle ? (""+detailHealthy.otherWashVegetablesStyle) : "";
//
detailHealthy.vegetableRate += "成";
let makeFoodTypeOption = healthyData["makeFoodTypeArray"].find(opt => opt.value == detailHealthy.makeFoodType+"");
detailHealthy.makeFoodType = makeFoodTypeOption ? makeFoodTypeOption.name : "";
//
detailHealthy.snacks += detailHealthy.otherSnacks ? ("" + detailHealthy.otherSnacks) : "";
detailHealthy.healthProductsFlag = detailHealthy.healthProductsFlag == 1 ? "有" : "无";
detailHealthy.healthProductsWeekRate = detailHealthy.healthProductsDayRate+"次/天,"+detailHealthy.healthProductsWeekRate+"次/周";
detailHealthy.waterNum += "毫升";
//
let drinksNumString = "";
if(detailHealthy.drinksNum != null){
detailHealthy.drinksNum.split(",").forEach(function(item, index){
drinksNumString += (drinksNumString != "" ? "" : "") + (healthyData["drinksNumArray"][index])+item +"次";
});
}
detailHealthy.drinksNum = drinksNumString;
detailHealthy.drinkWineClassify += detailHealthy.otherWineClassify ? (""+detailHealthy.otherWineClassify) : "";
let drinkWineAmountString = "";
if(detailHealthy.drinkWineAmount != null){
detailHealthy.drinkWineAmount.split(",").forEach(function(item, index){
drinkWineAmountString += (drinkWineAmountString != "" ? "" : "") + (healthyData["drinkWineAmountArray"][index])+item + healthyData["drinkWineAmountUnitArray"][index];
});
}
detailHealthy.drinkWineAmount = drinkWineAmountString;
detailHealthy.smokeFlag = detailHealthy.smokeFlag == 1 ? "是" : "否";
detailHealthy.secondSmoke = detailHealthy.secondSmoke == 1 ? "是" : "否";
let smokeRateString = "";
if(detailHealthy.smokeRate != null){
detailHealthy.smokeRate.split(",").forEach(function(item, index){
smokeRateString += (smokeRateString != "" ? "" : "") + (healthyData["smokeRateArray"][index])+item + healthyData["smokeRateUnitArray"][index];
});
}
detailHealthy.smokeRate = smokeRateString;
detailHealthy.defecationNum = detailHealthy.defecationNum + "次/天";
detailHealthy.motionDuration = detailHealthy.motionDuration +"分钟";
let motionStr = "";
if(detailHealthy.aerobicMotionClassify != null){
detailHealthy.aerobicMotionClassify.split(",").forEach(function(item, index){
motionStr += item ? ((motionStr != "" ? "" : "") + item) : "";
});
}
if(detailHealthy.anaerobicMotionClassify != null){
detailHealthy.anaerobicMotionClassify.split(",").forEach(function(item, index){
motionStr += item ? ((motionStr != "" ? "" : "") + item) : "";
});
}
if(detailHealthy.anaerobicAerobicMotionClassify != null){
detailHealthy.anaerobicAerobicMotionClassify.split(",").forEach(function(item, index){
motionStr += item ? ((motionStr != "" ? "" : "") + item) : "";
});
}
detailHealthy.motion = this.trimComma(motionStr + (detailHealthy.otherMotionClassify ? ( ""+ detailHealthy.otherMotionClassify) : ""));
detailHealthy.motionField += this.trimComma(detailHealthy.otherMotionField ? (""+detailHealthy.otherMotionField) : "");
detailHealthy.sleepDrugFlag = detailHealthy.sleepDrugFlag == 1 ? "有" : "无";
detailHealthy.stayupLateFlag = detailHealthy.stayupLateFlag == 1 ? "有" : "无";
detailHealthy.stayupLateWeekNum += "次/周";
let physicalSigns = this.getSignString(detailHealthy.signList);
/*if(detailHealthy.signList != null && detailHealthy.signList.length > 0){
detailHealthy.signList.forEach(function (sign, index) {
physicalSigns += "" + sign.name;
})
}*/
physicalSigns += "" + (detailHealthy.otherPhysicalSigns ? detailHealthy.otherPhysicalSigns : "");
detailHealthy.physicalSigns = this.trimComma(physicalSigns);
detailHealthy.familyIllnessHistory += this.trimComma(detailHealthy.otherFamilyIllnessHistory ? ("" + detailHealthy.otherFamilyIllnessHistory) : "");
detailHealthy.operationHistory += this.trimComma(detailHealthy.otherOperationHistory ? ("" + detailHealthy.otherOperationHistory) : "");
detailHealthy.nearOperationFlag = detailHealthy.nearOperationFlag == 1 ? "有" : "无";
detailHealthy.longEatDrugFlag = detailHealthy.longEatDrugFlag == 1 ? "有" : "无";
detailHealthy.longEatDrugClassify += detailHealthy.otherLongEatDrugClassify ? ("" + detailHealthy.otherLongEatDrugClassify) : "";
detailHealthy.allergyFlag = detailHealthy.allergyFlag == 1 ? "有" : "无";
detailHealthy.allergen += detailHealthy.otherAllergen ? ("" +detailHealthy.otherAllergen) : "";
detailHealthy.allergen = this.trimComma(detailHealthy.allergen);
let medicalReportPathArray = detailHealthy.medicalReport ? detailHealthy.medicalReport.split(",") : [];
let medicalReportNameArray = detailHealthy.medicalReportName ? detailHealthy.medicalReportName.split(",") : [];
this.medicalReportPathArray = medicalReportPathArray;
detailHealthy.medicalReport_one = medicalReportPathArray.length > 0 ? (medicalReportNameArray.length > 0 ? medicalReportNameArray[0] : "体检报告1") : "";
detailHealthy.medicalReport_two = medicalReportPathArray.length > 1 ? (medicalReportNameArray.length > 1 ? medicalReportNameArray[1] : "体检报告2") : "";
detailHealthy.medicalReport_three = medicalReportPathArray.length > 2 ? (medicalReportNameArray.length > 2 ? medicalReportNameArray[2] : "体检报告3") : "";
for(let i = 0; i < this.healthyTitleData.length; i++){
let stepArray = [];
for(let j= 0; j < this.healthyTitleData[i].length; j++){
stepArray[j] = ({"attr_name_one": this.healthyTitleData[i][j][0],"value_one": detailHealthy[this.healthyValueData[i][j][0]],"attr_name_two": this.healthyTitleData[i][j][1],"value_two": detailHealthy[this.healthyValueData[i][j][1]],"attr_name_three": this.healthyTitleData[i][j][2],"value_three": detailHealthy[this.healthyValueData[i][j][2]]});
}
this.dataList[i] = stepArray;
}
},
onClosed() {
this.dataList = [];
//
dealHealthy(customerHealthy){
let array = healthyData["needAttrName"];
for(let i = 0; i < array.length; i++){
customerHealthy[array[i]] = this.getHealthyStringByArray(array[i]+"Array", customerHealthy[array[i]]);
}
return customerHealthy;
},
//valuename
getHealthyStringByArray(key, valueArray){
var str = "";
if(valueArray != null && valueArray.split(",").length > 0){
valueArray.split(",").forEach(function (item, index) {
let data = healthyData[key].find(opt => opt.value == item);
if(data != null){
str += (str != "" ? "" : "") + data.name;
}
})
}
return str;
},
getSignString(signList){
if(signList == null){
return "";
}
let signStr = "";
for(let i in signList){
signStr += ""+signList[i].name;
}
return signList.length > 0 ? signStr.substring(1) : signStr;
},
downloadFile(fileName){
this.downloadResource(fileName);
},
trimComma(str){
if(str.startsWith("") || str.startsWith(",")){
str = str.substring(1,str.length);
}
if(str.endsWith("") || str.endsWith(",")){
str = str.substring(0,str.length-1);
}
return str;
}
},
};
</script>
<style>
.margin-top-20{
margin-top:20px;
}
.p_title_1{
font-size: 18px;
font-weight: bold;
margin-top: 20px;
}
</style>

View File

@ -108,7 +108,7 @@
//
multiple: true,
//
showSearch: false,
showSearch: true,
//
total: 0,
//

View File

@ -36,7 +36,7 @@
</el-form>
<div><span style="color:#E6A23C;font-family:PingFang SC">
注意事项
<br/>12021年1月开始的订单才开始按天计算提成
<br/>12021年1月开始的订单才开始按天计算提成只计算已审核的订单
<br/>2发工资日期定为每月15号若当前日期大于15号则认定上个月的工资已发放
</span></div>
<el-row :gutter="10" class="mb8" style="margin-top:10px;">

View File

@ -309,6 +309,7 @@
<!-- 订单抽屉 -->
<order-drawer ref="cusOrderDrawerRef" />
<!-- 合同抽屉 -->
<contract-drawer ref="cusContractDrawerRef"></contract-drawer>
<!-- 健康评估弹窗 -->
<physical-signs-dialog ref="physicalSignsDialogRef" />
<!-- 食谱计划抽屉 -->
@ -331,12 +332,14 @@ import { getOptions } from "@/api/custom/order";
import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer";
export default {
name: "Customer",
components: {
"order-drawer": OrderDrawer,
"physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer
},
data() {
const userId = store.getters && store.getters.userId;
@ -476,7 +479,7 @@ export default {
this.$refs["cusOrderDrawerRef"].showDrawer(row);
},
handleOnContractClick(row) {
console.log(row);
this.$refs["cusContractDrawerRef"].showDrawer(row);
},
handleOnBodySignClick(row) {
console.log(row);