diff --git a/packages/shop/index/index.css b/packages/shop/index/index.css index edaf47ff..d0ccd456 100644 --- a/packages/shop/index/index.css +++ b/packages/shop/index/index.css @@ -106,7 +106,7 @@ page { white-space: nowrap; } -.slide_item_active{ +.slide_item_active text{ color: #ff5f3c; } @@ -315,11 +315,14 @@ page { } .CateList_Box { + width: 71.5%; display: flex; overflow: hidden; - position: relative; - z-index: 9; + /* position: relative; */ + position: fixed; + z-index: 999; padding: 20rpx 10rpx; + background-color: #ffffff; } .CateList { @@ -337,7 +340,7 @@ page { height: 40rpx; background: #F6F7FB; border-radius: 10rpx 10rpx 10rpx 10rpx; - padding: 5rpx 30rpx; + padding: 5rpx 20rpx; font-size: 26rpx; color: #222222; display: flex; @@ -364,6 +367,10 @@ page { margin-left: 10rpx; } +.CateIte{ + margin-top: 80rpx; +} + .CateInfo { margin: 0 10rpx; padding: 10rpx 10rpx; @@ -435,13 +442,14 @@ page { padding: 20rpx 12rpx; padding-right: 0; position: absolute; + top: 85rpx; z-index: 9; width: 100%; } .activeCateList .CateList_Item { margin-bottom: 16rpx; - margin-right: 28rpx; + margin-right: 20rpx; } .activeCateList .CateList_Item:nth-child(4n) { diff --git a/packages/shop/index/index.vue b/packages/shop/index/index.vue index b69af3fd..b0a56273 100644 --- a/packages/shop/index/index.vue +++ b/packages/shop/index/index.vue @@ -16,7 +16,7 @@ - + {{ item.category_name }} @@ -46,8 +46,8 @@ - - + + {{ item.category_name }} @@ -97,109 +97,113 @@ - - - {{ item.tag_name }} - - - - - 当日达 - - - - - + + + {{ item.tag_name }} + + + + + 当日达 - {{ items.commodity_name }} + - - {{ items.commodity_intro }} - - - - {{ getPriceRange(items.commodity_goods_info_list) }} + + + 当日达 + {{ items.commodity_name }} - - - - - - {{ - items.commodity_goods_info_list[0].quantity - ? items.commodity_goods_info_list[0].quantity - : 0 - }} - - - - + + {{ items.commodity_intro }} - - - - 选择规格 - - - - - 收起 - - - - - - - - - 当日达 - - - - - 当日达 - {{ ite.goods_name }} - - - - {{ ite.sales_price }} + + + {{ getPriceRange(items.commodity_goods_info_list) }} - - + + - {{ ite.quantity ? - ite.quantity : 0 }} + {{ + items.commodity_goods_info_list[0].quantity + ? items.commodity_goods_info_list[0].quantity + : 0 + }} + + + 选择规格 + + + + + 收起 + + + + + + + + + 当日达 + + + + + 当日达 + {{ ite.goods_name }} + + + + {{ ite.sales_price }} + + + + + + + {{ ite.quantity ? + ite.quantity : 0 }} + + + + + + + - - - + + @@ -275,8 +279,11 @@ export default { rightTopActive: 0, currentLeftCateId: null, topShow: false, + currentCategoryId: null, GGshow: false, + originalTagList: [], // 存储原始的tagList数据 + selectedTagId: null, // 当前选中的标签ID CateList: [], //分类列表 currentFirstId: "", leftCateList: [], //底部左侧分类 @@ -321,6 +328,8 @@ export default { }, changeCate(id) { + // 更新当前选中的顶级分类ID + this.currentCategoryId = id; // 根据id查找对应的分类 const category = this.CateList.find((item) => item.id === id); if (category) { @@ -344,6 +353,8 @@ export default { //选择右下角分类 checkItem(index) { this.rightTopActive = index; + // 获取选中的标签ID + this.selectedTagId = this.tagList[index].id; }, //右下角点击更多 topOpen() { @@ -374,6 +385,8 @@ export default { console.log(res); this.CateList = res.commodity_category_list; this.firstId = res.commodity_category_list[0].id; + // 设置默认选中第一个分类 + this.currentCategoryId = this.firstId; this.leftCateList = res.commodity_category_list[0].level_two_category || []; if (this.leftCateList.length > 0) { @@ -390,6 +403,7 @@ export default { getGoodsList() { if (!this.secondId) { this.tagList = []; + this.originalTagList = []; return; } request(apiArr.getGoodsList, "POST", { @@ -410,7 +424,13 @@ export default { item.isShow = false; }); }); - this.tagList = res.commodity_list; + // 保存原始数据 + this.originalTagList = res.commodity_list; + // 添加"全部"选项并设置为默认选中 + this.tagList = [{ id: 'all', tag_name: '全部' }, ...res.commodity_list]; + // 默认选中"全部"选项 + this.rightTopActive = 0; + this.selectedTagId = 'all'; }); },