提交生成合同

This commit is contained in:
huangdeliang 2020-10-27 22:36:12 +08:00
parent 8b93c763c3
commit 626d6424f0
19 changed files with 701 additions and 408 deletions

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>

View File

@ -119,18 +119,6 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- itextpdf-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.1.12</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>layout</artifactId>
<version>7.1.12</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -3,7 +3,6 @@ package com.ruoyi.web.controller.common;
import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.Contract;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.common.utils.file.FileUtils;
@ -13,7 +12,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;

View File

@ -3,7 +3,6 @@ package com.ruoyi.web.controller.custom;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.Contract;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
@ -13,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 合同Controller * 合同Controller
@ -92,27 +93,35 @@ public class SysContractController extends BaseController {
@GetMapping("/file/{id}") @GetMapping("/file/{id}")
public AjaxResult getfile(@PathVariable long id) { public AjaxResult getfile(@PathVariable long id) {
try { AjaxResult ajax = AjaxResult.success();
AjaxResult ajax = AjaxResult.success(); SysContract contract = sysContractService.selectSysContractById(id);
// ajax.put("url", "/login"); if (contract.getPath() != null) {
ajax.put("data", id); ajax.put("url", contract.getPath());
return ajax; } else {
} catch (Exception e) { Map<String, String> data = new HashMap<>();
return AjaxResult.error(e.getMessage()); data.put("name", contract.getName());
data.put("amount", contract.getAmount().toString());
data.put("serveTime", contract.getServeTime().toString());
ajax.put("data", data);
} }
return ajax;
} }
/** /**
* 合同签单 * 合同签单
*/ */
@PostMapping("/sign") @PostMapping("/sign")
public AjaxResult signContract(@RequestBody Contract contract) throws Exception { public AjaxResult signContract(@RequestBody SysContract sysContract) {
try { sysContract.setStatus(1);
String path = "/file/" + sysContract.getId() + ".pdf";
sysContract.setPath(path);
int count = sysContractService.updateSysContract(sysContract);
if (count > 0) {
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
ajax.put("result", "hi"); ajax.put("url", path);
return ajax; return ajax;
} catch (Exception e) { } else {
return AjaxResult.error(e.getMessage()); return AjaxResult.error("操作失败");
} }
} }
} }

View File

@ -1,25 +0,0 @@
package com.ruoyi.common.core.domain.model;
public class Contract {
private String name;
private String phone;
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;
}
}

View File

