Commit 1b9fb0f6 by 胡悦

修改了部分接口,新增商户分组组件完善接口调用

1 parent 86644451
const path = 'glsx.accounts.admin.merchant.' const path = 'glsx.accounts.admin.merchant.'
const methods = { const methods = {
Search: `${path}group.search`, Create: `${path}group.relation.create`, // 分组新增商户
MerchantType: `${path}dict.type` // Search: `${path}group.search`,
// MerchantType: `${path}dict.type`
SearchChildList: `${path}group.search.param`, // 子商户根据商户号或者商户名搜索商户列表
SearchList: `${path}group.search.parampar` // 父商户根据商户号或者商户名搜索商户列表
} }
export { export {
methods methods
......
// 业务管理
const path = 'glsx.accounts.admin.merchant.dict.' const path = 'glsx.accounts.admin.merchant.dict.'
const methods = { const methods = {
Business: `${path}business`, Business: `${path}business`, // 业务列表
Create: `${path}business.create`, Create: `${path}business.create`, // 新增业务
Channel: `${path}channel`, Channel: `${path}channel`, // 获取渠道列表
Type: `${path}type` Type: `${path}type` // 获取商户类型列表
} }
export { export {
methods methods
......
<template> <template>
<div class="group">
<div class="default"> <div class="default">
<gl-form <div class="m-b10">
:inline="true"
:model="searchCondition"
>
<!-- <gl-form-item>
<gl-input
v-model="searchCondition.brand"
class="input-with-select"
placeholder="请输入品牌"
clearable
/>
</gl-form-item>
<gl-form-item>
<gl-button
type="primary"
@click="getList"
>搜索</gl-button>
</gl-form-item> -->
<gl-form-item style="float:right;">
<gl-button <gl-button
class="newButton" class="newButton"
type="primary" type="primary"
@click="dialog" @click="dialog"
>新增分组</gl-button> >新增分组</gl-button>
</gl-form-item> </div>
</gl-form>
</div>
<gl-table <gl-table
:table="tableData" :table="tableData"
v-loading="tableLoading" v-loading="tableLoading">
>
<!-- <gl-table-column align="center" v-for="(i, index) in tableData.column" :key="index" :label='i.label' :prop='i.prop' :width='i.width' >
<template slot-scope="scope">
<template v-if='i.prop === "ipBackgroundList"'>
<img class="tableImg" :src="tableData.data[scope.scope.$index][i.prop]">
</template>
<template v-else>
{{tableData.data[scope.scope.$index][i.prop]}}
</template>
</template>
</gl-table-column> -->
</gl-table> </gl-table>
<gl-pagination <gl-pagination
background background
...@@ -52,20 +20,17 @@ ...@@ -52,20 +20,17 @@
:page-size="pageSize" :page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
:total="total" :total="total"
> ></gl-pagination>
</gl-pagination>
<gl-dialog <gl-dialog
title="新增分组" title="新增分组"
width="30%" width="30%"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:before-close="handleClose" :before-close="handleClose">
>
<gl-form <gl-form
:model="addParams" :model="addParams"
:rules="rules" :rules="rules"
ref="addParams" ref="addParams"
label-width="120px" label-width="120px">
>
<gl-form-item label="分组名称:" prop="groupName"> <gl-form-item label="分组名称:" prop="groupName">
<gl-input name="groupName" placeholder="请输入名称" v-model="addParams.groupName"></gl-input> <gl-input name="groupName" placeholder="请输入名称" v-model="addParams.groupName"></gl-input>
</gl-form-item> </gl-form-item>
...@@ -75,8 +40,7 @@ ...@@ -75,8 +40,7 @@
v-validate="'required'" v-validate="'required'"
data-vv-as="业务类型" data-vv-as="业务类型"
v-model="addParams.businessCode" v-model="addParams.businessCode"
placeholder="请选择" placeholder="请选择">
>
<gl-option <gl-option
v-for="item in businessList" v-for="item in businessList"
:key="item.value" :key="item.value"
...@@ -84,14 +48,11 @@ ...@@ -84,14 +48,11 @@
:value="item.value"> :value="item.value">
</gl-option> </gl-option>
</gl-select> </gl-select>
<!-- <span v-show="errorBags.has('businessCode')" class="error">
{{ errorBags.first('businessCode') }}
</span> -->
</gl-form-item> </gl-form-item>
</gl-form> </gl-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<gl-button type="primary" @click="handleSubmit('addParams')" :loading="addLoading">提交</gl-button> <gl-button type="primary" @click="handleSubmit('addParams')" :loading="addLoading">提交</gl-button>
<gl-button @click="handleClose">取消</gl-button> <gl-button @click="handleClose">取消</gl-button>
</div> </div>
</gl-dialog> </gl-dialog>
</div> </div>
...@@ -295,11 +256,11 @@ export default { ...@@ -295,11 +256,11 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" > <style rel="stylesheet/scss" lang="scss" >
.group { // .group {
.cell { // .cell {
.el-button { // .el-button {
padding: 2px 10px; // padding: 2px 10px;
} // }
} // }
} // }
</style> </style>
...@@ -19,13 +19,13 @@ ...@@ -19,13 +19,13 @@
placeholder="请输入商户名称/商户号" placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号" data-vv-as="商户名称/商户号"
v-validate="'required'" v-validate="'required'"
:remote-method="remoteMethod" :remote-method="remoteList"
:loading="loading"> :loading="loading">
<gl-option <gl-option
v-for="item in options4" v-for="item in businessList"
:key="item.value" :key="item.merchantId"
:label="item.label" :label="item.merchantName"
:value="item.value"> :value="item.merchantId">
</gl-option> </gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has('merchant')" class="error">{{ errorBags.first('merchant') }}</span> <span v-show="errorBags.has('merchant')" class="error">{{ errorBags.first('merchant') }}</span>
...@@ -38,9 +38,9 @@ ...@@ -38,9 +38,9 @@
placeholder="请搜索"> placeholder="请搜索">
<gl-option <gl-option
v-for="item in merchantTypeList" v-for="item in merchantTypeList"
:key="item.merchantId" :key="item.confId"
:label="item.merchantName" :label="item.confKey"
:value="item.merchantId"> :value="item.confId">
</gl-option> </gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has('merchantType')" class="error">{{ errorBags.first('merchantType') }}</span> <span v-show="errorBags.has('merchantType')" class="error">{{ errorBags.first('merchantType') }}</span>
...@@ -56,13 +56,13 @@ ...@@ -56,13 +56,13 @@
:data-vv-as="`子商户${idx+1}`" :data-vv-as="`子商户${idx+1}`"
clearable clearable
placeholder="请输入商户名称/商户号" placeholder="请输入商户名称/商户号"
:remote-method="remoteMethod" :remote-method="remoteChildList"
:loading="loading"> :loading="childLoading">
<gl-option <gl-option
v-for="item in options4" v-for="item in businessChildList"
:key="item.value" :key="item.merchantId"
:label="item.label" :label="item.merchantName"
:value="item.value"> :value="item.merchantId">
</gl-option> </gl-option>
</gl-select> </gl-select>
<i v-show="item.show" class="el-icon-delete delete" @click="deleteBusiness(idx)"></i> <i v-show="item.show" class="el-icon-delete delete" @click="deleteBusiness(idx)"></i>
...@@ -78,9 +78,9 @@ ...@@ -78,9 +78,9 @@
placeholder="请选择"> placeholder="请选择">
<gl-option <gl-option
v-for="item in merchantTypeList" v-for="item in merchantTypeList"
:key="item.merchantId" :key="item.confId"
:label="item.merchantName" :label="item.confKey"
:value="item.merchantId"> :value="item.confId">
</gl-option> </gl-option>
</gl-select> </gl-select>
<span v-show="errorBags.has(`item.merchantType${idx+1}`)" class="error">{{ errorBags.first(`item.merchantType${idx+1}`) }}</span> <span v-show="errorBags.has(`item.merchantType${idx+1}`)" class="error">{{ errorBags.first(`item.merchantType${idx+1}`) }}</span>
...@@ -99,6 +99,8 @@ ...@@ -99,6 +99,8 @@
</template> </template>
<script> <script>
import notice from '@/common/notice'
import { businessManagenMethods, groupDetailMethods, request } from '@/api'
export default { export default {
name: 'AddBusiness', name: 'AddBusiness',
props: { props: {
...@@ -111,42 +113,16 @@ export default { ...@@ -111,42 +113,16 @@ export default {
merchant: '', merchant: '',
merchantType: '' merchantType: ''
}, },
merchantTypeList: [ merchantTypeList: [],
{
merchantId: 1,
merchantName: '广联'
}, {
merchantId: 2,
merchantName: '分组'
}, {
merchantId: 3,
merchantName: '富强'
}
],
rules: { rules: {
merchant: [{ required: true }], merchant: [{ required: true }],
merchantType: [{ required: true }] merchantType: [{ required: true }]
}, },
// 远程搜索 // 远程搜索
loading: false, loading: false,
options4: [], childLoading: false,
states: ['Alabama', 'Alaska', 'Arizona', businessList: [],
'Arkansas', 'California', 'Colorado', businessChildList: [],
'Connecticut', 'Delaware', 'Florida',
'Georgia', 'Hawaii', 'Idaho', 'Illinois',
'Indiana', 'Iowa', 'Kansas', 'Kentucky',
'Louisiana', 'Maine', 'Maryland',
'Massachusetts', 'Michigan', 'Minnesota',
'Mississippi', 'Missouri', 'Montana',
'Nebraska', 'Nevada', 'New Hampshire',
'New Jersey', 'New Mexico', 'New York',
'North Carolina', 'North Dakota', 'Ohio',
'Oklahoma', 'Oregon', 'Pennsylvania',
'Rhode Island', 'South Carolina',
'South Dakota', 'Tennessee', 'Texas',
'Utah', 'Vermont', 'Virginia',
'Washington', 'West Virginia', 'Wisconsin',
'Wyoming'],
addList: [ addList: [
{ {
label: '子商户1', label: '子商户1',
...@@ -162,23 +138,29 @@ export default { ...@@ -162,23 +138,29 @@ export default {
} }
}, },
mounted() { mounted() {
this.list = this.states.map(item => { this.getBusinessType()
return { value: item, label: item }
})
}, },
methods: { methods: {
// 确定按钮 // 确定按钮
ok() { ok() {
this.tip = false this.tip = false
console.log(this.$validator)
this.$validator.validateAll().then((result) => { this.$validator.validateAll().then((result) => {
if (this.addList)
if (result) { if (result) {
this.addList.forEach(item => { this.addList.forEach(item => {
delete item.label delete item.label
}) })
this.addForm.merchantRelationAdds = this.addList if (this.addList[0].merchantId) {
this.showAddDialog() 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)
})
} }
}) })
}, },
...@@ -208,22 +190,56 @@ export default { ...@@ -208,22 +190,56 @@ export default {
} }
}, },
deleteBusiness(idx) { deleteBusiness(idx) {
console.log(idx)
this.addList.splice(idx, 1) this.addList.splice(idx, 1)
}, },
remoteMethod(query) { // 父商户搜索
remoteList(query) {
if (query !== '') { if (query !== '') {
this.loading = true this.loading = true
setTimeout(() => { 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.loading = false
this.options4 = this.list.filter(item => { this.businessList = res.merchantParams
return item.label.toLowerCase() }).catch(err => {
.indexOf(query.toLowerCase()) > -1 notice.errorTips(err)
}) })
}, 200) } 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 { } else {
this.options4 = [] 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)
})
} }
} }
} }
......
<template> <template>
<div> <div class="default">
<div class="m-b10">
<gl-button <gl-button
type="primary" type="primary"
@click="showDialog" @click="showDialog"
...@@ -8,12 +9,12 @@ ...@@ -8,12 +9,12 @@
type="primary" type="primary"
@click="add" @click="add"
>新增商户</gl-button> >新增商户</gl-button>
</div>
<gl-table :table="tableData"></gl-table> <gl-table :table="tableData"></gl-table>
<gl-dialog <gl-dialog
title="新增业务" title="新增业务"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
:close-on-click-modal="false" :close-on-click-modal="false">
>
<gl-form <gl-form
:model="form" :model="form"
label-width="100px" label-width="100px"
...@@ -53,15 +54,6 @@ ...@@ -53,15 +54,6 @@
class="error" class="error"
>{{ errorBags.first('memo') }}</span> >{{ errorBags.first('memo') }}</span>
</gl-form-item> </gl-form-item>
<gl-form-item label="地址">
<city-area
ref="c"
:showCity="showCity"
:eventBus="eventBus"
:validateCity="validateCity"
@cityArea="getCityArea"
></city-area>
</gl-form-item>
</gl-form> </gl-form>
<div <div
slot="footer" slot="footer"
...@@ -76,44 +68,26 @@ ...@@ -76,44 +68,26 @@
</gl-dialog> </gl-dialog>
<add-business <add-business
:addDialogVisible="addDialogVisible" :addDialogVisible="addDialogVisible"
@addData="handleAddData" @addData="add"
></add-business> ></add-business>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { CityArea } from '../components'
import addBusiness from './addBusiness' import addBusiness from './addBusiness'
import notice from '@/common/notice' import notice from '@/common/notice'
import { businessManagenMethods, request } from '@/api' import { businessManagenMethods, request } from '@/api'
// import { jumpLink } from '../../../common/common.js'
export default { export default {
name: 'BusinessManagement', name: 'BusinessManagement',
components: { components: {
addBusiness, addBusiness
CityArea
}, },
data() { data() {
return { return {
eventBus: null,
tableData: { tableData: {
border: true, border: true,
align: 'center', align: 'center',
data: [ data: [],
// {
// businessId: 1,
// confKey: '爱车保镖',
// businessCode: '11',
// memo: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
// createTime: '2018-03-16'
// }, {
// businessId: 2,
// confKey: '爱车保镖',
// businessCode: '11',
// memo: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
// createTime: '2018-03-16'
// }
],
column: [ column: [
{ {
label: '业务ID', label: '业务ID',
...@@ -129,22 +103,6 @@ export default { ...@@ -129,22 +103,6 @@ export default {
prop: 'createTime' prop: 'createTime'
} }
] ]
// 详情
// console: {
// show: true,
// label: '操作',
// width: '150',
// fixed: 'right',
// button: [
// {
// type: 'text',
// label: '详情',
// callback: (index, rows) => {
// this.$parent.to(['商户数据平台', '商户数据平台', '商户数据平台', '业务管理', '商户详情'], { id: rows[index].businessId, name: rows[index].confKey })
// }
// }
// ]
// }
}, },
form: { form: {
confKey: '', confKey: '',
...@@ -158,14 +116,6 @@ export default { ...@@ -158,14 +116,6 @@ export default {
}, },
// 商户分组组件数据 // 商户分组组件数据
addDialogVisible: false, addDialogVisible: false,
// 省市区
showCity: [1, 1],
validateCity: [1, 1]
}
},
provide() {
return {
$validator: this.$validator
} }
}, },
watch: { watch: {
...@@ -173,17 +123,11 @@ export default { ...@@ -173,17 +123,11 @@ export default {
if (val) { if (val) {
this.form = { confKey: '', memo: '', area: '' } this.form = { confKey: '', memo: '', area: '' }
} else { } else {
this.eventBus.$emit('reset')
this.$validator.errors.clear() this.$validator.errors.clear()
clearTimeout(timer)
const timer = setTimeout(() => {
this.$refs['c'].$validator.errors.clear()
}, 400)
} }
} }
}, },
mounted() { mounted() {
this.eventBus = new Vue()
this.getList() this.getList()
}, },
methods: { methods: {
...@@ -193,15 +137,9 @@ export default { ...@@ -193,15 +137,9 @@ export default {
}, },
// 提交表单 // 提交表单
submit() { submit() {
Promise.all([ this.$validator.validateAll().then((result) => {
this.$refs['c'].$validator.validateAll(), if (result) {
this.$validator.validateAll()
]).then((result) => {
if (result[0] && result[1]) {
this.businessCreate() this.businessCreate()
// console.log('提交成功')
// console.log(this.form)
// this.showDialog()
} }
}) })
}, },
...@@ -211,9 +149,6 @@ export default { ...@@ -211,9 +149,6 @@ export default {
handleAddData() { handleAddData() {
this.addDialogVisible = !this.addDialogVisible this.addDialogVisible = !this.addDialogVisible
}, },
getCityArea(params) {
console.log(params)
},
// 接口请求 // 接口请求
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!