Commit 5797c33e by wangql

修改分组页面

2 parents 552f4bc8 52d0802e
...@@ -12375,6 +12375,21 @@ ...@@ -12375,6 +12375,21 @@
"integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=", "integrity": "sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=",
"dev": true "dev": true
}, },
"uppercamelcase": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/uppercamelcase/-/uppercamelcase-1.1.0.tgz",
"integrity": "sha1-Mk2YprOvx+iolT4QZBUJsOTiP5c=",
"requires": {
"camelcase": "^1.2.1"
},
"dependencies": {
"camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
"integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk="
}
}
},
"uri-js": { "uri-js": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "http://registry.npm.taobao.org/uri-js/download/uri-js-4.2.2.tgz", "resolved": "http://registry.npm.taobao.org/uri-js/download/uri-js-4.2.2.tgz",
...@@ -12540,6 +12555,11 @@ ...@@ -12540,6 +12555,11 @@
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"dev": true "dev": true
}, },
"vee-validate": {
"version": "2.1.7",
"resolved": "https://registry.npmjs.org/vee-validate/-/vee-validate-2.1.7.tgz",
"integrity": "sha512-IyPDTTvIRY6o9y14jXlgfY76Qv+hmvYDwNaMn9JY5KbQN8a1tJAu7H/+a/+EdHg1w8Zl9tsdG8lndGqY1lyMzQ=="
},
"vendors": { "vendors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz", "resolved": "http://registry.npm.taobao.org/vendors/download/vendors-1.0.2.tgz",
...@@ -12570,6 +12590,14 @@ ...@@ -12570,6 +12590,14 @@
"resolved": "http://registry.npm.taobao.org/vue/download/vue-2.5.17.tgz", "resolved": "http://registry.npm.taobao.org/vue/download/vue-2.5.17.tgz",
"integrity": "sha1-D4eJrXGL5oyhhyYpgy7VM1icato=" "integrity": "sha1-D4eJrXGL5oyhhyYpgy7VM1icato="
}, },
"vue-amap": {
"version": "0.5.8",
"resolved": "https://registry.npmjs.org/vue-amap/-/vue-amap-0.5.8.tgz",
"integrity": "sha512-VWU6M58jAY4K80QGi+2tYWxvAszd/MQiWkBEYdyu2ptBHAgsNfZz2zxR1mWL32V74Q2bFoZz4yfOycMrQywlUA==",
"requires": {
"uppercamelcase": "^1.1.0"
}
},
"vue-eslint-parser": { "vue-eslint-parser": {
"version": "2.0.3", "version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/vue-eslint-parser/download/vue-eslint-parser-2.0.3.tgz", "resolved": "http://registry.npm.taobao.org/vue-eslint-parser/download/vue-eslint-parser-2.0.3.tgz",
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
"glsx-vue-components": "^1.0.13", "glsx-vue-components": "^1.0.13",
"node-sass": "^4.9.3", "node-sass": "^4.9.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"vue": "^2.5.17" "vee-validate": "^2.1.7",
"vue": "^2.5.17",
"vue-amap": "^0.5.8"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-babel": "^3.0.1",
......
import {
GlAxios
} from 'glsx-vue-common'
const path = '/oss-merchant-data/businessList'
const __sGetList = `${path}/findMerchantsRemote`
const __sSaveMerchant = `${path}/saveMerchantRemote`
const getList = {
p: [__sGetList],
req: params => GlAxios.get(__sGetList, {
params
})
}
const saveMerchant = {
p: [__sSaveMerchant],
req: params => GlAxios.get(__sSaveMerchant, {
params
})
}
export {
getList,
saveMerchant
}
...@@ -4,10 +4,34 @@ import Vue from 'vue' ...@@ -4,10 +4,34 @@ import Vue from 'vue'
import GlsxVueComponents from 'glsx-vue-components' import GlsxVueComponents from 'glsx-vue-components'
import 'glsx-vue-components/dist/glsx-vue-components.css' import 'glsx-vue-components/dist/glsx-vue-components.css'
import './styles/index.scss' import './styles/index.scss'
import './styles/common.scss'
// import axios from 'axios' // import axios from 'axios'
import VeeValidate from 'vee-validate'
Vue.use(GlsxVueComponents) Vue.use(GlsxVueComponents)
Vue.use(VeeValidate, {
// i18n,
// i18nRootKey: 'validation',
dictionary: {
en: {
messages: {
required: (field) => `${field}不能为空`,
between: (field, data) => `${field}必须在${data[0]}~${data[1]}之间`,
confirmed: (field, data) => `${field}必须与${data[0]}相匹配`,
max: (field, data) => `${field}最大长度不能超过${data[0]}`,
min: (field, data) => `${field}最小长度不能小于${data[0]}`,
digits: (field, data) => `${field}必须为数字,且长度必须等于${data[0]}`,
min_value: (field, data) => `${field}数值不能小于${data[0]}`,
max_value: (field, data) => `${field}数值不能大于${data[0]}`,
not_in: (field, data) => `${field}不能为${data.join(',')}`,
is_phone: () => '请输入11位正确的手机号码'
}
}
},
errorBagName: 'errorBags',
fieldsBagName: 'fieldBags',
events: 'blur|input'
})
var mixin = { var mixin = {
mounted() { mounted() {
const _this = this const _this = this
......
import Vue from 'vue'
export default new Vue({
methods: {
warningTips(message) {
this.$notify({
type: 'warning',
title: message
})
},
okTips(message) {
this.$notify({
type: 'success',
title: message || '操作成功'
})
},
errorTips(message) {
this.$notify({
type: 'error',
title: message || '操作失败'
})
}
}
})
.default {
position: relative;
padding: 0px 25px;
}
.m-b10 {
margin-bottom: 10px;
}
.p-t15 {
padding-top: 15px;
}
\ No newline at end of file \ No newline at end of file
...@@ -73,3 +73,13 @@ a:hover { ...@@ -73,3 +73,13 @@ a:hover {
.app-container { .app-container {
padding: 20px; padding: 20px;
} }
.error {
color: #f56c6c;
font-size: 12px;
line-height: 1;
padding-top: 4px;
// position: absolute;
// top: 100%;
// left: 0;
float: left;
}
\ No newline at end of file \ No newline at end of file
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div>
<gl-breadcrumb separator='/'>
<gl-breadcrumb-item><a href='#' @click='back'>商户列表</a></gl-breadcrumb-item>
<gl-breadcrumb-item>商户详情</gl-breadcrumb-item>
<gl-breadcrumb-item>{{name}}</gl-breadcrumb-item>
</gl-breadcrumb>
<!-- <gl-button type='text' @click='back'>商户列表</gl-button>
<span>\ 商户详情 \{{name}}</span> -->
<gl-tabs v-model='activeName' @tab-click='handleClick'>
<gl-tab-pane label='基本信息' name='first'>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col>
<gl-col :span='24' style=''><span>商户名称:</span>
<div class='amap-page-container'>
<el-amap vid='amapDemo' :center='center' :amap-manager='amapManager' :zoom='zoom' :events='events' class='amap-demo'>
</el-amap>
</div></gl-col>
</gl-tab-pane>
<gl-tab-pane label='员工信息' name='second'>配置管理
</gl-tab-pane>
<gl-tab-pane label='分组信息' name='third'>角色管理
</gl-tab-pane>
</gl-tabs>
</div>
</template>
<script>
import VueAMap from 'vue-amap'
import Vue from 'vue'
const amapManager = new VueAMap.AMapManager()
VueAMap.initAMapApiLoader({
key: '44cc16e43ad7ed3358df507bd0618181',
uiVersion: '1.0'
})
Vue.use(VueAMap)
export default {
name: 'BusinessDetails',
data() {
const _this = this
return {
name: '',
activeName: 'first',
zoom: 12,
center: [121.59996, 31.197646], // 地图中心点
amapManager,
events: {
init(o) {
const marker = new AMap.Marker({
position: _this.point
})
marker.setMap(o)
}
},
point: [116.397428, 39.90923] // 赋值的点,有接口可删
}
},
mounted() {
this.center = this.point
// 链接,接受参数
var url = location.search
var theRequest = {}
if (url.indexOf('?') !== -1) {
// substr()方法返回从参数值开始到结束的字符串
var str = url.substr(1)
var strs = str.split('&')
const text = []
for (var i = 0; i < strs.length; i++) {
// 处理乱码
text[i] = decodeURI(strs[i])
theRequest[text[i].split('=')[0]] = (text[ i ].split('=')[1])
}
this.name = theRequest.name
}
},
methods: {
back() {
history.back()
},
handleClick(tab, event) {
console.log(tab, event)
}
}
}
</script>
<style>
.amap-page-container {
/* display: inline-block; */
width: 90%;
height: 300px;
/* vertical-align: text-top; */
}
.amap-demo {
height: 300px;
}
</style>
...@@ -55,20 +55,19 @@ ...@@ -55,20 +55,19 @@
> >
</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"
ref="addParams"
label-width="120px" label-width="120px"
> >
<gl-form-item label="分组名称:" prop="groupName"> <gl-form-item label="分组名称:" prop="groupName">
<gl-input name="groupName" v-validate="'required'" data-vv-as="分组名称" placeholder="请输入名称" v-model="addParams.groupName"></gl-input> <gl-input name="groupName" placeholder="请输入名称" v-model="addParams.groupName"></gl-input>
<!-- <span v-show="errorBags.has('groupName')" class="error">
{{ errorBags.first('groupName') }}
</span> -->
</gl-form-item> </gl-form-item>
<gl-form-item label="业务类型:" prop="businessCode"> <gl-form-item label="业务类型:" prop="businessCode">
<gl-select <gl-select
...@@ -91,7 +90,7 @@ ...@@ -91,7 +90,7 @@
</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" :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>
...@@ -105,11 +104,14 @@ ...@@ -105,11 +104,14 @@
// import { NoticeMixin } from '@/mixins' // import { NoticeMixin } from '@/mixins'
// import Vue from 'vue' // import Vue from 'vue'
export default { export default {
// name: 'channel', name: 'channel',
components: { components: {
// Edit, // Edit,
}, },
watch: { watch: {
dialogVisible(val) {
this.$refs['addParams'].resetFields()
}
}, },
// mixins: [NoticeMixin], // mixins: [NoticeMixin],
data() { data() {
...@@ -117,7 +119,16 @@ export default { ...@@ -117,7 +119,16 @@ export default {
searchCondition: {}, searchCondition: {},
addParams: { addParams: {
groupName: '', groupName: '',
businessCode: null businessCode: ''
},
rules: {
groupName: [
{ required: true, message: '请输入分组名称', trigger: 'blur' },
{ max: 10, message: '长度最多10个字符', trigger: 'blur' }
],
businessCode: [
{ required: true, message: '请选择业务类型', trigger: 'change' }
]
}, },
businessCodeList: [], businessCodeList: [],
pageNum: 1, pageNum: 1,
...@@ -233,8 +244,15 @@ export default { ...@@ -233,8 +244,15 @@ export default {
// this.idPassvalue.$emit('expressionId', objId) // this.idPassvalue.$emit('expressionId', objId)
}, },
// 新增分组 // 新增分组
handleSubmit() { handleSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!')
} else {
console.log('error submit!!')
return false
}
})
}, },
// 关闭新增分组弹出框 // 关闭新增分组弹出框
handleClose() { handleClose() {
......
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
<template>
<div class="detail">
<div class="default">
<gl-form
: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
class="newButton"
type="primary"
@click="searchDialog"
>高级搜索</gl-button>
<gl-button
class="newButton"
type="primary"
@click="addDialog"
>添加商户</gl-button>
</gl-form-item>
</gl-form>
</div>
<gl-table
: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 @href="merchantDetail(scope.scope.row[merchantId])">{{tableData.data[scope.scope.$index][i.prop]}}</a>
</template>
<template v-else-if='i.prop === "parentMerchantName"'>
<a @href="merchantDetail(scope.scope.row[parentMerchantId])">{{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"
>
<gl-form
:model="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="地区:" prop="area">
<gl-cascader
:options="areaOptions"
v-model="selectedOptions"
change-on-select
@change="handleChange">
</gl-cascader>
</gl-form-item> -->
<gl-form-item label='加入分组时间:'>
<gl-date-picker
v-model="times"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</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>
</div>
</template>
<script>
// import Edit from './Edit'
// import { fn, treeCheckKeys, deleteEmptyAttribute } from '@/common/common'
// import { getExpList, mergeExp } from '@/api'
// import { NoticeMixin } from '@/mixins'
// import Vue from 'vue'
export default {
name: 'detail',
components: {
// Edit,
},
watch: {
},
// mixins: [NoticeMixin],
data() {
return {
searchCondition: {},
searchParams: {
merchantName: '',
merchantId: null,
merchantType: null
},
times: [],
merchantTypeList: [],
pageNum: 1,
pageSize: 10,
total: 10,
tableLoading: false,
searchLoading: false,
dialogVisible_search: false,
tableData: {
border: true,
align: 'center',
// height: parseInt(this.$client_height() - 140),
data: [],
column: [
{
label: '序号',
prop: 'id'
},
{
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'
}
],
// 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() {
this.getList()
// this.idPassvalue = new Vue()
},
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams() {
return Object.assign(
{
pageNum: this.pageNum,
pageSize: this.pageSize
},
this.searchCondition
)
},
getList() {
// const params = this.getParams()
// getExpList
// .req(params)
// .then(res => {
// this.total = res.total
// this.tableData.data = res.list
// this.tableLoading = false
// })
// .catch(err => {
// this.tableLoading = false
// this.error(err)
// })
},
handleSizeChange(val) {
this.pageSize = val
this.loadingGetList()
},
handleCurrentChange(val) {
this.pageNum = val
this.loadingGetList()
},
// 打开高级搜索弹出框
searchDialog() {
this.dialogVisible_search = !this.dialogVisible_search
// this.idPassvalue.$emit('expressionId', objId)
},
// 关闭高级搜索弹出框
handleClose_search() {
this.dialogVisible_search = !this.dialogVisible_search
},
// 高级搜索
handleSubmit_search() {
},
// 重置搜索
searchReset() {
},
addDialog() {
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" >
.detail {
.cell {
.el-button {
padding: 2px 10px;
}
}
}
// .tableImg{
// width: 36px;
// height: 36px;
// cursor: pointer;
// }
</style>
<!-- 新增商户 -->
<template>
<div>
<gl-dialog
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
:width="diaWidth"
>
<gl-form
label-width="85px"
:model="merchantForm"
:rules="rules"
>
<gl-form-item label="商户名称:">
<gl-input
v-model="merchantForm.name"
placeholder="请输入商户名称"
name="name"
data-vv-as="商户名称"
v-validate="'required'"
clearable
></gl-input>
<span v-show="errorBags.has('name')" class="error">{{ errorBags.first('name') }}</span>
</gl-form-item>
<gl-form-item label="商户地址:">
<gl-input
v-model="merchantForm.address"
placeholder="请输入详细地址"
name="address"
data-vv-as="详细地址"
v-validate="'required'"
clearable
>
</gl-input>
<span v-show="errorBags.has('address')" class="error">{{ errorBags.first('address') }}</span>
</gl-form-item>
<gl-form-item label="商户渠道:">
<gl-select
v-model="merchantForm.merchantChannel"
placeholder="请选择"
></gl-select>
</gl-form-item>
<gl-form-item label="联系人:">
<gl-input
v-model="merchantForm.contactor"
placeholder="请输入联系人姓名"
name="contactor"
data-vv-as="联系人姓名"
v-validate="'required'"
clearable
></gl-input>
<span v-show="errorBags.has('contactor')" class="error">{{ errorBags.first('contactor') }}</span>
</gl-form-item>
<gl-form-item label="手机号码:">
<gl-input
v-model="merchantForm.contactPhone"
placeholder="请输入联系人手机号码"
name="contactPhone"
data-vv-as="联系人手机号码"
v-validate="'required|is_phone'"
clearable
></gl-input>
<span v-show="errorBags.has('contactPhone')" class="error">{{ errorBags.first('contactPhone') }}</span>
</gl-form-item>
</gl-form>
<span slot="footer">
<el-button
type="primary"
@click="handleComfrim"
>确 定</el-button>
<el-button @click="handleClose">取 消</el-button>
</span>
</gl-dialog>
</div>
</template>
<script>
const isPhone = {
validate: (value, args) => {
return value.length === 11 && /^((13|14|15|17|18)\d{9})$/.test(value)
}
}
export default {
name: 'AddDialog',
data() {
return {
title: '新增商户',
// phoneFixed: 11,
rules: {
merchantName: [{ required: true }],
address: [{ required: true }],
merchantChannel: [{ required: true }],
contactor: [{ required: true }],
contactPhone: [{ required: true, isPhone: true }]
}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
diaWidth: {
type: String,
default: '40%'
},
merchantForm: Object
},
watch: {
isVisible() {
this.$validator.errors.clear()
}
},
mounted() {
this.$validator.extend('is_phone', isPhone)
},
methods: {
handleClose() {
this.$emit('hideDialog')
},
handleComfrim() {
this.$validator.validateAll().then((result) => {
if (result) {
this.$emit('comfirmDialog')
}
})
}
}
}
</script>
<style>
</style>
\ No newline at end of file \ No newline at end of file
<!-- 搜索弹窗 -->
<template>
<div>
<gl-dialog
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
:width="diaWidth"
>
<gl-form
:model="merchantSearch"
label-width="85px"
>
<gl-form-item label="商户名称:">
<gl-input
v-model="merchantSearch.name"
placeholder="请输入商户名称"
clearable
></gl-input>
</gl-form-item>
<gl-col :span="12">
<gl-form-item label="商户号:">
<gl-input
v-model="merchantSearch.merchantId"
placeholder="请输入商户号"
clearable
></gl-input>
</gl-form-item>
</gl-col>
<gl-col :span="12">
<gl-form-item label="地区:">
<gl-col :span="11">
<gl-select
v-model="merchantSearch.provinceId"
placeholder="省"
>
</gl-select>
</gl-col>
<gl-col
:span="11"
:push="2"
>
<gl-select
v-model="merchantSearch.cityId"
placeholder="市"
>
</gl-select>
</gl-col>
</gl-form-item>
</gl-col>
<gl-col :span="12">
<gl-form-item label="渠道:">
<gl-select
style="width: 100%;"
v-model="merchantSearch.merchantChannel"
placeholder="请选择渠道"
></gl-select>
</gl-form-item>
</gl-col>
<gl-col :span="12">
<gl-form-item label="状态:">
<gl-select
style="width: 100%;"
v-model="merchantSearch.merchantStatus"
placeholder="请选择状态"
>
<!-- <gl-option
v-for="(item, index) in statusItems"
:key="item"
:value="index"
:label="item"
></gl-option> -->
<gl-option
v-for="(value, key) in statusItems"
:key="value"
:value="key"
:label="value"
></gl-option>
</gl-select>
</gl-form-item>
</gl-col>
<gl-col>
<gl-form-item label="注册时间:">
<gl-col :span="11">
<gl-date-picker
type="date"
placeholder="选择日期"
v-model="merchantSearch.startTime"
style="width:92%;"
></gl-date-picker>
</gl-col>
<gl-col
class="line"
:span="2"
>至</gl-col>
<gl-col :span="11">
<gl-date-picker
type="date"
placeholder="选择日期"
v-model="merchantSearch.endTime"
style="width: 100%;"
></gl-date-picker>
</gl-col>
</gl-form-item>
</gl-col>
</gl-form>
<span slot="footer">
<el-button
type="primary"
@click="handleComfrim"
>搜 索</el-button>
<el-button @click="hideDialog">重 置</el-button>
</span>
</gl-dialog>
</div>
</template>
<script>
export default {
name: 'SearchDialog',
data() {
return {
title: '高级搜索'
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
diaWidth: {
type: String,
default: '40%'
},
merchantSearch: Object,
statusItems: Object
},
methods: {
handleClose() {
this.$emit('hideDialog', true)
},
handleComfrim() {
this.$emit('comfirmDialog')
},
hideDialog() {
this.$emit('hideDialog')
}
}
}
</script>
<style>
</style>
\ No newline at end of file \ No newline at end of file
<template> <template>
<div class="default">
<div class="m-b10">
<gl-button
type="primary"
@click="handleSearch"
>高级搜索</gl-button>
<gl-button type="primary" @click="handleAdd">新增商户</gl-button>
</div>
<div> <div>
<h1>商户列表</h1> <gl-table
class="m-b10"
:table="ListTableData"
></gl-table>
<gl-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="pageSize"
layout="sizes, total, ->, prev, pager, next"
:total="total"
>
</gl-pagination>
</div>
<add-dialog
@hideDialog="handleAddHide"
@comfirmDialog="handleAddComfirm"
:isVisible="addVisible"
:merchantForm="merchantForm">
</add-dialog>
<search-dialog
@comfirmDialog="handleSearchComfirm"
@hideDialog="handleSearchHide"
:isVisible="searchVisible"
:merchantSearch="merchantSearch"
:statusItems="status"
>
</search-dialog>
</div> </div>
</template> </template>
<script> <script>
import SearchDialog from './SearchDialog'
import AddDialog from './AddDialog'
import { getList, saveMerchant } from '@/api/bussinessListApi'
import notice from '@/common/notice'
export default { export default {
name: 'businessList' name: 'businessList',
components: {
SearchDialog,
AddDialog
},
data() {
return {
// 新增弹窗
addVisible: false,
merchantForm: {
merchantName: '',
address: '',
merchantChannel: '',
contactor: '',
contactPhone: ''
},
// 搜索弹窗
searchVisible: false,
merchantSearch: {
name: '',
merchantId: '',
provinceId: '',
cityId: '',
address: '',
merchantChannel: '',
merchantStatus: '',
startTime: '',
endTime: ''
},
// status: ['已停用', '已启用', '待审核'],
status: {
0: '已停用',
1: '已启用',
2: '待审核'
},
// 分页所需参数-start
total: 10,
currentPage: 1,
pageSize: 10,
// 分页所需参数-end
ListTableData: {
border: true,
height: parseInt(this.$client_height() - 140),
align: 'center',
data: [],
column: [{
label: '商户名称',
prop: 'merchantName'
}, {
label: '商户号',
prop: 'merchantId'
}, {
label: '地区',
prop: 'merchantAdd'
}, {
label: '渠道',
prop: 'merchantChannel'
}, {
label: '联系人',
prop: 'merchantContact'
}, {
label: '电话',
prop: 'merchantPhone'
}, {
label: '注册时间',
prop: 'merchantTime'
}, {
label: '状态',
prop: 'merchantStatus',
formatter: (cellValue) => {
return this.status[cellValue.merchantStatus]
}
}],
number: {
label: '序号',
width: '80px',
index: (index) => {
++index
return index
}
},
console: {
show: true,
label: '操作',
button: [{
label: '详情',
type: 'text',
callback: (index, rows) => {
const url = encodeURI(`../../customer/businessDetails.html?id=${rows[index].merchantId}&name=${rows[index].merchantName}`)
location.href = url
}
}]
}
}
}
},
mounted() {
this.getList()
},
methods: {
// 获取页面参数
getParams() {
const params = this.$deep_clone(this.merchantSearch)
params.pageSize = this.pageSize
params.currentPage = this.currentPage
return params
},
// 接口请求-start
getList() {
const params = this.getParams()
getList.req(params).then(res => {
this.ListTableData.data = res.data
this.total = res.total
this.reset(this.merchantSearch)
}).catch(err => {
console.log(err)
notice.errorTips()
this.reset(this.merchantSearch)
})
},
saveMerchant() {
saveMerchant.req(this.merchantForm).then(res => {
notice.okTips()
this.reset(this.merchantForm)
}).catch(err => {
console.log(err)
notice.errorTips()
this.reset(this.merchantForm)
})
},
// 接口请求-end
handleSizeChange(val) {
this.pageSize = val
this.getList()
},
handleCurrentChange(val) {
this.currentPage = val
this.getList()
},
reset(params) {
for (var item in params) {
params[item] = ''
}
},
// 搜索-start--------
handleSearch() {
this.searchVisible = !this.searchVisible
},
// 隐藏/重置
handleSearchHide(hide) {
this.reset(this.merchantSearch)
hide && this.handleSearch()
},
// 搜索
handleSearchComfirm() {
this.handleSearch()
this.getList()
},
// 搜索-end--------
// 新增
handleAdd() {
this.addVisible = !this.addVisible
},
handleAddHide() {
this.handleAdd()
this.reset(this.merchantForm)
},
handleAddComfirm() {
this.handleAdd()
this.saveMerchant()
}
}
} }
</script> </script>
......
<template> <template>
<div> <div>
<h1>业务管理</h1> <gl-button type="primary" @click="showDialog">新增业务</gl-button>
<gl-table :table="tableData"></gl-table>
<gl-dialog title="新增业务"
:visible.sync="dialogFormVisible"
:close-on-click-modal="false">
<gl-form :model="form"
label-width="100px"
:rules="rules">
<gl-form-item label="业务名称" prop="businessName">
<gl-input v-model="form.businessName"
name="businessName"
placeholder="请输入业务名称"
data-vv-as="业务名称"
v-validate="'required'"></gl-input>
<span v-show="errorBags.has('businessName')" class="error">{{ errorBags.first('businessName') }}</span>
</gl-form-item>
<gl-form-item label="业务描述" prop="businessDescription">
<gl-input
v-model="form.businessDescription"
type="textarea"
:rows="4"
placeholder="请输入业务描述"
name="businessDescription"
data-vv-as="业务描述"
v-validate="'required'"
></gl-input>
<span v-show="errorBags.has('businessDescription')" class="error">{{ errorBags.first('businessDescription') }}</span>
</gl-form-item>
</gl-form>
<div slot="footer" class="dialog-footer">
<gl-button @click="showDialog">取 消</gl-button>
<gl-button type="primary" @click="submit">确 定</gl-button>
</div>
</gl-dialog>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'businessManagement' name: 'BusinessManagement',
data() {
return {
tableData: {
border: true,
align: 'center',
data: [
{
businessId: 1,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 2,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 3,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 4,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 5,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}, {
businessId: 6,
businessName: '爱车保镖',
businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16'
}
],
column: [
{
label: '业务ID',
prop: 'businessId'
}, {
label: '业务名称',
prop: 'businessName'
}, {
label: '业务编号',
prop: 'businessCode'
}, {
label: '业务描述',
prop: 'businessDescription'
}, {
label: '创建时间',
prop: 'createdTime'
}
],
// 详情
console: {
show: true,
label: '操作',
width: '150',
fixed: 'right',
button: [
{
type: 'text',
label: '详情',
callback: (index, rows) => {
const url = encodeURI(`../../customer/businessDetails.html?id=${rows[index].businessId}&name=${rows[index].businessName}`)
location.href = url
}
}
]
}
},
form: {
businessName: '',
businessDescription: ''
},
dialogFormVisible: false,
rules: {
businessName: [{ required: true }],
businessDescription: [{ required: true }]
}
}
},
watch: {
dialogFormVisible(val) {
this.$validator.errors.clear()
}
},
methods: {
// 显示隐藏弹窗
showDialog() {
this.dialogFormVisible = !this.dialogFormVisible
},
// 提交表单
submit() {
this.$validator.validateAll().then((result) => {
if (result) {
console.log('提交成功')
console.log(this.form)
this.showDialog()
}
})
}
}
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!