Commit 80261b22 by wangql

提交代码

2 parents fc26783d dbc6d2b8
...@@ -23,6 +23,13 @@ function jumpLink(url, params, _this) { ...@@ -23,6 +23,13 @@ function jumpLink(url, params, _this) {
// document.getElementById('child_iframe_1192').src=url + urlEncode(params) // document.getElementById('child_iframe_1192').src=url + urlEncode(params)
} }
function resetSearch(obj) {
for (var item in obj) {
obj[item] = ''
}
}
export { export {
jumpLink jumpLink,
resetSearch
} }
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
// import Vue from 'vue' // import Vue from 'vue'
import { groupDetailMethods, request } from '@/api' import { groupDetailMethods, request } from '@/api'
import AddBusiness from './addBusiness' import AddBusiness from './addBusiness'
import { resetSearch } from '@/common/common'
import { CityArea } from '../components' import { CityArea } from '../components'
export default { export default {
name: 'detail', name: 'detail',
...@@ -284,11 +285,11 @@ export default { ...@@ -284,11 +285,11 @@ export default {
}, },
// 重置搜索 // 重置搜索
searchReset() { searchReset() {
this.$refs['searchParams'].resetFields() // this.$refs['searchParams'].resetFields()
this.eventBus.$emit('reset') this.eventBus.$emit('reset')
this.searchParams.provinceId = '' // this.times = []
this.searchParams.cityId = '' resetSearch(this.searchParams)
this.times = [] console.log(this.getParams())
}, },
addDialog() { addDialog() {
this.addDialogVisible = !this.addDialogVisible this.addDialogVisible = !this.addDialogVisible
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page.sync="pageCount" :current-page.sync="pageNum"
:page-sizes="[10, 20, 30, 40]" :page-sizes="[10, 20, 30, 40]"
:page-size="pageSize" :page-size="pageSize"
layout="sizes, total, ->, prev, pager, next, jumper" layout="sizes, total, ->, prev, pager, next, jumper"
...@@ -88,7 +88,7 @@ export default { ...@@ -88,7 +88,7 @@ export default {
}, },
// 分页所需参数-start // 分页所需参数-start
totalCount: 10, totalCount: 10,
pageCount: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
// 分页所需参数-end // 分页所需参数-end
ListTableData: { ListTableData: {
...@@ -153,8 +153,8 @@ export default { ...@@ -153,8 +153,8 @@ export default {
// 获取页面参数 // 获取页面参数
getParams() { getParams() {
const params = this.$deep_clone(this.merchantSearch) const params = this.$deep_clone(this.merchantSearch)
params.pageSize = this.pageSize params.pageSize = this.pageNum
params.pageCount = this.pageCount params.pageCount = this.pageSize
return params return params
}, },
// 接口请求-start // 接口请求-start
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,7 @@ export default {
this.getList() this.getList()
}, },
handleCurrentChange(val) { handleCurrentChange(val) {
this.pageCount = val this.pageNum = val
this.getList() this.getList()
}, },
reset(params) { reset(params) {
...@@ -207,6 +207,7 @@ export default { ...@@ -207,6 +207,7 @@ export default {
handleSearchHide(hide) { handleSearchHide(hide) {
this.reset(this.merchantSearch) this.reset(this.merchantSearch)
hide && this.handleSearch() hide && this.handleSearch()
console.log(this.merchantSearch)
}, },
// 搜索 // 搜索
handleSearchComfirm() { handleSearchComfirm() {
......
<template>
<div>
<gl-dialog
title="添加商户"
:visible.sync="addDialogVisible"
width="400px"
:before-close="showAddDialog">
<gl-form
ref="addForm" :model="addForm"
label-width="100px"
:rules="rules">
<gl-form-item label="商户:" prop="merchant">
<gl-select
v-model="addForm.merchant"
filterable
remote
clearable
name="merchant"
placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号"
v-validate="'required'"
:remote-method="remoteList"
:loading="loading">
<gl-option
v-for="item in businessList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
</gl-option>
</gl-select>
<span v-show="errorBags.has('merchant')" class="error">{{ errorBags.first('merchant') }}</span>
</gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType">
<gl-select v-model="addForm.merchantType"
name="merchantType"
data-vv-as="商户类型"
v-validate="'required'"
placeholder="请搜索">
<gl-option
v-for="item in merchantTypeList"
:key="item.confId"
:label="item.confKey"
:value="item.confId">
</gl-option>
</gl-select>
<span v-show="errorBags.has('merchantType')" class="error">{{ errorBags.first('merchantType') }}</span>
</gl-form-item>
<div v-for="(item, idx) in addList" :key="idx">
<gl-form-item :label="item.label + ':'">
<gl-select
v-model="item.merchant"
filterable
remote
:name="`item.merchant${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}`"
clearable
placeholder="请输入商户名称/商户号"
:remote-method="remoteChildList"
:loading="childLoading">
<gl-option
v-for="item in businessChildList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
</gl-option>
</gl-select>
<i v-show="item.show" class="el-icon-delete delete" @click="deleteBusiness(idx)"></i>
<span v-show="errorBags.has(`item.merchant${idx+1}`)" class="error">{{ errorBags.first(`item.merchant${idx+1}`) }}</span>
<!-- <span v-show="item.merchant? !item.merchant : !!item.merchantType" class="error">{{ `请填写子商户${idx+1}的商户名称/商户号` }}</span> -->
</gl-form-item>
<gl-form-item label="商户类型:">
<gl-select v-model="item.merchantType"
:name="`item.merchantType${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
:data-vv-as="`子商户${idx+1}类型`"
clearable
placeholder="请选择">
<gl-option
v-for="item in merchantTypeList"
:key="item.confId"
:label="item.confKey"
:value="item.confId">
</gl-option>
</gl-select>
<span v-show="errorBags.has(`item.merchantType${idx+1}`)" class="error">{{ errorBags.first(`item.merchantType${idx+1}`) }}</span>
<!-- <span v-show="item.merchantType? !item.merchantType : !!item.merchant" class="error">{{ `请填写子商户${idx+1}的商户类型` }}</span> -->
</gl-form-item>
</div>
<span v-show="tip" class="error" style="float:right; margin-right: 43px;">{{ '请填写上一条子商户数据' }}</span>
<gl-button @click="addMore">添加更多</gl-button>
</gl-form>
<div slot="footer" class="dialog-footer">
<gl-button @click="showAddDialog">取 消</gl-button>
<gl-button type="primary" @click="ok">确 定</gl-button>
</div>
</gl-dialog>
</div>
</template>
<script>
import notice from '@/common/notice'
import { businessManagenMethods, groupDetailMethods, request } from '@/api'
export default {
name: 'AddBusiness',
props: {
addDialogVisible: Boolean
},
data() {
return {
tip: false,
addForm: {
merchant: '',
merchantType: ''
},
merchantTypeList: [],
rules: {
merchant: [{ required: true }],
merchantType: [{ required: true }]
},
// 远程搜索
loading: false,
childLoading: false,
businessList: [],
businessChildList: [],
addList: [
{
label: '子商户1',
merchant: '',
merchantType: ''
}
]
}
},
watch: {
addDialogVisible(val) {
this.$validator.errors.clear()
}
},
mounted() {
this.getBusinessType()
},
methods: {
// 确定按钮
ok() {
this.tip = false
this.$validator.validateAll().then((result) => {
if (result) {
this.addList.forEach(item => {
delete item.label
})
if (this.addList[0].merchantId) {
this.addForm.merchantRelationAdds = this.addList
}
console.log(this.addForm)
const params = this.$deep_clone(this.addForm)
params.method = groupDetailMethods.Create
request.req(params).then(res => {
notice.okTips()
this.showAddDialog()
}).catch(err => {
notice.errorTips(err)
})
}
})
},
// 显示隐藏添加商户按钮
showAddDialog() {
this.$emit('addData')
setTimeout(() => {
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }]
this.addForm = { merchant: '', merchantType: '' }
}, 400)
},
// 添加更多按钮
addMore() {
console.log(this.addList)
const len = this.addList.length - 1
if (this.addList[len].merchant == '' || this.addList[len].merchantType == '') {
console.log('请填写完上一条数据')
this.tip = true
} else {
this.tip = false
this.addList.push({
label: '子商户' + (this.addList.length + 1),
merchant: '',
merchantType: '',
show: true
})
}
},
deleteBusiness(idx) {
this.addList.splice(idx, 1)
},
// 父商户搜索
remoteList(query) {
if (query !== '') {
this.loading = true
const params = {}
params.groupId = 1
params.searchWrod = query
params.method = groupDetailMethods.SearchList
request.req(params).then(res => {
console.log(res.merchantParams)
this.loading = false
this.businessList = res.merchantParams
}).catch(err => {
notice.errorTips(err)
})
} else {
this.businessList = []
}
},
// 子商户远程搜索
remoteChildList(query) {
if (query !== '') {
this.childLoading = true
const params = {}
params.groupId = 1
params.searchWrod = query
params.method = groupDetailMethods.SearchChildList
request.req(params).then(res => {
console.log(res.merchantParams)
this.childLoading = false
this.businessChildList = res.merchantParams
}).catch(err => {
notice.errorTips(err)
})
} else {
this.businessChildList = []
}
},
// 获取商户类型列表
getBusinessType() {
const params = {}
params.method = businessManagenMethods.Type
request.req(params).then(res => {
console.log(res)
this.merchantTypeList = res.merchantDictList
}).catch(err => {
notice.errorTips(err)
})
}
}
}
</script>
<style>
.delete {
color: red;
margin-left: 20px;
font-size: 18px;
}
</style>
...@@ -66,27 +66,19 @@ ...@@ -66,27 +66,19 @@
>确 定</gl-button> >确 定</gl-button>
</div> </div>
</gl-dialog> </gl-dialog>
<!-- <add-business
:addDialogVisible="addDialogVisible"
@addData="add"
></add-business> -->
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import addBusiness from './addBusiness'
import notice from '@/common/notice' import notice from '@/common/notice'
import { businessManagenMethods, request } from '@/api' import { businessManagenMethods, request } from '@/api'
export default { export default {
name: 'BusinessManagement', name: 'BusinessManagement',
components: {
addBusiness
},
data() { data() {
return { return {
tableData: { tableData: {
border: true, border: true,
stripe: 'true', stripe: true,
align: 'center', align: 'center',
data: [], data: [],
column: [ column: [
...@@ -115,9 +107,7 @@ export default { ...@@ -115,9 +107,7 @@ export default {
rules: { rules: {
confKey: [{ required: true }], confKey: [{ required: true }],
memo: [{ required: true }] memo: [{ required: true }]
}, }
// 商户分组组件数据
// addDialogVisible: false,
} }
}, },
watch: { watch: {
...@@ -145,12 +135,6 @@ export default { ...@@ -145,12 +135,6 @@ export default {
} }
}) })
}, },
// add() {
// this.addDialogVisible = !this.addDialogVisible
// },
// handleAddData() {
// this.addDialogVisible = !this.addDialogVisible
// },
// 接口请求 // 接口请求
getList() { getList() {
const params = {} const params = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!