Commit 2c2615e0 by zhangquan

联调

1 parent dc154ed5
...@@ -82,6 +82,16 @@ const getServicesItemsList = params => { ...@@ -82,6 +82,16 @@ const getServicesItemsList = params => {
}) })
} }
const exportServicesItemsApi = params => {
params.method = `scrm.api.equity.service.items.pages.export`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const createCommonConfig = params => { const createCommonConfig = params => {
params.method = `scrm.api.equity.service.items.common.config.insert.or.update` params.method = `scrm.api.equity.service.items.common.config.insert.or.update`
return http({ return http({
...@@ -113,6 +123,16 @@ const addServicesProject = params => { ...@@ -113,6 +123,16 @@ const addServicesProject = params => {
}) })
} }
const getServiceDetailApi = params => {
params.method = `scrm.api.equity.service.items.detail`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
const getSpecificaListApi = params => { const getSpecificaListApi = params => {
params.method = `scrm.api.equity.service.items.grade.list` params.method = `scrm.api.equity.service.items.grade.list`
return http({ return http({
...@@ -122,6 +142,17 @@ const getSpecificaListApi = params => { ...@@ -122,6 +142,17 @@ const getSpecificaListApi = params => {
sign: true sign: true
}) })
} }
const addGradeApi = params => {
params.method = `scrm.api.equity.service.items.grade.insert.or.update`
return http({
url: CUR_BASE_URL,
method: 'POST',
data: params,
sign: true
})
}
export default { export default {
get4SList, get4SList,
getEquityList, getEquityList,
...@@ -131,8 +162,11 @@ export default { ...@@ -131,8 +162,11 @@ export default {
updateEquity, updateEquity,
getEquityDetail, getEquityDetail,
getServicesItemsList, getServicesItemsList,
exportServicesItemsApi,
createCommonConfig, createCommonConfig,
getCommonConfig, getCommonConfig,
addServicesProject, addServicesProject,
getSpecificaListApi getServiceDetailApi,
getSpecificaListApi,
addGradeApi
} }
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="bar-content"> <div class="bar-content">
<label for="" class="content-label">{{label}}</label> <label v-if="label" for="" class="content-label">{{label}}</label>
<div class="editor"> <div class="editor">
<quill-editor ref="myQuillEditor" class="quill" v-model="obj[attr]" :options="editorOption" @change="onEditorChange($event)"></quill-editor> <quill-editor placeholder="请输入" ref="myQuillEditor" class="quill" v-model="value" :options="editorOption" @change="$emit('change', $event.html)"></quill-editor>
<div class="extend-bar"> <div class="extend-bar" v-if="operateList && operateList.length">
<i class="el-icon-circle-plus extend-icon" @click="insertContent">购买条件</i> <i class="el-icon-circle-plus extend-icon" @click="insertContent">购买条件</i>
</div> </div>
</div> </div>
<el-input type="text" v-model="obj[attr]" name="" id=""></el-input>
<button @click="sss">ss</button>
</div> </div>
</template> </template>
...@@ -23,23 +21,34 @@ export default { ...@@ -23,23 +21,34 @@ export default {
components:{ components:{
quillEditor, quillEditor,
}, },
model: {
prop: 'value',
event: 'change'
},
props: { props: {
obj: { value: {
type: Object type: Object
}, },
attr: { label:{
type: String, type: String,
default: '', default: '',
}, },
label:{ operateList: {
type: String, type: Array,
default: '', default: ()=>{
return []
}, },
editorOption: { },
type: String, disable: {
default: ()=>{ type: Boolean,
return { default: false
modules: { },
editorOption: {
type: String,
default: ()=>{
return {
placeholder: '请输入内容',
modules: {
toolbar: { toolbar: {
container: [ container: [
['bold', 'italic', 'underline', 'strike'], ['bold', 'italic', 'underline', 'strike'],
...@@ -53,36 +62,30 @@ export default { ...@@ -53,36 +62,30 @@ export default {
// ['link', 'image'] // ['link', 'image']
], ],
} }
} }
} }
} }
} }
}, },
data() { data() {
return { return {
} }
}, },
mounted(){
if(this.disable) this.$refs.myQuillEditor.quill.enable(false);
},
methods: { methods: {
insertContent(){ insertContent(){
let quill = this.$refs.myQuillEditor.quill; let quill = this.$refs.myQuillEditor.quill;
let length = quill.selection.savedRange.index; let length = quill.selection.savedRange.index;
quill.insertEmbed(length, 'label', 132); quill.insertEmbed(length, 'label', 132);
quill.setSelection(length + 1); quill.setSelection(length + 1);
},
onEditorChange(e){
console.log(e)
},
sss(){
console.log(this.obj)
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.bar-content{ .bar-content{
background: #F9F9F9;
padding: 20px;
margin-bottom: 10px;
.content-label{ .content-label{
width: 154px; width: 154px;
display: inline-block; display: inline-block;
...@@ -99,7 +102,6 @@ export default { ...@@ -99,7 +102,6 @@ export default {
background-color: #fff; background-color: #fff;
.quill{ .quill{
background-color: #fff; background-color: #fff;
display: inline-block;
border-color: #E5E5E5; border-color: #E5E5E5;
/deep/ .ql-toolbar.ql-snow, /deep/ .ql-container.ql-snow{ /deep/ .ql-toolbar.ql-snow, /deep/ .ql-container.ql-snow{
border-color: #E5E5E5; border-color: #E5E5E5;
......
const gradeObj = {
gradeConfigList: [
{
servicePeriod: '',
priceGrade: '0',
maxPrice: '',
minPrice: '',
priceCoefficient: '',
standardShelfCost: '',
standardSalesCost: ''
},
{
servicePeriod: '',
priceGrade: '1',
maxPrice: '',
minPrice: '',
priceCoefficient: '',
standardShelfCost: '',
standardSalesCost: ''
},
{
servicePeriod: '',
priceGrade: '2',
maxPrice: '',
minPrice: '',
priceCoefficient: '',
standardShelfCost: '',
standardSalesCost: ''
},
],
salePeriodData: [],
serviceGrade: 'A',
serviceOverview: '',
serviceDetail: ''
}
const deepClone = (obj)=> {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== 'object') return obj
// Handle Date
if (obj instanceof Date) {
const copy = new Date()
copy.setTime(obj.getTime())
return copy
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {}
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = deepClone(obj[attr])
}
}
return copy
}
throw new Error("Unable to clone obj! Its type isn't supported.")
}
export const addGradeItem = (grade='A' , salePeriodList=[])=>{
let _gradeObj = deepClone(gradeObj)
_gradeObj.serviceGrade = grade
_gradeObj.salePeriodData = salePeriodList.map(item=>{
return { servicePeriod: item, standardShelfCost: '', standardSalesCost: ''}
})
console.log(_gradeObj)
return _gradeObj
}
export const handleGradeData = (dataFromApi, salePeriodList=[])=>{
console.log(dataFromApi)
const data = deepClone(dataFromApi)
let arr = []
data.forEach(element => {
const { serviceOverview, serviceDetail, serviceGrade, gradeConfigList, id } = element
let _gradeObj = {
id,
serviceOverview,
serviceDetail,
serviceGrade,
gradeConfigList: []
}
const gradeList = ['0','1','2'] //三个区间等级,后端定义的
gradeList.forEach(item => {
const _target = gradeConfigList.find(o => o.priceGrade == item)
const { id, servicePeriod, maxPrice, minPrice, priceCoefficient } = _target || {}
_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}
})
arr.push(_gradeObj)
});
return arr
}
\ No newline at end of file \ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</div> </div>
</FoldFrame> </FoldFrame>
<FoldFrame name="合同介绍区域"> <FoldFrame name="合同介绍区域">
<Editor label="标题和介绍:" :obj="obj" attr="content"></Editor> <Editor label="标题和介绍:" v-model="obj.content"></Editor>
</FoldFrame> </FoldFrame>
</div> </div>
<div class="preview-area"> <div class="preview-area">
......
...@@ -5,59 +5,59 @@ ...@@ -5,59 +5,59 @@
<th rowspan="2">规格</th> <th rowspan="2">规格</th>
<th rowspan="2">价格区间(万元)</th> <th rowspan="2">价格区间(万元)</th>
<th rowspan="2">价格系数</th> <th rowspan="2">价格系数</th>
<th colspan="2" v-for="(item, index) in list" :key="index">{{item.name}}</th> <th colspan="2" v-for="(item, index) in tableData.salePeriodData" :key="index">{{item.servicePeriod}}年版</th>
</tr> </tr>
<tr> <tr>
<template v-for="(item, index) in list"> <template v-for="(item, index) in tableData.salePeriodData">
<th :key="index">上架成本</th> <th :key="index">上架成本</th>
<th :key="index">销售成本</th> <th :key="index">销售成本</th>
</template> </template>
</tr> </tr>
<tr> <tr>
<td rowspan="4">A</td> <td rowspan="4">{{ tableData.serviceGrade }}</td>
<td>标准</td> <td>标准</td>
<td>-</td> <td>-</td>
<template v-for="(item, index) in list"> <template v-for="(item, index) in tableData.salePeriodData">
<td :key="index"><el-input></el-input></td> <td :key="index"><el-input :disabled="disable" v-model="item.standardShelfCost"></el-input></td>
<td :key="index"> <el-input></el-input></td> <td :key="index"> <el-input :disabled="disable" v-model="item.standardSalesCost"></el-input></td>
</template> </template>
</tr> </tr>
<tr v-for="(item, index) in [1,2,3]" :key="index"> <tr v-for="(item, index) in tableData.gradeConfigList" :key="index">
<td class="price"> <td class="price">
<el-input></el-input> <el-input :disabled="disable" v-model="item.minPrice"></el-input>
<span class="sign">-</span> <span class="sign">-</span>
<el-input></el-input> <el-input :disabled="disable" v-model="item.maxPrice"></el-input>
</td> </td>
<td><el-input></el-input></td> <td><el-input :disabled="disable" v-model="item.priceCoefficient"></el-input></td>
<td></td> <template v-for="(ele, eIdx) in tableData.salePeriodData">
<td></td> <td :key="eIdx">{{ Number((ele.standardShelfCost * item.priceCoefficient).toFixed(2))}}</td>
<td></td> <td :key="eIdx">{{ Number((ele.standardSalesCost * item.priceCoefficient).toFixed(2))}}</td>
<td></td> </template>
<td></td>
<td></td>
</tr> </tr>
<tr class="desc-wrap"> <tr class="desc-wrap">
<td colspan="9"> <td :colspan="tableData.salePeriodData.length*2 + 3">
<div class="desc"> <div class="desc">
<label for="">服务条款概述:</label> <label for="">服务条款概述:</label>
<el-input <el-input
:disabled="disable"
type="textarea" type="textarea"
:rows="3" :rows="3"
placeholder="请输入内容" placeholder="请输入内容"
v-model="textarea"> v-model="tableData.serviceOverview">
</el-input> </el-input>
</div> </div>
</td> </td>
</tr> </tr>
<tr class="desc-wrap"> <tr class="desc-wrap">
<td colspan="9"> <td :colspan="tableData.salePeriodData.length*2+3">
<div class="desc"> <div class="desc">
<label for="">规格详细描述:</label> <label for="">规格详细描述:</label>
<el-input <el-input
:disabled="disable"
type="textarea" type="textarea"
:rows="3" :rows="3"
placeholder="请输入内容" placeholder="请输入内容"
v-model="textarea"> v-model="tableData.serviceDetail">
</el-input> </el-input>
</div> </div>
</td> </td>
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</table> </table>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'ServicesTable', name: 'ServicesTable',
...@@ -74,6 +74,16 @@ ...@@ -74,6 +74,16 @@
type: String, type: String,
default: '' default: ''
}, },
tableData: {
type: String,
default: ()=>{
return {}
}
},
disable: {
type: Boolean,
default: false
},
url: { url: {
type: String, type: String,
default: '' default: ''
...@@ -85,23 +95,6 @@ ...@@ -85,23 +95,6 @@
}, },
data() { data() {
return { return {
list:[
{
name: '1年版',
shelfPrice: '2',
salePrice: '3'
},
{
name: '2年版',
shelfPrice: '4',
salePrice: '5'
},
{
name: '3年版',
shelfPrice: '6',
salePrice: '7'
}
]
} }
}, },
methods: { methods: {
...@@ -111,6 +104,10 @@ ...@@ -111,6 +104,10 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table-wrap{ .table-wrap{
/deep/ .el-input__inner{
padding: 0 2px;
text-align: center;
}
th, td{ th, td{
border: 1px solid #E5E5E5; border: 1px solid #E5E5E5;
padding: 0 16px; padding: 0 16px;
...@@ -135,7 +132,7 @@ ...@@ -135,7 +132,7 @@
margin: 0 6px; margin: 0 6px;
} }
.el-input{ .el-input{
width: 42px; width: 50px;
} }
} }
.desc-wrap{ .desc-wrap{
......
...@@ -130,7 +130,10 @@ ...@@ -130,7 +130,10 @@
{ {
label: '可销售服务年限', label: '可销售服务年限',
minWidth: 280, minWidth: 280,
prop: 'serviceContent' prop: 'salePeriod',
formatter: cellValue => {
return cellValue.salePeriod?.length ? cellValue.salePeriod.split(',').join('、') : '--'
}
}, },
{ {
label: '规格数量', label: '规格数量',
...@@ -199,7 +202,7 @@ ...@@ -199,7 +202,7 @@
// 导出 // 导出
handleExport() { handleExport() {
var params = this.getParams() var params = this.getParams()
this.$apis.serviceConfig.exportEquityApi(params).then(res => { this.$apis.serviceConfig.exportServicesItemsApi(params).then(res => {
// window.open(res) // window.open(res)
let tempaa = utils.getExplorer() let tempaa = utils.getExplorer()
if (tempaa == 'QQ') { if (tempaa == 'QQ') {
...@@ -229,13 +232,12 @@ ...@@ -229,13 +232,12 @@
addClause(type, row) { addClause(type, row) {
// 1新增 2查看 3编辑 // 1新增 2查看 3编辑
const { id, merchantId } = row || {} const { id } = row || {}
let query = { let query = {
type type
} }
if(type!=1){ if(type!=1){
query.id = id query.id = id
query.merchantId = merchantId
} }
const queryStr = encodeURIComponent(JSON.stringify(query)) const queryStr = encodeURIComponent(JSON.stringify(query))
this.$router.push('/serviceConfig/addService/' + queryStr) this.$router.push('/serviceConfig/addService/' + queryStr)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!