@ -23,5 +23,23 @@
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<!-- itextpdf-->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>io</artifactId>
<version>7.1.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>7.1.12</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13.2</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1,114 +1,158 @@
package com.ruoyi.custom.domain; package com.ruoyi.custom.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/** /**
* 合同对象 sys_contract * 合同对象 sys_contract
* *
* @author wonder * @author wonder
* @date 2020-10-23 * @date 2020-10-23
*/ */
public class SysContract extends BaseEntity public class SysContract extends BaseEntity {
{
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** 合同编号 */ /**
* 合同编号
*/
@Excel(name = "合同编号") @Excel(name = "合同编号")
private Long id; private Long id;
/** 客户姓名 */ /**
* 客户姓名
*/
@Excel(name = "客户姓名") @Excel(name = "客户姓名")
private String name; private String name;
/** 电话 */ /**
* 客户身份证
*/
private String cusId;
/**
* 电话
*/
@Excel(name = "电话") @Excel(name = "电话")
private String phone; private String phone;
/** 服务时间 */ /**
* 服务时间
*/
@Excel(name = "服务时间") @Excel(name = "服务时间")
private Integer serveTime; private Integer serveTime;
/** 金额 */ /**
* 金额
*/
@Excel(name = "金额") @Excel(name = "金额")
private BigDecimal amount; private BigDecimal amount;
/** 文件路径 */ private String amountUpper;
/**
* 文件路径
*/
@Excel(name = "文件路径") @Excel(name = "文件路径")
private String path; private String path;
public void setId(Long id) /**
{ * 合同状态
* 0-未签订1-已签订
*/
private int Status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id; this.id = id;
} }
public Long getId() public String getName() {
{ return name;
return id;
} }
public void setName(String name)
{ public void setName(String name) {
this.name = name; this.name = name;
} }
public String getName() public String getPhone() {
{ return phone;
return name;
} }
public void setPhone(String phone)
{ public void setPhone(String phone) {
this.phone = phone; this.phone = phone;
} }
public String getPhone() public Integer getServeTime() {
{ return serveTime;
return phone;
} }
public void setServeTime(Integer serveTime)
{ public void setServeTime(Integer serveTime) {
this.serveTime = serveTime; this.serveTime = serveTime;
} }
public Integer getServeTime() public BigDecimal getAmount() {
{ return amount;
return serveTime;
} }
public void setAmount(BigDecimal amount)
{ public String getAmountUpper() {
return amountUpper;
}
public void setAmountUpper(String amountUpper) {
this.amountUpper = amountUpper;
}
public void setAmount(BigDecimal amount) {
this.amount = amount; this.amount = amount;
} }
public BigDecimal getAmount() public String getPath() {
{ return path;
return amount;
} }
public void setPath(String path)
{ public void setPath(String path) {
this.path = path; this.path = path;
} }
public String getPath() public int getStatus() {
{ return Status;
return path; }
public void setStatus(int status) {
Status = status;
}
public String getCusId() {
return cusId;
}
public void setCusId(String cusId) {
this.cusId = cusId;
} }
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("name", getName()) .append("name", getName())
.append("phone", getPhone()) .append("cusId", getCusId())
.append("serveTime", getServeTime()) .append("status", getStatus())
.append("amount", getAmount()) .append("phone", getPhone())
.append("path", getPath()) .append("serveTime", getServeTime())
.append("createBy", getCreateBy()) .append("amount", getAmount())
.append("createTime", getCreateTime()) .append("path", getPath())
.append("updateBy", getUpdateBy()) .append("createBy", getCreateBy())
.append("updateTime", getUpdateTime()) .append("createTime", getCreateTime())
.append("remark", getRemark()) .append("updateBy", getUpdateBy())
.toString(); .append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
} }
} }

View File

@ -58,4 +58,6 @@ public interface ISysContractService
* @return 结果 * @return 结果
*/ */
public int deleteSysContractById(Long id); public int deleteSysContractById(Long id);
public int signContract(SysContract sysContract);
} }

View File

