|
|
@ -33,8 +33,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
<view class="goods-container"> |
|
|
|
<view class="left-box"> |
|
|
|
|
|
|
|
<view class="left-box no-scrollbar"> |
|
|
|
<view :class="['left-type-item',i==typeChildIndex?'active':'']" |
|
|
|
v-for="(item,i) in typeChild" :key="i" @click="changeChildType(item,i)"> |
|
|
|
<view class="name-item">{{item.name}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="right-box"> |
|
|
@ -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%; |
|
|
|