Commit f00dd1d7 by zhangquan

修改所有门店适用编辑

1 parent 1c3466da
......@@ -3,7 +3,7 @@
<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 v-if="routeInfo.type!=2" class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<el-button v-if="routeInfo.type==1 || (routeInfo.type==3 && routeInfo.merchantId) " class="el-icon-plus" @click="selectMerchant()">选择门店</el-button>
<div
class="merchantNameLabel"
v-if="formObj.merchantName && formObj.merchantId"
......@@ -11,6 +11,7 @@
<p>所属门店</p>
<div class="merchantName ellipsis-1">{{ formObj.merchantName }}</div>
</div>
<div v-if="routeInfo.type!=1 && !routeInfo.merchantId">所有门店适用</div>
</div>
<div class="equity-class" slot="selectEquity">
<div class="equity-area" v-for="item in formObj.serviceList" :key="item.serviceCode">
......@@ -181,31 +182,42 @@ export default {
})
},
submit(){
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 })
}
if(this.routeInfo.type!=1 && !this.routeInfo.merchantId){
this.$refs.submitRef.$refs.formRef.validateField('serviceList', valid => {
if(valid) return; //检验单个规则空才是通过
this.addConfigApi()
})
let params = {
merchantId,
merchantName,
serviceIterm
}
this.$apis.serviceConfig.craeteEquity(params).then(res => {
if(res?.length){
this.$message.success('操作成功')
this.$router.push('/serviceConfig/index')
}
}else{
this.$refs.submitRef.$refs.formRef.validate(valid => {
console.log(222, valid)
if(!valid) return;
this.addConfigApi()
})
}
},
addConfigApi(){
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')
}
})
}
}
......
......@@ -210,12 +210,13 @@
addClause(type, row) {
// 1新增 2查看 3编辑
const { id } = row || {}
const { id, merchantId } = row || {}
let query = {
type
}
if(type!=1){
query.id = id
query.merchantId = merchantId
}
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!