Commit fc26783d by wangql

提交代码

2 parents 01283ffe 57978827
const path = 'glsx.accounts.admin.merchant.' const path = 'glsx.accounts.admin.merchant.'
const methods = { const methods = {
Create: `${path}group.relation.create`, // 分组新增商户
Search: `${path}group.search`, Search: `${path}group.search`,
MerchantType: `${path}dict.type` 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}create`, Create: `${path}business.create`, // 新增业务
Channel: `${path}channel`, Channel: `${path}channel`, // 获取渠道列表
Type: `${path}type` Type: `${path}type` // 获取商户类型列表
} }
export { export {
methods methods
......
import MD5 from 'js-md5' import MD5 from 'js-md5'
const sign = params => { const sign = params => {
delete params.sign
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b' const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const keys = Object.keys(params).sort() const keys = Object.keys(params).sort()
var str = [] var str = []
......
<template> <template>
<div class="detail"> <div class="detail">
<gl-breadcrumb separator='/'> <gl-breadcrumb style="font-size: 20px;background: #f0f0f0;padding: 5px 10px;border-radius: 10px;display: inline-block;" separator='/'>
<gl-breadcrumb-item><a <gl-breadcrumb-item><a
href='#' href='#'
@click='back' @click='back'
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
<gl-breadcrumb-item>商户详情</gl-breadcrumb-item> <gl-breadcrumb-item>商户详情</gl-breadcrumb-item>
<gl-breadcrumb-item>{{List[0].value}}</gl-breadcrumb-item> <gl-breadcrumb-item>{{List[0].value}}</gl-breadcrumb-item>
</gl-breadcrumb> </gl-breadcrumb>
<!-- <gl-button type='text' @click='back'>商户列表</gl-button>
<span>\ 商户详情 \{{name}}</span> -->
<gl-tabs <gl-tabs
style="margin-top: 20px;"
:tab-position="tabPosition"
v-model='activeName' v-model='activeName'
@tab-click='handleClick' @tab-click='handleClick'
> >
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
label='基本信息' label='基本信息'
name='first' name='first'
> >
<gl-col :span="24" style="border: 1px solid #ebeef5;background: #fafafa;padding: 10px 20px;">
<gl-col <gl-col
class="detail-row" class="detail-row"
:span="i.isMap || i.img? 24 : 12" :span="i.isMap || i.img? 24 : 12"
...@@ -47,7 +48,7 @@ ...@@ -47,7 +48,7 @@
<span v-else>{{i.value}}</span> <span v-else>{{i.value}}</span>
</span> </span>
</gl-col> </gl-col>
</gl-col>
</gl-tab-pane> </gl-tab-pane>
<gl-tab-pane <gl-tab-pane
label='员工信息' label='员工信息'
...@@ -129,6 +130,7 @@ export default { ...@@ -129,6 +130,7 @@ export default {
name: 'BusinessDetails', name: 'BusinessDetails',
data() { data() {
return { return {
tabPosition: 'left',
merchantId: '', merchantId: '',
// 标记merchantId是否改变 // 标记merchantId是否改变
IdChange: [0, 0, 0], IdChange: [0, 0, 0],
...@@ -248,7 +250,8 @@ export default { ...@@ -248,7 +250,8 @@ export default {
label: '详情', label: '详情',
type: 'text', type: 'text',
callback: (index, rows) => { callback: (index, rows) => {
this.getGroupLevelInfo(rows[index].GroupName) // console.log(rows[index])
this.getGroupLevelInfo(rows[index].id)
} }
}] }]
} }
...@@ -299,13 +302,14 @@ export default { ...@@ -299,13 +302,14 @@ export default {
}, },
methods: { methods: {
back() { back() {
this.$parent.to(['商户数据平台', '商户数据平台', '商户数据平台', '业务管理', '业务管理列表']) this.$parent.to(['商户数据平台', '商户数据平台', '商户数据平台', '商户列表', '商户列表'])
}, },
goGroupDetail(row) { goGroupDetail(row) {
this.$root.to(['商户数据平台', '商户数据平台', '商户数据平台', '商户分组', '*商户分组详情'], { merchantId: row.merchantId }) console.log(row)
this.$root.to(['商户数据平台', '商户数据平台', '商户数据平台', '商户分组', '*商户分组详情'], { groudId: row.id })
}, },
goBusinessDetail(row) { goBusinessDetail(row) {
this.handleDetailClose() this.detailVisible()
this.activeName = 'first' this.activeName = 'first'
this.merchantId = row.merchantId this.merchantId = row.merchantId
}, },
...@@ -356,7 +360,7 @@ export default { ...@@ -356,7 +360,7 @@ export default {
}, },
// 员工信息 // 员工信息
getStaffInfo() { getStaffInfo() {
const params = ({ merchantId: this.merchantId }) const params = { merchantId: this.merchantId }
params.method = bizMethods.Personal params.method = bizMethods.Personal
request.req(params).then(res => { request.req(params).then(res => {
this.staffTableData.data = res.merchantPersonals this.staffTableData.data = res.merchantPersonals
...@@ -368,7 +372,7 @@ export default { ...@@ -368,7 +372,7 @@ export default {
}, },
// 分组信息 // 分组信息
getGroupInfo() { getGroupInfo() {
const params = ({ merchantId: this.merchantId }) const params = { merchantId: this.merchantId }
params.method = bizMethods.Group params.method = bizMethods.Group
request.req(params).then(res => { request.req(params).then(res => {
this.groupTableData.data = res.merchantGroups this.groupTableData.data = res.merchantGroups
...@@ -379,15 +383,17 @@ export default { ...@@ -379,15 +383,17 @@ export default {
}) })
}, },
// 分组信息-详情 // 分组信息-详情
getGroupLevelInfo(groupName) { getGroupLevelInfo(groupId) {
const params = ({ merchantId: this.merchantId, groupId: groupName }) const params = { merchantId: this.merchantId, groupId: groupId }
params.method = bizMethods.GroupLevel params.method = bizMethods.GroupLevel
console.log(params)
this.detailVisible()
request.req(params).then(res => { request.req(params).then(res => {
console.log([res.parentMerchantLevel]) // console.log([res.parentMerchantLevel])
this.parentLevelTableData.data = [res.parentMerchantLevel] this.parentLevelTableData.data = [res.parentMerchantLevel]
this.childLevelTableData.data = res.childMerchantLevels this.childLevelTableData.data = res.childMerchantLevels
this.detailVisible()
}).catch(err => { }).catch(err => {
// console.log(err)
notice.errorTips(err) notice.errorTips(err)
}) })
}, },
...@@ -404,7 +410,7 @@ export default { ...@@ -404,7 +410,7 @@ export default {
<style> <style>
.amap-page-container { .amap-page-container {
/* display: inline-block; */ /* display: inline-block; */
width: 75%; width: 100%;
height: 300px; height: 300px;
/* vertical-align: text-top; */ /* vertical-align: text-top; */
} }
...@@ -420,11 +426,15 @@ export default { ...@@ -420,11 +426,15 @@ export default {
} }
.detail-row { .detail-row {
line-height: 36px; line-height: 36px;
/* padding-left: 20px */
} }
.detail-logo { .detail-logo {
width: 40px; width: 40px;
height: 40px; height: 40px;
vertical-align: text-top; vertical-align: text-top;
} }
.el-tabs__header{
background-color: #fafafa;
}
</style> </style>
<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>
</gl-form>
</div> </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
...@@ -50,22 +18,20 @@ ...@@ -50,22 +18,20 @@
:current-page="pageNum" :current-page="pageNum"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="pageSize" :page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper" layout="sizes, total, ->, 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"
> :close-on-click-modal="false">
<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,18 +41,14 @@ ...@@ -75,18 +41,14 @@
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.confId"
:label="item.label" :label="item.confKey"
:value="item.value"> :value="item.confId">
</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">
...@@ -104,6 +66,7 @@ ...@@ -104,6 +66,7 @@
// import { NoticeMixin } from '@/mixins' // import { NoticeMixin } from '@/mixins'
// import Vue from 'vue' // import Vue from 'vue'
import { groupMethods, request } from '@/api' import { groupMethods, request } from '@/api'
import notice from '@/common/notice'
export default { export default {
name: 'businessGroup', name: 'businessGroup',
components: { components: {
...@@ -143,7 +106,7 @@ export default { ...@@ -143,7 +106,7 @@ export default {
tableData: { tableData: {
border: true, border: true,
align: 'center', align: 'center',
// height: parseInt(this.$client_height() - 140), height: parseInt(this.$client_height() - 140),
data: [], data: [],
column: [ column: [
{ {
...@@ -168,12 +131,12 @@ export default { ...@@ -168,12 +131,12 @@ export default {
}, },
{ {
label: '创建时间', label: '创建时间',
prop: 'createTime' prop: 'createTime',
// formatter: cellValue => { formatter: cellValue => {
// if (cellValue.createTime) { if (cellValue.createTime) {
// return new Date(cellValue.createTime).format('yyyy-MM-dd') return new Date(cellValue.createTime).format('yyyy-MM-dd')
// } }
// } }
} }
], ],
// number: { // number: {
...@@ -202,7 +165,7 @@ export default { ...@@ -202,7 +165,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.getList() this.loadingGetList()
this.getBusinessList() this.getBusinessList()
}, },
methods: { methods: {
...@@ -211,18 +174,14 @@ export default { ...@@ -211,18 +174,14 @@ export default {
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
// getParams() { getParams() {
// return Object.assign(
// {
// pageNum: this.pageNum,
// pageSize: this.pageSize
// },
// this.searchCondition
// )
// },
getList() {
// const params = this.getParams()
const params = {} const params = {}
params.pageCount = this.pageSize
params.pageSize = this.pageNum
return params
},
getList() {
const params = this.getParams()
params.method = groupMethods.Search params.method = groupMethods.Search
request request
.req(params) .req(params)
...@@ -242,9 +201,7 @@ export default { ...@@ -242,9 +201,7 @@ export default {
request request
.req(params) .req(params)
.then(res => { .then(res => {
res.merchantDictList.forEach((item, index) => { this.businessList = res.merchantDictList
this.businessList.push({ 'label': item.confKey, 'value': item.confId })
})
}) })
.catch(err => { .catch(err => {
this.tableLoading = false this.tableLoading = false
...@@ -281,6 +238,7 @@ export default { ...@@ -281,6 +238,7 @@ export default {
.req(params) .req(params)
.then(res => { .then(res => {
this.loadingGetList() this.loadingGetList()
notice.okTips()
this.dialogVisible = !this.dialogVisible this.dialogVisible = !this.dialogVisible
}) })
.catch(err => console.log(err)) .catch(err => console.log(err))
...@@ -294,11 +252,11 @@ export default { ...@@ -294,11 +252,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>
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
title="添加商户" title="添加商户"
:visible.sync="addDialogVisible" :visible.sync="addDialogVisible"
width="400px" width="400px"
:before-close="showAddDialog"> :before-close="showAddDialog"
:close-on-click-modal="false">
<gl-form <gl-form
ref="addForm" :model="addForm" ref="addForm" :model="addForm"
label-width="100px" label-width="100px"
...@@ -19,25 +20,28 @@ ...@@ -19,25 +20,28 @@
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>
</gl-form-item> </gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType"> <gl-form-item label="商户类型:" prop="merchantType">
<gl-select v-model="addForm.merchantType" name="merchantType" <gl-select v-model="addForm.merchantType"
data-vv-as="商户类型" v-validate="'required'" placeholder="请搜索"> name="merchantType"
data-vv-as="商户类型"
v-validate="'required'"
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>
...@@ -48,30 +52,43 @@ ...@@ -48,30 +52,43 @@
v-model="item.merchant" v-model="item.merchant"
filterable filterable
remote remote
:name="`item.merchant${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
: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>
<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>
<gl-form-item label="商户类型:"> <gl-form-item label="商户类型:">
<gl-select v-model="item.merchantType" placeholder="请选择"> <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 <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="item.merchantType? !item.merchantType : !!item.merchant" class="error">{{ `请填写子商户${idx+1}的商户类型` }}</span> -->
</gl-form-item> </gl-form-item>
</div> </div>
<span v-show="tip" 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">
...@@ -83,6 +100,8 @@ ...@@ -83,6 +100,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: {
...@@ -90,46 +109,21 @@ export default { ...@@ -90,46 +109,21 @@ export default {
}, },
data() { data() {
return { return {
tip: false,
addForm: { addForm: {
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',
...@@ -145,53 +139,102 @@ export default { ...@@ -145,53 +139,102 @@ 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.$validator.validateAll().then((result) => { this.$validator.validateAll().then((result) => {
if (result) { if (result) {
this.addList.forEach(item => { this.addList.forEach(item => {
delete item.label delete item.label
}) })
if (this.addList[0].merchantId) {
this.addForm.merchantRelationAdds = this.addList this.addForm.merchantRelationAdds = this.addList
}
const params = this.$deep_clone(this.addForm)
params.method = groupDetailMethods.Create
request.req(params).then(res => {
notice.okTips()
this.showAddDialog() this.showAddDialog()
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }] }).catch(err => {
this.addForm = { merchant: '', merchantType: '' } notice.errorTips(err)
})
} }
}) })
}, },
// 显示隐藏添加商户按钮
showAddDialog() { showAddDialog() {
this.$emit('addData') this.$emit('addData')
setTimeout(() => {
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }]
this.addForm = { merchant: '', merchantType: '' }
}, 400)
}, },
// 添加更多按钮
addMore() { addMore() {
console.log(this.addList.length) 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({ this.addList.push({
label: '子商户' + (this.addList.length + 1), label: '子商户' + (this.addList.length + 1),
merchant: '', merchant: '',
merchantType: '', merchantType: '',
show: true show: true
}) })
}
}, },
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 => {
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)
})
} 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 => {
this.childLoading = false
this.businessChildList = res.merchantParams
}).catch(err => {
notice.errorTips(err)
}) })
}, 200)
} else { } else {
this.options4 = [] this.businessChildList = []
} }
},
// 获取商户类型列表
getBusinessType() {
const params = {}
params.method = businessManagenMethods.Type
request.req(params).then(res => {
this.merchantTypeList = res.merchantDictList
}).catch(err => {
notice.errorTips(err)
})
} }
} }
} }
......
<template> <template>
<div class="detail">
<div class="default"> <div class="default">
<gl-form <div class="m-b10">
:inline="true"
>
<!-- <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"
...@@ -29,13 +11,10 @@ ...@@ -29,13 +11,10 @@
type="primary" type="primary"
@click="addDialog" @click="addDialog"
>添加商户</gl-button> >添加商户</gl-button>
</gl-form-item>
</gl-form>
</div> </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' > <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 slot-scope="scope">
<template v-if='i.prop === "merchantName"'> <template v-if='i.prop === "merchantName"'>
...@@ -66,12 +45,11 @@ ...@@ -66,12 +45,11 @@
width="40%" width="40%"
:visible.sync="dialogVisible_search" :visible.sync="dialogVisible_search"
:before-close="handleClose_search" :before-close="handleClose_search"
> :close-on-click-modal="false">
<gl-form <gl-form
:model="searchParams" :model="searchParams"
ref="searchParams" ref="searchParams"
label-width="120px" label-width="120px">
>
<gl-form-item label="商户名称:" prop="merchantName"> <gl-form-item label="商户名称:" prop="merchantName">
<gl-input name="merchantName" placeholder="请输入商户名称" v-model="searchParams.merchantName"></gl-input> <gl-input name="merchantName" placeholder="请输入商户名称" v-model="searchParams.merchantName"></gl-input>
</gl-form-item> </gl-form-item>
...@@ -82,8 +60,7 @@ ...@@ -82,8 +60,7 @@
<gl-select <gl-select
name="merchantType" name="merchantType"
v-model="searchParams.merchantType" v-model="searchParams.merchantType"
placeholder="请选择" placeholder="请选择">
>
<gl-option <gl-option
v-for="item in merchantTypeList" v-for="item in merchantTypeList"
:key="item.value" :key="item.value"
...@@ -92,8 +69,7 @@ ...@@ -92,8 +69,7 @@
</gl-option> </gl-option>
</gl-select> </gl-select>
</gl-form-item> </gl-form-item>
<gl-form-item label="地区:">
<gl-form-item label="地区:" prop="area">
<city-area <city-area
ref="c" ref="c"
:showCity="showCity" :showCity="showCity"
...@@ -129,7 +105,7 @@ ...@@ -129,7 +105,7 @@
// import { getMerchantGroupDetailList } from '@/api/index' // import { getMerchantGroupDetailList } from '@/api/index'
// import { NoticeMixin } from '@/mixins' // import { NoticeMixin } from '@/mixins'
// import Vue from 'vue' // import Vue from 'vue'
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 { CityArea } from '../components' import { CityArea } from '../components'
...@@ -140,7 +116,7 @@ export default { ...@@ -140,7 +116,7 @@ export default {
CityArea CityArea
}, },
watch: { watch: {
'searchParams.groupId'(val) { groupId(val) {
this.getList() this.getList()
} }
}, },
...@@ -148,13 +124,14 @@ export default { ...@@ -148,13 +124,14 @@ export default {
data() { data() {
return { return {
// searchCondition: {}, // searchCondition: {},
groupId: '',
searchParams: { searchParams: {
groupId: null, groupId: '',
merchantName: '', merchantName: '',
merchantId: null, merchantId: '',
merchantType: null, merchantType: '',
provinceId: null, provinceId: '',
cityId: null, cityId: '',
startTime: '', startTime: '',
endTime: '' endTime: ''
}, },
...@@ -216,41 +193,20 @@ export default { ...@@ -216,41 +193,20 @@ export default {
prop: 'parentMerchantId' prop: 'parentMerchantId'
} }
] ]
// number: {
// label: '序号',
// width: '50px',
// index: index => {
// ++index
// return index < 10 && index > 0 ? '0' + index : index
// }
// },
// console: {
// show: true,
// label: '操作',
// prop: 'options',
// button: [
// {
// label: '详情',
// type: 'text',
// callback: (index, row) => {
// this.detail(row)
// }
// }
// ]
// }
} }
} }
}, },
mounted() { mounted() {
// this.$root.eventBus.$on('params', (params) => {
// this.searchParams.merchantId = params.merchantId
// })
// this.getList()
this.getMerchantType()
this.eventBus = new Vue()
this.$root.eventBus.$on('params', (params) => { this.$root.eventBus.$on('params', (params) => {
this.groupId = params.groupId
this.searchParams.groupId = params.groupId this.searchParams.groupId = params.groupId
}) })
this.loadingGetList()
this.getMerchantType()
this.eventBus = this.$root.eventBus
// this.$root.eventBus.$on('params', (params) => {
// this.searchParams.groupId = params.groupId
// })
}, },
methods: { methods: {
loadingGetList() { loadingGetList() {
...@@ -261,8 +217,8 @@ export default { ...@@ -261,8 +217,8 @@ export default {
getParams() { getParams() {
return Object.assign( return Object.assign(
{ {
pageNum: this.pageNum, pageCount: this.pageSize,
pageSize: this.pageSize pageSize: this.pageNum
}, },
this.searchParams this.searchParams
) )
...@@ -273,11 +229,13 @@ export default { ...@@ -273,11 +229,13 @@ export default {
this.searchParams.endTime = this.times[1].format('yyyy-MM-dd HH:mm:ss') this.searchParams.endTime = this.times[1].format('yyyy-MM-dd HH:mm:ss')
} }
const params = this.getParams() const params = this.getParams()
params.groupId = 1
params.method = groupDetailMethods.Search params.method = groupDetailMethods.Search
console.log(params) console.log(params)
request request
.req(params) .req(params)
.then(res => { .then(res => {
console.log(res)
this.total = res.pagination.totalCount this.total = res.pagination.totalCount
this.tableData.data = res.merchantGroupRelations this.tableData.data = res.merchantGroupRelations
this.tableLoading = false this.tableLoading = false
...@@ -328,6 +286,8 @@ export default { ...@@ -328,6 +286,8 @@ export default {
searchReset() { searchReset() {
this.$refs['searchParams'].resetFields() this.$refs['searchParams'].resetFields()
this.eventBus.$emit('reset') this.eventBus.$emit('reset')
this.searchParams.provinceId = ''
this.searchParams.cityId = ''
this.times = [] this.times = []
}, },
addDialog() { addDialog() {
......
<!-- 新增商户 --> <!-- 新增商户 -->
<template> <template>
<div> <div class="newBusiness">
<gl-dialog <gl-dialog
:title="title" :title="title"
:visible.sync="isVisible" :visible.sync="isVisible"
:before-close="handleClose" :before-close="handleClose"
:width="diaWidth" :width="diaWidth"
:close-on-click-modal="false"
> >
<gl-form <gl-form
label-width="85px" label-width="85px"
...@@ -48,7 +49,14 @@ ...@@ -48,7 +49,14 @@
<gl-select <gl-select
v-model="merchantForm.merchantChannel" v-model="merchantForm.merchantChannel"
placeholder="请选择" placeholder="请选择"
></gl-select> >
<gl-option
v-for="item in channelList"
:key="item.confId"
:label="item.confKey"
:value="item.confId">
</gl-option>
</gl-select>
</gl-form-item> </gl-form-item>
<gl-form-item label="联系人:"> <gl-form-item label="联系人:">
<gl-input <gl-input
...@@ -87,6 +95,7 @@ ...@@ -87,6 +95,7 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { CityArea } from '../components' import { CityArea } from '../components'
import { businessManagenMethods, request } from '@/api'
const isPhone = { const isPhone = {
validate: (value, args) => { validate: (value, args) => {
return value.length === 11 && /^1[345789]\d{9}$/.test(value) return value.length === 11 && /^1[345789]\d{9}$/.test(value)
...@@ -97,6 +106,7 @@ export default { ...@@ -97,6 +106,7 @@ export default {
data() { data() {
return { return {
title: '新增商户', title: '新增商户',
channelList: [],
// 省市区组件-配置 // 省市区组件-配置
eventBus: null, eventBus: null,
showCity: [1, 1, 1], showCity: [1, 1, 1],
...@@ -128,8 +138,10 @@ export default { ...@@ -128,8 +138,10 @@ export default {
}, },
watch: { watch: {
isVisible(val) { isVisible(val) {
if (!val) {
this.$validator.errors.clear() this.$validator.errors.clear()
val && this.getChannel()
if (!val) {
this.eventBus.$emit('reset')
this.areaInfo = {} this.areaInfo = {}
} }
} }
...@@ -140,7 +152,7 @@ export default { ...@@ -140,7 +152,7 @@ export default {
}, },
methods: { methods: {
handleClose() { handleClose() {
this.eventBus.$emit('reset') // this.eventBus.$emit('reset')
this.$emit('hideDialog') this.$emit('hideDialog')
}, },
handleComfrim() { handleComfrim() {
...@@ -150,10 +162,19 @@ export default { ...@@ -150,10 +162,19 @@ export default {
]).then((result) => { ]).then((result) => {
if (result[0] && result[1]) { if (result[0] && result[1]) {
this.$emit('comfirmDialog', this.areaInfo) this.$emit('comfirmDialog', this.areaInfo)
this.eventBus.$emit('reset') // this.eventBus.$emit('reset')
} }
}) })
}, },
getChannel() {
const params = {}
params.method = businessManagenMethods.Channel
request.req(params).then(res => {
this.channelList = res.merchantDictList
}).catch(err => {
console.log(err)
})
},
getCityArea(params) { getCityArea(params) {
// console.log(params) // console.log(params)
this.areaInfo.provinceId = params[0] this.areaInfo.provinceId = params[0]
...@@ -168,4 +189,7 @@ export default { ...@@ -168,4 +189,7 @@ export default {
</script> </script>
<style> <style>
.newBusiness .el-dialog__body {
padding: 0 20px;
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
:visible.sync="isVisible" :visible.sync="isVisible"
:before-close="handleClose" :before-close="handleClose"
:width="diaWidth" :width="diaWidth"
:close-on-click-modal="false"
> >
<gl-form <gl-form
:model="merchantSearch" :model="merchantSearch"
...@@ -91,6 +92,7 @@ ...@@ -91,6 +92,7 @@
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
v-model="merchantSearch.startTime" v-model="merchantSearch.startTime"
value-format="yyyy-MM-dd"
style="width:92%;" style="width:92%;"
></gl-date-picker> ></gl-date-picker>
</gl-col> </gl-col>
...@@ -103,6 +105,7 @@ ...@@ -103,6 +105,7 @@
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
v-model="merchantSearch.endTime" v-model="merchantSearch.endTime"
value-format="yyyy-MM-dd"
style="width: 100%;" style="width: 100%;"
></gl-date-picker> ></gl-date-picker>
</gl-col> </gl-col>
......
...@@ -97,9 +97,6 @@ export default { ...@@ -97,9 +97,6 @@ export default {
align: 'center', align: 'center',
data: [], data: [],
column: [{ column: [{
label: '序号',
prop: 'id'
}, {
label: '商户名称', label: '商户名称',
prop: 'merchantName' prop: 'merchantName'
}, { }, {
...@@ -137,6 +134,14 @@ export default { ...@@ -137,6 +134,14 @@ export default {
this.$root.to(['商户数据平台', '商户数据平台', '商户数据平台', '商户列表', '*商户详情'], { merchantId: rows[index].merchantId }) this.$root.to(['商户数据平台', '商户数据平台', '商户数据平台', '商户列表', '*商户详情'], { merchantId: rows[index].merchantId })
} }
}] }]
},
number: {
label: '序号',
width: '90',
index: (index) => {
++index
return index
}
} }
} }
} }
...@@ -156,27 +161,28 @@ export default { ...@@ -156,27 +161,28 @@ export default {
getList() { getList() {
const params = this.getParams() const params = this.getParams()
params.method = bizMethods.Search params.method = bizMethods.Search
console.log(params)
request.req(params).then(res => { request.req(params).then(res => {
this.ListTableData.data = res.merchants this.ListTableData.data = res.merchants
this.totalCount = res.pagination.totalCount this.totalCount = res.pagination.totalCount
this.reset(this.merchantSearch) this.reset(this.merchantSearch)
}).catch(err => { }).catch(err => {
// console.log(err)
notice.errorTips(err) notice.errorTips(err)
console.log('失败-------------')
this.reset(this.merchantSearch) this.reset(this.merchantSearch)
}) })
}, },
saveMerchant(areaInfo) { saveMerchant(areaInfo) {
this.merchantForm = Object.assign(this.merchantForm, areaInfo) this.merchantForm = Object.assign(this.merchantForm, areaInfo)
const params = this.merchantForm const params = this.merchantForm
params.methods = bizMethods.Create params.method = bizMethods.Create
request.req(params).then(res => { request.req(params).then(res => {
notice.okTips() notice.okTips()
this.reset(this.merchantForm) this.reset(this.merchantForm)
this.handleAdd()
this.getList()
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
notice.errorTips() notice.errorTips(err)
}) })
}, },
// 接口请求-end // 接口请求-end
...@@ -217,7 +223,7 @@ export default { ...@@ -217,7 +223,7 @@ export default {
this.reset(this.merchantForm) this.reset(this.merchantForm)
}, },
handleAddComfirm(areaInfo) { handleAddComfirm(areaInfo) {
this.handleAdd() // this.handleAdd()
this.saveMerchant(areaInfo) this.saveMerchant(areaInfo)
} }
} }
......
...@@ -19,25 +19,28 @@ ...@@ -19,25 +19,28 @@
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>
</gl-form-item> </gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType"> <gl-form-item label="商户类型:" prop="merchantType">
<gl-select v-model="addForm.merchantType" name="merchantType" <gl-select v-model="addForm.merchantType"
data-vv-as="商户类型" v-validate="'required'" placeholder="请搜索"> name="merchantType"
data-vv-as="商户类型"
v-validate="'required'"
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>
...@@ -48,30 +51,43 @@ ...@@ -48,30 +51,43 @@
v-model="item.merchant" v-model="item.merchant"
filterable filterable
remote remote
:name="`item.merchant${idx+1}`"
v-validate="item.merchant || item.merchantType ? 'required' : ''"
: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>
<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>
<gl-form-item label="商户类型:"> <gl-form-item label="商户类型:">
<gl-select v-model="item.merchantType" placeholder="请选择"> <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 <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="item.merchantType? !item.merchantType : !!item.merchant" class="error">{{ `请填写子商户${idx+1}的商户类型` }}</span> -->
</gl-form-item> </gl-form-item>
</div> </div>
<span v-show="tip" 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">
...@@ -83,6 +99,8 @@ ...@@ -83,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: {
...@@ -90,46 +108,21 @@ export default { ...@@ -90,46 +108,21 @@ export default {
}, },
data() { data() {
return { return {
tip: false,
addForm: { addForm: {
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',
...@@ -145,53 +138,108 @@ export default { ...@@ -145,53 +138,108 @@ 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.$validator.validateAll().then((result) => { this.$validator.validateAll().then((result) => {
if (result) { if (result) {
this.addList.forEach(item => { this.addList.forEach(item => {
delete item.label delete item.label
}) })
if (this.addList[0].merchantId) {
this.addForm.merchantRelationAdds = this.addList 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() this.showAddDialog()
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }] }).catch(err => {
this.addForm = { merchant: '', merchantType: '' } notice.errorTips(err)
})
} }
}) })
}, },
// 显示隐藏添加商户按钮
showAddDialog() { showAddDialog() {
this.$emit('addData') this.$emit('addData')
setTimeout(() => {
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }]
this.addForm = { merchant: '', merchantType: '' }
}, 400)
}, },
// 添加更多按钮
addMore() { addMore() {
console.log(this.addList.length) 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({ this.addList.push({
label: '子商户' + (this.addList.length + 1), label: '子商户' + (this.addList.length + 1),
merchant: '', merchant: '',
merchantType: '', merchantType: '',
show: true show: true
}) })
}
}, },
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)
})
} 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)
}) })
}, 200)
} 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"
>新增业务</gl-button> >新增业务</gl-button>
<gl-button <!-- <gl-button
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"
...@@ -21,46 +22,37 @@ ...@@ -21,46 +22,37 @@
> >
<gl-form-item <gl-form-item
label="业务名称" label="业务名称"
prop="businessName" prop="confKey"
> >
<gl-input <gl-input
v-model="form.businessName" v-model="form.confKey"
name="businessName" name="confKey"
placeholder="请输入业务名称" placeholder="请输入业务名称"
data-vv-as="业务名称" data-vv-as="业务名称"
v-validate="'required'" v-validate="'required'"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('businessName')" v-show="errorBags.has('confKey')"
class="error" class="error"
>{{ errorBags.first('businessName') }}</span> >{{ errorBags.first('confKey') }}</span>
</gl-form-item> </gl-form-item>
<gl-form-item <gl-form-item
label="业务描述" label="业务描述"
prop="businessDescription" prop="memo"
> >
<gl-input <gl-input
v-model="form.businessDescription" v-model="form.memo"
type="textarea" type="textarea"
:rows="4" :rows="4"
placeholder="请输入业务描述" placeholder="请输入业务描述"
name="businessDescription" name="memo"
data-vv-as="业务描述" data-vv-as="业务描述"
v-validate="'required'" v-validate="'required'"
></gl-input> ></gl-input>
<span <span
v-show="errorBags.has('businessDescription')" v-show="errorBags.has('memo')"
class="error" class="error"
>{{ errorBags.first('businessDescription') }}</span> >{{ errorBags.first('memo') }}</span>
</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-item>
</gl-form> </gl-form>
<div <div
...@@ -74,117 +66,71 @@ ...@@ -74,117 +66,71 @@
>确 定</gl-button> >确 定</gl-button>
</div> </div>
</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 { jumpLink } from '../../../common/common.js' import notice from '@/common/notice'
import { businessManagenMethods, request } from '@/api'
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,
stripe: 'true',
align: 'center', align: 'center',
data: [ data: [],
{
businessId: 1,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 2,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}
],
column: [ column: [
{ {
label: '业务ID', label: '业务ID',
prop: 'businessId' prop: 'confId',
width: '100'
}, { }, {
label: '业务名称', label: '业务名称',
prop: 'businessName' prop: 'confKey'
}, {
label: '业务编号',
prop: 'businessCode'
}, { }, {
label: '业务描述', label: '业务描述',
prop: 'businessDescription' prop: 'memo'
}, { }, {
label: '创建时间', label: '创建时间',
prop: 'createdTime' 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].businessName })
}
} }
] ]
}
}, },
form: { form: {
businessName: '', confKey: '',
businessDescription: '', memo: '',
area: '' area: ''
}, },
dialogFormVisible: false, dialogFormVisible: false,
rules: { rules: {
businessName: [{ required: true }], confKey: [{ required: true }],
businessDescription: [{ required: true }] memo: [{ required: true }]
}, },
// 商户分组组件数据 // 商户分组组件数据
addDialogVisible: false, // addDialogVisible: false,
// 省市区
showCity: [1, 1],
validateCity: [1, 1]
}
},
provide() {
return {
$validator: this.$validator
} }
}, },
watch: { watch: {
dialogFormVisible(val) { dialogFormVisible(val) {
if (val) { if (val) {
this.form = { businessName: '', businessDescription: '', 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()
}, },
methods: { methods: {
// 显示隐藏弹窗 // 显示隐藏弹窗
...@@ -193,25 +139,40 @@ export default { ...@@ -193,25 +139,40 @@ export default {
}, },
// 提交表单 // 提交表单
submit() { submit() {
Promise.all([ this.$validator.validateAll().then((result) => {
this.$refs['c'].$validator.validateAll(), if (result) {
this.$validator.validateAll() this.businessCreate()
]).then((result) => {
if (result[0] && result[1]) {
console.log('提交成功')
console.log(this.form)
this.showDialog()
} }
}) })
}, },
add() { // add() {
this.addDialogVisible = !this.addDialogVisible // this.addDialogVisible = !this.addDialogVisible
}, // },
handleAddData() { // handleAddData() {
this.addDialogVisible = !this.addDialogVisible // this.addDialogVisible = !this.addDialogVisible
// },
// 接口请求
getList() {
const params = {}
params.method = businessManagenMethods.Business
request.req(params).then(res => {
// console.log(res)
this.tableData.data = res.merchantDictList
}).catch(err => {
notice.errorTips(err)
})
}, },
getCityArea(params) { businessCreate() {
const params = this.$deep_clone(this.form)
delete params.area
console.log(params) console.log(params)
params.method = businessManagenMethods.Create
request.req(params).then(res => {
notice.okTips()
this.showDialog()
}).catch(err => {
notice.errorTips(err)
})
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!