@ -1,96 +1,147 @@
package com.ruoyi.custom.service.impl; package com.ruoyi.custom.service.impl;
import java.util.List; import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.*;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.custom.domain.SysContract;
import com.ruoyi.custom.mapper.SysContractMapper;
import com.ruoyi.custom.service.ISysContractService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.custom.mapper.SysContractMapper;
import com.ruoyi.custom.domain.SysContract; import java.io.ByteArrayOutputStream;
import com.ruoyi.custom.service.ISysContractService; import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
/** /**
* 合同Service业务层处理 * 合同Service业务层处理
* *
* @author wonder * @author wonder
* @date 2020-10-23 * @date 2020-10-23
*/ */
@Service @Service
public class SysContractServiceImpl implements ISysContractService public class SysContractServiceImpl implements ISysContractService {
{
@Autowired @Autowired
private SysContractMapper sysContractMapper; private SysContractMapper sysContractMapper;
/** /**
* 查询合同 * 查询合同
* *
* @param id 合同ID * @param id 合同ID
* @return 合同 * @return 合同
*/ */
@Override @Override
public SysContract selectSysContractById(Long id) public SysContract selectSysContractById(Long id) {
{
return sysContractMapper.selectSysContractById(id); return sysContractMapper.selectSysContractById(id);
} }
/** /**
* 查询合同列表 * 查询合同列表
* *
* @param sysContract 合同 * @param sysContract 合同
* @return 合同 * @return 合同
*/ */
@Override @Override
public List<SysContract> selectSysContractList(SysContract sysContract) public List<SysContract> selectSysContractList(SysContract sysContract) {
{
return sysContractMapper.selectSysContractList(sysContract); return sysContractMapper.selectSysContractList(sysContract);
} }
/** /**
* 新增合同 * 新增合同
* *
* @param sysContract 合同 * @param sysContract 合同
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSysContract(SysContract sysContract) public int insertSysContract(SysContract sysContract) {
{ sysContract.setId(DateUtils.getNowDate().getTime());
sysContract.setCreateTime(DateUtils.getNowDate()); sysContract.setCreateTime(DateUtils.getNowDate());
return sysContractMapper.insertSysContract(sysContract); return sysContractMapper.insertSysContract(sysContract);
} }
/** /**
* 修改合同 * 修改合同
* *
* @param sysContract 合同 * @param sysContract 合同
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSysContract(SysContract sysContract) public int updateSysContract(SysContract sysContract) {
{
sysContract.setUpdateTime(DateUtils.getNowDate()); sysContract.setUpdateTime(DateUtils.getNowDate());
return sysContractMapper.updateSysContract(sysContract); return sysContractMapper.updateSysContract(sysContract);
} }
/** /**
* 批量删除合同 * 批量删除合同
* *
* @param ids 需要删除的合同ID * @param ids 需要删除的合同ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysContractByIds(Long[] ids) public int deleteSysContractByIds(Long[] ids) {
{
return sysContractMapper.deleteSysContractByIds(ids); return sysContractMapper.deleteSysContractByIds(ids);
} }
/** /**
* 删除合同信息 * 删除合同信息
* *
* @param id 合同ID * @param id 合同ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysContractById(Long id) public int deleteSysContractById(Long id) {
{
return sysContractMapper.deleteSysContractById(id); return sysContractMapper.deleteSysContractById(id);
} }
@Override
public int signContract(SysContract sysContract) {
String templatePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running/pdf/contract.pdf";
String filePath = "/Users/wonder/Documents/Workspaces/java/RuoYi-Vue/running" + sysContract.getPath();
PdfReader reader;
FileOutputStream out;
ByteArrayOutputStream bos;
PdfStamper stamper;
try {
out = new FileOutputStream(filePath);// 输出流到新的pdf,没有b2.pdf时会创建
reader = new PdfReader(templatePath);// 读取pdf模板
bos = new ByteArrayOutputStream();
stamper = new PdfStamper(reader, bos);
AcroFields form = stamper.getAcroFields();
form.setField("name", sysContract.getName());
form.setField("phone", sysContract.getName());
form.setField("money", sysContract.getAmount().toString());
form.setField("moneyUpper", sysContract.getAmountUpper());
form.setField("date", sysContract.getName());
form.setField("cusId", sysContract.getCusId());
stamper.setFormFlattening(true);// 如果为false那么生成的PDF文件还能编辑一定要设为true
stamper.close();
Document doc = new Document();
PdfCopy copy = new PdfCopy(doc, out);
doc.open();
PdfImportedPage importPage = null;
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
importPage = copy
.getImportedPage(new PdfReader(bos.toByteArray()), i);
copy.addPage(importPage);
}
doc.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
return 0;
}
} }

View File

@ -6,7 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysContract" id="SysContractResult"> <resultMap type="SysContract" id="SysContractResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="status" column="status" />
<result property="name" column="name" /> <result property="name" column="name" />
<result property="cusId" column="cus_id" />
<result property="phone" column="phone" /> <result property="phone" column="phone" />
<result property="serveTime" column="serve_time" /> <result property="serveTime" column="serve_time" />
<result property="amount" column="amount" /> <result property="amount" column="amount" />
@ -19,13 +21,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSysContractVo"> <sql id="selectSysContractVo">
select id, name, phone, serve_time, amount, path, create_by, create_time, update_by, update_time, remark from sys_contract select id, status, name, phone, cus_id, serve_time, amount, path, create_by, create_time, update_by, update_time, remark from sys_contract
</sql> </sql>
<select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult"> <select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult">
<include refid="selectSysContractVo"/> <include refid="selectSysContractVo"/>
<where> <where>
<if test="id != null "> and id = #{id}</if> <if test="id != null "> and id = #{id}</if>
<if test="status != null "> and status = #{status}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if> <if test="phone != null and phone != ''"> and phone = #{phone}</if>
</where> </where>
@ -39,7 +42,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id">
insert into sys_contract insert into sys_contract
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="status != null">status,</if>
<if test="name != null and name != ''">name,</if> <if test="name != null and name != ''">name,</if>
<if test="cusId != null and cusId != ''">cus_id,</if>
<if test="phone != null">phone,</if> <if test="phone != null">phone,</if>
<if test="serveTime != null">serve_time,</if> <if test="serveTime != null">serve_time,</if>
<if test="amount != null">amount,</if> <if test="amount != null">amount,</if>
@ -51,7 +57,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="status != null">#{status},</if>
<if test="name != null and name != ''">#{name},</if> <if test="name != null and name != ''">#{name},</if>
<if test="cusId != null and cusId != ''">#{cus_id},</if>
<if test="phone != null">#{phone},</if> <if test="phone != null">#{phone},</if>
<if test="serveTime != null">#{serveTime},</if> <if test="serveTime != null">#{serveTime},</if>
<if test="amount != null">#{amount},</if> <if test="amount != null">#{amount},</if>
@ -67,7 +76,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateSysContract" parameterType="SysContract"> <update id="updateSysContract" parameterType="SysContract">
update sys_contract update sys_contract
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="status != null">name = #{status},</if>
<if test="name != null and name != ''">name = #{name},</if> <if test="name != null and name != ''">name = #{name},</if>
<if test="cusId != null and cusId != ''">name = #{cus_id},</if>
<if test="phone != null">phone = #{phone},</if> <if test="phone != null">phone = #{phone},</if>
<if test="serveTime != null">serve_time = #{serveTime},</if> <if test="serveTime != null">serve_time = #{serveTime},</if>
<if test="amount != null">amount = #{amount},</if> <if test="amount != null">amount = #{amount},</if>

View File

@ -58,3 +58,11 @@ export function getFile(id) {
method: 'get', method: 'get',
}) })
} }
export function signContract(data) {
return request({
url: '/custom/contract/',
method: 'put',
data: data
})
}

View File

@ -23,7 +23,7 @@ import {
handleTree, handleTree,
parseTime, parseTime,
resetForm, resetForm,
searchToParams, digitUppercase,
selectDictLabel, selectDictLabel,
selectDictLabels, selectDictLabels,
toThousands toThousands
@ -43,7 +43,7 @@ Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.toThousands = toThousands Vue.prototype.toThousands = toThousands
Vue.prototype.searchToParams = searchToParams Vue.prototype.digitUppercase = digitUppercase
Vue.prototype.msgSuccess = function (msg) { Vue.prototype.msgSuccess = function (msg) {
this.$message({showClose: true, message: msg, type: "success"}); this.$message({showClose: true, message: msg, type: "success"});

View File

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

View File

@ -125,7 +125,7 @@ export const constantRoutes = [
] ]
}, },
{ {
path: '/contract/:id(\\d+)', path: '/file/contract/:id(\\d+)',
hidden: true, hidden: true,
component: (resolve) => require(['@/views/custom/signContract'], resolve), component: (resolve) => require(['@/views/custom/signContract'], resolve),
meta: { title: '合同' } meta: { title: '合同' }

View File

@ -167,13 +167,33 @@ export function toThousands(num) {
return result; return result;
} }
export function searchToParams(paramStr) { export function digitUppercase(n) {
if (!paramStr) { const fraction = ['角', '分'];
return {} const digit = [
'零', '壹', '贰', '叁', '肆',
'伍', '陆', '柒', '捌', '玖'
];
const unit = [
['元', '万', '亿'],
['', '拾', '佰', '仟']
];
const head = n < 0 ? '欠' : '';
n = Math.abs(n);
let s = '';
for (let i = 0; i < fraction.length; i++) {
s += (digit[Math.floor(n * 10 * Math.pow(10, i)) % 10] + fraction[i]).replace(/零./, '');
} }
return paramStr.split('&').reduce((obj, cur) => { s = s || '整';
const tarObj = cur.split('='); n = Math.floor(n);
obj[tarObj[0]] = tarObj[1]; for (let i = 0; i < unit[0].length && n > 0; i++) {
return obj; const p = '';
}, {}) for (let j = 0; j < unit[1].length && n > 0; j++) {
} p = digit[n % 10] + unit[1][j] + p;
n = Math.floor(n / 10);
}
s = p.replace(/(零.)*零$/, '').replace(/^$/, '零') + unit[0][i] + s;
}
return head + s.replace(/(零.)*零元/, '元')
.replace(/(零.)+/g, '零')
.replace(/^整$/, '零元整');
};

View File

@ -42,65 +42,77 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['custom:contract:add']" v-hasPermi="['custom:contract:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="success"--> <!-- type="success"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- :disabled="single"--> <!-- :disabled="single"-->
<!-- @click="handleUpdate"--> <!-- @click="handleUpdate"-->
<!-- v-hasPermi="['custom:contract:edit']"--> <!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="danger"--> <!-- type="danger"-->
<!-- icon="el-icon-delete"--> <!-- icon="el-icon-delete"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- :disabled="multiple"--> <!-- :disabled="multiple"-->
<!-- @click="handleDelete"--> <!-- @click="handleDelete"-->
<!-- v-hasPermi="['custom:contract:remove']"--> <!-- v-hasPermi="['custom:contract:remove']"-->
<!-- >删除</el-button>--> <!-- >删除</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="1.5">--> <!-- <el-col :span="1.5">-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="warning"--> <!-- type="warning"-->
<!-- icon="el-icon-download"--> <!-- icon="el-icon-download"-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- @click="handleExport"--> <!-- @click="handleExport"-->
<!-- v-hasPermi="['custom:contract:export']"--> <!-- v-hasPermi="['custom:contract:export']"-->
<!-- >导出</el-button>--> <!-- >导出</el-button>-->
<!-- </el-col>--> <!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />--> <!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="合同编号" align="center" prop="id" /> <el-table-column label="合同编号" align="center" prop="id"/>
<el-table-column label="客户姓名" align="center" prop="name" /> <el-table-column label="合同状态" align="center" prop="status">
<el-table-column label="电话" align="center" prop="phone" /> <template slot-scope="scope">
<el-table-column label="服务时间" align="center" prop="serveTime" :formatter="serveTimeFormat" /> <el-tag
<el-table-column label="金额" align="center" prop="amount" /> :type="scope.row.status ? 'success' : 'danger'"
<el-table-column label="合同地址" align="center" prop="path" /> disable-transitions>
<el-table-column label="备注" align="center" prop="remark" /> {{scope.row.status ? '已签订':'未签订'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="客户姓名" align="center" prop="name"/>
<el-table-column label="证件号" align="center" prop="cusId"/>
<el-table-column label="电话" align="center" prop="phone"/>
<el-table-column label="服务时间" align="center" prop="serveTime" :formatter="serveTimeFormat"/>
<el-table-column label="金额" align="center" prop="amount"/>
<el-table-column label="合同地址" align="center" prop="path"/>
<el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"--> <!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['custom:contract:edit']"--> <!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>--> <!-- >修改</el-button>-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['custom:contract:remove']" v-hasPermi="['custom:contract:remove']"
>删除</el-button> >删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -117,10 +129,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="客户姓名" prop="name"> <el-form-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名" /> <el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话" /> <el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item> </el-form-item>
<el-form-item label="服务时间" prop="serveTime"> <el-form-item label="服务时间" prop="serveTime">
<el-select v-model="form.serveTime" placeholder="请选择服务时间"> <el-select v-model="form.serveTime" placeholder="请选择服务时间">
@ -133,13 +145,13 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="金额" prop="amount"> <el-form-item label="金额" prop="amount">
<el-input v-model="form.amount" placeholder="请输入金额" /> <el-input v-model="form.amount" placeholder="请输入金额"/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="文件路径" prop="path">--> <!-- <el-form-item label="文件路径" prop="path">-->
<!-- <el-input v-model="form.path" placeholder="请输入文件路径" />--> <!-- <el-input v-model="form.path" placeholder="请输入文件路径" />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -151,175 +163,184 @@
</template> </template>
<script> <script>
import { listContract, getContract, delContract, addContract, updateContract, exportContract } from "@/api/custom/contract"; import {
addContract,
delContract,
exportContract,
getContract,
listContract,
updateContract
} from "@/api/custom/contract";
export default { export default {
name: "Contract", name: "Contract",
data() { data() {
return { return {
// //
loading: true, loading: true,
// //
ids: [], ids: [],
// //
single: true, single: true,
// //
multiple: true, multiple: true,
// //
showSearch: false, showSearch: false,
// //
total: 0, total: 0,
// //
contractList: [], contractList: [],
// //
title: "", title: "",
// //
open: false, open: false,
// //
serveTimeOptions: [], serveTimeOptions: [],
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
id: null, id: null,
name: null, name: null,
phone: null, phone: null,
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
name: [ name: [
{ required: true, message: "客户姓名不能为空", trigger: "blur" } {required: true, message: "客户姓名不能为空", trigger: "blur"}
], ],
}
};
},
created() {
this.getList();
this.getDicts("cus_serve_time").then(response => {
this.serveTimeOptions = response.data;
});
},
methods: {
/** 查询合同列表 */
getList() {
this.loading = true;
listContract(this.queryParams).then(response => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
serveTimeFormat(row, column) {
return this.selectDictLabel(this.serveTimeOptions, row.serveTime);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
phone: null,
serveTime: null,
amount: null,
path: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
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
getContract(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改合同";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
} }
};
},
created() {
this.getList();
this.getDicts("cus_serve_time").then(response => {
this.serveTimeOptions = response.data;
}); });
}, },
/** 删除按钮操作 */ methods: {
handleDelete(row) { /** 查询合同列表 */
const ids = row.id || this.ids; getList() {
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", { this.loading = true;
listContract(this.queryParams).then(response => {
this.contractList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
serveTimeFormat(row, column) {
return this.selectDictLabel(this.serveTimeOptions, row.serveTime);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
phone: null,
serveTime: null,
amount: null,
path: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
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
getContract(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改合同";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
}
});
} else {
addContract(this.form).then(response => {
if (response.code === 200) {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return delContract(ids); return delContract(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}).catch(function() {}); }).catch(function () {
}, });
/** 导出按钮操作 */ },
handleExport() { /** 导出按钮操作 */
const queryParams = this.queryParams; handleExport() {
this.$confirm('是否确认导出所有合同数据项?', "警告", { const queryParams = this.queryParams;
this.$confirm('是否确认导出所有合同数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return exportContract(queryParams); return exportContract(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);
}).catch(function() {}); }).catch(function () {
});
}
} }
} };
};
</script> </script>

