Commit eb6db6e9 by cwq0219
2 parents 5eb0355d e7483084
import {
GlAxios
} from 'glsx-vue-common'
const path = 'glsx.accounts.admin.merchant'
const __dictBusiness = `${path}.dict.business`
const getBusinessList = {
p: [__dictBusiness],
req: params => GlAxios.get(__dictBusiness, { params })
}
export {
getBusinessList
}
\ No newline at end of file \ No newline at end of file
import {
getBusinessList
} from './businessManagement'
import {
getList,
saveMerchant
} from './bussinessListApi'
export {
getBusinessList,
getList,
saveMerchant
}
\ No newline at end of file \ No newline at end of file
...@@ -33,26 +33,74 @@ Vue.use(VeeValidate, { ...@@ -33,26 +33,74 @@ Vue.use(VeeValidate, {
events: 'blur|input' events: 'blur|input'
}) })
var mixin = { var mixin = {
data() {
return {
flag: true
}
},
mounted() { mounted() {
const _this = this const _this = this
const theme = new this.$Theme() const theme = new this.$Theme()
const connection = this.$Penpal.connectToParent({ this.$$connection = this.$Penpal.connectToParent({
methods: { methods: {
setTheme(color) { setTheme(color) {
theme.change(color) theme.change(color)
}, },
height() { height() {
return document.height || document.body.offsetHeight // document.documentElement.clientHeight || document.body.clientHeight // return document.height || document.body.offsetHeight // document.documentElement.clientHeight || document.body.clientHeight //
},
/**
* 添加glsx-vue-admin 父框架传过来的参数 并广播这些参数
* @param {} params 接收到的参数 例如 列表页面 传到详情页面的ID
*/
translate(params) {
_this.eventBus.$emit('params', params)
} }
} }
}) })
connection.promise.then(parent => { this.$$connection.promise.then(parent => {
const cfg = _this.$get_session_config() const cfg = _this.$get_session_config()
_this.$$parent = parent // 缓存parent 也就是glsx-vue-admin 为该页面创建的 iframe
if (cfg) return if (cfg) return
parent.getResources().then(config => { parent.getResources().then(config => {
_this.$set_session_config(config) _this.$set_session_config(config)
}) })
}) })
},
methods: {
/**
* 页面跳转方法 用法 :
* this.$root.to(['MOCK系统A', '一键导航', '导航数据', 'MOCK数据B', 'localhost'],'1123')
* 或:
* this.$parent.to(['MOCK系统A', '一键导航', '导航数据', 'MOCK数据B', 'localhost'],'1123')
*
* @param {*} path 如: ['一级菜单名称','二级菜单名称','三级菜单名称','四级菜单名称','五级菜单名称']
* @param {*} params 传给下一个页面的参数
*/
to(path, params) {
if (this.$$parent) {
this.$$parent.to(path, params)
} else {
this.$$connection.promise.then(parent => {
parent.to(path, params)
})
}
}
},
data() {
return {
/**
* 定义一个事件传输总线
* 提示:页面与子组件间的参数都可以用之来互相传递
* 如:
* this.$root.eventBus.$emit('params', {id:123});
*
this.$root.eventBus.$on('params', (params)=>{
console.log(params);
});
*/
eventBus: new Vue()
}
} }
} }
const URL = ' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config' const URL = ' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config'
......
// 公共方法,设置颜色
function urlEncode(param, key, encode) {
if (param == null) return ''
var paramStr = ''
var t = typeof (param)
if (t == 'string' || t == 'number' || t == 'boolean') {
paramStr += '&' + key + '=' + ((encode == null || encode) ? encodeURIComponent(param) : param)
} else {
for (var i in param) {
var k = key == null ? i : key + (param instanceof Array ? '[' + i + ']' : '.' + i)
paramStr += urlEncode(param[i], k, encode)
}
}
return paramStr
}
function jumpLink(url, params, _this) {
location.href = url + urlEncode(params)
// setTimeout(() => {
// const theme = new _this.$Theme()
// theme.change('#FF0000')
// }, 1000)
// document.getElementById('child_iframe_1192').src=url + urlEncode(params)
}
export {
jumpLink
}
<template> <template>
<div> <div class="detail">
<gl-breadcrumb separator='/'> <gl-breadcrumb separator='/'>
<gl-breadcrumb-item><a href='#' @click='back'>商户列表</a></gl-breadcrumb-item> <gl-breadcrumb-item><a href='#' @click='back'>商户列表</a></gl-breadcrumb-item>
<gl-breadcrumb-item>商户详情</gl-breadcrumb-item> <gl-breadcrumb-item>商户详情</gl-breadcrumb-item>
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
<span>\ 商户详情 \{{name}}</span> --> <span>\ 商户详情 \{{name}}</span> -->
<gl-tabs v-model='activeName' @tab-click='handleClick'> <gl-tabs v-model='activeName' @tab-click='handleClick'>
<gl-tab-pane label='基本信息' name='first'> <gl-tab-pane label='基本信息' name='first'>
<gl-col class="detail-row" :span="i.isMap || i.img? 24 : 12" v-for="(i, index) in List" :key="index+''">
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> <span>{{i.label}}:
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> <div v-if="i.isMap" class='amap-page-container'>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> <el-amap vid='amapDemo' :center='center' :amap-manager='amapManager' :zoom='zoom' :events='events' class='amap-demo'>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> </el-amap>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> </div>
<gl-col :span='12'><span>商户名称:</span><span>深圳市安卓讯航科技有限公司</span></gl-col> <img v-else-if="i.isImg" class="detail-logo" :src="i.value" alt="">
<gl-col :span='24' style=''><span>商户名称:</span> <span v-else>{{i.value}}</span>
<div class='amap-page-container'> </span>
<el-amap vid='amapDemo' :center='center' :amap-manager='amapManager' :zoom='zoom' :events='events' class='amap-demo'> </gl-col>
</el-amap> <!-- <gl-col :span='24' style=''><span>商户名称:</span>
</div></gl-col> </gl-col> -->
</gl-tab-pane> </gl-tab-pane>
<gl-tab-pane label='员工信息' name='second'>配置管理 <gl-tab-pane label='员工信息' name='second'>配置管理
...@@ -49,6 +49,44 @@ export default { ...@@ -49,6 +49,44 @@ export default {
return { return {
name: '', name: '',
activeName: 'first', activeName: 'first',
List: [
{
label: '商户名称',
value: '深圳市安卓讯航科技有限公司'
}, {
label: '商户号',
value: '44186213'
}, {
label: '商户地址',
value: '广东省深圳市南山区科兴科学园C3单元'
}, {
label: '商户渠道',
value: '自有渠道'
}, {
label: '联系人',
value: '彭裕'
}, {
label: '注册时间',
value: '2018-03-16'
}, {
label: '联系电话',
value: '15999682114'
}, {
label: 'POI位置点',
value: '深圳市安卓讯航科技有限公司',
isMap: true
}, {
label: '服务电话',
value: '0755-88888888'
}, {
label: '邮箱',
value: 'GLSX@didihu.com'
}, {
label: '商户LOGO',
value: 'http://www.pptbz.com/pptpic/UploadFiles_6909/201203/2012031220134655.jpg',
isImg: true
}
],
zoom: 12, zoom: 12,
center: [121.59996, 31.197646], // 地图中心点 center: [121.59996, 31.197646], // 地图中心点
amapManager, amapManager,
...@@ -64,27 +102,40 @@ export default { ...@@ -64,27 +102,40 @@ export default {
} }
}, },
mounted() { mounted() {
this.center = this.point console.log(this)
this.$root.eventBus.$on('params', (params)=>{
console.log(params)
this.name = params.name
})
// setTimeout(() => {
// const theme = new this.$Theme()
// theme.change('#FF0000')
// }, 1000)
// const theme = new this.$Theme()
// console.log(theme)
// theme.change('#FF0000')
// this.center = this.point
// 链接,接受参数 // 链接,接受参数
var url = location.search // var url = location.search
var theRequest = {} // var theRequest = {}
if (url.indexOf('?') !== -1) { // if (url.indexOf('?') !== -1) {
// substr()方法返回从参数值开始到结束的字符串 // // substr()方法返回从参数值开始到结束的字符串
var str = url.substr(1) // var str = url.substr(1)
var strs = str.split('&') // var strs = str.split('&')
const text = [] // const text = []
for (var i = 0; i < strs.length; i++) { // for (var i = 0; i < strs.length; i++) {
// 处理乱码 // // 处理乱码
text[i] = decodeURI(strs[i]) // text[i] = decodeURI(strs[i])
theRequest[text[i].split('=')[0]] = (text[ i ].split('=')[1]) // theRequest[text[i].split('=')[0]] = (text[ i ].split('=')[1])
} // }
this.name = theRequest.name // this.name = theRequest.name
} // }
}, },
methods: { methods: {
back() { back() {
history.back() // history.back()
this.$parent.to(['商户数据平台', '商户数据平台', '商户数据平台', '业务管理', '业务管理列表'])
}, },
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event) console.log(tab, event)
...@@ -96,12 +147,23 @@ export default { ...@@ -96,12 +147,23 @@ export default {
<style> <style>
.amap-page-container { .amap-page-container {
/* display: inline-block; */ /* display: inline-block; */
width: 90%; width: 75%;
height: 300px; height: 300px;
/* vertical-align: text-top; */ /* vertical-align: text-top; */
} }
.amap-demo { .amap-demo {
height: 300px; height: 300px;
} }
.detail {
margin: 12px;
}
.detail-row {
line-height: 36px;
}
.detail-logo {
width: 40px;
height: 40px;
vertical-align: text-top;
}
</style> </style>
<template>
<div>
<gl-dialog
title="添加商户"
:visible.sync="addDialogVisible"
width="400px"
:before-close="showAddDialog">
<gl-form
ref="addForm" :model="addForm"
label-width="100px"
:rules="rules">
<gl-form-item label="商户:" prop="merchant">
<gl-select
v-model="addForm.merchant"
filterable
remote
clearable
name="merchant"
placeholder="请输入商户名称/商户号"
data-vv-as="商户名称/商户号"
v-validate="'required'"
:remote-method="remoteMethod"
:loading="loading">
<gl-option
v-for="item in options4"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
<span v-show="errorBags.has('merchant')" class="error">{{ errorBags.first('merchant') }}</span>
</gl-form-item>
<gl-form-item label="商户类型:" prop="merchantType">
<gl-select v-model="addForm.merchantType" name="merchantType"
data-vv-as="商户类型" v-validate="'required'" placeholder="请搜索">
<gl-option
v-for="item in merchantTypeList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
</gl-option>
</gl-select>
<span v-show="errorBags.has('merchantType')" class="error">{{ errorBags.first('merchantType') }}</span>
</gl-form-item>
<div v-for="(item, idx) in addList" :key="idx">
<gl-form-item :label="item.label + ':'">
<gl-select
v-model="item.merchant"
filterable
remote
clearable
placeholder="请输入商户名称/商户号"
:remote-method="remoteMethod"
:loading="loading">
<gl-option
v-for="item in options4"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
<i v-show="item.show" class="el-icon-delete delete" @click="deleteBusiness(idx)"></i>
</gl-form-item>
<gl-form-item label="商户类型:">
<gl-select v-model="item.merchantType" placeholder="请选择">
<gl-option
v-for="item in merchantTypeList"
:key="item.merchantId"
:label="item.merchantName"
:value="item.merchantId">
</gl-option>
</gl-select>
</gl-form-item>
</div>
<gl-button @click="addMore">添加更多</gl-button>
</gl-form>
<div slot="footer" class="dialog-footer">
<gl-button @click="showAddDialog">取 消</gl-button>
<gl-button type="primary" @click="ok">确 定</gl-button>
</div>
</gl-dialog>
</div>
</template>
<script>
export default {
name: 'AddBusiness',
props: {
addDialogVisible: Boolean
},
data() {
return {
addForm: {
merchant: '',
merchantType: ''
},
merchantTypeList: [
{
merchantId: 1,
merchantName: '广联'
}, {
merchantId: 2,
merchantName: '分组'
}, {
merchantId: 3,
merchantName: '富强'
}
],
rules: {
merchant: [{ required: true }],
merchantType: [{ required: true }]
},
// 远程搜索
loading: false,
options4: [],
states: ["Alabama", "Alaska", "Arizona",
"Arkansas", "California", "Colorado",
"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: [
{
label: '子商户1',
merchant: '',
merchantType: ''
}
]
}
},
watch: {
addDialogVisible(val) {
this.$validator.errors.clear()
}
},
mounted() {
this.list = this.states.map(item => {
return { value: item, label: item }
})
},
methods: {
ok() {
this.$validator.validateAll().then((result) => {
if (result) {
this.addList.forEach(item => {
delete item.label
})
this.addForm.merchantRelationAdds = this.addList
this.showAddDialog()
this.addList = [{ label: '子商户1', merchant: '', merchantType: '' }]
this.addForm = { merchant: '', merchantType: '' }
}
})
},
showAddDialog() {
this.$emit('addData')
},
addMore() {
console.log(this.addList.length)
this.addList.push({
label: '子商户' + (this.addList.length + 1),
merchant: '',
merchantType: '',
show: true
})
},
deleteBusiness(idx) {
console.log(idx)
this.addList.splice(idx, 1)
},
remoteMethod(query) {
if (query !== '') {
this.loading = true
setTimeout(() => {
this.loading = false
this.options4 = this.list.filter(item => {
return item.label.toLowerCase()
.indexOf(query.toLowerCase()) > -1
})
}, 200)
} else {
this.options4 = []
}
}
}
}
</script>
<style>
.delete {
color: red;
margin-left: 20px;
font-size: 18px;
}
</style>
<template> <template>
<div> <div>
<gl-button type="primary" @click="showDialog">新增业务</gl-button> <gl-button type="primary" @click="showDialog">新增业务</gl-button>
<gl-button type="primary" @click="add">新增商户</gl-button>
<gl-table :table="tableData"></gl-table> <gl-table :table="tableData"></gl-table>
<gl-dialog title="新增业务" <gl-dialog title="新增业务"
:visible.sync="dialogFormVisible" :visible.sync="dialogFormVisible"
...@@ -28,18 +29,33 @@ ...@@ -28,18 +29,33 @@
></gl-input> ></gl-input>
<span v-show="errorBags.has('businessDescription')" class="error">{{ errorBags.first('businessDescription') }}</span> <span v-show="errorBags.has('businessDescription')" class="error">{{ errorBags.first('businessDescription') }}</span>
</gl-form-item> </gl-form-item>
<gl-form-item label="地址">
<city-area></city-area>
</gl-form-item>
</gl-form> </gl-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<gl-button @click="showDialog">取 消</gl-button> <gl-button @click="showDialog">取 消</gl-button>
<gl-button type="primary" @click="submit">确 定</gl-button> <gl-button type="primary" @click="submit">确 定</gl-button>
</div> </div>
</gl-dialog> </gl-dialog>
<add-business
:addDialogVisible="addDialogVisible"
@addData="handleAddData"
></add-business>
</div> </div>
</template> </template>
<script> <script>
import { CityArea } from '../components'
import addBusiness from './addBusiness'
import { jumpLink } from '../../../common/common.js'
export default { export default {
name: 'BusinessManagement', name: 'BusinessManagement',
components: {
addBusiness,
CityArea
},
data() { data() {
const _this = this
return { return {
tableData: { tableData: {
border: true, border: true,
...@@ -57,30 +73,6 @@ export default { ...@@ -57,30 +73,6 @@ export default {
businessCode: '11', businessCode: '11',
businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务', businessDescription: ' 基于车联网智能终端大数据为汽车金融提供资产保全的服务',
createdTime: '2018-03-16' 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: [ column: [
...@@ -112,8 +104,11 @@ export default { ...@@ -112,8 +104,11 @@ export default {
type: 'text', type: 'text',
label: '详情', label: '详情',
callback: (index, rows) => { callback: (index, rows) => {
const url = encodeURI(`../../customer/businessDetails.html?id=${rows[index].businessId}&name=${rows[index].businessName}`) // const url = encodeURI(`./businessDetails.html?id=${rows[index].businessId}&name=${rows[index].businessName}`)
location.href = url // location.href = url
const url = jumpLink('./businessDetails.html?', {id: rows[index].businessId,name: rows[index].businessName}, _this)
this.$parent.to(['商户数据平台', '商户数据平台', '商户数据平台', '业务管理', '商户详情'],{id: rows[index].businessId,name: rows[index].businessName})
// console.log(url)
} }
} }
] ]
...@@ -121,24 +116,23 @@ export default { ...@@ -121,24 +116,23 @@ export default {
}, },
form: { form: {
businessName: '', businessName: '',
businessDescription: '' businessDescription: '',
area: ''
}, },
dialogFormVisible: false, dialogFormVisible: false,
rules: { rules: {
businessName: [{ required: true }], businessName: [{ required: true }],
businessDescription: [{ required: true }] businessDescription: [{ required: true }]
} },
} // 商户分组组件数据
}, addDialogVisible: false
watch: {
dialogFormVisible(val) {
this.$validator.errors.clear()
} }
}, },
methods: { methods: {
// 显示隐藏弹窗 // 显示隐藏弹窗
showDialog() { showDialog() {
this.dialogFormVisible = !this.dialogFormVisible this.dialogFormVisible = !this.dialogFormVisible
this.$validator.errors.clear()
}, },
// 提交表单 // 提交表单
submit() { submit() {
...@@ -149,6 +143,12 @@ export default { ...@@ -149,6 +143,12 @@ export default {
this.showDialog() this.showDialog()
} }
}) })
},
add() {
this.addDialogVisible = !this.addDialogVisible
},
handleAddData() {
this.addDialogVisible = !this.addDialogVisible
} }
} }
} }
......
import CityArea from './src/cityArea.vue'
export {
CityArea
}
\ No newline at end of file \ No newline at end of file
<template>
<div>
<gl-select style="width: 20%;margin-right: 20px" v-model="province" @click="selectProvince" @focus="selectProvince" placeholder="请选择省">
<gl-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
<gl-select style="width: 20%;margin-right: 20px" v-model="province" placeholder="请选择市">
<gl-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
<gl-select style="width: 20%" v-model="province" placeholder="请选择区">
<gl-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</gl-option>
</gl-select>
</div>
</template>
<script>
export default {
name: 'CityArea',
data() {
return {
options: [
{
value: '选项1',
label: '黄金糕黄金糕黄金糕黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}
],
province: '', // 省值
city: '', // 市值
area: '' // 区值
}
},
methods: {
selectProvince() {
console.log('我选择了省')
}
},
}
</script>
<style>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!