Commit 1c3466da by zhangquan

联调完成

1 parent 151a508c
...@@ -42,7 +42,27 @@ const getServiceList = params => { ...@@ -42,7 +42,27 @@ const getServiceList = params => {
} }
const craeteEquity = params => { const craeteEquity = params => {
params.method = `scrm.api.equity.serviceterms.insertorupdate` params.method = `scrm.api.equity.serviceterms.insert`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const updateEquity = params => {
params.method = `scrm.api.equity.serviceterms.update`
return http({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
const getEquityDetail = params => {
params.method = `scrm.api.equity.serviceterms.detail`
return http({ return http({
url: 'rop-scrm-equity/router', url: 'rop-scrm-equity/router',
method: 'POST', method: 'POST',
...@@ -56,5 +76,7 @@ export default { ...@@ -56,5 +76,7 @@ export default {
getEquityList, getEquityList,
exportEquityApi, exportEquityApi,
getServiceList, getServiceList,
craeteEquity craeteEquity,
updateEquity,
getEquityDetail
} }
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,18 @@ ...@@ -3,12 +3,18 @@
<div class="main-warp"> <div class="main-warp">
<glsx-combi-form ref="submitRef" labelWidth="154px" defaultWidth="284px" :isInline="false" :formObj="formObj" :formData="formData" :formRules="editRule"> <glsx-combi-form ref="submitRef" labelWidth="154px" defaultWidth="284px" :isInline="false" :formObj="formObj" :formData="formData" :formRules="editRule">
<div slot="merchantName"> <div slot="merchantName">
<el-button class="el-icon-plus" @click="selectMerchant()">选择门店</el-button> <el-button v-if="routeInfo.type!=2" class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<div v-if="formObj.merchantName">{{ formObj.merchantName }}</div> <div
class="merchantNameLabel"
v-if="formObj.merchantName && formObj.merchantId"
>
<p>所属门店</p>
<div class="merchantName ellipsis-1">{{ formObj.merchantName }}</div>
</div>
</div> </div>
<div class="equity-class" slot="selectEquity"> <div class="equity-class" slot="selectEquity">
<div class="equity-area" v-for="item in serviceList" :key="item.serviceCode"> <div class="equity-area" v-for="item in formObj.serviceList" :key="item.serviceCode">
<el-checkbox v-model="item.checked">{{item.serviceName}}</el-checkbox> <el-checkbox @change="checkField" v-model="item.checked">{{item.serviceName}}</el-checkbox>
<div v-if="item.checked"> <div v-if="item.checked">
<el-input class="desc" v-model="item.summary" placeholder="请输入概述"></el-input> <el-input class="desc" v-model="item.summary" placeholder="请输入概述"></el-input>
<quill-editor class="quill" v-model="item.serviceContent" :options="editorOption"></quill-editor> <quill-editor class="quill" v-model="item.serviceContent" :options="editorOption"></quill-editor>
...@@ -26,8 +32,8 @@ ...@@ -26,8 +32,8 @@
> >
</select-store> </select-store>
</div> </div>
<div class="page-btm-btn"> <div v-if="routeInfo.type!=2" class="page-btm-btn">
<el-button class="custom_black">取消</el-button> <el-button class="custom_black" @click="back">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button> <el-button type="primary" @click="submit">提交</el-button>
</div> </div>
</div> </div>
...@@ -39,7 +45,7 @@ import selectStore from './components/selectStore.vue' ...@@ -39,7 +45,7 @@ import selectStore from './components/selectStore.vue'
import { quillEditor } from 'vue-quill-editor' import { quillEditor } from 'vue-quill-editor'
import 'quill/dist/quill.core.css' import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css' import 'quill/dist/quill.snow.css'
export default { export default {
name: 'addClause', name: 'addClause',
components:{ components:{
glsxCombiForm, glsxCombiForm,
...@@ -49,23 +55,35 @@ import 'quill/dist/quill.snow.css' ...@@ -49,23 +55,35 @@ import 'quill/dist/quill.snow.css'
data() { data() {
return { return {
size: 'small', size: 'small',
txt: '', routeInfo: {},
serviceList: [], serviceList: [],
relateStoreVisible: false, relateStoreVisible: false,
selectedList: [], selectedList: [],
editorOption: { editorOption: {
placeholder: '请输入具体条款内容', placeholder: '请输入具体条款内容',
modules: { modules: {
toolbar: false toolbar: false,
clipboard: {
// 粘贴版,处理粘贴时候的自带样式
matchers: [[Node.ELEMENT_NODE, this.HandleCustomMatcher]],
},
} }
}, },
editRule:{ editRule:{
merchantId: { required: true, message: '请选择门店', trigger: 'change' }, merchantId: { required: true, message: '请选择门店', trigger: 'change' },
selectedList: { required: true, message: '至少选择一个权益', trigger: 'change' }, serviceList: { trigger: 'blur', validator: (rule, value, callback) => {
const target = value?.find(item => item.checked)
if (!target) {
callback(new Error("至少选择一个权益"));
} else {
callback();
}
} },
}, },
formObj: { formObj: {
merchantId: '', merchantId: '',
merchantName: '' merchantName: '',
serviceList: []
}, },
formData: [ formData: [
{ {
...@@ -75,25 +93,58 @@ import 'quill/dist/quill.snow.css' ...@@ -75,25 +93,58 @@ import 'quill/dist/quill.snow.css'
}, },
{ {
label: '选中权益:', label: '选中权益:',
name:'selectedList', name:'serviceList',
addHtml:'selectEquity' addHtml:'selectEquity'
} }
] ]
} }
}, },
created() { created() {
const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
if(this.routeInfo?.id) {
this.getServiceDetail()
}else{
this.getServiceList() this.getServiceList()
}
}, },
mounted() { mounted() {
}, },
methods: { 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
},
getServiceDetail(){
const { id } = this.routeInfo
this.$apis.serviceConfig.getEquityDetail({id}).then(res => {
if(res?.id) {
const { id, merchantId, merchantName, serviceCode, serviceContent, serviceName, summary} = res
let list = [{ checked: true, serviceCode, serviceContent, serviceName, summary }]
this.formObj = {
id,
merchantId,
merchantName,
serviceList: list
}
}
})
},
getServiceList(){ getServiceList(){
this.$apis.serviceConfig.getServiceList({}).then(res => { this.$apis.serviceConfig.getServiceList({}).then(res => {
console.log(res)
if(res?.length){ if(res?.length){
this.serviceList = res.map(item => { this.formObj.serviceList = res.map(item => {
item.checked=false item.checked=false
item.serviceContent = '' item.serviceContent = ''
item.summary = '' item.summary = ''
...@@ -106,19 +157,55 @@ import 'quill/dist/quill.snow.css' ...@@ -106,19 +157,55 @@ import 'quill/dist/quill.snow.css'
this.relateStoreVisible = !this.relateStoreVisible this.relateStoreVisible = !this.relateStoreVisible
}, },
handleRelateStoreConfirm(e = {}){ handleRelateStoreConfirm(e = {}){
this.formObj = {...e} const {merchantId, merchantName} = e
this.formObj.merchantId = merchantId
this.formObj.merchantName = merchantName
this.$refs.submitRef.$refs.formRef.validateField('merchantId')
this.selectMerchant() this.selectMerchant()
}, },
checkField(){
this.$refs.submitRef.$refs.formRef.validateField('serviceList')
},
back(){
this.$router.back()
},
editService(){
const { id, merchantId, merchantName, serviceList } = this.formObj
const { serviceCode, serviceContent, serviceName, summary } = serviceList?.[0] || {}
const params = { id, merchantId, merchantName, serviceCode, serviceContent, serviceName, summary}
this.$apis.serviceConfig.updateEquity(params).then(res => {
if(res){
this.$message.success('修改成功')
this.$router.push('/serviceConfig/index')
}
})
},
submit(){ submit(){
this.$refs.submitRef.$refs.formRef.validate(valid => {
if(!valid) return;
if(this.routeInfo.id){
this.editService()
return;
}
let { merchantId, merchantName } = this.formObj let { merchantId, merchantName } = this.formObj
let serviceList = {...this.serviceList} let serviceIterm = []
this.formObj.serviceList.forEach(item => {
if(item.checked) {
let {serviceCode, serviceContent, serviceName, summary } = item
serviceIterm.push({serviceCode, serviceContent, serviceName, summary })
}
})
let params = { let params = {
merchantId, merchantId,
merchantName, merchantName,
serviceList: serviceList.map(item => item.checked) serviceIterm
} }
this.$apis.serviceConfig.craeteEquity(params).then(res => { this.$apis.serviceConfig.craeteEquity(params).then(res => {
console.log() if(res?.length){
this.$message.success('操作成功')
this.$router.push('/serviceConfig/index')
}
})
}) })
} }
} }
...@@ -128,9 +215,33 @@ import 'quill/dist/quill.snow.css' ...@@ -128,9 +215,33 @@ import 'quill/dist/quill.snow.css'
<style lang="scss" scoped> <style lang="scss" scoped>
.container{ .container{
.main-warp{ .main-warp{
height: calc(100vh - 200px); // height: calc(100vh - 200px);
padding: 32px 20px; padding: 32px 20px;
background-color: #fff; background-color: #fff;
.merchantNameLabel {
width: 510px;
color: #1d1d1d;
// margin-left: 50px;
padding: 16px;
margin-top: 8px;
border: 1px solid #e6e6e6;
border-radius: 8rpx;
background: #f9f9f9;
.merchantName {
box-sizing: border-box;
width: 284px;
height: 32px;
background: #ffffff;
border: 1px solid #e6e6e6;
border-radius: 4px;
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 14px;
color: #999999;
line-height: 32px;
padding: 0 8px;
}
}
.equity-class{ .equity-class{
.equity-area{ .equity-area{
.desc{ .desc{
......
...@@ -165,7 +165,6 @@ export default { ...@@ -165,7 +165,6 @@ export default {
}, },
methods: { methods: {
getList(pageCon) { getList(pageCon) {
console.log(pageCon, 'pageCon')
pageCon && (this.pageConfig = pageCon) pageCon && (this.pageConfig = pageCon)
var params = { var params = {
merchantId: this.merchantId, merchantId: this.merchantId,
...@@ -173,9 +172,7 @@ export default { ...@@ -173,9 +172,7 @@ export default {
...this.pageConfig ...this.pageConfig
// merchantId: '44209390', // merchantId: '44209390',
} }
console.log(params)
this.$apis.serviceConfig.get4SList(params).then(res => { this.$apis.serviceConfig.get4SList(params).then(res => {
console.log(res)
this.storeList = res.list this.storeList = res.list
this.total = res.total this.total = res.total
// // this.storeList = res.staffUnitList // // this.storeList = res.staffUnitList
...@@ -183,11 +180,9 @@ export default { ...@@ -183,11 +180,9 @@ export default {
// // // 添加序号 // // // 添加序号
// pageConfig // pageConfig
let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1) let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1)
console.log(nowIndex)
this.storeList.forEach((item, index) => { this.storeList.forEach((item, index) => {
item.idx = index + 1 + nowIndex item.idx = index + 1 + nowIndex
}) })
console.log(this.storeList)
// this.$refs.staffRef.tableHeightValues = '460px' // this.$refs.staffRef.tableHeightValues = '460px'
// }) // })
}) })
...@@ -203,7 +198,6 @@ export default { ...@@ -203,7 +198,6 @@ export default {
this.$refs.staffRef.tableHeightValues = '460px' this.$refs.staffRef.tableHeightValues = '460px'
}, },
handleClick(val) { handleClick(val) {
console.log(val)
// let { merchantId, merchantName } =val // let { merchantId, merchantName } =val
this.merchantId = val.merchantNo this.merchantId = val.merchantNo
this.merchantName = val.merchantName this.merchantName = val.merchantName
......
...@@ -7,11 +7,14 @@ ...@@ -7,11 +7,14 @@
<div class="operate_wrap"> <div class="operate_wrap">
<span class="table_title">配置列表</span> <span class="table_title">配置列表</span>
<div class="operate_btn"> <div class="operate_btn">
<el-button :size="size" type="primary" @click="addClause()">新增</el-button> <el-button :size="size" type="primary" @click="addClause(1)">新增</el-button>
<el-button :size="size" @click="handleExport">导出</el-button> <el-button :size="size" @click="handleExport">导出</el-button>
</div> </div>
</div> </div>
<GLTable ref="equityRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn"> <GLTable ref="equityRef" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="serviceContent" slot-scope="scope">
<div v-html="scope.scope.serviceContent"></div>
</div>
<span slot="auth-button" slot-scope="scope" :data="scope.scope"> <span slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton> <GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span> </span>
...@@ -40,7 +43,7 @@ ...@@ -40,7 +43,7 @@
type: 'text' type: 'text'
}, },
listeners: { listeners: {
click: row => this.download(row.scope) click: row => this.addClause(2,row.scope)
} }
}, },
{ {
...@@ -52,7 +55,7 @@ ...@@ -52,7 +55,7 @@
type: 'text' type: 'text'
}, },
listeners: { listeners: {
click: row => this.download(row.scope) click: row => this.addClause(3,row.scope)
} }
} }
], ],
...@@ -114,10 +117,11 @@ ...@@ -114,10 +117,11 @@
{ {
label: '条款描述', label: '条款描述',
prop: 'serviceContent', prop: 'serviceContent',
addHtml: 'serviceContent'
}, },
{ {
label: '使用说明', label: '使用说明',
prop: 'summary' prop: 'instruct'
}, },
{ {
label: '创建时间', label: '创建时间',
...@@ -152,7 +156,6 @@ ...@@ -152,7 +156,6 @@
methods: { methods: {
getParams() { getParams() {
let params = JSON.parse(JSON.stringify(this.searchForm)) let params = JSON.parse(JSON.stringify(this.searchForm))
console.log(params,'params')
if (this.searchForm?.createdDate?.length) { if (this.searchForm?.createdDate?.length) {
params.minCreateTime = new Date(this.searchForm.createdDate[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' 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.maxCreateTime = new Date(this.searchForm.createdDate[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
...@@ -205,9 +208,17 @@ ...@@ -205,9 +208,17 @@
this.handleSearch() this.handleSearch()
}, },
addClause() { addClause(type, row) {
let urlpara = 1 // 1新增 2查看 3编辑
this.$router.push('/serviceConfig/addClause/' + urlpara) const { id } = row || {}
let query = {
type
}
if(type!=1){
query.id = id
}
const queryStr = encodeURIComponent(JSON.stringify(query))
this.$router.push('/serviceConfig/addClause/' + queryStr)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!