Commit 1c3466da by zhangquan

联调完成

1 parent 151a508c
......@@ -42,7 +42,7 @@ const getServiceList = 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',
......@@ -51,10 +51,32 @@ const craeteEquity = params => {
})
}
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({
url: 'rop-scrm-equity/router',
method: 'POST',
data: params,
sign: true
})
}
export default {
get4SList,
getEquityList,
exportEquityApi,
getServiceList,
craeteEquity
craeteEquity,
updateEquity,
getEquityDetail
}
\ No newline at end of file
......@@ -3,12 +3,18 @@
<div class="main-warp">
<glsx-combi-form ref="submitRef" labelWidth="154px" defaultWidth="284px" :isInline="false" :formObj="formObj" :formData="formData" :formRules="editRule">
<div slot="merchantName">
<el-button class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<div v-if="formObj.merchantName">{{ formObj.merchantName }}</div>
<el-button v-if="routeInfo.type!=2" class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<div
class="merchantNameLabel"
v-if="formObj.merchantName && formObj.merchantId"
>
<p>所属门店</p>
<div class="merchantName ellipsis-1">{{ formObj.merchantName }}</div>
</div>
</div>
<div class="equity-class" slot="selectEquity">
<div class="equity-area" v-for="item in serviceList" :key="item.serviceCode">
<el-checkbox v-model="item.checked">{{item.serviceName}}</el-checkbox>
<div class="equity-area" v-for="item in formObj.serviceList" :key="item.serviceCode">
<el-checkbox @change="checkField" v-model="item.checked">{{item.serviceName}}</el-checkbox>
<div v-if="item.checked">
<el-input class="desc" v-model="item.summary" placeholder="请输入概述"></el-input>
<quill-editor class="quill" v-model="item.serviceContent" :options="editorOption"></quill-editor>
......@@ -26,8 +32,8 @@
>
</select-store>
</div>
<div class="page-btm-btn">
<el-button class="custom_black">取消</el-button>
<div v-if="routeInfo.type!=2" class="page-btm-btn">
<el-button class="custom_black" @click="back">取消</el-button>
<el-button type="primary" @click="submit">提交</el-button>
</div>
</div>
......@@ -39,7 +45,7 @@ import selectStore from './components/selectStore.vue'
import { quillEditor } from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
export default {
export default {
name: 'addClause',
components:{
glsxCombiForm,
......@@ -49,23 +55,35 @@ import 'quill/dist/quill.snow.css'
data() {
return {
size: 'small',
txt: '',
routeInfo: {},
serviceList: [],
relateStoreVisible: false,
selectedList: [],
editorOption: {
placeholder: '请输入具体条款内容',
modules: {
toolbar: false
toolbar: false,
clipboard: {
// 粘贴版,处理粘贴时候的自带样式
matchers: [[Node.ELEMENT_NODE, this.HandleCustomMatcher]],
},
}
},
editRule:{
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: {
merchantId: '',
merchantName: ''
merchantName: '',
serviceList: []
},
formData: [
{
......@@ -75,25 +93,58 @@ import 'quill/dist/quill.snow.css'
},
{
label: '选中权益:',
name:'selectedList',
name:'serviceList',
addHtml:'selectEquity'
}
]
}
},
created() {
this.getServiceList()
const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
if(this.routeInfo?.id) {
this.getServiceDetail()
}else{
this.getServiceList()
}
},
mounted() {
},
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(){
this.$apis.serviceConfig.getServiceList({}).then(res => {
console.log(res)
if(res?.length){
this.serviceList = res.map(item => {
this.formObj.serviceList = res.map(item => {
item.checked=false
item.serviceContent = ''
item.summary = ''
......@@ -106,19 +157,55 @@ import 'quill/dist/quill.snow.css'
this.relateStoreVisible = !this.relateStoreVisible
},
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()
},
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(){
let { merchantId, merchantName } = this.formObj
let serviceList = {...this.serviceList}
let params = {
merchantId,
merchantName,
serviceList: serviceList.map(item => item.checked)
}
this.$apis.serviceConfig.craeteEquity(params).then(res => {
console.log()
this.$refs.submitRef.$refs.formRef.validate(valid => {
if(!valid) return;
if(this.routeInfo.id){
this.editService()
return;
}
let { merchantId, merchantName } = this.formObj
let serviceIterm = []
this.formObj.serviceList.forEach(item => {
if(item.checked) {
let {serviceCode, serviceContent, serviceName, summary } = item
serviceIterm.push({serviceCode, serviceContent, serviceName, summary })
}
})
let params = {
merchantId,
merchantName,
serviceIterm
}
this.$apis.serviceConfig.craeteEquity(params).then(res => {
if(res?.length){
this.$message.success('操作成功')
this.$router.push('/serviceConfig/index')
}
})
})
}
}
......@@ -128,9 +215,33 @@ import 'quill/dist/quill.snow.css'
<style lang="scss" scoped>
.container{
.main-warp{
height: calc(100vh - 200px);
// height: calc(100vh - 200px);
padding: 32px 20px;
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-area{
.desc{
......
......@@ -165,7 +165,6 @@ export default {
},
methods: {
getList(pageCon) {
console.log(pageCon, 'pageCon')
pageCon && (this.pageConfig = pageCon)
var params = {
merchantId: this.merchantId,
......@@ -173,9 +172,7 @@ export default {
...this.pageConfig
// merchantId: '44209390',
}
console.log(params)
this.$apis.serviceConfig.get4SList(params).then(res => {
console.log(res)
this.storeList = res.list
this.total = res.total
// // this.storeList = res.staffUnitList
......@@ -183,11 +180,9 @@ export default {
// // // 添加序号
// pageConfig
let nowIndex = this.pageConfig.pageSize * (this.pageConfig.currentPage - 1)
console.log(nowIndex)
this.storeList.forEach((item, index) => {
item.idx = index + 1 + nowIndex
})
console.log(this.storeList)
// this.$refs.staffRef.tableHeightValues = '460px'
// })
})
......@@ -203,7 +198,6 @@ export default {
this.$refs.staffRef.tableHeightValues = '460px'
},
handleClick(val) {
console.log(val)
// let { merchantId, merchantName } =val
this.merchantId = val.merchantNo
this.merchantName = val.merchantName
......
......@@ -7,11 +7,14 @@
<div class="operate_wrap">
<span class="table_title">配置列表</span>
<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>
</div>
</div>
<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">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span>
......@@ -40,7 +43,7 @@
type: 'text'
},
listeners: {
click: row => this.download(row.scope)
click: row => this.addClause(2,row.scope)
}
},
{
......@@ -52,7 +55,7 @@
type: 'text'
},
listeners: {
click: row => this.download(row.scope)
click: row => this.addClause(3,row.scope)
}
}
],
......@@ -114,10 +117,11 @@
{
label: '条款描述',
prop: 'serviceContent',
addHtml: 'serviceContent'
},
{
label: '使用说明',
prop: 'summary'
prop: 'instruct'
},
{
label: '创建时间',
......@@ -152,7 +156,6 @@
methods: {
getParams() {
let params = JSON.parse(JSON.stringify(this.searchForm))
console.log(params,'params')
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'
......@@ -205,9 +208,17 @@
this.handleSearch()
},
addClause() {
let urlpara = 1
this.$router.push('/serviceConfig/addClause/' + urlpara)
addClause(type, row) {
// 1新增 2查看 3编辑
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!