客户跟进模块

pull/371/head
wuyibo 2 years ago
parent 05db667a80
commit dd94242a61

@ -0,0 +1,107 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.domain.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.service.ICustomerService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* Controller
*
* @author ruoyi
* @date 2023-05-06
*/
@RestController
@RequestMapping("/customer")
public class CustomerController extends BaseController
{
@Autowired
private ICustomerService customerService;
/**
*
*/
@RequiresPermissions("system:customer:list")
@GetMapping("/list")
public TableDataInfo list(CustomerVo customer)
{
startPage();
List<CustomerVo> list = customerService.selectCustomerList(customer);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("system:customer:export")
@Log(title = "客户信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CustomerVo customer)
{
List<CustomerVo> list = customerService.selectCustomerList(customer);
ExcelUtil<CustomerVo> util = new ExcelUtil<CustomerVo>(CustomerVo.class);
util.exportExcel(response, list, "客户信息数据");
}
/**
*
*/
@RequiresPermissions("system:customer:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(customerService.selectCustomerById(id));
}
/**
*
*/
@RequiresPermissions("system:customer:add")
@Log(title = "客户信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Customer customer)
{
return toAjax(customerService.insertCustomer(customer));
}
/**
*
*/
@RequiresPermissions("system:customer:edit")
@Log(title = "客户信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Customer customer)
{
return toAjax(customerService.updateCustomer(customer));
}
/**
*
*/
@RequiresPermissions("system:customer:remove")
@Log(title = "客户信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(customerService.deleteCustomerByIds(ids));
}
}

@ -0,0 +1,105 @@
package com.ruoyi.system.controller;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.FollowUp;
import com.ruoyi.system.service.IFollowUpService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;
/**
* -Controller
*
* @author ruoyi
* @date 2023-05-07
*/
@RestController
@RequestMapping("/up")
public class FollowUpController extends BaseController
{
@Autowired
private IFollowUpService followUpService;
/**
* -
*/
@RequiresPermissions("system:up:list")
@GetMapping("/list")
public TableDataInfo list(FollowUp followUp)
{
startPage();
List<FollowUp> list = followUpService.selectFollowUpList(followUp);
return getDataTable(list);
}
/**
* -
*/
@RequiresPermissions("system:up:export")
@Log(title = "跟进模块-客户跟进记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, FollowUp followUp)
{
List<FollowUp> list = followUpService.selectFollowUpList(followUp);
ExcelUtil<FollowUp> util = new ExcelUtil<FollowUp>(FollowUp.class);
util.exportExcel(response, list, "跟进模块-客户跟进记录数据");
}
/**
* -
*/
@RequiresPermissions("system:up:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Integer id)
{
return AjaxResult.success(followUpService.selectFollowUpById(id));
}
/**
* -
*/
@RequiresPermissions("system:up:add")
@Log(title = "跟进模块-客户跟进记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FollowUp followUp)
{
return toAjax(followUpService.insertFollowUp(followUp));
}
/**
* -
*/
@RequiresPermissions("system:up:edit")
@Log(title = "跟进模块-客户跟进记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FollowUp followUp)
{
return toAjax(followUpService.updateFollowUp(followUp));
}
/**
* -
*/
@RequiresPermissions("system:up:remove")
@Log(title = "跟进模块-客户跟进记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Integer[] ids)
{
return toAjax(followUpService.deleteFollowUpByIds(ids));
}
}

@ -0,0 +1,453 @@
package com.ruoyi.system.domain;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* f_customer
*
* @author ruoyi
* @date 2023-05-06
*/
public class Customer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 客户ID */
private Long id;
/** 客户名 */
@Excel(name = "客户名")
private String userName;
/** 客户昵称 */
@Excel(name = "客户昵称")
private String nickName;
/** 客户级别 */
@Excel(name = "客户级别")
private String userType;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
private String phoneNumber;
/** 客户性别 */
@Excel(name = "客户性别")
private String sex;
/** 头像地址 */
@Excel(name = "头像地址")
private String avatar;
/** 线索渠道 */
@Excel(name = "线索渠道")
private String clueChannel;
/** 客户信息来源 */
@Excel(name = "客户信息来源")
private String dataSource;
/** 客户居住 区县/区域 */
@Excel(name = "客户居住 区县/区域")
private String liveAddress;
/** 客户状态 */
@Excel(name = "客户状态")
private String status;
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
/** 最后登录IP */
private String loginIp;
/** 最后登录时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date loginDate;
/** 微信号 */
@Excel(name = "微信号")
private String wechat;
/** 购车类型 */
@Excel(name = "购车类型")
private String buyCarType;
/** 置换/保有车型 */
@Excel(name = "置换/保有车型")
private String existModels;
/** 是否评估 */
@Excel(name = "是否评估")
private Integer isAssessment;
/** 意向车型 */
@Excel(name = "意向车型")
private String intentionCarModels;
/** 对比车型 */
@Excel(name = "对比车型")
private String contrastCarModels;
/** 是否试驾 */
@Excel(name = "是否试驾")
private Integer isTestDrive;
/** 是否报价 */
@Excel(name = "是否报价")
private Integer isOffer;
/** 是否金融 */
@Excel(name = "是否金融")
private Integer isFinance;
/** 未订车原因 */
@Excel(name = "未订车原因")
private String unBookingCarReason;
/** 预计到店时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "预计到店时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date preToStoreDate;
/** 最后一次到店日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "最后一次到店日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastToStoreDate;
/** 4S店 */
@Excel(name = "4S店")
private String storeName;
/** 下单日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下单日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date orderDate;
/** 跟进模块-客户跟进记录信息 */
private List<FollowUp> followUpList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setNickName(String nickName)
{
this.nickName = nickName;
}
public String getNickName()
{
return nickName;
}
public void setUserType(String userType)
{
this.userType = userType;
}
public String getUserType()
{
return userType;
}
public void setEmail(String email)
{
this.email = email;
}
public String getEmail()
{
return email;
}
public void setPhoneNumber(String phoneNumber)
{
this.phoneNumber = phoneNumber;
}
public String getPhoneNumber()
{
return phoneNumber;
}
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
{
return sex;
}
public void setAvatar(String avatar)
{
this.avatar = avatar;
}
public String getAvatar()
{
return avatar;
}
public void setClueChannel(String clueChannel)
{
this.clueChannel = clueChannel;
}
public String getClueChannel()
{
return clueChannel;
}
public void setDataSource(String dataSource)
{
this.dataSource = dataSource;
}
public String getDataSource()
{
return dataSource;
}
public void setLiveAddress(String liveAddress)
{
this.liveAddress = liveAddress;
}
public String getLiveAddress()
{
return liveAddress;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setLoginIp(String loginIp)
{
this.loginIp = loginIp;
}
public String getLoginIp()
{
return loginIp;
}
public void setLoginDate(Date loginDate)
{
this.loginDate = loginDate;
}
public Date getLoginDate()
{
return loginDate;
}
public void setWechat(String wechat)
{
this.wechat = wechat;
}
public String getWechat()
{
return wechat;
}
public void setBuyCarType(String buyCarType)
{
this.buyCarType = buyCarType;
}
public String getBuyCarType()
{
return buyCarType;
}
public void setExistModels(String existModels)
{
this.existModels = existModels;
}
public String getExistModels()
{
return existModels;
}
public void setIsAssessment(Integer isAssessment)
{
this.isAssessment = isAssessment;
}
public Integer getIsAssessment()
{
return isAssessment;
}
public void setIntentionCarModels(String intentionCarModels)
{
this.intentionCarModels = intentionCarModels;
}
public String getIntentionCarModels()
{
return intentionCarModels;
}
public void setContrastCarModels(String contrastCarModels)
{
this.contrastCarModels = contrastCarModels;
}
public String getContrastCarModels()
{
return contrastCarModels;
}
public void setIsTestDrive(Integer isTestDrive)
{
this.isTestDrive = isTestDrive;
}
public Integer getIsTestDrive()
{
return isTestDrive;
}
public void setIsOffer(Integer isOffer)
{
this.isOffer = isOffer;
}
public Integer getIsOffer()
{
return isOffer;
}
public void setIsFinance(Integer isFinance)
{
this.isFinance = isFinance;
}
public Integer getIsFinance()
{
return isFinance;
}
public void setUnBookingCarReason(String unBookingCarReason)
{
this.unBookingCarReason = unBookingCarReason;
}
public String getUnBookingCarReason()
{
return unBookingCarReason;
}
public void setPreToStoreDate(Date preToStoreDate)
{
this.preToStoreDate = preToStoreDate;
}
public Date getPreToStoreDate()
{
return preToStoreDate;
}
public void setLastToStoreDate(Date lastToStoreDate)
{
this.lastToStoreDate = lastToStoreDate;
}
public Date getLastToStoreDate()
{
return lastToStoreDate;
}
public void setStoreName(String storeName)
{
this.storeName = storeName;
}
public String getStoreName()
{
return storeName;
}
public void setOrderDate(Date orderDate)
{
this.orderDate = orderDate;
}
public Date getOrderDate()
{
return orderDate;
}
public List<FollowUp> getFollowUpList()
{
return followUpList;
}
public void setFollowUpList(List<FollowUp> followUpList)
{
this.followUpList = followUpList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userName", getUserName())
.append("nickName", getNickName())
.append("userType", getUserType())
.append("email", getEmail())
.append("phoneNumber", getPhoneNumber())
.append("sex", getSex())
.append("avatar", getAvatar())
.append("clueChannel", getClueChannel())
.append("dataSource", getDataSource())
.append("liveAddress", getLiveAddress())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("loginIp", getLoginIp())
.append("loginDate", getLoginDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("wechat", getWechat())
.append("buyCarType", getBuyCarType())
.append("existModels", getExistModels())
.append("isAssessment", getIsAssessment())
.append("intentionCarModels", getIntentionCarModels())
.append("contrastCarModels", getContrastCarModels())
.append("isTestDrive", getIsTestDrive())
.append("isOffer", getIsOffer())
.append("isFinance", getIsFinance())
.append("unBookingCarReason", getUnBookingCarReason())
.append("preToStoreDate", getPreToStoreDate())
.append("lastToStoreDate", getLastToStoreDate())
.append("storeName", getStoreName())
.append("orderDate", getOrderDate())
.append("followUpList", getFollowUpList())
.toString();
}
}

@ -0,0 +1,116 @@
package com.ruoyi.system.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* - f_follow_up
*
* @author ruoyi
* @date 2023-05-07
*/
public class FollowUp extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Integer id;
/** 客户id */
@Excel(name = "客户id")
private Long customerId;
/** 跟进日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "跟进日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date followUpDate;
/** 跟进记录 */
@Excel(name = "跟进记录")
private String followUpRecord;
/** 再次预约到店日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "再次预约到店日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date preToStoreDate;
/** 级别 */
@Excel(name = "级别")
private String followLevel;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
{
return id;
}
public void setCustomerId(Long customerId)
{
this.customerId = customerId;
}
public Long getCustomerId()
{
return customerId;
}
public void setFollowUpDate(Date followUpDate)
{
this.followUpDate = followUpDate;
}
public Date getFollowUpDate()
{
return followUpDate;
}
public void setFollowUpRecord(String followUpRecord)
{
this.followUpRecord = followUpRecord;
}
public String getFollowUpRecord()
{
return followUpRecord;
}
public void setPreToStoreDate(Date preToStoreDate)
{
this.preToStoreDate = preToStoreDate;
}
public Date getPreToStoreDate()
{
return preToStoreDate;
}
public void setFollowLevel(String followLevel)
{
this.followLevel = followLevel;
}
public String getFollowLevel()
{
return followLevel;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("customerId", getCustomerId())
.append("followUpDate", getFollowUpDate())
.append("followUpRecord", getFollowUpRecord())
.append("preToStoreDate", getPreToStoreDate())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("followLevel", getFollowLevel())
.toString();
}
}

@ -0,0 +1,30 @@
package com.ruoyi.system.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.system.domain.Customer;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author
* @date 20230509 15:48
* @Description
*/
@Setter
@Getter
public class CustomerVo extends Customer {
@Excel(name = "跟进次数")
private String followUpTimes;
@Excel(name = "最新跟进日期")
private String followUpLastDate;
@Excel(name = "最新跟进级别")
private String followUpLastLevel;
@Excel(name = "建议下次跟进日期")
private String proposalNextFollowDate;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "跟进超期", width = 30, dateFormat = "yyyy-MM-dd")
private String followUpOverdueDate;
}

@ -0,0 +1,88 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.domain.FollowUp;
import com.ruoyi.system.domain.vo.CustomerVo;
/**
* Mapper
*
* @author ruoyi
* @date 2023-05-06
*/
public interface CustomerMapper
{
/**
*
*
* @param id
* @return
*/
public Customer selectCustomerById(Long id);
/**
*
*
* @param customer
* @return
*/
public List<CustomerVo> selectCustomerList(CustomerVo customer);
/**
*
*
* @param customer
* @return
*/
public int insertCustomer(Customer customer);
/**
*
*
* @param customer
* @return
*/
public int updateCustomer(Customer customer);
/**
*
*
* @param id
* @return
*/
public int deleteCustomerById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteCustomerByIds(Long[] ids);
/**
* -
*
* @param ids
* @return
*/
public int deleteFollowUpByCustomerIds(Long[] ids);
/**
* -
*
* @param followUpList -
* @return
*/
public int batchFollowUp(List<FollowUp> followUpList);
/**
* -
*
* @param id ID
* @return
*/
public int deleteFollowUpByCustomerId(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.FollowUp;
/**
* -Mapper
*
* @author ruoyi
* @date 2023-05-07
*/
public interface FollowUpMapper
{
/**
* -
*
* @param id -
* @return -
*/
public FollowUp selectFollowUpById(Integer id);
/**
* -
*
* @param followUp -
* @return -
*/
public List<FollowUp> selectFollowUpList(FollowUp followUp);
/**
* -
*
* @param followUp -
* @return
*/
public int insertFollowUp(FollowUp followUp);
/**
* -
*
* @param followUp -
* @return
*/
public int updateFollowUp(FollowUp followUp);
/**
* -
*
* @param id -
* @return
*/
public int deleteFollowUpById(Integer id);
/**
* -
*
* @param ids
* @return
*/
public int deleteFollowUpByIds(Integer[] ids);
}

@ -0,0 +1,62 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.domain.vo.CustomerVo;
/**
* Service
*
* @author ruoyi
* @date 2023-05-06
*/
public interface ICustomerService
{
/**
*
*
* @param id
* @return
*/
public Customer selectCustomerById(Long id);
/**
*
*
* @param customer
* @return
*/
public List<CustomerVo> selectCustomerList(CustomerVo customer);
/**
*
*
* @param customer
* @return
*/
public int insertCustomer(Customer customer);
/**
*
*
* @param customer
* @return
*/
public int updateCustomer(Customer customer);
/**
*
*
* @param ids
* @return
*/
public int deleteCustomerByIds(Long[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteCustomerById(Long id);
}

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.FollowUp;
/**
* -Service
*
* @author ruoyi
* @date 2023-05-07
*/
public interface IFollowUpService
{
/**
* -
*
* @param id -
* @return -
*/
public FollowUp selectFollowUpById(Integer id);
/**
* -
*
* @param followUp -
* @return -
*/
public List<FollowUp> selectFollowUpList(FollowUp followUp);
/**
* -
*
* @param followUp -
* @return
*/
public int insertFollowUp(FollowUp followUp);
/**
* -
*
* @param followUp -
* @return
*/
public int updateFollowUp(FollowUp followUp);
/**
* -
*
* @param ids -
* @return
*/
public int deleteFollowUpByIds(Integer[] ids);
/**
* -
*
* @param id -
* @return
*/
public int deleteFollowUpById(Integer id);
}

@ -0,0 +1,135 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ruoyi.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.system.domain.FollowUp;
import com.ruoyi.system.mapper.CustomerMapper;
import com.ruoyi.system.domain.Customer;
import com.ruoyi.system.service.ICustomerService;
/**
* Service
*
* @author ruoyi
* @date 2023-05-06
*/
@Service
public class CustomerServiceImpl implements ICustomerService
{
@Autowired
private CustomerMapper customerMapper;
/**
*
*
* @param id
* @return
*/
@Override
public Customer selectCustomerById(Long id)
{
return customerMapper.selectCustomerById(id);
}
/**
*
*
* @param customer
* @return
*/
@Override
public List<CustomerVo> selectCustomerList(CustomerVo customer)
{
return customerMapper.selectCustomerList(customer);
}
/**
*
*
* @param customer
* @return
*/
@Transactional
@Override
public int insertCustomer(Customer customer)
{
customer.setCreateTime(DateUtils.getNowDate());
int rows = customerMapper.insertCustomer(customer);
insertFollowUp(customer);
return rows;
}
/**
*
*
* @param customer
* @return
*/
@Transactional
@Override
public int updateCustomer(Customer customer)
{
customer.setUpdateTime(DateUtils.getNowDate());
customerMapper.deleteFollowUpByCustomerId(customer.getId());
insertFollowUp(customer);
return customerMapper.updateCustomer(customer);
}
/**
*
*
* @param ids
* @return
*/
@Transactional
@Override
public int deleteCustomerByIds(Long[] ids)
{
customerMapper.deleteFollowUpByCustomerIds(ids);
return customerMapper.deleteCustomerByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Transactional
@Override
public int deleteCustomerById(Long id)
{
customerMapper.deleteFollowUpByCustomerId(id);
return customerMapper.deleteCustomerById(id);
}
/**
* -
*
* @param customer
*/
public void insertFollowUp(Customer customer)
{
List<FollowUp> followUpList = customer.getFollowUpList();
Long id = customer.getId();
if (StringUtils.isNotNull(followUpList))
{
List<FollowUp> list = new ArrayList<FollowUp>();
for (FollowUp followUp : followUpList)
{
followUp.setCustomerId(id);
list.add(followUp);
}
if (list.size() > 0)
{
customerMapper.batchFollowUp(list);
}
}
}
}

@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.FollowUpMapper;
import com.ruoyi.system.domain.FollowUp;
import com.ruoyi.system.service.IFollowUpService;
/**
* -Service
*
* @author ruoyi
* @date 2023-05-07
*/
@Service
public class FollowUpServiceImpl implements IFollowUpService
{
@Autowired
private FollowUpMapper followUpMapper;
/**
* -
*
* @param id -
* @return -
*/
@Override
public FollowUp selectFollowUpById(Integer id)
{
return followUpMapper.selectFollowUpById(id);
}
/**
* -
*
* @param followUp -
* @return -
*/
@Override
public List<FollowUp> selectFollowUpList(FollowUp followUp)
{
return followUpMapper.selectFollowUpList(followUp);
}
/**
* -
*
* @param followUp -
* @return
*/
@Override
public int insertFollowUp(FollowUp followUp)
{
followUp.setCreateTime(DateUtils.getNowDate());
return followUpMapper.insertFollowUp(followUp);
}
/**
* -
*
* @param followUp -
* @return
*/
@Override
public int updateFollowUp(FollowUp followUp)
{
followUp.setUpdateTime(DateUtils.getNowDate());
return followUpMapper.updateFollowUp(followUp);
}
/**
* -
*
* @param ids -
* @return
*/
@Override
public int deleteFollowUpByIds(Integer[] ids)
{
return followUpMapper.deleteFollowUpByIds(ids);
}
/**
* -
*
* @param id -
* @return
*/
@Override
public int deleteFollowUpById(Integer id)
{
return followUpMapper.deleteFollowUpById(id);
}
}

@ -0,0 +1,287 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.CustomerMapper">
<resultMap type="Customer" id="CustomerResult">
<result property="id" column="id" />
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="userType" column="user_type" />
<result property="email" column="email" />
<result property="phoneNumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="clueChannel" column="clue_channel" />
<result property="dataSource" column="data_source" />
<result property="liveAddress" column="live_address" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="wechat" column="wechat" />
<result property="buyCarType" column="buy_car_type" />
<result property="existModels" column="exist_models" />
<result property="isAssessment" column="is_assessment" />
<result property="intentionCarModels" column="intention_car_models" />
<result property="contrastCarModels" column="contrast_car_models" />
<result property="isTestDrive" column="is_test_drive" />
<result property="isOffer" column="is_offer" />
<result property="isFinance" column="is_finance" />
<result property="unBookingCarReason" column="un_booking_car_reason" />
<result property="preToStoreDate" column="pre_to_store_date" />
<result property="lastToStoreDate" column="last_to_store_date" />
<result property="storeName" column="store_name" />
<result property="orderDate" column="order_date" />
</resultMap>
<resultMap id="CustomerFollowUpResult" type="Customer" extends="CustomerResult">
<collection property="followUpList" notNullColumn="sub_id" javaType="java.util.List" resultMap="FollowUpResult" />
</resultMap>
<resultMap type="FollowUp" id="FollowUpResult">
<result property="id" column="sub_id" />
<result property="customerId" column="sub_customer_id" />
<result property="followUpDate" column="sub_follow_up_date" />
<result property="followUpRecord" column="sub_follow_up_record" />
<result property="preToStoreDate" column="sub_pre_to_store_date" />
<result property="createBy" column="sub_create_by" />
<result property="createTime" column="sub_create_time" />
<result property="updateBy" column="sub_update_by" />
<result property="updateTime" column="sub_update_time" />
<result property="remark" column="sub_remark" />
<result property="followLevel" column="sub_follow_level" />
</resultMap>
<sql id="selectCustomerVo">
select id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, clue_channel, data_source, live_address, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark, wechat, buy_car_type, exist_models, is_assessment, intention_car_models, contrast_car_models, is_test_drive, is_offer, is_finance, un_booking_car_reason, pre_to_store_date, last_to_store_date, store_name, order_date from f_customer
</sql>
<select id="selectCustomerList" resultType="com.ruoyi.system.domain.vo.CustomerVo">
SELECT t.*,f.follow_up_date as followUpLastDate,f.follow_level as followUpLastLevel,
(CASE f.follow_level
WHEN 'H' THEN
date_add(f.follow_up_date,interval 1 day)
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 7 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 13 day)
ELSE
IF(ISNULL(f.follow_level),f.follow_level,'暂不回访')
END
) as followUpOverdueDate,
(case f.follow_level
WHEN 'H' THEN '24小时内回访'
WHEN 'A' THEN
date_add(f.follow_up_date,interval 3 day)
WHEN 'B' THEN
date_add(f.follow_up_date,interval 5 day)
WHEN 'C' THEN
date_add(f.follow_up_date,interval 7 day)
when '成交' then '成交'
when '战败' then '战败'
when '休眠' then '休眠'
when '订车' then '订车'
ELSE ''
end
) as proposalNextFollowDate,f1.followUpTimes FROM f_customer t
LEFT JOIN (
SELECT a.* FROM f_follow_up AS a
LEFT JOIN (
SELECT MAX(create_time) AS create_time, customer_id FROM f_follow_up GROUP BY customer_id
) AS b ON a.customer_id = b.customer_id where a.create_time = b.create_time
) f on f.customer_id = t.id
LEFT JOIN (SELECT customer_id,COUNT(id) as followUpTimes FROM f_follow_up GROUP BY customer_id) f1 on f1.customer_id = t.id
<where>
<if test="userName != null and userName != ''"> and t.user_name like concat('%', #{userName}, '%')</if>
<if test="nickName != null and nickName != ''"> and t.nick_name like concat('%', #{nickName}, '%')</if>
<if test="userType != null and userType != ''"> and t.user_type = #{userType}</if>
<if test="email != null and email != ''"> and t.email = #{email}</if>
<if test="phoneNumber != null and phoneNumber != ''"> and t.phonenumber = #{phoneNumber}</if>
<if test="sex != null and sex != ''"> and t.sex = #{sex}</if>
<if test="avatar != null and avatar != ''"> and t.avatar = #{avatar}</if>
<if test="clueChannel != null and clueChannel != ''"> and t.clue_channel = #{clueChannel}</if>
<if test="dataSource != null and dataSource != ''"> and t.data_source = #{dataSource}</if>
<if test="liveAddress != null and liveAddress != ''"> and t.live_address = #{liveAddress}</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
<if test="loginDate != null "> and t.login_date = #{loginDate}</if>
<if test="wechat != null and wechat != ''"> and t.wechat = #{wechat}</if>
<if test="buyCarType != null and buyCarType != ''"> and t.buy_car_type = #{buyCarType}</if>
<if test="existModels != null and existModels != ''"> and t.exist_models = #{existModels}</if>
<if test="isAssessment != null "> and t.is_assessment = #{isAssessment}</if>
<if test="intentionCarModels != null and intentionCarModels != ''"> and t.intention_car_models = #{intentionCarModels}</if>
<if test="contrastCarModels != null and contrastCarModels != ''"> and t.contrast_car_models = #{contrastCarModels}</if>
<if test="isTestDrive != null "> and t.is_test_drive = #{isTestDrive}</if>
<if test="isOffer != null "> and t.is_offer = #{isOffer}</if>
<if test="isFinance != null "> and t.is_finance = #{isFinance}</if>
<if test="unBookingCarReason != null and unBookingCarReason != ''"> and t.un_booking_car_reason = #{unBookingCarReason}</if>
<if test="preToStoreDate != null "> and t.pre_to_store_date = #{preToStoreDate}</if>
<if test="lastToStoreDate != null "> and t.last_to_store_date = #{lastToStoreDate}</if>
<if test="storeName != null and storeName != ''"> and t.store_name like concat('%', #{storeName}, '%')</if>
<if test="orderDate != null "> and t.order_date = #{orderDate}</if>
<if test="followUpLastDate != null "> and f.follow_up_date = #{followUpLastDate}</if>
<if test="followUpLastLevel != null "> and f.follow_level = #{followUpLastLevel}</if>
<if test="proposalNextFollowDate != null "> and f.pre_to_store_date = #{proposalNextFollowDate}</if>
</where>
</select>
<select id="selectCustomerById" parameterType="Long" resultMap="CustomerFollowUpResult">
select a.id, a.user_name, a.nick_name, a.user_type, a.email, a.phonenumber, a.sex, a.avatar, a.clue_channel, a.data_source, a.live_address, a.status, a.del_flag, a.login_ip, a.login_date, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.wechat, a.buy_car_type, a.exist_models, a.is_assessment, a.intention_car_models, a.contrast_car_models, a.is_test_drive, a.is_offer, a.is_finance, a.un_booking_car_reason, a.pre_to_store_date, a.last_to_store_date, a.store_name, a.order_date,
b.id as sub_id, b.customer_id as sub_customer_id, b.follow_up_date as sub_follow_up_date, b.follow_up_record as sub_follow_up_record, b.pre_to_store_date as sub_pre_to_store_date, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.follow_level as sub_follow_level
from f_customer a
left join f_follow_up b on b.customer_id = a.id
where a.id = #{id}
</select>
<insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="id">
insert into f_customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name,</if>
<if test="nickName != null and nickName != ''">nick_name,</if>
<if test="userType != null">user_type,</if>
<if test="email != null">email,</if>
<if test="phoneNumber != null">phonenumber,</if>
<if test="sex != null">sex,</if>
<if test="avatar != null">avatar,</if>
<if test="clueChannel != null">clue_channel,</if>
<if test="dataSource != null">data_source,</if>
<if test="liveAddress != null">live_address,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="loginIp != null">login_ip,</if>
<if test="loginDate != null">login_date,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="wechat != null">wechat,</if>
<if test="buyCarType != null">buy_car_type,</if>
<if test="existModels != null">exist_models,</if>
<if test="isAssessment != null">is_assessment,</if>
<if test="intentionCarModels != null">intention_car_models,</if>
<if test="contrastCarModels != null">contrast_car_models,</if>
<if test="isTestDrive != null">is_test_drive,</if>
<if test="isOffer != null">is_offer,</if>
<if test="isFinance != null">is_finance,</if>
<if test="unBookingCarReason != null">un_booking_car_reason,</if>
<if test="preToStoreDate != null">pre_to_store_date,</if>
<if test="lastToStoreDate != null">last_to_store_date,</if>
<if test="storeName != null">store_name,</if>
<if test="orderDate != null">order_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null and userName != ''">#{userName},</if>
<if test="nickName != null and nickName != ''">#{nickName},</if>
<if test="userType != null">#{userType},</if>
<if test="email != null">#{email},</if>
<if test="phoneNumber != null">#{phoneNumber},</if>
<if test="sex != null">#{sex},</if>
<if test="avatar != null">#{avatar},</if>
<if test="clueChannel != null">#{clueChannel},</if>
<if test="dataSource != null">#{dataSource},</if>
<if test="liveAddress != null">#{liveAddress},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="loginIp != null">#{loginIp},</if>
<if test="loginDate != null">#{loginDate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="wechat != null">#{wechat},</if>
<if test="buyCarType != null">#{buyCarType},</if>
<if test="existModels != null">#{existModels},</if>
<if test="isAssessment != null">#{isAssessment},</if>
<if test="intentionCarModels != null">#{intentionCarModels},</if>
<if test="contrastCarModels != null">#{contrastCarModels},</if>
<if test="isTestDrive != null">#{isTestDrive},</if>
<if test="isOffer != null">#{isOffer},</if>
<if test="isFinance != null">#{isFinance},</if>
<if test="unBookingCarReason != null">#{unBookingCarReason},</if>
<if test="preToStoreDate != null">#{preToStoreDate},</if>
<if test="lastToStoreDate != null">#{lastToStoreDate},</if>
<if test="storeName != null">#{storeName},</if>
<if test="orderDate != null">#{orderDate},</if>
</trim>
</insert>
<update id="updateCustomer" parameterType="Customer">
update f_customer
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="userType != null">user_type = #{userType},</if>
<if test="email != null">email = #{email},</if>
<if test="phoneNumber != null">phonenumber = #{phoneNumber},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="clueChannel != null">clue_channel = #{clueChannel},</if>
<if test="dataSource != null">data_source = #{dataSource},</if>
<if test="liveAddress != null">live_address = #{liveAddress},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="loginIp != null">login_ip = #{loginIp},</if>
<if test="loginDate != null">login_date = #{loginDate},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="wechat != null">wechat = #{wechat},</if>
<if test="buyCarType != null">buy_car_type = #{buyCarType},</if>
<if test="existModels != null">exist_models = #{existModels},</if>
<if test="isAssessment != null">is_assessment = #{isAssessment},</if>
<if test="intentionCarModels != null">intention_car_models = #{intentionCarModels},</if>
<if test="contrastCarModels != null">contrast_car_models = #{contrastCarModels},</if>
<if test="isTestDrive != null">is_test_drive = #{isTestDrive},</if>
<if test="isOffer != null">is_offer = #{isOffer},</if>
<if test="isFinance != null">is_finance = #{isFinance},</if>
<if test="unBookingCarReason != null">un_booking_car_reason = #{unBookingCarReason},</if>
<if test="preToStoreDate != null">pre_to_store_date = #{preToStoreDate},</if>
<if test="lastToStoreDate != null">last_to_store_date = #{lastToStoreDate},</if>
<if test="storeName != null">store_name = #{storeName},</if>
<if test="orderDate != null">order_date = #{orderDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCustomerById" parameterType="Long">
delete from f_customer where id = #{id}
</delete>
<delete id="deleteCustomerByIds" parameterType="String">
delete from f_customer where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteFollowUpByCustomerIds" parameterType="String">
delete from f_follow_up where customer_id in
<foreach item="customerId" collection="array" open="(" separator="," close=")">
#{customerId}
</foreach>
</delete>
<delete id="deleteFollowUpByCustomerId" parameterType="Long">
delete from f_follow_up where customer_id = #{customerId}
</delete>
<insert id="batchFollowUp">
insert into f_follow_up( id, customer_id, follow_up_date, follow_up_record, pre_to_store_date, create_by, create_time, update_by, update_time, remark, follow_level) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.customerId}, #{item.followUpDate}, #{item.followUpRecord}, #{item.preToStoreDate}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.followLevel})
</foreach>
</insert>
</mapper>

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.FollowUpMapper">
<resultMap type="FollowUp" id="FollowUpResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="followUpDate" column="follow_up_date" />
<result property="followUpRecord" column="follow_up_record" />
<result property="preToStoreDate" column="pre_to_store_date" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="followLevel" column="follow_level" />
</resultMap>
<sql id="selectFollowUpVo">
select id, customer_id, follow_up_date, follow_up_record, pre_to_store_date, create_by, create_time, update_by, update_time, remark, follow_level from f_follow_up
</sql>
<select id="selectFollowUpList" parameterType="FollowUp" resultMap="FollowUpResult">
<include refid="selectFollowUpVo"/>
<where>
<if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
<if test="followUpDate != null "> and follow_up_date = #{followUpDate}</if>
<if test="followUpRecord != null and followUpRecord != ''"> and follow_up_record = #{followUpRecord}</if>
<if test="preToStoreDate != null "> and pre_to_store_date = #{preToStoreDate}</if>
<if test="followLevel != null and followLevel != ''"> and follow_level = #{followLevel}</if>
</where>
</select>
<select id="selectFollowUpById" parameterType="Integer" resultMap="FollowUpResult">
<include refid="selectFollowUpVo"/>
where id = #{id}
</select>
<insert id="insertFollowUp" parameterType="FollowUp" useGeneratedKeys="true" keyProperty="id">
insert into f_follow_up
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="followUpDate != null">follow_up_date,</if>
<if test="followUpRecord != null">follow_up_record,</if>
<if test="preToStoreDate != null">pre_to_store_date,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="followLevel != null">follow_level,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="followUpDate != null">#{followUpDate},</if>
<if test="followUpRecord != null">#{followUpRecord},</if>
<if test="preToStoreDate != null">#{preToStoreDate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="followLevel != null">#{followLevel},</if>
</trim>
</insert>
<update id="updateFollowUp" parameterType="FollowUp">
update f_follow_up
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="followUpDate != null">follow_up_date = #{followUpDate},</if>
<if test="followUpRecord != null">follow_up_record = #{followUpRecord},</if>
<if test="preToStoreDate != null">pre_to_store_date = #{preToStoreDate},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="followLevel != null">follow_level = #{followLevel},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteFollowUpById" parameterType="Integer">
delete from f_follow_up where id = #{id}
</delete>
<delete id="deleteFollowUpByIds" parameterType="String">
delete from f_follow_up where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,66 @@
import request from '@/utils/request'
// 查询客户信息列表
export function listCustomer(query) {
return request({
url: '/system/customer/list',
method: 'get',
params: query
})
}
// 查询客户信息列表
export function listCustomerFollow(query) {
return request({
url: '/system/up/list',
method: 'get',
params: query
})
}
// 查询客户信息详细
export function getCustomer(id) {
return request({
url: '/system/customer/' + id,
method: 'get'
})
}
// 新增客户信息
export function addCustomer(data) {
return request({
url: '/system/customer',
method: 'post',
data: data
})
}
// 修改客户信息
export function updateCustomer(data) {
return request({
url: '/system/customer',
method: 'put',
data: data
})
}
// 新增客户跟进信息
export function addCustomerFollowRecerd(data) {
return request({
url: '/system/up',
method: 'post',
data: data
})
}
export function updateCustomerFollowRecerd(data) {
return request({
url: '/system/up',
method: 'put',
data: data
})
}
// 删除客户信息
export function delCustomer(id) {
return request({
url: '/system/customer/' + id,
method: 'delete'
})
}

@ -0,0 +1,831 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="客户名" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入客户名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户级别" prop="userType">
<el-select v-model="queryParams.userType" placeholder="请选择客户级别" clearable>
<el-option
v-for="dict in dict.type.customer_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="手机号码" prop="phoneNumber">
<el-input
v-model="queryParams.phoneNumber"
placeholder="请输入手机号码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="线索渠道" prop="clueChannel">
<el-select v-model="queryParams.clueChannel" placeholder="请选择线索渠道" clearable>
<el-option
v-for="dict in dict.type.clue_channels"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="信息来源" prop="dataSource">
<el-select v-model="queryParams.dataSource" placeholder="请选择信息来源" clearable>
<el-option
v-for="dict in dict.type.customer_source"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="到店状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择到店状态" clearable>
<el-option
v-for="dict in dict.type.to_store_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="微信号" prop="wechat">
<el-input
v-model="queryParams.wechat"
placeholder="请输入微信号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="意向车型" prop="intentionCarModels">
<el-input
v-model="queryParams.intentionCarModels"
placeholder="请输入意向车型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="预计到店" prop="preToStoreDate">
<el-date-picker clearable
v-model="queryParams.preToStoreDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择预计到店">
</el-date-picker>
</el-form-item>
<el-form-item label="下单日期" prop="orderDate">
<el-date-picker clearable
v-model="queryParams.orderDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择下单日期">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" 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>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:customer:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:customer:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:customer:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:customer:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户姓名" align="center" prop="userName" width="120"/>
<el-table-column label="客户级别" align="center" prop="userType">
<template slot-scope="scope">
<dict-tag :options="dict.type.customer_level" :value="scope.row.userType"/>
</template>
</el-table-column>
<el-table-column label="手机号码" align="center" prop="phoneNumber" width="110"/>
<el-table-column label="线索渠道" align="center" prop="clueChannel">
<template slot-scope="scope">
<dict-tag :options="dict.type.clue_channels" :value="scope.row.clueChannel"/>
</template>
</el-table-column>
<el-table-column label="信息来源" align="center" prop="dataSource">
<template slot-scope="scope">
<dict-tag :options="dict.type.customer_source" :value="scope.row.dataSource"/>
</template>
</el-table-column>
<el-table-column label="客户居住" align="center" prop="liveAddress" width="100"/>
<el-table-column label="到店状态" align="center" prop="status" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.to_store_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="微信号" align="center" prop="wechat" width="100"/>
<el-table-column label="下单日期" align="center" prop="orderDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<!-- <el-table-column label="是否评估" align="center" prop="isAssessment" />-->
<el-table-column label="意向车型" align="center" prop="intentionCarModels" width="120"/>
<!-- <el-table-column label="对比车型" align="center" prop="contrastCarModels" />
<el-table-column label="是否试驾" align="center" prop="isTestDrive" />
<el-table-column label="是否报价" align="center" prop="isOffer" />
<el-table-column label="是否金融" align="center" prop="isFinance" />-->
<!-- <el-table-column label="最后到店" align="center" prop="lastToStoreDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.lastToStoreDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>-->
<el-table-column label="已有车辆" align="center" prop="existModels" />
<el-table-column label="预计到店" class-name="specialColor" align="center" prop="preToStoreDate" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.preToStoreDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="跟进次数" class-name="specialColor" align="center" prop="followUpTimes" />
<el-table-column label="最新跟进日" class-name="specialColor" align="center" prop="followUpLastDate" width="100" />
<el-table-column label="最新跟进级别" class-name="specialColor" align="center" prop="followUpLastLevel" width="100"/>
<el-table-column label="建议下次跟进日" class-name="specialColor" align="center" prop="proposalNextFollowDate" width="120"/>
<el-table-column label="跟进超期" class-name="specialColor" align="center" prop="followUpOverdueDate" width="120"/>
<el-table-column label="未订车原因" align="center" prop="unBookingCarReason" width="110" show-overflow-tooltip/>
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
<el-table-column label="操作" width="160" align="center" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleFollow(scope.row)"
v-hasPermi="['system:customer:edit']"
>跟进</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:customer:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:customer:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改客户信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form ref="form" :model="form" :inline="true" :rules="rules" label-width="110px">
<el-form-item label="下单日期" prop="orderDate">
<el-date-picker clearable
v-model="form.orderDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择下单日期">
</el-date-picker>
</el-form-item>
<el-form-item label="客户姓名" prop="userName">
<el-input v-model="form.userName" placeholder="请输入客户姓名" />
</el-form-item>
<el-form-item label="客户性别" prop="sex">
<el-select v-model="form.sex" placeholder="请选择客户性别">
<el-option
v-for="dict in dict.type.sys_user_sex"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="客户手机" prop="phoneNumber">
<el-input v-model="form.phoneNumber" placeholder="请输入客户手机号码" />
</el-form-item>
<el-form-item label="客户微信" prop="wechat">
<el-input v-model="form.wechat" placeholder="请输入客户微信" />
</el-form-item>
<el-form-item label="客户级别" prop="userType">
<el-select v-model="form.userType" placeholder="请选择客户级别">
<el-option
v-for="dict in dict.type.customer_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="用户邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入用户邮箱" />
</el-form-item>
<el-form-item label="线索渠道" prop="clueChannel">
<el-select v-model="form.clueChannel" placeholder="请选择线索渠道">
<el-option
v-for="dict in dict.type.clue_channels"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="信息来源" prop="dataSource">
<el-select v-model="form.dataSource" placeholder="请选择信息来源">
<el-option
v-for="dict in dict.type.customer_source"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="客户居住" prop="liveAddress">
<el-input v-model="form.liveAddress" placeholder="请输入客户居住" />
</el-form-item>
<el-form-item label="到店状态" prop="status">
<el-select v-model="form.status" placeholder="请选择到店状态">
<el-option
v-for="dict in dict.type.to_store_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="已有车型" prop="existModels">
<el-input v-model="form.existModels" placeholder="请输入已有车型" />
</el-form-item>
<el-form-item label="意向车型" prop="intentionCarModels">
<el-input v-model="form.intentionCarModels" placeholder="请输入意向车型" />
</el-form-item>
<!-- <el-form-item label="是否试驾" prop="isTestDrive">
<el-input v-model="form.isTestDrive" placeholder="请输入是否试驾" />
</el-form-item>
<el-form-item label="是否报价" prop="isOffer">
<el-input v-model="form.isOffer" placeholder="请输入是否报价" />
</el-form-item>
<el-form-item label="是否金融" prop="isFinance">
<el-input v-model="form.isFinance" placeholder="请输入是否金融" />
</el-form-item>
-->
<el-form-item label="预计到店" prop="preToStoreDate">
<el-date-picker clearable
v-model="form.preToStoreDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择预计到店">
</el-date-picker>
</el-form-item>
<!-- <el-form-item label="最后到店" prop="lastToStoreDate">
<el-date-picker clearable
v-model="form.lastToStoreDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择最后到店">
</el-date-picker>
</el-form-item>-->
<el-form-item label="4S店" prop="storeName">
<el-input v-model="form.storeName" placeholder="请输入4S店" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="未订车原因" prop="unBookingCarReason">
<el-input v-model="form.unBookingCarReason" type="textarea" placeholder="请输入内容" />
</el-form-item>
<!--
<el-divider content-position="center">跟进模块-客户跟进记录信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddFollowUp"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteFollowUp"></el-button>
</el-col>
</el-row>
<el-table style="width: 100%" :data="followUpList" :row-class-name="rowFollowUpIndex" @selection-change="handleFollowUpSelectionChange" ref="followUp">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="80"/>
<el-table-column label="跟进日期" prop="followUpDate" width="130">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.followUpDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择跟进日期" />
</template>
</el-table-column>
<el-table-column label="再次预约到店日期" prop="preToStoreDate" width="130">
<template slot-scope="scope">
<el-date-picker clearable v-model="scope.row.preToStoreDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择再次预约到店日期" />
</template>
</el-table-column>
<el-table-column label="级别" prop="followLevel" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.followLevel" placeholder="请选择级别" clearable>
<el-option
v-for="dict in dict.type.customer_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="跟进记录" prop="followUpRecord" >
<template slot-scope="scope">
<el-input v-model="scope.row.followUpRecord" placeholder="请输入级别" />
</template>
</el-table-column>
</el-table>-->
</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>
<!-- 添加客户跟进记录Drawer 抽屉 -->
<el-drawer :title="followTitle" :before-close="handleDrawerClose" :visible.sync="drawer" size="50%">
<div style="position: fixed;top: 40px;left: 65%;z-index: 100;font-size: smaller">
<el-radio-group v-model="reverse">
<el-radio :label="true">倒序</el-radio>
<el-radio :label="false">正序</el-radio>
</el-radio-group>
<el-button size="mini" type="primary" icon="el-icon-edit" style="position: relative;left: 100px" @click="handleDrawerAddFollowUp" >新增</el-button>
</div>
<el-timeline :reverse="reverse">
<el-timeline-item placement="top" v-for="(follow, index) in followUpList" :key="index" :timestamp="follow.followUpDate">
<el-card>
<p><el-tag>级别</el-tag> {{follow.followLevel}} </p>
<h4><el-tag>记录</el-tag> {{follow.followUpRecord}}</h4>
<p> <el-tag>再次预约到店日期</el-tag> {{follow.preToStoreDate}} </p>
<p>提交于 {{follow.createTime}}</p>
</el-card>
</el-timeline-item>
</el-timeline>
<el-drawer title="新增跟进日志" :append-to-body="true" :visible.sync="innerDrawer">
<el-form ref="followForm" :model="followForm" :rules="followRules" label-width="140px">
<el-form-item label="跟进日期" prop="followUpDate">
<el-date-picker clearable
v-model="followForm.followUpDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择跟进日期">
</el-date-picker>
</el-form-item>
<el-form-item label="跟进记录" prop="followUpRecord">
<el-input v-model="followForm.followUpRecord" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="级别" prop="followLevel">
<el-select v-model="followForm.followLevel" placeholder="请选择级别" clearable>
<el-option
v-for="dict in dict.type.customer_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="再次预约到店日期" prop="preToStoreDate">
<el-date-picker clearable
v-model="followForm.preToStoreDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择再次预约到店日期">
</el-date-picker>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="followForm.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div style="text-align: center">
<el-button type="primary" @click="submitFollowForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-drawer>
</el-drawer>
</div>
</template>
<script>
import {
listCustomer,
getCustomer,
delCustomer,
addCustomer,
updateCustomer,
addCustomerFollowRecerd, updateCustomerFollowRecerd, listCustomerFollow
} from "@/api/system/customer";
import Data from "@/views/system/dict/data";
export default {
name: "Customer",
dicts: ['to_store_status', 'customer_source', 'sys_user_sex', 'customer_level', 'clue_channels'],
data() {
return {
drawer:false,
reverse: true,
innerDrawer:false,
dafaultValue:null,
customerId:null,
//
loading: true,
followTitle:null,
//
ids: [],
//
checkedFollowUp: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
customerList: [],
// -
followUpList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
userName: null,
userType: null,
phoneNumber: null,
clueChannel: null,
dataSource: null,
status: null,
wechat: null,
intentionCarModels: null,
preToStoreDate: null,
orderDate: null
},
//
form: {},
followForm:{
followUpDate:null,
customerId:null,
},
//
rules: {
userName: [
{ required: true, message: "客户名不能为空", trigger: "blur" }
],
orderDate:[
{ required: true, message: "下单日期不能为空", trigger: "blur" }
],
phoneNumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" }
],
dataSource: [
{ required: true, message: "信息来源不能为空", trigger: "change" }
],
intentionCarModels: [
{ required: true, message: "意向车型不能为空", trigger: "blur" }
],
},
//
followRules: {
followUpDate: [
{ required: true, message: "跟进日期不能为空", trigger: "blur" }
],
followUpRecord:[
{ required: true, message: "跟进记录不能为空", trigger: "blur" }
],
followLevel: [
{ required: true, message: "级别不能为空", trigger: "blur" }
],
},
};
},
created() {
this.getList();
this.dafaultValue = new Date;
},
methods: {
/** 查询客户信息列表 */
getList() {
this.loading = true;
listCustomer(this.queryParams).then(response => {
this.customerList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询客户跟进信息列表 */
getFollowList(customerId) {
this.loading = true;
let queryParams = {
customerId:customerId
}
listCustomerFollow(queryParams).then(response => {
this.followUpList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
userName: null,
nickName: null,
userType: null,
email: null,
phoneNumber: null,
sex: null,
avatar: null,
clueChannel: null,
dataSource: null,
liveAddress: null,
status: null,
delFlag: null,
loginIp: null,
loginDate: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
wechat: null,
buyCarType: null,
existModels: null,
isAssessment: 0,
intentionCarModels: null,
contrastCarModels: null,
isTestDrive: null,
isOffer: null,
isFinance: null,
unBookingCarReason: null,
preToStoreDate: null,
lastToStoreDate: null,
storeName: null,
orderDate: null
};
this.followUpList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加客户信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCustomer(id).then(response => {
this.form = response.data;
this.followUpList = response.data.followUpList;
this.open = true;
this.title = "修改客户信息";
});
},
/**跟进按钮**/
handleFollow(row){
this.drawer = true;
this.customerId = row.id;
this.followTitle = row.userName + " 跟进记录";
this.getFollowList(this.customerId);
},
handleDrawerAddFollowUp(){
this.innerDrawer = true;
this.followForm = {};
this.followForm.followUpDate = new Date();
this.followForm.customerId = this.customerId;
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.followUpList = this.followUpList;
if (this.form.id != null) {
updateCustomer(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCustomer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
submitFollowForm(){
this.$refs["followForm"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCustomerFollowRecerd(this.followForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getFollowList(this.customerId);
});
} else {
addCustomerFollowRecerd(this.followForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getFollowList(this.customerId);
this.innerDrawer = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除客户信息编号为"' + ids + '"的数据项?').then(function() {
return delCustomer(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 跟进模块-客户跟进记录序号 */
rowFollowUpIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 跟进模块-客户跟进记录添加按钮操作 */
handleAddFollowUp() {
let obj = {};
obj.followUpDate = "";
obj.followUpRecord = "";
obj.preToStoreDate = "";
obj.remark = "";
obj.followLevel = "";
this.followUpList.push(obj);
},
/** 跟进模块-客户跟进记录删除按钮操作 */
handleDeleteFollowUp() {
if (this.checkedFollowUp.length == 0) {
this.$modal.msgError("请先选择要删除的跟进模块-客户跟进记录数据");
} else {
const followUpList = this.followUpList;
const checkedFollowUp = this.checkedFollowUp;
this.followUpList = followUpList.filter(function(item) {
return checkedFollowUp.indexOf(item.index) == -1
});
}
},
/** 复选框选中数据 */
handleFollowUpSelectionChange(selection) {
this.checkedFollowUp = selection.map(item => item.index)
},
handleDrawerClose(done){
this.getList()
this.drawer = false;
},
/** 导出按钮操作 */
handleExport() {
this.download('system/customer/export', {
...this.queryParams
}, `customer_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.specialColor{
color:red;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}
</style>
Loading…
Cancel
Save