Browse Source

品牌选择框支持搜索

master
sj 2 years ago
parent
commit
a0aec27ffc
  1. 12
      src/views/bxg/shop/goods/form.vue

12
src/views/bxg/shop/goods/form.vue

@ -24,7 +24,7 @@
</el-col> </el-col>
<el-col v-bind="grid2"> <el-col v-bind="grid2">
<el-form-item label="商品品牌:" prop="brand_id"> <el-form-item label="商品品牌:" prop="brand_id">
<el-select v-model="formValidate.brand_id" filterable :filter-method="dataFilter" clearable> <el-select v-model="formValidate.brand_id" filterable clearable>
<el-option v-for="item in brandList" <el-option v-for="item in brandList"
:value="item.id" :key="item.id" :label="item.brandName" ></el-option> :value="item.id" :key="item.id" :label="item.brandName" ></el-option>
</el-select> </el-select>
@ -601,6 +601,9 @@ export default {
cate_id: [ cate_id: [
{ required: true, message: '请选择商品分类', trigger: 'change' } { required: true, message: '请选择商品分类', trigger: 'change' }
], ],
brand_id: [
{ required: true, message: '请选择商品品牌', trigger: 'change' }
],
keyword: [ keyword: [
{ required: true, message: '请输入商品关键字', trigger: 'blur' } { required: true, message: '请输入商品关键字', trigger: 'blur' }
], ],
@ -709,6 +712,7 @@ export default {
this.parameter.splice(index,1); this.parameter.splice(index,1);
}, },
dataFilter(val){ dataFilter(val){
// console.log('val',val)
this.value=val this.value=val
if(val){ if(val){
this.optionsMetaShow=this.treeSelect.filter((item=>{ this.optionsMetaShow=this.treeSelect.filter((item=>{
@ -843,7 +847,7 @@ export default {
sort: 'id,desc' sort: 'id,desc'
}).then(data => { }).then(data => {
that.hotList=data.content that.hotList=data.content
// //
}), }),
// //
initData('/bxg/api/yxStoreBrand', { initData('/bxg/api/yxStoreBrand', {
@ -859,7 +863,7 @@ export default {
getInfo(id).then(async res => { getInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
if(data){ if(data){
console.log('data11111',data) // console.log('data11111',data)
let cate_id = parseInt(data.cate_id) || 0; let cate_id = parseInt(data.cate_id) || 0;
let brand_id = parseInt(data.brand_id) || 0; let brand_id = parseInt(data.brand_id) || 0;
this.attrs = data.items || []; this.attrs = data.items || [];
@ -904,7 +908,7 @@ export default {
// //
that.ruleList = res.ruleList; that.ruleList = res.ruleList;
that.templateList = res.tempList; that.templateList = res.tempList;
that.optionsMetaShow = that.treeSelect that.optionsMetaShow = res.cateList;
}).catch(res => { }).catch(res => {
console.log('err:'+res) console.log('err:'+res)

Loading…
Cancel
Save