品牌、分类组件优化,传出品牌名称和分类名称

master
zhaochencheng 3 years ago
parent 44c944890e
commit 62b4a1cc37

@ -1,5 +1,5 @@
<template> <template>
<el-select v-model="value1" placeholder="选择品牌"> <el-select v-model="value1" placeholder="选择品牌" ref="brandSelect" @change="handleBrandChange">
<el-option v-for="it in options" :key="it.id" :value="it.id" :label="it.name">{{it.name}}</el-option> <el-option v-for="it in options" :key="it.id" :value="it.id" :label="it.name">{{it.name}}</el-option>
</el-select> </el-select>
</template> </template>
@ -24,6 +24,16 @@ export default {
return this.brandList return this.brandList
} }
}, },
methods:{
handleBrandChange (id) {
if (this.value1) {
let brand=this.brandList.find(item=>{
return item.id==id
})
this.$emit('change', brand.name);
}
},
},
created() { created() {
this.$store.dispatch('mall/loadBrandList') this.$store.dispatch('mall/loadBrandList')
} }

@ -1,5 +1,7 @@
<template> <template>
<el-cascader <el-cascader
ref="cascaderMallCatergory"
@change="handleMallCatergoryChange"
v-model="value1" v-model="value1"
:options="menuOptions" :options="menuOptions"
v-bind="$props" v-bind="$props"
@ -34,6 +36,12 @@ export default {
} }
}, },
methods: { methods: {
handleMallCatergoryChange () {
if (this.value1 && this.value1.length != 0) {
let arr = this.$refs['cascaderMallCatergory'].getCheckedNodes()[0].pathLabels
this.$emit('change', arr);
}
},
recurs(list){ recurs(list){
list.forEach(it => { list.forEach(it => {
it.label = it.name it.label = it.name

@ -12,10 +12,10 @@
<el-input v-model="form.outProductId" placeholder="请输入商品编码"></el-input> <el-input v-model="form.outProductId" placeholder="请输入商品编码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="品牌" prop="brandId"> <el-form-item label="品牌" prop="brandId">
<brand-select v-model="form.brandId"></brand-select> <brand-select v-model="form.brandId" @change="onBrandChange"></brand-select>
</el-form-item> </el-form-item>
<el-form-item label="分类" prop="categoryId"> <el-form-item label="分类" prop="categoryId">
<product-category-select class="w200" v-model="form.categoryId"></product-category-select> <product-category-select class="w200" v-model="form.categoryId" @change="categoryChange"></product-category-select>
</el-form-item> </el-form-item>
<el-form-item label="上架状态"> <el-form-item label="上架状态">
<DictRadio v-model="form.publishStatus" size="small" <DictRadio v-model="form.publishStatus" size="small"
@ -199,6 +199,18 @@ export default {
this.form.productAttr = JSON.stringify(this.productAttr) this.form.productAttr = JSON.stringify(this.productAttr)
this.skuList= skus this.skuList= skus
}, },
categoryChange(value){
if(Array.isArray(value)){
console.log(value.toString())
this.form.productCategoryName=value.toString()
}else{
this.form.productCategoryName=null
}
},
onBrandChange(value){
this.form.brandName = value
},
getInfo(id) { getInfo(id) {
getPmsProduct(id).then(response => { getPmsProduct(id).then(response => {
const {albumPics } = response const {albumPics } = response

Loading…
Cancel
Save