chore:还原到模板3二级分类按钮正常

This commit is contained in:
2026-07-18 10:31:35 +08:00
parent b410597d9c
commit d8816bbe42

View File

@@ -180,7 +180,7 @@
<view class="categoty-goods-wrap" v-if="loadType == 'part'"
:style="'padding-top:' + (value.search ? 0 : '20rpx')">
<!-- 分类筛选 -->
<block v-if="value.goodsLevel == 2 && (value.template == 4 ? (currentOneCategory && currentOneCategory.child_list) : category.child_list)">
<block v-if="category.child_list && value.goodsLevel == 2">
<view class="screen-category-wrap">
<scroll-view scroll-x="true" class="screen-category"
:class="{ 'screen-category-4': value.template == 4 }" :scroll-with-animation="true"
@@ -189,7 +189,7 @@
@tap.stop="selectCategory(-1)">{{ $lang('components-diy.diy-category-item.all') }}</view>
<view class="item" :id="'category-2-' + oneIndex"
:class="{ selected: categoryId == oneIndex }" @tap.stop="selectCategory(oneIndex)"
v-for="(one, oneIndex) in (value.template == 4 ? currentOneCategory.child_list : category.child_list)" :key="oneIndex">
v-for="(one, oneIndex) in category.child_list" :key="oneIndex">
{{ one.category_name }}
</view>
</scroll-view>
@@ -201,7 +201,7 @@
:class="{ 'screen-category-4': value.template == 4 }">
<view class="title">{{ $lang('components-diy.diy-category-item.all') }}</view>
<view class="item" :class="{ selected: categoryId == oneIndex }"
@tap.stop="selectCategory(oneIndex)" v-for="(one, oneIndex) in (value.template == 4 ? currentOneCategory.child_list : category.child_list)"
@tap.stop="selectCategory(oneIndex)" v-for="(one, oneIndex) in category.child_list"
:key="oneIndex">
{{ one.category_name }}
</view>
@@ -630,7 +630,6 @@ export default {
},
watch: {
oneCategorySelect: function () {
if (this.index != this.select) return;
this.scrollTop = -1;
this.goodsList = [];
this.selectCategory(-1);
@@ -638,7 +637,6 @@ export default {
select: function () {
if (this.index == this.select) {
this.scrollTop = 0;
this.categoryId = -1;
if (this.pageIndex == 0) {
this.getGoodsList();
} else if (this.$refs.loadingCover && this.loadType == 'part') {
@@ -742,14 +740,13 @@ export default {
sort = 'desc';
}
}
const childList = this.value.template == 4 && this.currentOneCategory ? this.currentOneCategory.child_list : this.category.child_list;
const baseCategoryId = this.value.template == 4 && this.currentOneCategory ? this.currentOneCategory.category_id : this.category.category_id;
this.$api.sendRequest({
url: '/api/goodssku/pageByCategory',
data: {
page: this.pageIndex,
page_size: this.pageSize,
category_id: this.categoryId != -1 ? childList[this.categoryId].category_id : baseCategoryId,
category_id: this.categoryId != -1 ? this.category.child_list[this.categoryId]
.category_id : this.category.category_id,
order: order,
sort: sort
},
@@ -1057,7 +1054,6 @@ export default {
* @param {Object} action
*/
switchCategory(action) {
const childList = this.value.template == 4 && this.currentOneCategory ? this.currentOneCategory.child_list : this.category.child_list;
if (action == 'prev') {
if (this.categoryId == -1) {
let index = this.index - 1;
@@ -1068,7 +1064,7 @@ export default {
this.selectCategory(index);
}
} else {
if (this.categoryId == -1 || (childList && this.categoryId == childList.length - 1)) {
if (this.categoryId == -1 || (this.category.child_list && this.categoryId == this.category.child_list.length - 1)) {
let index = this.index + 1;
this.$emit('switch', index);
} else {
@@ -2242,7 +2238,6 @@ export default {
flex: 1;
height: 0;
transform: translateX(0px);
margin-top: -50rpx;
}
}
@@ -2259,7 +2254,7 @@ export default {
.screen-category {
flex: 1;
width: 0;
padding: 0 0 10rpx 0;
padding: 0 0 20rpx 0;
white-space: nowrap;
height: 60rpx;
@@ -2269,7 +2264,7 @@ export default {
background: #f5f5f5;
color: #666;
margin-right: 20rpx;
border-radius: 8rpx;
border-radius: 40rpx;
&.selected {
background-color: $base-color;
@@ -2338,17 +2333,14 @@ export default {
}
.screen-category-4 .item {
background-color: #fff !important;
padding: 16rpx 40rpx;
background-color: #f2f2f2 !important;
padding: 10rpx 24rpx;
line-height: 1;
font-size: 28rpx;
border: 1rpx solid #eee;
border-radius: 12rpx !important;
font-size: $font-size-tag;
&.selected {
background-color: $base-color !important;
color: #fff;
border-color: $base-color;
background-color: var(--main-color-shallow) !important;
color: var(--main-color);
}
}