Commit 825bb511 by 胡悦

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

1 parent 4b28195f
<template>
<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
href='#'
@click='back'
......@@ -9,7 +9,7 @@
<gl-breadcrumb-item>{{List[0].value}}</gl-breadcrumb-item>
</gl-breadcrumb>
<gl-tabs
style="margin-top: 20px;"
style="margin-top: 20px;"
:tab-position="tabPosition"
v-model='activeName'
@tab-click='handleClick'
......@@ -18,10 +18,10 @@
label='基本信息'
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
class="detail-row"
:span="i.isMap || i.img? 24 : 12"
:span="i.isMap? 24 : 8"
v-for="(i, index) in List"
:key="index+''"
>
......@@ -166,10 +166,6 @@ export default {
label: '联系电话',
value: ''
}, {
label: 'POI位置点',
value: '',
isMap: true
}, {
name: 'phone',
label: '服务电话',
value: ''
......@@ -181,6 +177,10 @@ export default {
label: '商户LOGO',
value: '',
isImg: true
}, {
label: 'POI位置点',
value: '',
isMap: true
}
],
zoom: 12,
......@@ -416,9 +416,23 @@ export default {
}
.amap-demo {
height: 300px;
border: 1px solid #ebeef5;
border-radius: 10px;
}
.detail {
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{
/* color: #0000FF; */
......
......@@ -70,7 +70,7 @@ import notice from '@/common/notice'
export default {
name: 'businessGroup',
components: {
// Edit,
// Edit,
},
watch: {
dialogVisible(val) {
......
......@@ -54,7 +54,7 @@
remote
:name="`item.merchant${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}`"
:data-vv-as="`子商户`"
clearable
placeholder="请输入商户名称/商户号"
:remote-method="remoteChildList"
......@@ -74,7 +74,7 @@
<gl-select v-model="item.merchantType"
:name="`item.merchantType${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}类型`"
:data-vv-as="`子商户类型`"
clearable
placeholder="请选择">
<gl-option
......@@ -89,6 +89,7 @@
</gl-form-item>
</div>
<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-form>
<div slot="footer" class="dialog-footer">
......@@ -100,6 +101,7 @@
</template>
<script>
import { resetSearch } from '@/common/common'
import notice from '@/common/notice'
import { businessManagenMethods, groupDetailMethods, request } from '@/api'
export default {
......@@ -109,7 +111,8 @@ export default {
},
data() {
return {
tip: false,
tip: false, // 添加下一个子商户的提示
isAdd: false, // 添加子商户,需填写商户提示
addForm: {
merchant: '',
merchantType: ''
......@@ -125,17 +128,28 @@ export default {
businessList: [],
businessChildList: [],
addList: [
{
label: '子商户1',
merchant: '',
merchantType: ''
}
// {
// label: '子商户1',
// merchant: '',
// merchantType: ''
// }
]
}
},
watch: {
addDialogVisible(val) {
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() {
......@@ -145,6 +159,7 @@ export default {
// 确定按钮
ok() {
this.tip = false
this.isAdd = false
this.$validator.validateAll().then((result) => {
if (result) {
this.addList.forEach(item => {
......@@ -168,23 +183,38 @@ export default {
showAddDialog() {
this.$emit('addData')
setTimeout(() => {
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }]
this.addList = []
this.addForm = { merchant: '', merchantType: '' }
}, 400)
},
// 添加更多按钮
addMore() {
const len = this.addList.length - 1
if (this.addList[len].merchant == '' || this.addList[len].merchantType == '') {
this.tip = true
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
if (this.addList[len].merchant == '' || this.addList[len].merchantType == '') {
this.tip = true
} else {
this.tip = false
this.addList.push({
label: '子商户' + (this.addList.length + 1),
merchant: '',
merchantType: '',
show: true
})
}
}
} else {
this.tip = false
this.addList.push({
label: '子商户' + (this.addList.length + 1),
merchant: '',
merchantType: '',
show: true
})
this.isAdd = true
}
},
deleteBusiness(idx) {
......@@ -210,10 +240,13 @@ export default {
},
// 子商户远程搜索
remoteChildList(query) {
console.log(this.addForm.merchant)
console.log(query)
if (query !== '') {
this.childLoading = true
const params = {}
params.groupId = 1
params.merchantId = 11
params.searchWrod = query
params.method = groupDetailMethods.SearchChildList
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!