Commit 23554c1f by zhangquan

接口联调

1 parent 2c2615e0
......@@ -8824,6 +8824,11 @@
"integrity": "sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==",
"dev": true
},
"number-precision": {
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/number-precision/-/number-precision-1.6.0.tgz",
"integrity": "sha512-05OLPgbgmnixJw+VvEh18yNPUo3iyp4BEWJcrLu4X9W05KmMifN7Mu5exYvQXqxxeNWhvIF+j3Rij+HmddM/hQ=="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmmirror.com/oauth-sign/-/oauth-sign-0.9.0.tgz",
......
......@@ -15,6 +15,7 @@
"glsx-common": "^1.4.6",
"glsx-components": "^1.5.2",
"lodash": "^4.17.21",
"number-precision": "^1.6.0",
"vue": "^2.6.10",
"vue-quill-editor": "^3.0.6",
"vue-router": "^3.1.3",
......
import { http } from '@/main'
const CUR_BASE_URL = 'rop-scrm-equity/router'
const getContractListApi = params => {
params.method = `scrm.api.equity.service.contract.template.list`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
const saveContractTemplateApi = params => {
params.method = `scrm.api.equity.service.contract.template.update`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
const getContractDetailApi = params => {
params.method = `scrm.api.equity.service.contract.template.detail`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
const printContractApi = params => {
params.method = `scrm.api.equity.service.contract.template.printTest`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
export default {
getContractListApi,
saveContractTemplateApi,
getContractDetailApi,
printContractApi
}
\ No newline at end of file
<template>
<div class="bar-content">
<div class="editor-ctnr">
<label v-if="label" for="" class="content-label">{{label}}</label>
<div class="editor">
<quill-editor placeholder="请输入" ref="myQuillEditor" class="quill" v-model="value" :options="editorOption" @change="$emit('change', $event.html)"></quill-editor>
<div class="extend-bar" v-if="operateList && operateList.length">
<i class="el-icon-circle-plus extend-icon" @click="insertContent">购买条件</i>
<i v-for="item in operateList" :key="item.key" class="el-icon-circle-plus extend-icon" @click="insertContent(item.name, item.key, -1)">{{ item.name }}</i>
</div>
</div>
</div>
......@@ -16,6 +16,7 @@ import Label from '@/util/quillTool'
Quill.register(Label, true)
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import { cpSync } from 'fs'
export default {
name: 'FoldFrame',
components:{
......@@ -75,17 +76,41 @@ export default {
if(this.disable) this.$refs.myQuillEditor.quill.enable(false);
},
methods: {
insertContent(){
let quill = this.$refs.myQuillEditor.quill;
let length = quill.selection.savedRange.index;
quill.insertEmbed(length, 'label', 132);
quill.setSelection(length + 1);
}
insertContent(name, key, index){
let quill = this.$refs.myQuillEditor.quill;
let length = index >-1 ? index : quill.selection.savedRange.index
quill.insertEmbed(length, 'label', {name, key});
quill.setSelection(length + 1);
},
replaceText(){
let quill = this.$refs.myQuillEditor.quill;
if(!quill.container.innerText || !this.operateList?.length) return
let num = 0
this.operateList.forEach(item => {
console.log(item)
let subStr = item.key
let offset = 0;
do{
offset = quill.getText().indexOf(subStr, offset);
if(offset != -1){
// console.log(quill.container.innerText,111)
// this.insertContent(item.name, subStr, offset)
quill.updateContents([
{ retain: offset + num },
{ delete: subStr.length },
{ insert: { label: {name: item.name, key: subStr} } }
]);
num++
offset += item.name.length
}
}while(offset != -1)
})
},
}
}
</script>
<style lang="scss" scoped>
.bar-content{
.editor-ctnr{
.content-label{
width: 154px;
display: inline-block;
......@@ -123,12 +148,13 @@ export default {
border-top: none;
.extend-icon{
cursor: pointer;
margin-right: 10px;
&::before{
// font-size: 16px;
margin-right: 5px;
margin-right: 4px;
}
font-size: 14px;
color: #666;
color: #3f3b3b;
}
}
}
......
......@@ -28,7 +28,7 @@
},
url: {
type: String,
default: 'https://img02.glsx.com.cn/weapp/resource/saas/scrm/assets/glsx/logo_menu.png'
default: ''
},
attr: {
type: String,
......
import NP from 'number-precision'
const gradeObj = {
gradeConfigList: [
{
......@@ -82,12 +83,14 @@ export const handleGradeData = (dataFromApi, salePeriodList=[])=>{
const gradeList = ['0','1','2'] //三个区间等级,后端定义的
gradeList.forEach(item => {
const _target = gradeConfigList.find(o => o.priceGrade == item)
const { id, servicePeriod, maxPrice, minPrice, priceCoefficient } = _target || {}
let { id, servicePeriod, maxPrice, minPrice, priceCoefficient } = _target || {}
maxPrice = NP.divide(maxPrice || 0, 100)
minPrice = NP.divide(minPrice || 0, 100)
_gradeObj.gradeConfigList.push({ servicePeriod, priceGrade: item, maxPrice, minPrice, priceCoefficient, id })
})
_gradeObj.salePeriodData = salePeriodList.map(item=>{
const _target = element.gradeConfigList.find( o => o.servicePeriod == item)
return { servicePeriod: item, standardShelfCost: _target?.standardShelfCost, standardSalesCost: _target?.standardSalesCost}
return { servicePeriod: item, standardShelfCost: NP.divide(_target?.standardShelfCost || 0, 100), standardSalesCost: NP.divide(_target?.standardSalesCost || 0, 100)}
})
arr.push(_gradeObj)
});
......
......@@ -4,10 +4,11 @@ const Delta = Quill.imports.delta;
class Label extends Parchment.Embed {
static create(value) {
const node = super.create(value);
node.innerText = value;
const node = super.create(value.name);
node.setAttribute('keyName', value.key)
node.innerText = value.name;
node.contentEditable = 'false';
// this._addRemovalButton(node);
// this._addRemovalButton(node, value.key); //创建额外的标签,比如删除键
return node;
}
......@@ -15,15 +16,16 @@ class Label extends Parchment.Embed {
return node.childNodes[0].textContent;
}
static _addRemovalButton(node) {
const button = document.createElement('button');
button.innerText = 'x';
button.onclick = () => node.remove();
button.contentEditable = 'false';
node.appendChild(button);
static _addRemovalButton(node, key) {
// const button = document.createElement('button');
// button.innerText = 'x';
// button.onclick = () => node.remove();
// button.contentEditable = 'false';
// node.appendChild(button);
// Extra span forces the cursor to the end of the label, otherwise it appears inside the removal button
const span = document.createElement('span');
span.setAttribute('keyName', key)
span.innerText = '';
node.appendChild(span);
}
......
......@@ -3,20 +3,28 @@
<div class="global-title">编辑</div>
<div class="main">
<div class="edit-bar">
<FoldFrame name="Logo区域">
<div class="bar-content">
<Upload class="upload" name="Logo图:" :defaultStyle="{width:'208px'}"></Upload>
<FoldFrame :name="item.title" v-for="item in contentList" :key="item.key">
<div v-if="item.type=='img'" class="bar-content">
<div v-if="item.key=='electronicSealUrl'" class="input-content">
<label for="">服务主体:</label>
<el-input size="small" type="text" v-model="contentObj.serviceSubject" ></el-input>
</div>
<Upload @uploadSuccess="uploadSuccess" @delImage="delImage" class="upload" :name="item.label+':'" :attr="item.key" :url="contentObj[item.key]" :defaultStyle="{width:'208px'}"></Upload>
<span class="upload-tip">建议高度:48px</span>
</div>
</FoldFrame>
<FoldFrame name="合同介绍区域">
<Editor label="标题和介绍:" v-model="obj.content"></Editor>
<div v-if="item.type=='richText'" class="bar-content">
<div v-if="item.key=='contractIntroduce'" class="input-content">
<label for="">合同标题:</label>
<el-input size="small" type="text" v-model="contentObj.contractTitle"></el-input>
</div>
<Editor :ref="item.key+'Ref'" :operateList="item.key=='useConditions' ? placeholderList : []" :label="item.label" v-model="contentObj[item.key]"></Editor>
</div>
</FoldFrame>
</div>
<div class="preview-area">
<div v-html="obj.content"></div>
</div>
<button @click="cons">dasdasdas</button>
<div class="footer-btn">
<el-button @click="handelCancel">取消</el-button>
<el-button type="primary" @click="commitTemplate">提交</el-button>
</div>
</div>
</div>
</template>
......@@ -34,20 +42,130 @@ export default {
},
data() {
return {
obj: {
content: ''
}
placeholderList: [],
contentObj: {
id: '',
logoUrl: '',
contractTitle: '',
contractIntroduce: '',
relevantDefinition: '',
useConditions: '',
serviceScope: '',
exclusionLiability: '',
serviceData: '',
specialStatement: '',
serviceSubject: '',
electronicSealUrl: ''
},
contentList: [
{
title: 'Logo区域',
label: 'Logo图',
key: 'logoUrl',
type: 'img'
},
// {
// label: '合同标题区域',
// label: '合同标题',
// key: 'contractTitle',
// type: 'input'
// },
{
title: '合同介绍区域',
label: '合同介绍:',
key: 'contractIntroduce',
type: 'richText'
},
{
title: '相关定义区域',
label: '相关定义:',
key: 'relevantDefinition',
type: 'richText'
},
{
title: '使用条件区域',
label: '使用条件:',
key: 'useConditions',
type: 'richText'
},
{
title: '服务范围区域',
label: '服务范围:',
key: 'serviceScope',
type: 'richText'
},
{
title: '除外责任区域',
label: '除外责任:',
key: 'exclusionLiability',
type: 'richText'
},
{
title: '服务所需资料区域',
label: '服务所需资料:',
key: 'serviceData',
type: 'richText'
},
{
title: '特别声明区域',
label: '特别声明:',
key: 'specialStatement',
type: 'richText'
},
{
title: '电子章图片区域',
label: '电子章图片',
key: 'electronicSealUrl',
type: 'img'
},
]
}
},
created(){
},
mounted() {
this.getContractDetail()
},
methods: {
cons(){
console.log(this.obj.content)
}
getContractDetail() {
this.$apis.contractManager.getContractDetailApi({id: this.$route.params.id}).then(res => {
if(res && res.templateConfig){
this.placeholderList = res.placeholderList
for(const key in this.contentObj){
this.contentObj[key] = res.templateConfig[key]
}
this.$nextTick(()=>{
this.$refs.useConditionsRef[0].replaceText()
})
}
})
},
handelCancel(){
console.log(this.$refs.useConditionsRef)
this.getParams()
},
getParams(){
const params = this.$common.utils.deepClone(this.contentObj)
params.useConditions = params.useConditions.replace(/<span.*?class.*?keyname\=\"(.*?)\".*?<\/span>/g,'$1')
return params
},
commitTemplate(){
const params = this.getParams()
this.$apis.contractManager.saveContractTemplateApi({...params}).then(res => {
if(res){
this.$message.success('操作成功')
}
})
},
uploadSuccess(e){
this.contentObj[e.attr] = e.url
},
delImage(e){
this.contentObj[e.attr] = ''
},
}
}
</script>
......@@ -55,6 +173,27 @@ export default {
<style lang="scss" scoped>
.container{
background-color: #fff;
.footer-btn{
text-align: center;
margin-top: 16px;
}
.input-content{
display: flex;
align-items: center;
margin-bottom: 24px;
label{
flex-shrink: 0;
width: 154px;
white-space: nowrap;
text-align: right;
font-weight: 400;
font-size: 14px;
color: #333333;
}
/deep/ .el-input__inner{
width: 342px;
}
}
.main{
padding: 10px 20px 32px;
.edit-bar{
......
......@@ -19,19 +19,23 @@
</span>
</GLTable>
</div>
<pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog>
</div>
</template>
<script>
import * as dayjs from 'dayjs'
import utils from '../../util/util'
import pdfDialog from '@/views/beforeSale/pdfDialog'
export default {
name: 'equityList',
components:{
pdfDialog
},
data() {
return {
size: 'small',
isPdfVisible: false,
buttonList: [
{
type: 'el-button',
......@@ -42,7 +46,7 @@
type: 'text'
},
listeners: {
click: row => this.addClause(2,row.scope)
click: row => this.handlePdf(row.scope)
}
},
{
......@@ -59,7 +63,7 @@
}
],
searchForm: {
serviceName: '',
merchantName: '',
createdDate: '',
updatedDate: ''
},
......@@ -67,7 +71,7 @@
searchFormData: [
{
label: '商户名称',
name: 'serveiceName',
name: 'merchantName',
type: 'input',
isClear: true,
},
......@@ -89,39 +93,39 @@
}
],
// 表格
getListApi: this.$apis.serviceConfig.getEquityList,
getListApi: this.$apis.contractManager.getContractListApi,
tableParams: {
listName: 'list',
tableOption: true,
tableColumns: [
{
label: '合同编号',
prop: 'sno',
prop: 'id',
width: 200
},
{
label: '商户名称',
prop: 'serviceName'
prop: 'merchantName'
},
{
label: '创建时间',
prop: 'createDate',
prop: 'createdDate',
width: 200,
formatter: cellValue => {
return cellValue.createDate ? dayjs(cellValue.createDate).format('YYYY-MM-DD HH:mm:ss') : '--'
return cellValue.createdDate ? dayjs(cellValue.createdDate).format('YYYY-MM-DD HH:mm:ss') : '--'
}
},
{
label: '更新时间',
prop: 'updateDate',
prop: 'updatedDate',
width: 200,
formatter: cellValue => {
return cellValue.updateDate ? dayjs(cellValue.updateDate).format('YYYY-MM-DD HH:mm:ss') : '--'
return cellValue.updatedDate ? dayjs(cellValue.updatedDate).format('YYYY-MM-DD HH:mm:ss') : '--'
}
},
{
label: '操作人',
prop: 'updateBy',
prop: 'updatedBy',
width: 140
}
]
......@@ -137,12 +141,12 @@
getParams() {
let params = JSON.parse(JSON.stringify(this.searchForm))
if (this.searchForm?.createdDate?.length) {
params.minCreateTime = new Date(this.searchForm.createdDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.maxCreateTime = new Date(this.searchForm.createdDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
params.beginCreateDate = new Date(this.searchForm.createdDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endCreateDate = new Date(this.searchForm.createdDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
if (this.searchForm?.updatedDate?.length) {
params.minUpdateTime = new Date(this.searchForm.updatedDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.maxUpdateTime = new Date(this.searchForm.updatedDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
params.beginUpdateDate = new Date(this.searchForm.updatedDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
params.endUpdateDate = new Date(this.searchForm.updatedDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
}
delete params.createdDate
delete params.updatedDate
......@@ -155,6 +159,25 @@
resolve()
})
},
handlePdfClose() {
this.isPdfVisible = !this.isPdfVisible
},
// 打印
handlePdf(row) {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.contractManager.printContractApi({ packageCode : row.packageCode , merchantId: row.merchantId }).then(res => {
this.pdfUrl = res
this.handlePdfClose()
loading.close()
})
},
// 导出
handleExport() {
......
......@@ -90,6 +90,7 @@ import Upload from '@/components/Upload'
import ServicesTable from './components/ServicesTable'
import Editor from '@/components/Editor'
import { addGradeItem, handleGradeData } from '@/util/gradeData'
import NP from 'number-precision'
export default {
name: 'addService',
components:{
......@@ -292,10 +293,14 @@ export default {
const {id, serviceGrade, serviceOverview, serviceDetail, salePeriodData, gradeConfigList} = item
let _gradeConfigList = []
gradeConfigList.forEach(ele => {
const {priceGrade, priceCoefficient, minPrice, maxPrice} = ele
let {priceGrade, priceCoefficient, minPrice, maxPrice} = ele
salePeriodData.forEach(element => {
const {id, servicePeriod, standardSalesCost, standardShelfCost} = element
_gradeConfigList.push({id, priceGrade, priceCoefficient, minPrice, maxPrice, servicePeriod, standardSalesCost, standardShelfCost})
let {id, servicePeriod, standardSalesCost, standardShelfCost} = element
minPrice = NP.times(minPrice || 0, 100)
maxPrice = NP.times(maxPrice || 0, 100)
standardSalesCost = NP.times(standardSalesCost || 0, 100)
standardShelfCost = NP.times(standardShelfCost || 0, 100)
_gradeConfigList.push({id, priceGrade, priceCoefficient, minPrice , maxPrice, servicePeriod, standardSalesCost, standardShelfCost})
})
})
let _gradeObj = {
......@@ -311,7 +316,7 @@ export default {
serviceCode: this.routeInfo.serviceCode,
serviceName: this.routeInfo.serviceName,
gradeList: _gradeList,
monthlyInsuranceCost: this.gradeFormObj.monthlyInsuranceCost
monthlyInsuranceCost: NP.times(this.gradeFormObj.monthlyInsuranceCost || 0, 100)
}
return params
},
......@@ -355,7 +360,7 @@ export default {
}
this.routeInfo.serviceCode = res.serviceCode
this.routeInfo.serviceName = res.serviceName
this.gradeFormObj.monthlyInsuranceCost = res.monthlyInsuranceCost
this.gradeFormObj.monthlyInsuranceCost = NP.divide((res.monthlyInsuranceCost || 0) ,100)
}
})
},
......
......@@ -38,13 +38,7 @@
<td :colspan="tableData.salePeriodData.length*2 + 3">
<div class="desc">
<label for="">服务条款概述:</label>
<el-input
:disabled="disable"
type="textarea"
:rows="3"
placeholder="请输入内容"
v-model="tableData.serviceOverview">
</el-input>
<Editor :disable="disable" :editorOption="overviewOption" v-model="tableData.serviceOverview"></Editor>
</div>
</td>
</tr>
......@@ -52,13 +46,7 @@
<td :colspan="tableData.salePeriodData.length*2+3">
<div class="desc">
<label for="">规格详细描述:</label>
<el-input
:disabled="disable"
type="textarea"
:rows="3"
placeholder="请输入内容"
v-model="tableData.serviceDetail">
</el-input>
<Editor :disable="disable" :editorOption="DetailOption" v-model="tableData.serviceDetail"></Editor>
</div>
</td>
</tr>
......@@ -67,8 +55,12 @@
</template>
<script>
import Editor from '@/components/Editor'
export default {
name: 'ServicesTable',
components:{
Editor,
},
props: {
name: {
type: String,
......@@ -95,10 +87,42 @@
},
data() {
return {
overviewOption: {
placeholder: '请输入服务条款概述',
modules: {
toolbar: false,
clipboard: {
// 粘贴版,处理粘贴时候的自带样式
matchers: [[Node.ELEMENT_NODE, this.HandleCustomMatcher]],
},
}
},
DetailOption: {
placeholder: '请输入规格详细描述',
modules: {
toolbar: false,
clipboard: {
// 粘贴版,处理粘贴时候的自带样式
matchers: [[Node.ELEMENT_NODE, this.HandleCustomMatcher]],
},
}
}
}
},
methods: {
HandleCustomMatcher(node, Delta) {
// 文字、图片等,从别处复制而来,清除自带样式,转为纯文本
let ops = []
Delta.ops.forEach(op => {
if (op.insert && typeof op.insert === 'string') {
ops.push({
insert: op.insert,
})
}
})
Delta.ops = ops
return Delta
},
}
}
</script>
......@@ -142,6 +166,23 @@
label{
white-space: nowrap;
}
/deep/ .bar-content{
height: 64px;
width: 100%;
.editor{
height: 100%;
width: 100%;
.quill-editor{
height: 100%;
.ql-container{
border-radius: 4px;
.ql-editor{
padding: 8px;
}
}
}
}
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!