提交生成合同

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

@ -42,65 +42,77 @@
size="mini"
@click="handleAdd"
v-hasPermi="['custom:contract:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['custom:contract:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['custom:contract:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['custom:contract:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- icon="el-icon-download"-->
<!-- size="mini"-->
<!-- @click="handleExport"-->
<!-- v-hasPermi="['custom:contract:export']"-->
<!-- >导出</el-button>-->
<!-- </el-col>-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="contractList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="合同编号" align="center" prop="id" />
<el-table-column label="客户姓名" align="center" prop="name" />
<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 type="selection" width="55" align="center" />-->
<el-table-column label="合同编号" align="center" prop="id"/>
<el-table-column label="合同状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag
:type="scope.row.status ? 'success' : 'danger'"
disable-transitions>
{{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">
<template slot-scope="scope">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['custom:contract:edit']"-->
<!-- >修改</el-button>-->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['custom:contract:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -117,10 +129,10 @@
<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-item label="客户姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名" />
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
</el-form-item>
<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 label="服务时间" prop="serveTime">
<el-select v-model="form.serveTime" placeholder="请选择服务时间">
@ -133,13 +145,13 @@
</el-select>
</el-form-item>
<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 label="文件路径" prop="path">-->
<!-- <el-input v-model="form.path" placeholder="请输入文件路径" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="文件路径" prop="path">-->
<!-- <el-input v-model="form.path" placeholder="请输入文件路径" />-->
<!-- </el-form-item>-->
<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>
<div slot="footer" class="dialog-footer">
@ -151,175 +163,184 @@
</template>
<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 {
name: "Contract",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: false,
// 总条数
total: 0,
// 合同表格数据
contractList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 服务时间字典
serveTimeOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
name: null,
phone: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
name: [
{ 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();
}
});
}
export default {
name: "Contract",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: false,
// 总条数
total: 0,
// 合同表格数据
contractList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 服务时间字典
serveTimeOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
id: null,
name: null,
phone: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
name: [
{required: true, message: "客户姓名不能为空", trigger: "blur"}
],
}
};
},
created() {
this.getList();
this.getDicts("cus_serve_time").then(response => {
this.serveTimeOptions = response.data;
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
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();
}
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除合同编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
}).then(function () {
return delContract(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(function() {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有合同数据项?', "警告", {
}).catch(function () {
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有合同数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
}).then(function () {
return exportContract(queryParams);
}).then(response => {
this.download(response.msg);
}).catch(function() {});
}).catch(function () {
});
}
}
}
};
};
</script>

View File

@ -1,37 +1,179 @@
<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-item label="姓名" prop="name">
<el-input v-model="form.name" placeholder="请输入客户姓名"/>
<el-form-item label="服务方" style="margin: 0">
<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 label="电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入电话"/>
</el-form-item>
</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>
</template>
<script>
import {getFile} from "@/api/custom/contract";
import {getFile, signContract} from "@/api/custom/contract";
import {digitUppercase} from "../../../utils/ruoyi";
export default {
name: 'sign',
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.isInteger是es6验证数字是否为整数的方法,实际输入的数字总是识别成字符串
// 所以在前面加了一个+实现隐式转换
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.isInteger是es6验证数字是否为整数的方法,实际输入的数字总是识别成字符串
// 所以在前面加了一个+实现隐式转换
if (!Number.isInteger(+value)) {
callback(new Error('请输入数字值'))
} else {
if (phoneReg.test(value)) {
callback()
} else {
callback(new Error('证件号码格式不正确'))
}
}
}, 100)
}
return {
show: false,
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: {
name: [
{required: true, message: "姓名不能为空", trigger: "blur"}
userName: [
{required: true, trigger: "blur", validator: checkUserName}
],
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() {
this.getContract();
},
@ -39,11 +181,15 @@
getContract() {
const {pathname} = window.location;
const id = pathname.substring(pathname.lastIndexOf('/') + 1);
console.log(id)
// console.log(id)
getFile(id).then(result => {
if (result.url) {
this.$router.push(result.url);
} 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;
}
})
@ -51,20 +197,62 @@
submitForm() {
this.$refs["form"].validate(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>
<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;
background-color: rgb(240, 242, 245);
/*background-color: rgb(240, 242, 245);*/
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 {
background: #fff;
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>