Commit 77f499f1 by yy

fixed

1 parent d186e092
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* @param {*} params * @param {*} params
* @returns * @returns
*/ */
import { http_config } from '@/main' import { http_config,http_car } from '@/main'
const getMerchantTree = params => { const getMerchantTree = params => {
params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list' params.method = 'entmicro.api.common.findMerchantTreeByMerchantNo.list'
return http_config({ return http_config({
...@@ -43,9 +43,20 @@ const merchantInfo = params => { ...@@ -43,9 +43,20 @@ const merchantInfo = params => {
sign: true sign: true
}) })
} }
const brandList = params => {
params.method = 'dj.api.get.car.brandList'
return http_car({
url: '/rop-dj-car-boutique/router',
method: 'POST',
data: params,
sign: true
})
}
export default { export default {
getMerchantTree, getMerchantTree,
getDepartment, getDepartment,
toGL, toGL,
merchantInfo merchantInfo,
brandList
} }
\ No newline at end of file \ No newline at end of file
...@@ -17,35 +17,45 @@ const findMerchantByPage = params => { ...@@ -17,35 +17,45 @@ const findMerchantByPage = params => {
}) })
} }
const findAllDictData = params => { const findAllDictData = params => {
params.method = 'merchants.api.menu.findAllDictData' params.method = 'merchants.api.menu.findAllDictData'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//主营品牌 //主营品牌
const getCarbrandTree = params => { const getCarbrandTree = params => {
params.method = 'merchants.api.merchantCommon.getCarbrandTree' params.method = 'merchants.api.merchantCommon.getCarbrandTree'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//详情 //详情
const findMerchantDetail = params => { const findMerchantDetail = params => {
params.method = 'merchants.api.merchant.findMerchantDetail' params.method = 'merchants.api.merchant.findMerchantDetail'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//下一步 const findMerchantBaseInfo = params => {
params.method = 'merchants.api.merchant.findMerchantBaseInfo'
return http({
url: '/rop-merchants/router',
method: 'POST',
data: params,
sign: true
})
}
//下一步
const saveMerchant = params => { const saveMerchant = params => {
params.method = 'merchants.api.merchant.saveMerchant' params.method = 'merchants.api.merchant.saveMerchant'
return http({ return http({
...@@ -65,35 +75,35 @@ const updateMerchant = params => { ...@@ -65,35 +75,35 @@ const updateMerchant = params => {
}) })
} }
const accountTypeSearchRequest = params => { const accountTypeSearchRequest = params => {
params.method = 'merchants.api.merchant.accountTypeSearchRequest' params.method = 'merchants.api.merchant.accountTypeSearchRequest'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//功能权限 //功能权限
const findPermissionsByMerId = params => { const findPermissionsByMerId = params => {
params.method = 'merchants.api.merchant.findPermissionsByMerId' params.method = 'merchants.api.merchant.findPermissionsByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//功能权限 //功能权限
const findMenuFunTreeByMerId = params => { const findMenuFunTreeByMerId = params => {
params.method = 'merchants.api.merchant.findMenuFunTreeByMerId' params.method = 'merchants.api.merchant.findMenuFunTreeByMerId'
return http({ return http({
url: '/rop-merchants/router', url: '/rop-merchants/router',
method: 'POST', method: 'POST',
data: params, data: params,
sign: true sign: true
}) })
} }
//草稿保存 //草稿保存
const updatePermissions = params => { const updatePermissions = params => {
params.method = 'merchants.api.merchant.updatePermissions' params.method = 'merchants.api.merchant.updatePermissions'
return http({ return http({
...@@ -108,6 +118,7 @@ export default { ...@@ -108,6 +118,7 @@ export default {
findAllDictData, findAllDictData,
getCarbrandTree, getCarbrandTree,
findMerchantDetail, findMerchantDetail,
findMerchantBaseInfo,
saveMerchant, saveMerchant,
updateMerchant, updateMerchant,
findPermissionsByMerId, findPermissionsByMerId,
......
...@@ -30,6 +30,7 @@ export { bootstrap, mount, unmount } ...@@ -30,6 +30,7 @@ export { bootstrap, mount, unmount }
export const http = params => Vue.prototype.$http(params) export const http = params => Vue.prototype.$http(params)
export const http_common = params => Vue.prototype.$http_common(params) export const http_common = params => Vue.prototype.$http_common(params)
export const http_config = params => Vue.prototype.$http_config(params) export const http_config = params => Vue.prototype.$http_config(params)
export const http_car = params => Vue.prototype.$http_car(params)
console.log(http_config) console.log(http_config)
Object.keys(filters).forEach(key => { Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key]); Vue.filter(key, filters[key]);
......
...@@ -2,11 +2,12 @@ import Vue from 'vue' ...@@ -2,11 +2,12 @@ import Vue from 'vue'
// import { message } from '@/plugins/element.js' // import { message } from '@/plugins/element.js'
import { fetchConfig } from '@/config' import { fetchConfig } from '@/config'
import ElementUI from 'element-ui' import ElementUI from 'element-ui'
import { GLButton, GLTable } from 'glsx-components' //权限按钮 (根据权限动态创建) import { GLButton, GLTable,GLFooter } from 'glsx-components' //权限按钮 (根据权限动态创建)
import { getRoutes } from '@/router' import { getRoutes } from '@/router'
import render from './render' import render from './render'
Vue.use(ElementUI) Vue.use(ElementUI)
Vue.use(GLTable) Vue.use(GLTable)
Vue.use(GLFooter)
// import GLTable from '@/components/glsx-table/index' // import GLTable from '@/components/glsx-table/index'
// Vue.component('GLTable', GLTable) // Vue.component('GLTable', GLTable)
import 'glsx-components/dist/glsx-components.css' import 'glsx-components/dist/glsx-components.css'
...@@ -15,7 +16,7 @@ let routes = [] ...@@ -15,7 +16,7 @@ let routes = []
let router = null let router = null
let instance = null let instance = null
export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) { export async function bootstrap({ name, id, history, common, messenger, globalState, routerBase }) {
const { response, request, sign, secret, request_common, request_config, sign_common } = await fetchConfig() const { response, request, sign, secret, request_common, request_config,request_car, sign_common } = await fetchConfig()
console.log(request) console.log(request)
Vue.prototype.$history = history Vue.prototype.$history = history
Vue.prototype.$messenger = messenger Vue.prototype.$messenger = messenger
...@@ -25,6 +26,7 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt ...@@ -25,6 +26,7 @@ export async function bootstrap({ name, id, history, common, messenger, globalSt
Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http = new common.Http({ response, request, sign, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } }) Vue.prototype.$http_common = new common.Http({ response, signWay: "md5", request: request_common, sign: sign_common, secret, alert: ElementUI.Message.error, headers: { TGT: globalState.session.token } })
Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } }) Vue.prototype.$http_config = new common.Http({ response, request: request_config, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
Vue.prototype.$http_car = new common.Http({ response, request: request_car, sign, secret, alert: ElementUI.Message.error, headers: { token: globalState.session.token } })
// Vue.prototype.$setGlobalState = globalState.actions.setGlobalState // Vue.prototype.$setGlobalState = globalState.actions.setGlobalState
// Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] }) // Vue.use(GLButton, { permissions: globalState.permissions || ['1-1-1-1', '2-1-1-1', '3-1-1-1'] })
......
...@@ -7,8 +7,27 @@ ...@@ -7,8 +7,27 @@
* @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue * @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue
--> -->
<template> <template>
<div> <div class="main-information">
<el-button>选择地址</el-button> <div class="information-title">修改企业信息</div>
<div class="information-form-box">
<el-form ref="baseForm" :model="infoForm" class="account-body-form" label-width="120px">
<el-form-item size="small" label="商户地址" class="map-row">
<el-input v-model="infoForm.merchantAddress" placeholder="请选择商户地址" readonly="readonly"></el-input>
<el-button @click="hanleSelectMap" type="primary">选择地址</el-button>
</el-form-item>
<el-form-item size="small" label="业务类型">
<el-checkbox-group v-model="infoForm.businessType">
<el-checkbox :label="item.dictValue" v-for="item in businessType" :key="item.dictValue">{{ item.dictLabel }}</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item size="small" label="营业时间" class="time-row">
<el-time-picker size="small" value-format="HH:mm:ss" is-range v-model="infoForm.bussinessTime" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
</el-form-item>
<el-form-item size="small" label="主营品牌">
<select-brand :brandListTree="brandListTree" ref="brandListTree"></select-brand>
</el-form-item>
</el-form>
</div>
<el-dialog :visible.sync="dialogMapVisible" width="60%"> <el-dialog :visible.sync="dialogMapVisible" width="60%">
<map-view ref="mapForm" :mapHeight="mapHeight"></map-view> <map-view ref="mapForm" :mapHeight="mapHeight"></map-view>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
...@@ -16,21 +35,163 @@ ...@@ -16,21 +35,163 @@
<el-button type="primary" @click="getAddress">确 定</el-button> <el-button type="primary" @click="getAddress">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<GLFooter>
<el-button type="primary" @click="handleSave">提交</el-button>
<el-button @click="goback">取消</el-button>
</GLFooter>
</div> </div>
</template> </template>
<script> <script>
import mapView from '@/components/mapView/index' import mapView from '@/components/mapView/index'
import SelectBrand from './selectBrand.vue'
export default { export default {
name: 'EditInfo', name: 'EditInfo',
components: { components: {
mapView mapView,
SelectBrand
}, },
data() { data() {
return {} return {
checkedAll: false,
filterText: '',
dialogMapVisible: false,
mapHeight: 450,
infoForm: {
businessType: [],
bussinessTime: []
},
businessType: [],
brandListTree: []
}
},
mounted() {
this.brandList()
},
methods: {
async brandList() {
this.$refs.brandListTree.loading = true
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
console.log(this.businessType)
const infoForm = await this.$apis.store.findMerchantBaseInfo({ merchantId: this.$globalState.session.merchantId })
const { merchantAddress, lng, lat, id, merchantName, businessType, bussinessTime, bussinessBegintime, bussinessEndtime, channelId, merchantNo, merchantBrandMain } = infoForm
this.infoForm = {
merchantAddress,
lng,
lat,
id,
merchantName,
businessType,
bussinessTime: [bussinessBegintime, bussinessEndtime],
merchantBrandMain,
merchantNo,
channelId
}
if (!businessType) {
this.infoForm.businessType = []
} else {
const businessType = this.infoForm.businessType.split(',')
this.infoForm.businessType = businessType.map(item => (item = parseInt(item)))
}
console.log(this.infoForm.businessType)
const brandListTree = await this.$apis.baseInfo.brandList({ needCarSeries: true })
brandListTree.forEach(item => {
let child = item.childs
child.forEach(k => {
delete k.childs
})
})
this.brandListTree = brandListTree
if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = []
} else {
this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.split(',')
}
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain)
this.$nextTick(() => {
this.$refs.brandListTree.loading = false
})
},
hanleSelectMap() {
this.dialogMapVisible = true
this.$nextTick(() => {
if (this.infoForm.merchantAddress && !this.$refs.mapForm.address) {
this.$refs.mapForm.address = this.infoForm.merchantAddress
this.$refs.mapForm.addMarker([this.infoForm.lng, this.infoForm.lat])
}
})
},
getAddress() {
if (!this.$refs.mapForm.address) {
this.$message.error('请选择地址')
return
}
this.dialogMapVisible = false
this.infoForm.merchantAddress = this.$refs.mapForm.address
let lnglat = this.$refs.mapForm.lnglat
this.infoForm.lat = lnglat.lat
this.infoForm.lng = lnglat.lng
},
handleSave() {
const params = this.infoForm
console.log(this.infoForm)
if (params.bussinessTime) {
params.bussinessBegintime = params.bussinessTime[0]
params.bussinessEndtime = params.bussinessTime[1]
}else {
params.bussinessBegintime = ''
params.bussinessEndtime = ''
}
delete params.stores
params.businessType = params.businessType.join(',')
//merchantBrandMain 品牌id
const getCheckedArr = this.$refs.brandListTree.getCheckedArr
const merchantBrandMain = getCheckedArr.map(item => item.id)
params.merchantBrandMain = merchantBrandMain.join(',')
this.$apis.store.updateMerchant(params).then(res => {
if (res) {
this.$router.push({ path: '/baseInfo/index' })
}
})
},
goback() {
this.$router.go(-1)
}
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-information {
background: #ffffff;
border-radius: 2px;
height: calc(100% - 80px);
.information-title {
height: 58px;
line-height: 58px;
font-size: 16px;
font-weight: 500;
color: rgba(0, 0, 0, 0.85);
padding-left: 20px;
border-bottom: 1px solid #dcdfe6;
}
.information-form-box {
width: 50%;
padding-top: 30px;
.map-row {
/deep/ .el-form-item__content {
display: flex;
}
.el-input {
margin-right: 10px;
}
}
.time-row {
/deep/ .el-input__inner {
width: 100%;
}
}
}
}
</style> </style>
<!--
* @Author: your name
* @Date: 2022-03-07 14:32:50
* @LastEditTime: 2022-03-07 14:43:18
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue
-->
<template>
<div v-loading="loading">
<div class="select-input-box">
<template v-for="(item, idx) in getCheckedArr">
<el-tag effect="plain" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)" v-if="idx < 3">
{{ item.name }}
</el-tag>
</template>
<el-popover placement="top" width="600" trigger="hover" class="select-popover">
<div class="select-popover-box">
<el-tag effect="plain" class="popover-item" v-for="(item, idx) in getCheckedArr" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)">
{{ item.name }}
</el-tag>
</div>
<el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag>
</el-popover>
</div>
<div class="tree-box">
<el-input class="tree-input" prefix-icon="el-icon-search" placeholder="输入关键字进行过滤" v-model="filterText"></el-input>
<el-tree class="filter-tree" @check="handleCheck" :data="brandListTree" :props="defaultProps" node-key="id" default-expand-all show-checkbox :filter-node-method="filterNode" ref="tree"></el-tree>
<div class="tree-footer">
<div class="tree-footer-checkbox">
<el-checkbox v-model="checkedAll" @change="selectAll">全部</el-checkbox>
</div>
<div class="tree-footer-reset" @click="selectClear">重置</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'selectBrand',
data() {
return {
loading: false,
checkedAll: false,
filterText: '',
treeArr: [],
getCheckedArr: [],
defaultProps: {
children: 'childs',
label: 'name'
}
}
},
props: {
brandListTree: {
type: Array
}
},
watch: {
filterText(val) {
this.$refs.tree.filter(val)
},
treeArr: {
handler() {
const getCheckedNodes = this.$refs.tree.getCheckedNodes()
this.getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs') && cur.childs.length > 0) {
return prev
}
return prev.concat(cur)
}, [])
},
deep: true
}
},
methods: {
//勾选
handleCheck() {
this.treeArr = this.getTreeArray()
if (this.$refs.tree.getCheckedKeys().length == 0) {
this.checkedAll = false
}
if (this.$refs.tree.getCheckedKeys().length == this.treeArr.length) {
this.checkedAll = true
}
},
getCheckList(checkArr = []) {
this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => {
this.handleCheck()
})
},
//获取选择项
getTreeArray() {
let tree_arr = []
this.brandListTree.forEach(k => {
let child = k.childs
if (child && child.length > 0) {
child.forEach(j => {
tree_arr.push(j.id)
})
} else {
tree_arr.push(k.id)
}
})
return tree_arr
},
//全选
selectAll() {
this.loading = true
this.treeArr = this.getTreeArray()
if (this.getCheckedArr.length == this.treeArr.length) {
this.checkedAll = false
this.$refs.tree.setCheckedKeys([])
} else {
this.checkedAll = true
this.$refs.tree.setCheckedKeys(this.treeArr)
}
setTimeout(() => {
this.loading = false
}, 1000)
},
//重置
selectClear() {
this.treeArr = []
this.checkedAll = false
this.$refs.tree.setCheckedKeys([])
},
//删除
removeItem(checkItem, index) {
this.loading = true
this.getCheckedArr.splice(index, 1)
const getCheckedNodes = this.$refs.tree.getCheckedNodes()
let getCheckedArr = getCheckedNodes.reduce((prev, cur) => {
if (Object.keys(cur).includes('childs')) {
return prev
}
return prev.concat(cur)
}, [])
getCheckedArr = getCheckedArr.filter(item => {
return item.id != checkItem.id
})
this.$refs.tree.setCheckedNodes(getCheckedArr)
if (getCheckedArr.length == 0) {
this.checkedAll = false
}
this.$nextTick(() => {
this.loading = false
})
},
//过滤
filterNode(value, data) {
if (!value) return true
return data.name.indexOf(value) !== -1
}
}
}
</script>
<style lang="scss" scoped>
.select-input-box {
width: 100%;
height: 38px;
background: #ffffff;
border-radius: 4px;
border: 1px solid #e5e5e5;
box-sizing: border-box;
padding: 4px;
display: flex;
align-items: center;
/deep/ .el-tag {
margin-right: 5px;
height: 26px;
line-height: 26px;
box-sizing: border-box;
}
}
.select-popover {
&-box {
display: flex;
flex-wrap: wrap;
max-height: 500px;
overflow-y: auto;
.popover-item {
margin-right: 5px;
margin-bottom: 5px;
height: 26px;
line-height: 26px;
box-sizing: border-box;
}
}
}
.tree-box {
margin-top: 10px;
padding: 15px 15px 0px;
background: #ffffff;
box-shadow: 0px 6px 20px 0px rgba(122, 122, 122, 0.2);
border-radius: 4px;
.tree-input {
margin-bottom: 10px;
}
.filter-tree {
height: 300px;
overflow-y: auto;
}
.tree-footer {
border-top: 1px solid #e5e5e5;
height: 48px;
padding: 0px 15px;
display: flex;
justify-content: space-between;
align-items: center;
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!