| | |
| | | --> |
| | | <div class="marketing-box"> |
| | | <el-tabs v-model="activeTab"> |
| | | <el-tab-pane label="分类" name="type"></el-tab-pane> |
| | | <el-tab-pane label="详情" name="detail"></el-tab-pane> |
| | | </el-tabs> |
| | | |
| | | <div class="product" v-if="activeTab == 'type'"> |
| | | <!--内容--> |
| | | <div class="product-content" v-loading="loading"> |
| | | <div class="table-wrap type-table"> |
| | | <el-cascader class="ww100" |
| | | ref="cascader" |
| | | v-model="categoryActive" |
| | | :options="categoryList" |
| | | :props="{ children: 'child', value: 'category_id', label: 'name' }" |
| | | @change="changeCategory"> |
| | | </el-cascader> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="product-list" v-if="activeTab == 'detail'" v-loading="loading"> |
| | | <!--搜索表单--> |
| | | <div class="common-seach-wrap"> |
| | |
| | | activeTab: function(n, o) { |
| | | if (n != o) { |
| | | this.tableData = []; |
| | | if (n == 'type') { |
| | | this.autoType(); |
| | | } |
| | | if (n == 'detail') { |
| | | this.getData(); |
| | | } |
| | |
| | | .then(data => { |
| | | self.loading = false; |
| | | self.tableData = data.data.list.data; |
| | | self.categoryList = data.data.category; |
| | | self.totalDataNumber = data.data.list.total; |
| | | if(self.curPage==1&&self.tableData.length>0){ |
| | | self.changeFunc(self.tableData[0]); |
| | |
| | | /*选中的值*/ |
| | | changeFunc(e) { |
| | | let obj={}; |
| | | if (this.activeTab == 'type') { |
| | | obj.name = e.name; |
| | | obj.url = 'pages/product/list/list?category_id=' + e.category_id; |
| | | obj.type = '商品分类'; |
| | | } |
| | | if (this.activeTab == 'detail') { |
| | | obj.name = e.product_name; |
| | | obj.url = 'pages/product/detail/detail?product_id=' + e.product_id; |
| | |
| | | } |
| | | |
| | | this.$emit('changeData', obj); |
| | | } |
| | | }, |
| | | /*自动选择类别*/ |
| | | autoType(i){ |
| | | i=i|0; |
| | | this.categoryActive=[]; |
| | | if(this.categoryList.length>0){ |
| | | let item=this.categoryList[i]; |
| | | this.categoryActive.push(item.category_id); |
| | | if(item.child&&typeof item.child!='undefined'&&item.child.length>0){ |
| | | this.categoryActive.push(item.child[0].category_id); |
| | | this.changeFunc(item.child[0]); |
| | | }else{ |
| | | i++; |
| | | this.autoType(i); |
| | | } |
| | | } |
| | | }, |
| | | /*选择类别*/ |
| | | changeCategory(e){ |
| | | let item= this.$refs['cascader'].getCheckedNodes(); |
| | | this.changeFunc(item[0].data); |
| | | }, |
| | | |
| | | |
| | | } |