Commit bcfee26a by 胡悦

修改主营品牌交互

1 parent 0476321a
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-select v-model="provinceForm.provinceName" placeholder="选择省份" @change="selectProvince" class="select-padding"> <el-select v-model="provinceForm.provinceName" placeholder="选择省份" @change="selectProvince" class="select-padding">
<el-option v-for="item in AllData" :key="item.provinceCode" :label="item.provinceName" :value="item.provinceName" @click.native="selectProvince(item)"></el-option> <el-option v-for="item in AllData" :key="item.provinceCode" :label="item.provinceName" :value="item.provinceName" @click.native="selectProvince(item)"></el-option>
</el-select> </el-select>
<el-select v-model="provinceForm.cityName" placeholder="选择您所在的市" style="width:250px" @change="selectCity" class="select-padding"> <el-select v-model="provinceForm.cityName" placeholder="选择您所在的市" style="width: 250px" @change="selectCity" class="select-padding">
<el-option v-for="item in cityList" :key="item.cityCode" :label="item.cityName" :value="item.cityName" @click.native="selectCity(item)"></el-option> <el-option v-for="item in cityList" :key="item.cityCode" :label="item.cityName" :value="item.cityName" @click.native="selectCity(item)"></el-option>
</el-select> </el-select>
</el-form> </el-form>
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
inject: ['provinceEditAccount'], inject: ['provinceEditAccount'],
mounted() { mounted() {
// 初始化 // 初始化
this.getProvinceList() // this.getProvinceList()
console.log(this.provinceEditAccount, '====') console.log(this.provinceEditAccount, '====')
// if (this.province.provinceName) { // if (this.province.provinceName) {
// console.log('++++') // console.log('++++')
...@@ -46,6 +46,16 @@ export default { ...@@ -46,6 +46,16 @@ export default {
provinceName: provinceName, provinceName: provinceName,
cityName: cityName cityName: cityName
} }
this.getProvinceList(provinceName, cityName)
},
async getProvinceList(provinceName, cityName) {
const { provinceInfoList: provinceList } = await this.provinceList
this.AllData = provinceList
// this.$set(this, 'AllData', provinceList)
if (this.provinceEditAccount) {
this.init(this.provinceEditAccount.provinceName, this.provinceEditAccount.cityName)
}
if (provinceName) {
this.AllData.map(item => { this.AllData.map(item => {
if (item.provinceName.indexOf(provinceName) != -1) { if (item.provinceName.indexOf(provinceName) != -1) {
this.cityList = item.cityInfoList this.cityList = item.cityInfoList
...@@ -57,13 +67,6 @@ export default { ...@@ -57,13 +67,6 @@ export default {
}) })
} }
}) })
},
async getProvinceList() {
const { provinceInfoList: provinceList } = await this.provinceList
this.AllData = provinceList
// this.$set(this, 'AllData', provinceList)
if (this.provinceEditAccount) {
this.init(this.provinceEditAccount.provinceName, this.provinceEditAccount.cityName)
} }
}, },
// 选择省 // 选择省
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="主营品牌"> <el-form-item label="主营品牌">
<select-brand :brandListTree="brandListTree" ref="brandListTree"></select-brand> <select-brand :brandListTree="brandListTree" @clickBrand="clickBrand" ref="brandListTree"></select-brand>
<!-- <el-input size="small" v-model="filterText"></el-input> <!-- <el-input size="small" v-model="filterText"></el-input>
<div class="brand-tree"> <div class="brand-tree">
<el-tree :data="brandData" show-checkbox default-expand-all node-key="id" ref="brandTree" highlight-current :props="defaultProps" :filter-node-method="filterNode" @check="clickDeal"></el-tree> <el-tree :data="brandData" show-checkbox default-expand-all node-key="id" ref="brandTree" highlight-current :props="defaultProps" :filter-node-method="filterNode" @check="clickDeal"></el-tree>
...@@ -199,7 +199,8 @@ export default { ...@@ -199,7 +199,8 @@ export default {
provinceCode: '', provinceCode: '',
provinceName: '', provinceName: '',
cityCode: '', cityCode: '',
cityName: '' cityName: '',
isFirstBrand: false
} }
}, },
watch: { watch: {
...@@ -230,7 +231,6 @@ export default { ...@@ -230,7 +231,6 @@ export default {
}, },
async brandList() { async brandList() {
this.$refs.brandListTree.loading = true this.$refs.brandListTree.loading = true
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
const brandListTree = await this.$apis.baseInfo.brandList({}) const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => { brandListTree.forEach(item => {
let child = item.children let child = item.children
...@@ -244,6 +244,16 @@ export default { ...@@ -244,6 +244,16 @@ export default {
this.$refs.brandListTree.loading = false this.$refs.brandListTree.loading = false
}) })
}, },
async getUserInfo() {
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
},
// 点击主营品牌
clickBrand(val) {
if (!this.isFirstBrand) {
this.brandList()
this.isFirstBrand = true
}
},
hanleSelectMap() { hanleSelectMap() {
this.dialogMapVisible = true this.dialogMapVisible = true
this.$nextTick(() => { this.$nextTick(() => {
...@@ -366,7 +376,7 @@ export default { ...@@ -366,7 +376,7 @@ export default {
}, },
mounted() { mounted() {
this.brandList() this.getUserInfo()
} }
} }
</script> </script>
......
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-03-07 14:32:50 * @Date: 2022-03-07 14:32:50
* @LastEditTime: 2022-04-02 17:42:14 * @LastEditTime: 2022-04-14 17:50:13
* @LastEditors: Please set LastEditors * @LastEditors: huyue
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue * @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue
--> -->
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
<el-form-item size="small" label="营业时间" class="time-row"> <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-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>
<el-form-item size="small" label="驻店电话" style="position: relative;"> <el-form-item size="small" label="驻店电话" style="position: relative">
<el-input v-model="infoForm.residentPhone" placeholder="此电话会在小程序上显示,请填写真实有效的电话或手机号"></el-input> <el-input v-model="infoForm.residentPhone" placeholder="此电话会在小程序上显示,请填写真实有效的电话或手机号"></el-input>
<div @click="showTelDia" class="show-address">显示位置</div> <div @click="showTelDia" class="show-address">显示位置</div>
</el-form-item> </el-form-item>
<el-form-item size="small" label="主营品牌" style="height: 500px"> <el-form-item size="small" label="主营品牌" style="height: 500px">
<select-brand :brandListTree="brandListTree" ref="brandListTree"></select-brand> <select-brand :brandListTree="brandListTree" @clickBrand="clickBrand" ref="brandListTree"></select-brand>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -77,15 +77,34 @@ export default { ...@@ -77,15 +77,34 @@ export default {
cityCode: '' cityCode: ''
}, },
businessType: [], businessType: [],
brandListTree: [] brandListTree: [],
isFirstBrand: false
} }
}, },
mounted() { mounted() {
this.brandList() // this.brandList()
this.getUserInfo()
}, },
methods: { methods: {
async brandList() { async brandList() {
this.$refs.brandListTree.loading = true this.$refs.brandListTree.loading = true
const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => {
let child = item.children
if (!child) return
child.forEach(k => {
delete k.children
})
})
this.brandListTree = brandListTree
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain)
this.$nextTick(() => {
this.$refs.brandListTree.loading = false
})
},
async getUserInfo() {
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' }) this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
const infoForm = await this.$apis.store.findMerchantBaseInfo({ merchantId: this.$globalState.session.merchantId }) const infoForm = await this.$apis.store.findMerchantBaseInfo({ merchantId: this.$globalState.session.merchantId })
const { merchantAddress, provinceName, cityName, provinceCode, cityCode, lng, lat, id, merchantName, businessType, bussinessTime, bussinessBegintime, bussinessEndtime, channelId, merchantNo, merchantBrandMain } = infoForm const { merchantAddress, provinceName, cityName, provinceCode, cityCode, lng, lat, id, merchantName, businessType, bussinessTime, bussinessBegintime, bussinessEndtime, channelId, merchantNo, merchantBrandMain } = infoForm
...@@ -105,32 +124,26 @@ export default { ...@@ -105,32 +124,26 @@ export default {
provinceCode, provinceCode,
cityCode cityCode
} }
// 省市回显
this.$refs.provinceForm.init(this.infoForm.provinceName, this.infoForm.cityName)
if (!businessType) { if (!businessType) {
this.infoForm.businessType = [1, 2, 3, 4, 5, 6] this.infoForm.businessType = [1, 2, 3, 4, 5, 6]
} else { } else {
const businessType = this.infoForm.businessType.split(',') const businessType = this.infoForm.businessType.split(',')
this.infoForm.businessType = businessType.map(item => (item = parseInt(item))) this.infoForm.businessType = businessType.map(item => (item = parseInt(item)))
} }
const brandListTree = await this.$apis.baseInfo.brandList({}) // 省市回显
brandListTree.forEach(item => { this.$refs.provinceForm.init(this.infoForm.provinceName, this.infoForm.cityName)
let child = item.children
if (!child) return
child.forEach(k => {
delete k.children
})
})
this.brandListTree = brandListTree
if (!this.infoForm.merchantBrandMain) { if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = [] this.infoForm.merchantBrandMain = []
} else { } else {
this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.replaceAll(';', ',').split(',') this.infoForm.merchantBrandMain = this.infoForm.merchantBrandMain.replaceAll(';', ',').split(',')
} }
this.$refs.brandListTree.getCheckList(this.infoForm.merchantBrandMain) },
this.$nextTick(() => { // 点击主营品牌
this.$refs.brandListTree.loading = false clickBrand(val) {
}) if (!this.isFirstBrand) {
this.brandList()
this.isFirstBrand = true
}
}, },
hanleSelectMap() { hanleSelectMap() {
this.dialogMapVisible = true this.dialogMapVisible = true
......
<!-- <!--
* @Author: your name * @Author: your name
* @Date: 2022-03-07 14:32:50 * @Date: 2022-03-07 14:32:50
* @LastEditTime: 2022-03-07 14:43:18 * @LastEditTime: 2022-04-14 17:41:10
* @LastEditors: Please set LastEditors * @LastEditors: huyue
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue * @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue
--> -->
<template> <template>
<div v-loading="loading"> <div v-loading="loading">
<div class="select-input-box"> <div class="select-input-box" @click="switchBrand">
<template v-for="(item, idx) in getCheckedArr"> <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"> <el-tag effect="plain" type="info" :key="idx" closable :disable-transitions="false" @close="removeItem(item, idx)" v-if="idx < 3">
{{ item.label }} {{ item.label }}
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag> <el-tag effect="plain" slot="reference" type="info" v-show="getCheckedArr.length > 3">+ {{ getCheckedArr.length - 3 }}</el-tag>
</el-popover> </el-popover>
</div> </div>
<div class="tree-box"> <div class="tree-box" v-show="brandTree">
<el-input class="tree-input" prefix-icon="el-icon-search" placeholder="输入关键字进行过滤" v-model="filterText"></el-input> <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> <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">
...@@ -49,7 +49,8 @@ export default { ...@@ -49,7 +49,8 @@ export default {
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label'
} },
brandTree: false
} }
}, },
props: { props: {
...@@ -91,7 +92,7 @@ export default { ...@@ -91,7 +92,7 @@ export default {
merchantBrandId merchantBrandId
} }
}) })
getCheckedNodes = getCheckedNodes.filter(item=>item.children) getCheckedNodes = getCheckedNodes.filter(item => item.children)
let merchantBrandList2 = getCheckedNodes.map(car => { let merchantBrandList2 = getCheckedNodes.map(car => {
let merchantBrandId = [] let merchantBrandId = []
car.children.forEach(item => { car.children.forEach(item => {
...@@ -117,7 +118,7 @@ export default { ...@@ -117,7 +118,7 @@ export default {
} }
}, },
getCheckList(checkArr = []) { getCheckList(checkArr = []) {
checkArr.forEach(item=>item = parseInt(item)); checkArr.forEach(item => (item = parseInt(item)))
console.log(checkArr) console.log(checkArr)
this.$refs.tree.setCheckedKeys(checkArr) this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => { this.$nextTick(() => {
...@@ -186,6 +187,11 @@ export default { ...@@ -186,6 +187,11 @@ export default {
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
},
// 显示隐藏
switchBrand() {
this.brandTree = !this.brandTree
this.$emit('clickBrand', this.brandTree)
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!