View File

@ -1,37 +1,179 @@
<template> <template>
<div v-if="show"> <div v-if="show" class="sign-contract-container">
<div class="contract-title">合同简要</div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名" prop="name"> <el-form-item label="服务方" style="margin: 0">
<el-input v-model="form.name" placeholder="请输入客户姓名"/> <span>深圳市胜唐科技有限公司</span>
</el-form-item>
<el-form-item label="服务费" style="margin: 0">
<span>{{form.amount}}</span>
</el-form-item>
<el-form-item label="服务时长" style="margin: 0">
<span>{{form.serveTime}}</span>
</el-form-item>
<el-form-item label="姓名" prop="userName">
<el-input v-model="form.userName" placeholder="请输入客户姓名"/>
</el-form-item>
<el-form-item label="证件号" prop="cusId">
<el-input v-model="form.cusId" placeholder="请输入证件号"/>
</el-form-item> </el-form-item>
<el-form-item label="电话" prop="phone"> <el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话"/> <el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" @click="submitForm">提交</el-button> <div>
<el-checkbox v-model="read" @change="handleRadioChange" style="margin-bottom: 12px">已阅读合同相关
</el-checkbox>
<span class="detail" @click="dialogVisible = true">详情</span>
</div>
<el-button type="primary" style="width: 100%" @click="submitForm" :disabled="!read">提交签约</el-button>
<el-dialog
title="服务合同"
:visible.sync="dialogVisible"
width="90%"
custom-class="contract_dialog"
center>
<div class="dialog-detail">
<p>甲方胜唐体控深圳市胜唐科技有限公司</p>
<p>乙方<b>{{form.name}}</b></p>
<p>甲乙双方本着诚信合作互惠互利的原则依据中华人民共和国有关法律经友好协商现就胜唐体控减肥咨询指导服务合作相关事宣达成一致协议以兹共同遵守
如果需要减脂的乙方未成年由应由乙方法定监护人代签本合同乙方享受同等法律权益</p>
<p>
第一条甲方资质与服务保证
<div class="line-rule">1甲方保证是在工商部门注册合法经营的正规公司</div>
<div class="line-rule">2甲方保证为乙方提供知名体重管理专家导师全程服务</div>
<div class="line-rule">3甲方保证按承诺的方式靠一日三餐吃瘦绝不使用仪器及针药亦不服用药物等达到双方约定效果</div>
<div class="line-rule">4甲方保证全程为乙方提供本合同所承诺的服务内容</div>
<div class="line-rule">5服务标准</div>
<div style="margin-left: 24px">a拥有体重管理专家导师亲自每天主动服务节假日除外</div>
<div style="margin-left: 24px">b享受免费赠送营养基础知识学习肥胖与生活习惯知识学习享受专家亲自培训初級自我管理体重知识</div>
</p>
<p>第二条 合作内容及费用
<div class="line-rule">11经甲乙双方协商确定乙方向甲方购买<b>{{form.serveTime}}</b>胜唐体控瘦身指导服务以下简称服务</div>
<div class="line-rule">12乙方向甲方购买<b>{{form.serveTime}}</b>经甲乙双方协商确定乙方向甲方支付疗程费用共为人民币<b>{{form.amount}}</b>大写<b>{{form.amountUppercase}}</b>
</div>
</p>
<p>第三条 服务期约定
<div class="line-rule">1服务时间阶段服务指导期服务跟踪期免费咨询期具体安排由甲方根据乙方的实际情况与乙方协商确定</div>
<div class="line-rule">2因不可抗拒的因素如意外怀孕等而暂停服务指导其后续服务期限由甲乙方协商确定</div>
<div class="line-rule">3减肥需要双方的配合在不是甲方技术问题的情况下乙方不执行营养师的指导导致没有达到预期效果责任由乙方承担根据个人体质不同在调理营养健康的前提下健康吃瘦25-35
</div>
<div class="line-rule">
4乙方应按甲方制定的饮食方案来饮食承诺在未与甲方沟通前不擅自吃方案之外的高热量高油高盐高糖等不利于健康和减脂的饮食服务期内擅自暴食导致体重上涨次数超过3次视为乙方主动放弃营养减脂且甲方无需免费延长服务时间
</div>
<div class="line-rule">
5乙方在一个疗程内享有2次暂停服务的机会在暂停前应与甲方沟通确认暂停前已减重斤数累积到总减重结果中在暂停结束后从新体重开始甲方服务乙方继续完成承诺的减重斤数包瘦斤数 - 暂停前已成功减重数
</div>
</p>
<p>公司地址深圳市宝安区西乡街道宝立方中心创意研发大厦B座708</p>
<p>联系电话0755-23213903</p>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleConfirm"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import {getFile} from "@/api/custom/contract"; import {getFile, signContract} from "@/api/custom/contract";
import {digitUppercase} from "../../../utils/ruoyi";
export default { export default {
name: 'sign', name: 'sign',
data() { data() {
const checkUserName = (rule, value, callback) => {
if (!value) {
return callback(new Error('姓名不能为空'))
}
if(value !== this.form.name){
return callback(new Error('输入姓名不匹配,请联系客服核对'))
}
callback();
}
const checkPhone = (rule, value, callback) => {
const phoneReg = /^1[3|4|5|7|8][0-9]{9}$/
if (!value) {
return callback(new Error('电话号码不能为空'))
}
setTimeout(() => {
// Number.isIntegeres6,
// +
if (!Number.isInteger(+value)) {
callback(new Error('请输入数字值'))
} else {
if (phoneReg.test(value)) {
callback()
} else {
callback(new Error('电话号码格式不正确'))
}
}
}, 100)
}
const checkcusId = (rule, value, callback) => {
const phoneReg = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/
if (!value) {
return callback(new Error('证件号码不能为空'))
}
setTimeout(() => {
// Number.isIntegeres6,
// +
if (!Number.isInteger(+value)) {
callback(new Error('请输入数字值'))
} else {
if (phoneReg.test(value)) {
callback()
} else {
callback(new Error('证件号码格式不正确'))
}
}
}, 100)
}
return { return {
show: false, show: false,
form: {}, form: {},
read: false,
dialogVisible: false,
serveTimeIdOption: [
{label: '7天', value: 7},
{label: '1个月', value: 30},
{label: '2个月', value: 60},
{label: '3个月', value: 90},
{label: '4个月', value: 120},
{label: '5个月', value: 150},
{label: '6个月', value: 180},
{label: '7个月', value: 210},
{label: '8个月', value: 240},
{label: '9个月', value: 270},
{label: '10个月', value: 300},
{label: '11个月', value: 330},
{label: '12个月', value: 360},
],
rules: { rules: {
name: [ userName: [
{required: true, message: "姓名不能为空", trigger: "blur"} {required: true, trigger: "blur", validator: checkUserName}
], ],
phone: [ phone: [
{required: true, message: "电话不能为空", trigger: "blur"} {required: true, trigger: "blur", validator: checkPhone}
],
cusId: [
{required: true, trigger: "blur", validator: checkcusId}
] ]
} }
} }
}, },
mounted() {
document.title = this.$route.meta.title
},
created() { created() {
this.getContract(); this.getContract();
}, },
@ -39,11 +181,15 @@
getContract() { getContract() {
const {pathname} = window.location; const {pathname} = window.location;
const id = pathname.substring(pathname.lastIndexOf('/') + 1); const id = pathname.substring(pathname.lastIndexOf('/') + 1);
console.log(id) // console.log(id)
getFile(id).then(result => { getFile(id).then(result => {
if (result.url) { if (result.url) {
this.$router.push(result.url); this.$router.push(result.url);
} else if (result.data) { } else if (result.data) {
this.form = result.data;
this.form.amount = parseInt(result.data.amount);
this.form.amountUppercase = digitUppercase(this.form.amount);
this.form.serveTime = this.serveTimeIdOption.find(obj => obj.value === parseInt(result.data.serveTime)).label
this.show = true; this.show = true;
} }
}) })
@ -51,20 +197,62 @@
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
this.$emit('handleOnSubmit', this.form); signContract(this.form).then(result => {
if (result.code === 200) {
// this.$router.push(result.url);
}
});
} }
}) })
} },
handleRadioChange(val) {
this.read = val;
},
handleConfirm() {
this.dialogVisible = false;
this.read = true;
},
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.dashboard-editor-container { .sign-contract-container {
font-family: Helvetica Neue, Helvetica, Arial, Microsoft Yahei, Hiragino Sans GB, Heiti SC, WenQuanYi Micro Hei, sans-serif;
padding: 32px; padding: 32px;
background-color: rgb(240, 242, 245); /*background-color: rgb(240, 242, 245);*/
position: relative; position: relative;
.contract-title {
text-align: center;
font-size: 20px;
margin-bottom: 32px;
}
.detail {
color: #0066cc;
cursor: pointer;
font-size: 14px;
}
.contract_dialog {
.dialog-detail {
height: 60vh;
margin-top: -12px;
margin-bottom: -12px;
overflow: auto;
}
}
.line-rule {
margin: 4px 0;
line-height: 18px;
}
.chart-wrapper { .chart-wrapper {
background: #fff; background: #fff;
padding: 16px 16px 0; padding: 16px 16px 0;

View File

@ -1,41 +0,0 @@
<template>
<div>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item>
</el-form>
<el-button type="primary" @click="submitForm">提交</el-button>
</div>
</template>
<script>
export default {
name: 'signContract',
data() {
return {
form: {},
rules: {
name: [
{required: true, message: "姓名不能为空", trigger: "blur"}
],
phone: [
{required: true, message: "电话不能为空", trigger: "blur"}
]
}
}
},
methods: {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.$emit('handleOnSubmit', this.form);
}
})
}
}
}
</script>