From b0d23c107e318d81a0ac7621f54ee449dceb489c Mon Sep 17 00:00:00 2001 From: jiazhipeng Date: Thu, 28 Aug 2025 14:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E4=BA=A7=E6=94=B9=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- subPackages/techan/index.vue | 73 ++++++++++++++++++++++++++++++++---- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/subPackages/techan/index.vue b/subPackages/techan/index.vue index 186d31e..63a7bed 100644 --- a/subPackages/techan/index.vue +++ b/subPackages/techan/index.vue @@ -33,8 +33,11 @@ - - + + + {{item.name}} + @@ -247,8 +250,13 @@ headImg: "https://cgc.js-dyyj.com/uploads/20250513/f8b255f965efcd71b6843e4b72c3f1f3.png", type_pid: 20, + // 第一层分类 typeParam: [], typeIndex: 0, + // 第二层分类 + typeChild: [], + typeChildIndex: 0, + list:[], finished: false, @@ -309,30 +317,50 @@ this.typePopShow = e.show }, + // 获取第一层分类 getTypeTags () { this.Post({ pid: this.type_pid },'/api/product/tag_list').then(res => { this.typeParam = res.data || [] - - this.getList() + this.getChildType() + // this.getList() // 初始化选中位置 this.changeSelectPosition(this.typeIndex) }) }, - - changeType (item, i) { if (this.typeIndex!== i) { this.typeIndex=i this.finished = false this.list = [] - this.getList() + this.getChildType() + // this.getList() this.showTypes(false) } this.changeSelectPosition(i) }, + // 第二层分类 + getChildType (pid) { + let id = this.typeParam[this.typeIndex].id + if (pid) { id = pid } + this.Post({pid: id},'/api/product/tag_list').then(res => { + this.typeChild = res.data || [] + this.typeChildIndex = 0 + this.getList() + }) + }, + changeChildType (item,i) { + if (this.typeChildIndex!== i) { + this.typeChildIndex=i + this.finished = false + this.list = [] + this.getChildType() + this.getList() + } + }, + changeSearchParm(value) { this.search_type = value @@ -343,13 +371,17 @@ // 根据产品分类获取产品列表 getList(){ + if (!this.typeChild[this.typeChildIndex] || !this.typeChild[this.typeChildIndex].id) { + return + } + let param = {} if (this.search_type == 1) { param = {order: 'asc',sort:'sales_number'} } if (this.search_type == 2) { param = {order: 'desc',sort:'sales_number'} } if (this.search_type == 3) { param = {order: 'asc',sort:'price'} } if (this.search_type == 4) { param = {order: 'desc',sort:'price'} } this.Post({ - tag_id: this.typeParam[this.typeIndex].id, + tag_id: this.typeChild[this.typeChildIndex].id, offset: this.list.length, limit: 10, ...param @@ -1091,6 +1123,31 @@ flex-shrink: 0; overflow-x: hidden; overflow-y: auto; + .left-type-item{ + width: 100%; + font-weight: bold; + font-size: 27rpx; + color: #000000; + position: relative; + padding: 26rpx 0; + display: flex; + align-items: center; + .name-item{ + width: 100%; + min-height: 53rpx; + text-align: center; + display: flex; + align-items: center; + justify-content: center; + padding: 0 20rpx; + } + &.active { + background: white; + .name-item{ + border-left: 7rpx solid #6A8A2D;; + } + } + } } .right-box{ height: 100%;