Commit 6cc633f8 by 胡悦

shanchu

2 parents 72b7d526 52566eab
<template>
<div class="default businessGD">
<div class="m-b10">
<gl-button
class="newButton"
type="primary"
@click="searchDialog"
>高级搜索</gl-button>
<gl-button
class="newButton"
type="primary"
@click="addDialog"
>添加商户</gl-button>
</div>
<gl-table
class="m-b10"
:table="tableData"
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 === "merchantName"'>
<a @click="merchantDetail(scope.scope.row.merchantId)" class="el-button el-button--text">{{tableData.data[scope.scope.$index][i.prop]}}</a>
</template>
<template v-else-if='i.prop === "parentMerchantName"'>
<a @click="merchantDetail(scope.scope.row.parentMerchantId)" class="el-button el-button--text">{{tableData.data[scope.scope.$index][i.prop]}}</a>
</template>
<template v-else>
{{tableData.data[scope.scope.$index][i.prop]}}
</template>
</template>
</gl-table-column>
</gl-table>
<gl-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
layout="total, sizes, ->, prev, pager, next, jumper"
:total="total"
>
</gl-pagination>
<gl-dialog
title="高级搜索"
width="40%"
:visible.sync="dialogVisible_search"
:before-close="handleClose_search"
:close-on-click-modal="false">
<gl-form
:model="searchParams"
ref="searchParams"
label-width="120px">
<gl-form-item label="商户名称:" prop="merchantName">
<gl-input name="merchantName" placeholder="请输入商户名称" v-model="searchParams.merchantName"></gl-input>
</gl-form-item>
<gl-form-item label="商户号:" prop="merchantId">
<gl-input name="merchantId" placeholder="请输入商户号" v-model="searchParams.merchantId"></gl-input>
</gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType">
<gl-select
name="merchantType"
v-model="searchParams.merchantType"
placeholder="请选择">
<gl-option
v-for="item in merchantTypeList"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</gl-form-item>
<gl-form-item label="地区:">
<city-area
ref="c"
:showCity="showCity"
:eventBus="eventBus"
@cityArea="getCityArea"
></city-area>
</gl-form-item>
<gl-form-item label='加入分组时间:'>
<gl-date-picker
v-model="times"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions"
>
</gl-date-picker>
</gl-form-item>
</gl-form>
<div slot="footer" class="dialog-footer">
<gl-button type="primary" @click="handleSubmit_search" :loading="searchLoading">搜索</gl-button>
<gl-button @click="searchReset">重置</gl-button>
</div>
</gl-dialog>
<add-business
:groupId="groupId+''"
:addDialogVisible="addDialogVisible"
@addData="handleAddData"
></add-business>
</div>
</template>
<script>
import { groupDetailMethods, request } from '@/api'
import AddBusiness from './addBusiness'
import { resetSearch } from '@/common/common'
import { CityArea } from '../components'
import notice from '@/common/notice'
export default {
name: 'detail',
components: {
AddBusiness,
CityArea
},
watch: {
dialogVisible_search(val) {
if (!val) {
this.eventBus.$emit('reset')
this.times = []
resetSearch(this.searchParams)
// this.loadingGetList()
}
}
},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now()
}
},
groupId: '',
searchParams: {
// groupId: '',
merchantName: '',
merchantId: '',
merchantType: '',
provinceId: '',
cityId: '',
startTime: '',
endTime: ''
},
times: [],
merchantTypeList: [],
pageNum: 1,
pageSize: 10,
total: 10,
tableLoading: false,
searchLoading: false,
// 高级搜索
dialogVisible_search: false,
// 添加商户
addDialogVisible: false,
// 省市区
showCity: [1, 1],
eventBus: null,
tableData: {
border: true,
stripe: true,
align: 'center',
height: parseInt(this.$client_height() - 140),
data: [],
column: [
{
label: '序号',
prop: 'id',
width: '80px'
},
{
label: '商户名称',
prop: 'merchantName'
},
{
label: '商户号',
prop: 'merchantId'
},
{
label: '地区',
prop: 'areaAddress'
},
{
label: '商户类型',
prop: 'merchantTypeName'
},
{
label: '加入分组时间',
prop: 'createTime'
// formatter: cellValue => {
// if (cellValue.createTime) {
// return new Date(cellValue.createTime).format('yyyy-MM-dd')
// }
// }
},
{
label: '父商户名称',
prop: 'parentMerchantName'
},
{
label: '父商户号',
prop: 'parentMerchantId'
}
]
}
}
},
mounted() {
this.$root.eventBus.$on('params', (params) => {
this.groupId = params.groupId
this.getList()
this.addDialogVisible = false
this.dialogVisible_search = false
// this.searchParams.groupId = params.groupId
})
// this.loadingGetList()
this.getMerchantType()
this.eventBus = this.$root.eventBus
},
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams() {
return Object.assign(
{
pageCount: this.pageSize,
pageSize: this.pageNum
},
this.searchParams
)
},
getList() {
if (this.times.length) {
this.searchParams.startTime = this.times[0] + ' 00:00:00'
this.searchParams.endTime = this.times[1] + ' 23:59:59'
}
const params = this.getParams()
params.groupId = this.groupId
params.method = groupDetailMethods.Search
request
.req(params)
.then(res => {
if (res.pagination) {
this.total = res.pagination.totalCount
}
this.tableData.data = res.merchantGroupRelations
this.tableLoading = false
})
.catch(err => {
this.tableLoading = false
notice.errorTips(err)
})
},
handleSizeChange(val) {
this.pageSize = val
this.loadingGetList()
},
handleCurrentChange(val) {
this.pageNum = val
this.loadingGetList()
},
// 获取商户类型
getMerchantType() {
const params = {}
params.method = groupDetailMethods.MerchantType
request
.req(params)
.then(res => {
res.merchantDictList.forEach((item, index) => {
this.merchantTypeList.push({ 'label': item.confKey, 'value': item.confId })
})
})
.catch(err => {
this.tableLoading = false
notice.errorTips(err)
})
},
// 打开高级搜索弹出框
searchDialog() {
this.dialogVisible_search = !this.dialogVisible_search
// this.idPassvalue.$emit('expressionId', objId)
},
// 关闭高级搜索弹出框
handleClose_search() {
this.dialogVisible_search = !this.dialogVisible_search
},
// 高级搜索
handleSubmit_search() {
this.getList()
this.dialogVisible_search = !this.dialogVisible_search
},
// 重置搜索
searchReset() {
// this.$refs['searchParams'].resetFields()
this.eventBus.$emit('reset')
this.times = []
resetSearch(this.searchParams)
},
addDialog() {
this.addDialogVisible = !this.addDialogVisible
},
handleAddData(t) {
if (t) {
this.loadingGetList()
}
this.addDialogVisible = !this.addDialogVisible
},
getCityArea(params) {
if (params[0]) {
this.searchParams.provinceId = params[0]
}
if (params[1]) {
this.searchParams.cityId = params[1]
}
},
merchantDetail(merchantId) {
this.$root.to(['商户数据平台', '商户数据管理', '商户数据', '商户列表管理', '*商户详情'], { merchantId: merchantId })
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" >
.detail {
.cell {
.el-button {
padding: 2px 10px;
}
}
}
.businessGD a{
/* color: #0000FF; */
text-decoration:underline
}
// .tableImg{
// width: 36px;
// height: 36px;
// cursor: pointer;
// }
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!