Commit bcfee26a by 胡悦

修改主营品牌交互

1 parent 0476321a
......@@ -4,7 +4,7 @@
<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-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-select>
</el-form>
......@@ -32,7 +32,7 @@ export default {
inject: ['provinceEditAccount'],
mounted() {
// 初始化
this.getProvinceList()
// this.getProvinceList()
console.log(this.provinceEditAccount, '====')
// if (this.province.provinceName) {
// console.log('++++')
......@@ -46,25 +46,28 @@ export default {
provinceName: provinceName,
cityName: cityName
}
this.AllData.map(item => {
if (item.provinceName.indexOf(provinceName) != -1) {
this.cityList = item.cityInfoList
this.provinceForm.provinceCode = item.provinceCode
this.cityList.map(itm => {
if (cityName == itm.cityName) {
this.provinceForm.cityCode = itm.cityCode
}
})
}
})
this.getProvinceList(provinceName, cityName)
},
async getProvinceList() {
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 => {
if (item.provinceName.indexOf(provinceName) != -1) {
this.cityList = item.cityInfoList
this.provinceForm.provinceCode = item.provinceCode
this.cityList.map(itm => {
if (cityName == itm.cityName) {
this.provinceForm.cityCode = itm.cityCode
}
})
}
})
}
},
// 选择省
selectProvince(val) {
......
......@@ -103,7 +103,7 @@
<el-row>
<el-col :span="12">
<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>
<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>
......@@ -199,7 +199,8 @@ export default {
provinceCode: '',
provinceName: '',
cityCode: '',
cityName: ''
cityName: '',
isFirstBrand: false
}
},
watch: {
......@@ -230,7 +231,6 @@ export default {
},
async brandList() {
this.$refs.brandListTree.loading = true
this.businessType = await this.$apis.store.findAllDictData({ dictType: 'business_type' })
const brandListTree = await this.$apis.baseInfo.brandList({})
brandListTree.forEach(item => {
let child = item.children
......@@ -244,6 +244,16 @@ export default {
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() {
this.dialogMapVisible = true
this.$nextTick(() => {
......@@ -366,7 +376,7 @@ export default {
},
mounted() {
this.brandList()
this.getUserInfo()
}
}
</script>
......
<!--
* @Author: your name
* @Date: 2022-03-07 14:32:50
* @LastEditTime: 2022-04-02 17:42:14
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-14 17:50:13
* @LastEditors: huyue
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \scrm-micro-settings\src\views\baseInfo\editInfo.vue
-->
......@@ -24,12 +24,12 @@
<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="驻店电话" style="position: relative;">
<el-form-item size="small" label="驻店电话" style="position: relative">
<el-input v-model="infoForm.residentPhone" placeholder="此电话会在小程序上显示,请填写真实有效的电话或手机号"></el-input>
<div @click="showTelDia" class="show-address">显示位置</div>
</el-form-item>
<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>
</div>
......@@ -77,15 +77,34 @@ export default {
cityCode: ''
},
businessType: [],
brandListTree: []
brandListTree: [],
isFirstBrand: false
}
},
mounted() {
this.brandList()
// this.brandList()
this.getUserInfo()
},
methods: {
async brandList() {
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' })
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
......@@ -105,32 +124,26 @@ export default {
provinceCode,
cityCode
}
// 省市回显
this.$refs.provinceForm.init(this.infoForm.provinceName, this.infoForm.cityName)
if (!businessType) {
this.infoForm.businessType = [1, 2, 3, 4, 5, 6]
} else {
const businessType = this.infoForm.businessType.split(',')
this.infoForm.businessType = businessType.map(item => (item = parseInt(item)))
}
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.provinceForm.init(this.infoForm.provinceName, this.infoForm.cityName)
if (!this.infoForm.merchantBrandMain) {
this.infoForm.merchantBrandMain = []
} else {
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() {
this.dialogMapVisible = true
......
<!--
* @Author: your name
* @Date: 2022-03-07 14:32:50
* @LastEditTime: 2022-03-07 14:43:18
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-14 17:41:10
* @LastEditors: huyue
* @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">
<div class="select-input-box" @click="switchBrand">
<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.label }}
......@@ -23,7 +23,7 @@
<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">
<div class="tree-box" v-show="brandTree">
<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">
......@@ -49,7 +49,8 @@ export default {
defaultProps: {
children: 'children',
label: 'label'
}
},
brandTree: false
}
},
props: {
......@@ -76,7 +77,7 @@ export default {
},
methods: {
getMerchantBrandList() {
let getCheckedNodes = this.$refs.tree.getCheckedNodes()
let getCheckedNodes = this.$refs.tree.getCheckedNodes()
const getCheckedKeys = this.$refs.tree.getCheckedKeys()
const getHalfCheckedNodes = this.$refs.tree.getHalfCheckedNodes()
let merchantBrandList = getHalfCheckedNodes.map(car => {
......@@ -91,7 +92,7 @@ export default {
merchantBrandId
}
})
getCheckedNodes = getCheckedNodes.filter(item=>item.children)
getCheckedNodes = getCheckedNodes.filter(item => item.children)
let merchantBrandList2 = getCheckedNodes.map(car => {
let merchantBrandId = []
car.children.forEach(item => {
......@@ -117,7 +118,7 @@ export default {
}
},
getCheckList(checkArr = []) {
checkArr.forEach(item=>item = parseInt(item));
checkArr.forEach(item => (item = parseInt(item)))
console.log(checkArr)
this.$refs.tree.setCheckedKeys(checkArr)
this.$nextTick(() => {
......@@ -186,6 +187,11 @@ export default {
filterNode(value, data) {
if (!value) return true
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!