Commit 825bb511 by 胡悦

修改商户分组新增商户逻辑

1 parent 4b28195f
<template> <template>
<div class="detail"> <div class="detail">
<gl-breadcrumb style="font-size: 20px;background: #f0f0f0;padding: 5px 10px;border-radius: 10px;display: inline-block;" separator='/'> <gl-breadcrumb class="detail-bread" style="" separator='/'>
<gl-breadcrumb-item><a <gl-breadcrumb-item><a
href='#' href='#'
@click='back' @click='back'
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
label='基本信息' label='基本信息'
name='first' name='first'
> >
<gl-col :span="24" style="border: 1px solid #ebeef5;background: #fafafa;padding: 10px 20px;"> <gl-col :span="24" class="detail-basic">
<gl-col <gl-col
class="detail-row" class="detail-row"
:span="i.isMap || i.img? 24 : 12" :span="i.isMap? 24 : 8"
v-for="(i, index) in List" v-for="(i, index) in List"
:key="index+''" :key="index+''"
> >
...@@ -166,10 +166,6 @@ export default { ...@@ -166,10 +166,6 @@ export default {
label: '联系电话', label: '联系电话',
value: '' value: ''
}, { }, {
label: 'POI位置点',
value: '',
isMap: true
}, {
name: 'phone', name: 'phone',
label: '服务电话', label: '服务电话',
value: '' value: ''
...@@ -181,6 +177,10 @@ export default { ...@@ -181,6 +177,10 @@ export default {
label: '商户LOGO', label: '商户LOGO',
value: '', value: '',
isImg: true isImg: true
}, {
label: 'POI位置点',
value: '',
isMap: true
} }
], ],
zoom: 12, zoom: 12,
...@@ -416,9 +416,23 @@ export default { ...@@ -416,9 +416,23 @@ export default {
} }
.amap-demo { .amap-demo {
height: 300px; height: 300px;
border: 1px solid #ebeef5;
border-radius: 10px;
} }
.detail { .detail {
margin: 12px; margin: 12px;
font-size: 14px;
}
.detail-bread {
background: #f0f0f0;
padding: 5px 10px;
border-radius: 10px;
display: inline-block;
}
.detail-basic {
border: 1px solid #ebeef5;
background: #fafafa;
padding: 10px 20px;
} }
.detail a{ .detail a{
/* color: #0000FF; */ /* color: #0000FF; */
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
remote remote
:name="`item.merchant${idx+1}`" :name="`item.merchant${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''" v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}`" :data-vv-as="`子商户`"
clearable clearable
placeholder="请输入商户名称/商户号" placeholder="请输入商户名称/商户号"
:remote-method="remoteChildList" :remote-method="remoteChildList"
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<gl-select v-model="item.merchantType" <gl-select v-model="item.merchantType"
:name="`item.merchantType${idx+1}`" :name="`item.merchantType${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''" v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}类型`" :data-vv-as="`子商户类型`"
clearable clearable
placeholder="请选择"> placeholder="请选择">
<gl-option <gl-option
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
</gl-form-item> </gl-form-item>
</div> </div>
<span v-show="tip" class="error" style="float:right; margin-right: 43px;">{{ '请填写上一条子商户数据' }}</span> <span v-show="tip" class="error" style="float:right; margin-right: 43px;">{{ '请填写上一条子商户数据' }}</span>
<span v-show="isAdd" class="error" style="float:right; margin-right: 43px;">{{ '请填商户数据' }}</span>
<gl-button @click="addMore">添加更多</gl-button> <gl-button @click="addMore">添加更多</gl-button>
</gl-form> </gl-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -100,6 +101,7 @@ ...@@ -100,6 +101,7 @@
</template> </template>
<script> <script>
import { resetSearch } from '@/common/common'
import notice from '@/common/notice' import notice from '@/common/notice'
import { businessManagenMethods, groupDetailMethods, request } from '@/api' import { businessManagenMethods, groupDetailMethods, request } from '@/api'
export default { export default {
...@@ -109,7 +111,8 @@ export default { ...@@ -109,7 +111,8 @@ export default {
}, },
data() { data() {
return { return {
tip: false, tip: false, // 添加下一个子商户的提示
isAdd: false, // 添加子商户,需填写商户提示
addForm: { addForm: {
merchant: '', merchant: '',
merchantType: '' merchantType: ''
...@@ -125,17 +128,28 @@ export default { ...@@ -125,17 +128,28 @@ export default {
businessList: [], businessList: [],
businessChildList: [], businessChildList: [],
addList: [ addList: [
{ // {
label: '子商户1', // label: '子商户1',
merchant: '', // merchant: '',
merchantType: '' // merchantType: ''
} // }
] ]
} }
}, },
watch: { watch: {
addDialogVisible(val) { addDialogVisible(val) {
this.$validator.errors.clear() this.$validator.errors.clear()
},
'addForm.merchant'(val) {
if (this.addList.length !== 0) {
this.addList.forEach(item => {
for(var j in item) {
if (j == 'merchant' || j == 'merchantType') {
item[j] = ''
}
}
})
}
} }
}, },
mounted() { mounted() {
...@@ -145,6 +159,7 @@ export default { ...@@ -145,6 +159,7 @@ export default {
// 确定按钮 // 确定按钮
ok() { ok() {
this.tip = false this.tip = false
this.isAdd = false
this.$validator.validateAll().then((result) => { this.$validator.validateAll().then((result) => {
if (result) { if (result) {
this.addList.forEach(item => { this.addList.forEach(item => {
...@@ -168,12 +183,23 @@ export default { ...@@ -168,12 +183,23 @@ export default {
showAddDialog() { showAddDialog() {
this.$emit('addData') this.$emit('addData')
setTimeout(() => { setTimeout(() => {
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }] this.addList = []
this.addForm = { merchant: '', merchantType: '' } this.addForm = { merchant: '', merchantType: '' }
}, 400) }, 400)
}, },
// 添加更多按钮 // 添加更多按钮
addMore() { addMore() {
console.log(this.addForm.merchant)
if (this.addForm.merchant) {
this.isAdd = false
if (this.addList.length === 0) {
this.addList.push({
label: '子商户' + (this.addList.length + 1),
merchant: '',
merchantType: '',
show: true
})
} else {
const len = this.addList.length - 1 const len = this.addList.length - 1
if (this.addList[len].merchant == '' || this.addList[len].merchantType == '') { if (this.addList[len].merchant == '' || this.addList[len].merchantType == '') {
this.tip = true this.tip = true
...@@ -186,6 +212,10 @@ export default { ...@@ -186,6 +212,10 @@ export default {
show: true show: true
}) })
} }
}
} else {
this.isAdd = true
}
}, },
deleteBusiness(idx) { deleteBusiness(idx) {
this.addList.splice(idx, 1) this.addList.splice(idx, 1)
...@@ -210,10 +240,13 @@ export default { ...@@ -210,10 +240,13 @@ export default {
}, },
// 子商户远程搜索 // 子商户远程搜索
remoteChildList(query) { remoteChildList(query) {
console.log(this.addForm.merchant)
console.log(query)
if (query !== '') { if (query !== '') {
this.childLoading = true this.childLoading = true
const params = {} const params = {}
params.groupId = 1 params.groupId = 1
params.merchantId = 11
params.searchWrod = query params.searchWrod = query
params.method = groupDetailMethods.SearchChildList params.method = groupDetailMethods.SearchChildList
request.req(params).then(res => { request.req(params).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!